diff --git a/.github/workflows/spm-ci.yml b/.github/workflows/run-tests.yml similarity index 62% rename from .github/workflows/spm-ci.yml rename to .github/workflows/run-tests.yml index f23a63b..aac4fcb 100644 --- a/.github/workflows/spm-ci.yml +++ b/.github/workflows/run-tests.yml @@ -1,9 +1,10 @@ -name: SPM CI +name: Run Tests on: [pull_request, push] jobs: - macos-test: + + spm-macos-test: runs-on: macos-11.0 steps: - uses: actions/checkout@v2 @@ -11,10 +12,17 @@ jobs: run: sudo xcode-select -switch /Applications/Xcode_12.5.app - name: Run tests run: swift test -v - - linux-test: + + spm-linux-test: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Run tests run: swift test -v + + cocoapods-podspec-lint: + runs-on: macos-11.0 + steps: + - uses: actions/checkout@v2 + - name: Lint Podspec + run: pod lib lint --verbose diff --git a/.jazzy.yaml b/.jazzy.yaml index 9ad7db7..559ca16 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -24,5 +24,5 @@ disable_search: true github_file_prefix: https://github.com/yakovmanshin/YMFF/tree/main github_url: https://github.com/yakovmanshin/YMFF hide_documentation_coverage: true -title: YMFF Docs +title: YMFF v2 Docs undocumented_text: Documentation Coming Soon… diff --git a/README.md b/README.md index 8cfb9e2..03e48b2 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ YMFF is a nice little library that makes management of features with feature fla YMFF ships completely ready for use, right out of the box: you get everything you need to start in just a few minutes. But you can also replace nearly any component of the system with your own, customized implementation. Since version 2.0, the implementation and the protocols are in two separate targets (YMFF and YMFFProtocols, respectively). ## Installation + +### Swift Package Manager (SPM) To add YMFF to your project, use Xcode’s built-in support for Swift packages. Click File → Swift Packages → Add Package Dependency, and paste the following URL into the search field: ``` @@ -23,6 +25,15 @@ If you need to use YMFF in another Swift package, add it as a dependency: .package(url: "https://github.com/yakovmanshin/YMFF", .upToNextMajor(from: "2.0.0")) ``` +### CocoaPods +YMFF now supports installation via [CocoaPods](https://youtu.be/iEAjvNRdZa0). + +Add the following to your Podfile: + +```ruby +pod 'YMFF', '~> 2.1' +``` + ## Setup All you need to start managing features with YMFF is at least one feature flag *store*—an object which conforms to `FeatureFlagStoreProtocol` and provides values that correspond to feature flag keys. diff --git a/Sources/YMFF/FeatureFlag/FeatureFlag.swift b/Sources/YMFF/FeatureFlag/FeatureFlag.swift index db22edb..9b94591 100644 --- a/Sources/YMFF/FeatureFlag/FeatureFlag.swift +++ b/Sources/YMFF/FeatureFlag/FeatureFlag.swift @@ -6,7 +6,9 @@ // Copyright © 2020 Yakov Manshin. See the LICENSE file for license info. // +#if !COCOAPODS import YMFFProtocols +#endif /// An object that facilitates access to feature flag values. @propertyWrapper diff --git a/Sources/YMFF/FeatureFlagResolver/Configuration/FeatureFlagResolverConfiguration.swift b/Sources/YMFF/FeatureFlagResolver/Configuration/FeatureFlagResolverConfiguration.swift index c71a981..a2b9ace 100644 --- a/Sources/YMFF/FeatureFlagResolver/Configuration/FeatureFlagResolverConfiguration.swift +++ b/Sources/YMFF/FeatureFlagResolver/Configuration/FeatureFlagResolverConfiguration.swift @@ -6,7 +6,9 @@ // Copyright © 2020 Yakov Manshin. See the LICENSE file for license info. // +#if !COCOAPODS import YMFFProtocols +#endif // MARK: - FeatureFlagResolverConfiguration diff --git a/Sources/YMFF/FeatureFlagResolver/FeatureFlagResolver.swift b/Sources/YMFF/FeatureFlagResolver/FeatureFlagResolver.swift index e1f007c..bd92dde 100644 --- a/Sources/YMFF/FeatureFlagResolver/FeatureFlagResolver.swift +++ b/Sources/YMFF/FeatureFlagResolver/FeatureFlagResolver.swift @@ -6,7 +6,9 @@ // Copyright © 2020 Yakov Manshin. See the LICENSE file for license info. // +#if !COCOAPODS import YMFFProtocols +#endif // MARK: - FeatureFlagResolver diff --git a/Sources/YMFF/FeatureFlagResolver/Store/RuntimeOverridesStore.swift b/Sources/YMFF/FeatureFlagResolver/Store/RuntimeOverridesStore.swift index 80c7316..7845346 100644 --- a/Sources/YMFF/FeatureFlagResolver/Store/RuntimeOverridesStore.swift +++ b/Sources/YMFF/FeatureFlagResolver/Store/RuntimeOverridesStore.swift @@ -6,7 +6,9 @@ // Copyright © 2020 Yakov Manshin. See the LICENSE file for license info. // +#if !COCOAPODS import YMFFProtocols +#endif // MARK: - RuntimeOverridesStore diff --git a/Sources/YMFF/FeatureFlagResolver/Store/TransparentFeatureFlagStore.swift b/Sources/YMFF/FeatureFlagResolver/Store/TransparentFeatureFlagStore.swift index 54f962f..d2a32e0 100644 --- a/Sources/YMFF/FeatureFlagResolver/Store/TransparentFeatureFlagStore.swift +++ b/Sources/YMFF/FeatureFlagResolver/Store/TransparentFeatureFlagStore.swift @@ -6,7 +6,9 @@ // Copyright © 2020 Yakov Manshin. See the LICENSE file for license info. // +#if !COCOAPODS import YMFFProtocols +#endif // MARK: - TransparentFeatureFlagStore diff --git a/Sources/YMFF/FeatureFlagResolver/Store/UserDefaultsStore.swift b/Sources/YMFF/FeatureFlagResolver/Store/UserDefaultsStore.swift index e9dcb76..5bb5ec0 100644 --- a/Sources/YMFF/FeatureFlagResolver/Store/UserDefaultsStore.swift +++ b/Sources/YMFF/FeatureFlagResolver/Store/UserDefaultsStore.swift @@ -9,7 +9,9 @@ #if canImport(Foundation) import Foundation +#if !COCOAPODS import YMFFProtocols +#endif // MARK: - UserDefaultsStore diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift deleted file mode 100644 index 7e97d46..0000000 --- a/Tests/LinuxMain.swift +++ /dev/null @@ -1,8 +0,0 @@ -import XCTest - -import YMFFTests - -var tests = [XCTestCaseEntry]() -tests += YMFFTests.__allTests() - -XCTMain(tests) diff --git a/Tests/YMFFTests/FeatureFlagResolverTests.swift b/Tests/YMFFTests/FeatureFlagResolverTests.swift index 5c0410a..a597f05 100644 --- a/Tests/YMFFTests/FeatureFlagResolverTests.swift +++ b/Tests/YMFFTests/FeatureFlagResolverTests.swift @@ -7,7 +7,10 @@ // import XCTest +#if !COCOAPODS import YMFFProtocols +#endif + @testable import YMFF // MARK: - Configuration diff --git a/Tests/YMFFTests/FeatureFlagTests.swift b/Tests/YMFFTests/FeatureFlagTests.swift index ee7e91c..2e05230 100644 --- a/Tests/YMFFTests/FeatureFlagTests.swift +++ b/Tests/YMFFTests/FeatureFlagTests.swift @@ -7,7 +7,10 @@ // import XCTest +#if !COCOAPODS import YMFFProtocols +#endif + @testable import YMFF // MARK: - Configuration diff --git a/Tests/YMFFTests/MutableStoreTests.swift b/Tests/YMFFTests/MutableStoreTests.swift index a1f46f3..14bb3cf 100644 --- a/Tests/YMFFTests/MutableStoreTests.swift +++ b/Tests/YMFFTests/MutableStoreTests.swift @@ -7,7 +7,9 @@ // import XCTest +#if !COCOAPODS import YMFFProtocols +#endif @testable import YMFF diff --git a/Tests/YMFFTests/RuntimeOverridesStoreTests.swift b/Tests/YMFFTests/RuntimeOverridesStoreTests.swift index 8c1f607..9375783 100644 --- a/Tests/YMFFTests/RuntimeOverridesStoreTests.swift +++ b/Tests/YMFFTests/RuntimeOverridesStoreTests.swift @@ -7,7 +7,10 @@ // import XCTest +#if !COCOAPODS import YMFFProtocols +#endif + @testable import YMFF // MARK: - Configuration diff --git a/Tests/YMFFTests/SharedAssets/SharedAssets.swift b/Tests/YMFFTests/SharedAssets/SharedAssets.swift index adb5e34..27b9c5f 100644 --- a/Tests/YMFFTests/SharedAssets/SharedAssets.swift +++ b/Tests/YMFFTests/SharedAssets/SharedAssets.swift @@ -7,7 +7,9 @@ // import YMFF +#if !COCOAPODS import YMFFProtocols +#endif // MARK: - Shared diff --git a/Tests/YMFFTests/UserDefaultsStoreTests.swift b/Tests/YMFFTests/UserDefaultsStoreTests.swift index 0720a71..ee44373 100644 --- a/Tests/YMFFTests/UserDefaultsStoreTests.swift +++ b/Tests/YMFFTests/UserDefaultsStoreTests.swift @@ -9,6 +9,7 @@ #if canImport(Foundation) import XCTest + @testable import YMFF final class UserDefaultsStoreTests: XCTestCase { diff --git a/Tests/YMFFTests/XCTestManifests.swift b/Tests/YMFFTests/XCTestManifests.swift deleted file mode 100644 index 6769494..0000000 --- a/Tests/YMFFTests/XCTestManifests.swift +++ /dev/null @@ -1,91 +0,0 @@ -#if !canImport(ObjectiveC) -import XCTest - -extension FeatureFlagResolverTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__FeatureFlagResolverTests = [ - ("testIfValueIsOptional", testIfValueIsOptional), - ("testIntValueResolution", testIntValueResolution), - ("testNonexistentValueResolution", testNonexistentValueResolution), - ("testOptionalIntValueResolution", testOptionalIntValueResolution), - ("testOverrideFailureNoMutableStores", testOverrideFailureNoMutableStores), - ("testOverrideFailureTypeMismatch", testOverrideFailureTypeMismatch), - ("testOverrideForNewKeys", testOverrideForNewKeys), - ("testOverrideRemovalFailureNoMutableStoreContainsValue", testOverrideRemovalFailureNoMutableStoreContainsValue), - ("testOverrideSuccess", testOverrideSuccess), - ("testOverrideValueValidationFailureOptional", testOverrideValueValidationFailureOptional), - ("testOverrideValueValidationFailureTypeMismatch", testOverrideValueValidationFailureTypeMismatch), - ("testOverrideValueValidationSuccess", testOverrideValueValidationSuccess), - ("testStringValueResolution", testStringValueResolution), - ("testValueRetrieval", testValueRetrieval), - ("testValueRetrievalFromEmptyStoresArray", testValueRetrievalFromEmptyStoresArray), - ("testValueValidation", testValueValidation), - ] -} - -extension FeatureFlagTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__FeatureFlagTests = [ - ("testBoolProjectedValue", testBoolProjectedValue), - ("testBoolWrappedValue", testBoolWrappedValue), - ("testIntProjectedValue", testIntProjectedValue), - ("testIntWrappedValue", testIntWrappedValue), - ("testNonexistentIntProjectedValue", testNonexistentIntProjectedValue), - ("testNonexistentIntWrappedValue", testNonexistentIntWrappedValue), - ("testNonexistentWrappedValueOverride", testNonexistentWrappedValueOverride), - ("testOptionalIntProjectedValue", testOptionalIntProjectedValue), - ("testOptionalIntValue", testOptionalIntValue), - ("testStringProjectedValue", testStringProjectedValue), - ("testStringWrappedValue", testStringWrappedValue), - ("testWrappedValueOverride", testWrappedValueOverride), - ] -} - -extension MutableStoreTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__MutableStoreTests = [ - ("testChangeSaving", testChangeSaving), - ("testOverride", testOverride), - ("testOverrideRemoval", testOverrideRemoval), - ] -} - -extension RuntimeOverridesStoreTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__RuntimeOverridesStoreTests = [ - ("testRuntimeOverride", testRuntimeOverride), - ("testRuntimeOverrideRemoval", testRuntimeOverrideRemoval), - ] -} - -extension UserDefaultsStoreTests { - // DO NOT MODIFY: This is autogenerated, use: - // `swift test --generate-linuxmain` - // to regenerate. - static let __allTests__UserDefaultsStoreTests = [ - ("testChangeSaving", testChangeSaving), - ("testReadValueWithResolver", testReadValueWithResolver), - ("testRemoveValueWithResolver", testRemoveValueWithResolver), - ("testWriteAndReadValueWithResolver", testWriteAndReadValueWithResolver), - ("testWriteValueWithResolver", testWriteValueWithResolver), - ] -} - -public func __allTests() -> [XCTestCaseEntry] { - return [ - testCase(FeatureFlagResolverTests.__allTests__FeatureFlagResolverTests), - testCase(FeatureFlagTests.__allTests__FeatureFlagTests), - testCase(MutableStoreTests.__allTests__MutableStoreTests), - testCase(RuntimeOverridesStoreTests.__allTests__RuntimeOverridesStoreTests), - testCase(UserDefaultsStoreTests.__allTests__UserDefaultsStoreTests), - ] -} -#endif diff --git a/YMFF.podspec b/YMFF.podspec new file mode 100644 index 0000000..a1b4d66 --- /dev/null +++ b/YMFF.podspec @@ -0,0 +1,48 @@ +Pod::Spec.new do |s| + + # Basic Info + + s.name = "YMFF" + s.version = "2.1.0" + s.summary = "Feature management made easy." + + s.description = <<-DESC + YMFF is a nice little library that makes management of features + with feature flags—and management of the feature flags themselves—a bliss. + DESC + + s.homepage = "https://github.com/yakovmanshin/YMFF" + s.documentation_url = "https://opensource.ym.dev/YMFF/" + + s.license = { :type => "Apache License, version 2.0", :file => "LICENSE" } + + s.author = { "Yakov Manshin" => "contact@yakovmanshin.com" } + s.social_media_url = "https://github.com/yakovmanshin" + + # Sources & Build Settings + + s.source = { :git => "https://github.com/yakovmanshin/YMFF.git", :tag => "#{s.version}" } + + s.swift_version = "5.3" + s.osx.deployment_target = "10.13" + s.ios.deployment_target = "11.0" + + # Subspecs + + s.default_subspec = "YMFF" + + s.subspec "YMFF" do |is| + is.source_files = "Sources/YMFF/**/*.{swift}" + is.dependency "YMFF/YMFFProtocols" + end + + s.subspec "YMFFProtocols" do |ps| + ps.source_files = "Sources/YMFFProtocols/**/*.{swift}" + end + + s.test_spec "Tests" do |ts| + ts.source_files = "Tests/YMFFTests/**/*.{swift}" + ts.dependency "YMFF/YMFF" + end + +end