All Projects → mxcl → Version

mxcl / Version

Licence: apache-2.0
semver (Semantic Version) Swift µFramework.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Version

Flowbase
A Flow-based Programming inspired micro-framework / un-framework for Go (Golang)
Stars: ✭ 129 (-43.42%)
Mutual labels:  micro-framework
Azkarra Streams
🚀 Azkarra is a lightweight java framework to make it easy to develop, deploy and manage cloud-native streaming microservices based on Apache Kafka Streams.
Stars: ✭ 146 (-35.96%)
Mutual labels:  micro-framework
Nodejs
Node.js基础与应用教程,适合初学者入门,以及有一定经验的开发者提高。Node.js全栈交流QQ群:423652352,node.js或者全栈开发培训QQ群:579500717
Stars: ✭ 202 (-11.4%)
Mutual labels:  semver
Tf
✔️ tf is a microframework for parameterized testing of functions and HTTP in Go.
Stars: ✭ 133 (-41.67%)
Mutual labels:  micro-framework
Micro Graphql
GraphQL Microservice
Stars: ✭ 145 (-36.4%)
Mutual labels:  micro-framework
Beachball
The Sunniest Semantic Version Bumper
Stars: ✭ 158 (-30.7%)
Mutual labels:  semver
Dom I18n
Provides a very basic HTML multilingual support using JavaScript
Stars: ✭ 125 (-45.18%)
Mutual labels:  micro-framework
Falco
A functional-first toolkit for building brilliant ASP.NET Core applications using F#.
Stars: ✭ 214 (-6.14%)
Mutual labels:  micro-framework
Semver.c
Semantic version library written in ANSI C
Stars: ✭ 147 (-35.53%)
Mutual labels:  semver
Semantic Release
📦🚀 Fully automated version management and package publishing
Stars: ✭ 14,364 (+6200%)
Mutual labels:  semver
Keel
Kubernetes Operator to automate Helm, DaemonSet, StatefulSet & Deployment updates
Stars: ✭ 1,870 (+720.18%)
Mutual labels:  semver
Semver
Semantic versioning helper library for PHP
Stars: ✭ 144 (-36.84%)
Mutual labels:  semver
Gitversion
From git log to SemVer in no time
Stars: ✭ 2,131 (+834.65%)
Mutual labels:  semver
Gh Release
Create a github release for a node package.
Stars: ✭ 132 (-42.11%)
Mutual labels:  semver
Flight
An extensible micro-framework for PHP
Stars: ✭ 2,396 (+950.88%)
Mutual labels:  micro-framework
Meshki
Meshki: A Black-Colored, Responsive Boilerplate for UI Development
Stars: ✭ 129 (-43.42%)
Mutual labels:  micro-framework
Legibleerror
Beating `Error.localizedDescription` at its own game.
Stars: ✭ 156 (-31.58%)
Mutual labels:  micro-framework
Bumped
📦 Makes easy release software
Stars: ✭ 222 (-2.63%)
Mutual labels:  semver
Nutz
Nutz -- Web Framework(Mvc/Ioc/Aop/Dao/Json) for ALL Java developer
Stars: ✭ 2,422 (+962.28%)
Mutual labels:  micro-framework
Version
Represent and compare versions via semantic versioning (SemVer) in Swift
Stars: ✭ 160 (-29.82%)
Mutual labels:  semver

Version badge-platforms badge-languages badge-ci badge-jazzy badge-codecov

A µ-framework for representing, comparing, encoding and utilizing semantic versions, eg. 1.2.3 or 2.0.0-beta.

This is Version.swift from the Swift Package Manager, with some minor adjustments:

  1. More compact Codable implementation †
  2. Implements LosslessStringConvertible
  3. Not a massive-single-source-file (MSSF)
  4. Online documentation
  5. Extensions for Bundle and ProcessInfo
  6. Removal of the potentially fatal ExpressibleByStringLiteral conformance
  7. A “tolerant” initializer for user input like 10.0 or v3
  8. Idiomatic implementations for Range<Version>
  9. Initialization from StringProtocol, not just String

We have automatic monitoring for changes at Apple’s repo to alert us if we should need merge any fixes.

Semantic versions can be losslessly expressed as strings; thus we do so.

‡ Like Int we can losslessly store a semantic version from a valid string, so we conform to the same protocol.

Support mxcl

Hey there, I’m Max Howell. I’m a prolific producer of open source software and probably you already use some of it (for example, I created brew). I work full-time on open source and it’s hard; currently I earn less than minimum wage. Please help me continue my work, I appreciate it 🙏🏻

Other ways to say thanks.

Usage

import Version

// these two initializers are the same, use whichever suits the code context
let v1 = Version(1,0,0)
let v2 = Version(major: 1, minor: 0, patch: 0)

let v3 = Version("1.2.3")           // =>  1.2.3: Version?
let v4 = Version(tolerant: "10.1")  // => 10.1.0: Version?
let v5 = Version(tolerant: "10")    // => 10.0.0: Version?

// a real Version object from your app’s Info.plist
let v6 = Bundle.main.version

let range = Version(1,2,3)..<Version(2,0,0)

let null: Version = .null  // => Version(0,0,0)

let foo = Version(1,2,3) < Version(2,0,0)  // => true

Installation

SwiftPM:

package.append(.package(url: "https://github.com/mxcl/Version.git", from: "2.0.0"))

Carthage:

Waiting on: @Carthage#1945.

Ranges

Ranges work as you expect, but there are caveats for prerelease identifiers, here are the rules:

1.0.0..<2.0.0 does not include eg. 2.0.0-alpha

This is probably what you expected. However:

1.0.0..<2.0.0 also does not include eg. 1.5.0-alpha

However:

1.0.0..<2.0.0-beta does include eg. 2.0.0-alpha

This is how the majority of Semantic Version libraries work.

Comparable, Equatable & Hashable

Both comparable and equatable ignore build metadata as per the specification. Thus:

Version("1.2.3+14") == Version("1.2.3+15")  // => true
Version("1.2.3+14") <= Version("1.2.3+15")  // => true
Version("1.2.3+14") <  Version("1.2.3+15")  // => false

This also means that Hashable must mirror this behavior, thus:

dict[Version("1.2.3+14")] = 1
dict[Version("1.2.3+15")] = 2
dict.count  // => 1
dict        // => ["1.2.3+15": 2]

Be aware of this as it may catch you out, naturally this will also effect structures that depend on Hashable, eg. Set.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].