diff --git a/.gitignore b/.gitignore index 4535251..8ae89a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Xcode # -build/ +.build *.pbxuser !default.pbxuser *.mode1v3 @@ -16,6 +16,7 @@ DerivedData *.hmap *.ipa *.xcuserstate +.swiftpm # CocoaPods # diff --git a/.travis.yml b/.travis.yml index f821fdc..e7fb97b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,16 @@ -osx_image: xcode10 -language: objective-c +language: swift +os: osx +osx_image: xcode11.3 -env: - - DESTINATION="platform=iOS Simulator,name=iPhone 6,OS=9.0" - - DESTINATION="platform=iOS Simulator,name=iPhone 6,OS=10.0" - - DESTINATION="platform=iOS Simulator,name=iPhone 6,OS=11.1" - - DESTINATION="platform=iOS Simulator,name=iPhone 6,OS=12.0" +jobs: + include: + - name: "TV OS" + env: DESTINATION="platform=tvOS Simulator,OS=11.0,name=Apple TV" + - name: "iOS" + env: DESTINATION="platform=iOS Simulator,OS=11.0.1,name=iPhone X" + - name: "Mac" + env: DESTINATION="platform=macOS,arch=x86_64" script: - - xcodebuild clean build -project SemanticVersioning.xcodeproj -scheme "SemanticVersioning" -destination "$DESTINATION" -enableCodeCoverage YES test -after_success: - - bash <(curl -s https://codecov.io/bash) -J "$DESTINATION" -t cee9d255-69c0-455d-83d4-eb28f696a299 + - swift package generate-xcodeproj + - echo "build for $DESTINATION" + - xcodebuild clean build -project SemanticVersioning.xcodeproj -scheme "SemanticVersioning-Package" -destination "$DESTINATION" -enableCodeCoverage YES test diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..94a82bd --- /dev/null +++ b/Package.swift @@ -0,0 +1,26 @@ +// swift-tools-version:5.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SemanticVersioning", + platforms: [ + .macOS(.v10_13), .iOS(.v11), .tvOS(.v11), .watchOS(.v4) + ], + products: [ + .library(name: "SemanticVersioning", targets: ["SemanticVersioning"]), + ], + dependencies: [], + targets: [ + .target( + name: "SemanticVersioning", + dependencies: [], + path: "Source"), + .testTarget( + name: "SemanticVersioningTests", + dependencies: ["SemanticVersioning"], + path: "Tests"), + ], + swiftLanguageVersions: [.v5] +) diff --git a/README.md b/README.md index 017e78f..e43ccb0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Platform](https://img.shields.io/cocoapods/p/SemanticVersioning.svg) ![License](https://img.shields.io/cocoapods/l/SemanticVersioning.svg) ![Travis](https://img.shields.io/travis/AlexanderNey/SemanticVersioning.svg) -[![Swift Version](https://img.shields.io/badge/Swift-3.0-F16D39.svg?style=flat)](https://developer.apple.com/swift) +[![Swift Version](https://img.shields.io/badge/Swift-5.0-F16D39.svg?style=flat)](https://developer.apple.com/swift) [![codecov](https://codecov.io/gh/AlexanderNey/SemanticVersioning/branch/master/graph/badge.svg)](https://codecov.io/gh/AlexanderNey/SemanticVersioning) Semantic Versioning implementation in Swift! @@ -20,21 +20,24 @@ Use the struct `Version` to represent a version according to the [Semantic Versi ### Requirements -- iOS 8.0+ / Mac OS X 10.9+ -- Xcode 10.0+ -- Swift 4.2 +- iOS 11.0+ / Mac OS X 10.13+ +- Xcode 11+ +- Swift 5.0 ### Installation The easiest way to use SemanticVersion in your project is using the CocaPods package manager. +### Swift PM +See [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) on how to use this library with Swift PM. + ### CocoaPods See installation instructions for [CocoaPods](http://cocoapods.org) if not already installed To integrate the library into your Xcode project specify the pod dependency to your `Podfile`: ```ruby -platform :ios, '8.0' +platform :ios, '11.0' use_frameworks! pod 'SemanticVersioning' @@ -105,7 +108,7 @@ for identifier in version.buildMetadataIdentifier Conforms to Printable so you can simply get a String representation by accessing the description property ```Swift -println(version) +print(version) // OR let stringRepresentation = version.description ``` @@ -113,37 +116,25 @@ let stringRepresentation = version.description mutability / immutability -### Comparsion +### Comparison -The default operators for comparsion are implemented +The default operators for comparison are implemented `<` , `<=` , `>` ,`>=` ,`==` , `!=` -This will comapre major, minor, patch and the prerelease identifiers according to the [Semantic Versioning Sepcification 2.0.0](http://semver.org/spec/v2.0.0.html) +This will compare major, minor, patch and the prerelease identifiers according to the [Semantic Versioning Specification 2.0.0](http://semver.org/spec/v2.0.0.html) ## Parser -The implementation includes a full-fledged component ot parse String representation of a version. Please have a look at the tests and the soruce of `SemanticVersioningParser` for now 😉 +The implementation includes a full-fledged component of parse String representation of a version. Please have a look at the tests and the source of `SemanticVersioningParser` for now 😉 ## Tests -The libary includes a suite of tests showing how to use the different initialiser and the Parser +The library includes a suite of tests showing how to use the different initialiser and the Parser ## Extensions There are some build in extensions to make your live easier. -### NSOperatingSystemVersion - -`NSOperatingSystemVersion` conforms to `SemanticVersion` so it can be compared with all other structs / objects that conform to the same protocol (e.g. `Version`). - -So you can check the current system Version like this (on iOS 8+): -```Swift -let systemVersion = NSProcessInfo.processInfo().operatingSystemVersion -if systemVersion < Version(major: 8) -{ - // ... -} -``` ### NSBundle @@ -157,42 +148,11 @@ if let version = bundle.version } ``` -### UIDevice - -You can get the operating system version from a `UIDevice` object by using `operatingSystemVersion` which returns a `Version` representation of `systemVersion`. - -```Swift -let systemVersion = UIDevice.currentDevice().operatingSystemVersion -if systemVersion < Version(major: 8) -{ - // ... -} - -``` - ### IntegerLiteralConvertible Converts an Integer to a `Version` struct. You can use this only to represent major versions. -```Swift -let systemVersion = NSProcessInfo.processInfo().operatingSystemVersion -if systemVersion < 8 -{ - // ... -} -``` - -Reducing the version's minor and major value to a `Float` is also possible. Use this with ⚠️**caution**⚠️ as the `Float` representation could lead to accuracy loss of the minor value (that is represented as fractional digits). I would not reccommend to compare with `==` but `<` , `<=` , `>` ,`>=` should be useful. - -```Swift -let systemVersion = NSProcessInfo.processInfo().operatingSystemVersion -if systemVersion.floatValue() < 8.1 -{ - // ... -} -``` - ## Custom extensions -Create your own extensions or Version representations by creating struct / object that conforms to `SemanticVersioning`. Have a look at the extensions or the `Version` implementation for more information. +Create your own extensions or Version representations by creating struct / object that conforms to `SemanticVersion`. Have a look at the extensions or the `Version` implementation for more information. diff --git a/SemanticVersioning.podspec b/SemanticVersioning.podspec index c3f3f71..5b4f52c 100644 --- a/SemanticVersioning.podspec +++ b/SemanticVersioning.podspec @@ -1,17 +1,16 @@ Pod::Spec.new do |s| s.name = 'SemanticVersioning' - s.version = '2.0.1' + s.version = '3.0.0' s.license = { :type => "MIT" } - s.summary = 'Elegant Semantic Versioning in Swift 4' + s.summary = 'Elegant Semantic Versioning in Swift 5' s.homepage = 'https://github.com/AlexanderNey/SemanticVersioning' s.social_media_url = 'http://twitter.com/Ajax64' s.authors = { 'Alexander Ney' => 'alexander.ney@me.com' } s.source = { :git => 'https://github.com/AlexanderNey/SemanticVersioning.git', :branch => 'master', :tag => "v#{s.version}" } s.requires_arc = true - s.ios.deployment_target = '9.0' - s.tvos.deployment_target = '10.0' - s.osx.deployment_target = '10.9' - s.swift_version = '4.0' + s.ios.deployment_target = '11.0' + s.tvos.deployment_target = '11.0' + s.osx.deployment_target = '10.13' + s.swift_version = '5.0' s.source_files = 'Source/*.swift' - end diff --git a/SemanticVersioning.xcodeproj/project.pbxproj b/SemanticVersioning.xcodeproj/project.pbxproj deleted file mode 100644 index 50d5a37..0000000 --- a/SemanticVersioning.xcodeproj/project.pbxproj +++ /dev/null @@ -1,515 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - AC02F68B1AC8872E005EA738 /* FoundationExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC02F6871AC88714005EA738 /* FoundationExtensionTests.swift */; }; - AC02F68E1AC8B538005EA738 /* NSBundle+Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC02F68D1AC8B538005EA738 /* NSBundle+Version.swift */; }; - AC108A4C1A866DE800BAC3CD /* SemanticVersioningParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC108A4B1A866DE800BAC3CD /* SemanticVersioningParser.swift */; }; - AC108A4E1A86840A00BAC3CD /* SemanticVersioningParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC108A4D1A86840A00BAC3CD /* SemanticVersioningParserTest.swift */; }; - AC1B79C01A842D80002DD206 /* SemanticVersioning.h in Headers */ = {isa = PBXBuildFile; fileRef = AC1B79BF1A842D80002DD206 /* SemanticVersioning.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AC1B79C61A842D80002DD206 /* SemanticVersioning.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC1B79BA1A842D80002DD206 /* SemanticVersioning.framework */; }; - AC1B79CD1A842D80002DD206 /* SemanticVersioningTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC1B79CC1A842D80002DD206 /* SemanticVersioningTests.swift */; }; - AC1B79D71A842DB5002DD206 /* SemanticVersioning.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC1B79D61A842DB5002DD206 /* SemanticVersioning.swift */; }; - AC1DBF161B31EDD700ACF199 /* SemanticVersioning.framework in Copy Framework */ = {isa = PBXBuildFile; fileRef = AC1B79BA1A842D80002DD206 /* SemanticVersioning.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - AC711DD61ADAAEC3000D854A /* Version+IntegerLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC711DD51ADAAEC3000D854A /* Version+IntegerLiteralConvertible.swift */; }; - AC711DD91ADAB34D000D854A /* VersionIntegerLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC711DD71ADAB318000D854A /* VersionIntegerLiteralConvertible.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - AC1B79C71A842D80002DD206 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = AC1B79B11A842D80002DD206 /* Project object */; - proxyType = 1; - remoteGlobalIDString = AC1B79B91A842D80002DD206; - remoteInfo = SemanticVersioning; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - AC1DBF151B31EDC500ACF199 /* Copy Framework */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - AC1DBF161B31EDD700ACF199 /* SemanticVersioning.framework in Copy Framework */, - ); - name = "Copy Framework"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - AC02F6871AC88714005EA738 /* FoundationExtensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationExtensionTests.swift; sourceTree = ""; }; - AC02F68D1AC8B538005EA738 /* NSBundle+Version.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSBundle+Version.swift"; sourceTree = ""; }; - AC108A4B1A866DE800BAC3CD /* SemanticVersioningParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SemanticVersioningParser.swift; sourceTree = ""; }; - AC108A4D1A86840A00BAC3CD /* SemanticVersioningParserTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SemanticVersioningParserTest.swift; sourceTree = ""; }; - AC1B79BA1A842D80002DD206 /* SemanticVersioning.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SemanticVersioning.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - AC1B79BE1A842D80002DD206 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AC1B79BF1A842D80002DD206 /* SemanticVersioning.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SemanticVersioning.h; sourceTree = ""; }; - AC1B79C51A842D80002DD206 /* SemanticVersioningTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SemanticVersioningTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - AC1B79CB1A842D80002DD206 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AC1B79CC1A842D80002DD206 /* SemanticVersioningTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SemanticVersioningTests.swift; sourceTree = ""; }; - AC1B79D61A842DB5002DD206 /* SemanticVersioning.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SemanticVersioning.swift; sourceTree = ""; }; - AC711DD51ADAAEC3000D854A /* Version+IntegerLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Version+IntegerLiteralConvertible.swift"; sourceTree = ""; }; - AC711DD71ADAB318000D854A /* VersionIntegerLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VersionIntegerLiteralConvertible.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - AC1B79B61A842D80002DD206 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AC1B79C21A842D80002DD206 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AC1B79C61A842D80002DD206 /* SemanticVersioning.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - AC1B79B01A842D80002DD206 = { - isa = PBXGroup; - children = ( - AC1B79BC1A842D80002DD206 /* Source */, - AC1B79C91A842D80002DD206 /* Tests */, - AC1B79BB1A842D80002DD206 /* Products */, - ); - sourceTree = ""; - }; - AC1B79BB1A842D80002DD206 /* Products */ = { - isa = PBXGroup; - children = ( - AC1B79BA1A842D80002DD206 /* SemanticVersioning.framework */, - AC1B79C51A842D80002DD206 /* SemanticVersioningTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - AC1B79BC1A842D80002DD206 /* Source */ = { - isa = PBXGroup; - children = ( - AC1B79BF1A842D80002DD206 /* SemanticVersioning.h */, - AC1B79D61A842DB5002DD206 /* SemanticVersioning.swift */, - AC108A4B1A866DE800BAC3CD /* SemanticVersioningParser.swift */, - AC711DD51ADAAEC3000D854A /* Version+IntegerLiteralConvertible.swift */, - AC02F68D1AC8B538005EA738 /* NSBundle+Version.swift */, - AC1B79BD1A842D80002DD206 /* Supporting Files */, - ); - path = Source; - sourceTree = ""; - }; - AC1B79BD1A842D80002DD206 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - AC1B79BE1A842D80002DD206 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - AC1B79C91A842D80002DD206 /* Tests */ = { - isa = PBXGroup; - children = ( - AC1B79CC1A842D80002DD206 /* SemanticVersioningTests.swift */, - AC108A4D1A86840A00BAC3CD /* SemanticVersioningParserTest.swift */, - AC02F6871AC88714005EA738 /* FoundationExtensionTests.swift */, - AC711DD71ADAB318000D854A /* VersionIntegerLiteralConvertible.swift */, - AC1B79CA1A842D80002DD206 /* Supporting Files */, - ); - path = Tests; - sourceTree = ""; - }; - AC1B79CA1A842D80002DD206 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - AC1B79CB1A842D80002DD206 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - AC1B79B71A842D80002DD206 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - AC1B79C01A842D80002DD206 /* SemanticVersioning.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - AC1B79B91A842D80002DD206 /* SemanticVersioning */ = { - isa = PBXNativeTarget; - buildConfigurationList = AC1B79D01A842D80002DD206 /* Build configuration list for PBXNativeTarget "SemanticVersioning" */; - buildPhases = ( - AC1B79B51A842D80002DD206 /* Sources */, - AC1B79B61A842D80002DD206 /* Frameworks */, - AC1B79B71A842D80002DD206 /* Headers */, - AC1B79B81A842D80002DD206 /* Resources */, - BDB467731F24763100A69860 /* Swift Lint */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SemanticVersioning; - productName = SemanticVersioning; - productReference = AC1B79BA1A842D80002DD206 /* SemanticVersioning.framework */; - productType = "com.apple.product-type.framework"; - }; - AC1B79C41A842D80002DD206 /* SemanticVersioningTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = AC1B79D31A842D80002DD206 /* Build configuration list for PBXNativeTarget "SemanticVersioningTests" */; - buildPhases = ( - AC1B79C11A842D80002DD206 /* Sources */, - AC1B79C21A842D80002DD206 /* Frameworks */, - AC1B79C31A842D80002DD206 /* Resources */, - AC1DBF151B31EDC500ACF199 /* Copy Framework */, - ); - buildRules = ( - ); - dependencies = ( - AC1B79C81A842D80002DD206 /* PBXTargetDependency */, - ); - name = SemanticVersioningTests; - productName = SemanticVersioningTests; - productReference = AC1B79C51A842D80002DD206 /* SemanticVersioningTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - AC1B79B11A842D80002DD206 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftMigration = 0700; - LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 1000; - ORGANIZATIONNAME = "Alexander Ney"; - TargetAttributes = { - AC1B79B91A842D80002DD206 = { - CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 1000; - }; - AC1B79C41A842D80002DD206 = { - CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 1000; - }; - }; - }; - buildConfigurationList = AC1B79B41A842D80002DD206 /* Build configuration list for PBXProject "SemanticVersioning" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = AC1B79B01A842D80002DD206; - productRefGroup = AC1B79BB1A842D80002DD206 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - AC1B79B91A842D80002DD206 /* SemanticVersioning */, - AC1B79C41A842D80002DD206 /* SemanticVersioningTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - AC1B79B81A842D80002DD206 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AC1B79C31A842D80002DD206 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - BDB467731F24763100A69860 /* Swift Lint */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Swift Lint"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - AC1B79B51A842D80002DD206 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AC108A4C1A866DE800BAC3CD /* SemanticVersioningParser.swift in Sources */, - AC02F68E1AC8B538005EA738 /* NSBundle+Version.swift in Sources */, - AC1B79D71A842DB5002DD206 /* SemanticVersioning.swift in Sources */, - AC711DD61ADAAEC3000D854A /* Version+IntegerLiteralConvertible.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AC1B79C11A842D80002DD206 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AC108A4E1A86840A00BAC3CD /* SemanticVersioningParserTest.swift in Sources */, - AC711DD91ADAB34D000D854A /* VersionIntegerLiteralConvertible.swift in Sources */, - AC1B79CD1A842D80002DD206 /* SemanticVersioningTests.swift in Sources */, - AC02F68B1AC8872E005EA738 /* FoundationExtensionTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - AC1B79C81A842D80002DD206 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = AC1B79B91A842D80002DD206 /* SemanticVersioning */; - targetProxy = AC1B79C71A842D80002DD206 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - AC1B79CE1A842D80002DD206 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - AC1B79CF1A842D80002DD206 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - AC1B79D11A842D80002DD206 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - CURRENT_PROJECT_VERSION = 0.90; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_SWIFT_FLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = "com.alexander-ney.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - AC1B79D21A842D80002DD206 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - CURRENT_PROJECT_VERSION = 0.90; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_SWIFT_FLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = "com.alexander-ney.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; - AC1B79D41A842D80002DD206 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_SWIFT_FLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = "com.alexander-ney.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - AC1B79D51A842D80002DD206 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_SWIFT_FLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = "com.alexander-ney.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - AC1B79B41A842D80002DD206 /* Build configuration list for PBXProject "SemanticVersioning" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AC1B79CE1A842D80002DD206 /* Debug */, - AC1B79CF1A842D80002DD206 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AC1B79D01A842D80002DD206 /* Build configuration list for PBXNativeTarget "SemanticVersioning" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AC1B79D11A842D80002DD206 /* Debug */, - AC1B79D21A842D80002DD206 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AC1B79D31A842D80002DD206 /* Build configuration list for PBXNativeTarget "SemanticVersioningTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AC1B79D41A842D80002DD206 /* Debug */, - AC1B79D51A842D80002DD206 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = AC1B79B11A842D80002DD206 /* Project object */; -} diff --git a/SemanticVersioning.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SemanticVersioning.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index b7e3b3a..0000000 --- a/SemanticVersioning.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/SemanticVersioning.xcodeproj/xcshareddata/xcschemes/SemanticVersioning.xcscheme b/SemanticVersioning.xcodeproj/xcshareddata/xcschemes/SemanticVersioning.xcscheme deleted file mode 100644 index 8ce0cb1..0000000 --- a/SemanticVersioning.xcodeproj/xcshareddata/xcschemes/SemanticVersioning.xcscheme +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/Info.plist b/Source/Info.plist deleted file mode 100644 index 783e22e..0000000 --- a/Source/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 2.0.1 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Source/SemanticVersioning.h b/Source/SemanticVersioning.h deleted file mode 100644 index 1d0d2ef..0000000 --- a/Source/SemanticVersioning.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// SemanticVersioning.h -// -// Copyright (c) 2015 Alexander Ney. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -//! Project version number for SemanticVersioning. -FOUNDATION_EXPORT double SemanticVersioningVersionNumber; - -//! Project version string for SemanticVersioning. -FOUNDATION_EXPORT const unsigned char SemanticVersioningVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - diff --git a/Source/SemanticVersioning.swift b/Source/SemanticVersioning.swift index def090b..54451c7 100644 --- a/Source/SemanticVersioning.swift +++ b/Source/SemanticVersioning.swift @@ -33,7 +33,7 @@ public protocol SemanticVersion: Comparable { } /** -* Implements Sematic Version specification 2.0.0 +* Implements Semantic Version specification 2.0.0 */ public struct Version: SemanticVersion, CustomStringConvertible { public var major: Int diff --git a/Source/SemanticVersioningParser.swift b/Source/SemanticVersioningParser.swift index ec02742..6414be3 100644 --- a/Source/SemanticVersioningParser.swift +++ b/Source/SemanticVersioningParser.swift @@ -23,19 +23,19 @@ import Foundation -private let defaultDelimeter = "." -private let prereleaseDelimeter = "-" -private let buildMetaDataDelimeter = "+" +private let defaultDelimiter = "." +private let prereleaseDelimiter = "-" +private let buildMetaDataDelimiter = "+" private let numericCharacterSet = CharacterSet.decimalDigits -private let indentifierCharacterSet: CharacterSet = { +private let identifierCharacterSet: CharacterSet = { var characterSet = NSMutableCharacterSet.alphanumeric() characterSet.addCharacters(in: "-") return characterSet as CharacterSet }() /** -* SemanticVersionParser parses a semantic version string and returns the parsed compoentns +* SemanticVersionParser parses a semantic version string and returns the parsed components */ open class SemanticVersionParser { @@ -52,7 +52,7 @@ open class SemanticVersionParser { /** Represents the result of the string parsing - - Success: Success case with an array of sucessfully parsed components + - Success: Success case with an array of successfully parsed components - Failure: Failure case with the location in the original string, the failed component and the already successful parsed components */ @@ -65,7 +65,7 @@ open class SemanticVersionParser { public enum ConsistencyError: Error { case nonNumericValue - case delimeterExpected + case delimiterExpected case malformedIdentifiers([String]) case endOfStringExpected } @@ -86,7 +86,7 @@ open class SemanticVersionParser { /** starts parsing the version string - - returns: Result object represeting the success of the parsing operation + - returns: Result object representing the success of the parsing operation */ open func parse() throws -> Result { @@ -96,16 +96,16 @@ open class SemanticVersionParser { do { result.major = try scanNumericComponent(scanner) - try scanDelimeter(defaultDelimeter, scanner) + try scanDelimiter(defaultDelimiter, scanner) component = .minor result.minor = try scanNumericComponent(scanner) - try scanDelimeter(defaultDelimeter, scanner) + try scanDelimiter(defaultDelimiter, scanner) component = .patch result.patch = try scanNumericComponent(scanner) - if scanOptionalDelimeter(prereleaseDelimeter, scanner) { + if scanOptionalDelimiter(prereleaseDelimiter, scanner) { component = .prereleaseIdentifiers do { result.prereleaseIdentifiers = try scanIdentifiersComponent(scanner) @@ -115,7 +115,7 @@ open class SemanticVersionParser { } } - if scanOptionalDelimeter(buildMetaDataDelimeter, scanner) { + if scanOptionalDelimiter(buildMetaDataDelimiter, scanner) { component = .buildMetadataIdentifiers do { result.buildMetadataIdentifiers = try scanIdentifiersComponent(scanner) @@ -138,7 +138,7 @@ open class SemanticVersionParser { return result } - fileprivate func scanNumericComponent(_ scanner: Scanner, upTo delimeter: String = defaultDelimeter) throws -> Int { + fileprivate func scanNumericComponent(_ scanner: Scanner, upTo delimiter: String = defaultDelimiter) throws -> Int { var string: NSString? scanner.scanCharacters(from: numericCharacterSet, into: &string) guard let numberString = string as String?, @@ -152,24 +152,24 @@ open class SemanticVersionParser { var identifiers: [String] = [] repeat { var string: NSString? - scanner.scanCharacters(from: indentifierCharacterSet, into: &string) + scanner.scanCharacters(from: identifierCharacterSet, into: &string) guard let identifier = string as String?, !identifier.isEmpty else { throw ConsistencyError.malformedIdentifiers(identifiers) } identifiers.append(identifier) - guard scanOptionalDelimeter(defaultDelimeter, scanner) else { break } + guard scanOptionalDelimiter(defaultDelimiter, scanner) else { break } } while (true) return identifiers } - private func scanOptionalDelimeter(_ delimeter: String, _ scanner: Scanner) -> Bool { - return scanner.scanString(delimeter, into: nil) + private func scanOptionalDelimiter(_ delimiter: String, _ scanner: Scanner) -> Bool { + return scanner.scanString(delimiter, into: nil) } - private func scanDelimeter(_ delimeter: String, _ scanner: Scanner) throws { - guard scanOptionalDelimeter(delimeter, scanner) else { - throw ConsistencyError.delimeterExpected + private func scanDelimiter(_ delimiter: String, _ scanner: Scanner) throws { + guard scanOptionalDelimiter(delimiter, scanner) else { + throw ConsistencyError.delimiterExpected } } @@ -177,7 +177,7 @@ open class SemanticVersionParser { /** * Extension of SemanticVersion the conform to StringLiteralConvertible -* so Versions can be initalized by assigning a String like: +* so Versions can be initialized by assigning a String like: * `let version : SemanticVersion = "1.2.0"` */ extension Version: ExpressibleByStringLiteral { @@ -186,8 +186,8 @@ extension Version: ExpressibleByStringLiteral { Will try to initialize a SemanticVersion from a specified String - parameter versionString: String representing a version - - parameter strict: Bool specifies if the string should be parsed strictly accoring to the - Semantic Versioning sepcification or not. If strict is false usually obligatory values like + - parameter strict: Bool specifies if the string should be parsed strictly according to the + Semantic Versioning specification or not. If strict is false usually obligatory values like minor and path can be omitted - returns: initialized SemanticVersion or nil if version string could not be parsed */ @@ -220,12 +220,4 @@ extension Version: ExpressibleByStringLiteral { public init(stringLiteral value: String) { self = (try? Version(value)) ?? Version(major: 0) } - - public init(extendedGraphemeClusterLiteral value: String) { - self = (try? Version(value)) ?? Version(major: 0) - } - - public init(unicodeScalarLiteral value: String) { - self = (try? Version(value)) ?? Version(major: 0) - } } diff --git a/Source/Version+IntegerLiteralConvertible.swift b/Source/Version+IntegerLiteralConvertible.swift index 74aad4c..a836455 100644 --- a/Source/Version+IntegerLiteralConvertible.swift +++ b/Source/Version+IntegerLiteralConvertible.swift @@ -1,5 +1,5 @@ // -// Versionin+IntegerLiteralConvertible.swift +// Version+IntegerLiteralConvertible.swift // SemanticVersioning // // Created by Alexander Ney on 12/04/2015. @@ -9,15 +9,6 @@ import Foundation import Darwin -extension Version { - public func floatValue() -> Float { - let minorLenght = self.minor > 0 ? floor(log10(Float(self.minor)) + 1.0) : 0 - let minorSummand = Float(self.minor) / 10.0 * minorLenght - - return Float(self.major) + minorSummand - } -} - extension Version: ExpressibleByIntegerLiteral { public init(integerLiteral value: IntegerLiteralType) { self.init(major: max(0, value)) diff --git a/Tests/FoundationExtensionTests.swift b/Tests/FoundationExtensionTests.swift deleted file mode 100644 index 1ded8a4..0000000 --- a/Tests/FoundationExtensionTests.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// FoundationExtensionTests.swift -// -// Copyright (c) 2015 Alexander Ney. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation -import XCTest -import SemanticVersioning - -class FoundationExtensionTests: XCTestCase { - - override func setUp() { - continueAfterFailure = false - } - - func testNSBundleVersion() { - let selfType = type(of: self) - let bundle = Bundle(for: selfType) - let version = bundle.version! - - XCTAssertEqual(version.major, 1) - XCTAssertEqual(version.minor, 1) - XCTAssertEqual(version.patch, 0) - XCTAssertFalse(version.isPrerelease) - XCTAssertTrue(version.preReleaseIdentifier.isEmpty) - XCTAssertEqual(version.buildMetadataIdentifier, ["unittests"]) - } -} diff --git a/Tests/Info.plist b/Tests/Info.plist deleted file mode 100644 index 0862e22..0000000 --- a/Tests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.1.0+unittests - - diff --git a/Tests/VersionIntegerLiteralConvertible.swift b/Tests/VersionIntegerLiteralConvertible.swift index ecdb53a..a4e0a77 100644 --- a/Tests/VersionIntegerLiteralConvertible.swift +++ b/Tests/VersionIntegerLiteralConvertible.swift @@ -35,14 +35,4 @@ class VersionIntegerLiteralConvertibleTests: XCTestCase { let versionB = Version(major: 2) XCTAssert(versionB == 2, "version must equal 2") } - - func testGetFloatValue() { - let versionA = Version(major: 8) - let versionB = Version(major: 0, minor: 1002) - let versionC = Version(major: 2, minor: 5431) - - XCTAssert(versionA.floatValue() == 8.0, "version must equal 8.0") - XCTAssert(versionB.floatValue() >= 0.1002, "version must be bigger or equal then 0.1002") - XCTAssert(versionC.floatValue() >= 2.5431, "version must be bigger or equal 2.5431") - } }