diff --git a/Package.swift b/Package.swift index bbdaa4f..c4a6eee 100644 --- a/Package.swift +++ b/Package.swift @@ -17,8 +17,8 @@ let package = Package( targets: ["FeaturevisorTypes"] ), .executable( - name: "FeaturevisorCLI", - targets: ["FeaturevisorCLI"] + name: "featurevisor", + targets: ["Featurevisor"] ), ], dependencies: [ @@ -43,7 +43,7 @@ let package = Package( ] ), .executableTarget( - name: "FeaturevisorCLI", + name: "Featurevisor", dependencies: [ "FeaturevisorSDK", "FeaturevisorTypes", @@ -52,7 +52,7 @@ let package = Package( .product(name: "Commands", package: "swift-commands"), .product(name: "ArgumentParser", package: "swift-argument-parser") ], - path: "Sources/FeaturevisorCLI" + path: "Sources/Featurevisor" ), .testTarget( name: "FeaturevisorSDKTests", diff --git a/README.md b/README.md index c9403a0..af9d368 100644 --- a/README.md +++ b/README.md @@ -320,8 +320,6 @@ let f = try createInstance(options: options) ### Test runner -@TODO: Work still in progress. Currently we have an early POC. - ### Options ```bash @@ -332,18 +330,23 @@ If you are interested to see only the test specs that fail: Example command: -First you need to install the Swift Test Runner using above steps (until we release official version) +``` +$ swift run featurevisor test . +``` + +You can also install it locally using below commands. Note, we use featurevisor-swift to avoid conflicts with other Featurevisor CLIs + ``` $ cd path/to/featurevisor-swift-sdk $ swift build -c release $ cd .build/release -$ cp -f FeaturevisorSwiftTestRunner /usr/local/bin/featurevisor-swift-test-runner +$ cp -f Featurevisor /usr/local/bin/featurevisor-swift ``` Now you can usage like below: ``` $ cd path/to/featurevisor-project-with-yamls -$ featurevisor-swift-cli test . +$ featurevisor-swift test . ``` ### Benchmarking @@ -355,7 +358,7 @@ The `--n` option is used to specify the number of iterations to run the benchmar To benchmark evaluating a feature itself if it is enabled or disabled via SDK's `.isEnabled()` method: ```bash - featurevisor-swift-cli benchmark \ + featurevisor-swift benchmark \ --environment staging \ --feature feature_key \ --context '{"user_id":"123"}' \ @@ -366,7 +369,7 @@ To benchmark evaluating a feature itself if it is enabled or disabled via SDK's To benchmark evaluating a feature's variation via SDKs's `.getVariation()` method: ```bash - featurevisor-swift-cli benchmark \ + featurevisor-swift benchmark \ --environment staging \ --feature feature_key \ --context '{"user_id":"123"}' \ @@ -378,7 +381,7 @@ To benchmark evaluating a feature's variation via SDKs's `.getVariation()` metho To benchmark evaluating a feature's variable via SDKs's `.getVariable()` method: ```bash - featurevisor-swift-cli benchmark \ + featurevisor-swift benchmark \ --environment staging \ --feature feature_key \ --variable variable_key \ @@ -390,7 +393,7 @@ To benchmark evaluating a feature's variable via SDKs's `.getVariable()` method: To learn why certain values (like feature and its variation or variables) are evaluated as they are against provided [context](https://featurevisor.com/docs/sdks/javascript/#context): ```bash - featurevisor-swift-cli evaluate \ + featurevisor-swift evaluate \ --environment staging \ --feature feature_key \ --context '{"user_id":"123"}' \ diff --git a/Sources/FeaturevisorCLI/Extensions/Evaluation+CustomStringConvertible.swift b/Sources/Featurevisor/Extensions/Evaluation+CustomStringConvertible.swift similarity index 100% rename from Sources/FeaturevisorCLI/Extensions/Evaluation+CustomStringConvertible.swift rename to Sources/Featurevisor/Extensions/Evaluation+CustomStringConvertible.swift diff --git a/Sources/FeaturevisorCLI/Extensions/TimeInterval+Init.swift b/Sources/Featurevisor/Extensions/TimeInterval+Init.swift similarity index 100% rename from Sources/FeaturevisorCLI/Extensions/TimeInterval+Init.swift rename to Sources/Featurevisor/Extensions/TimeInterval+Init.swift diff --git a/Sources/FeaturevisorCLI/Extensions/UInt64+Time.swift b/Sources/Featurevisor/Extensions/UInt64+Time.swift similarity index 100% rename from Sources/FeaturevisorCLI/Extensions/UInt64+Time.swift rename to Sources/Featurevisor/Extensions/UInt64+Time.swift diff --git a/Sources/FeaturevisorCLI/FeaturevisorCLI+Benchmark.swift b/Sources/Featurevisor/Featurevisor+Benchmark.swift similarity index 98% rename from Sources/FeaturevisorCLI/FeaturevisorCLI+Benchmark.swift rename to Sources/Featurevisor/Featurevisor+Benchmark.swift index 004f9e9..d90d38d 100644 --- a/Sources/FeaturevisorCLI/FeaturevisorCLI+Benchmark.swift +++ b/Sources/Featurevisor/Featurevisor+Benchmark.swift @@ -3,7 +3,7 @@ import FeaturevisorSDK import FeaturevisorTypes import Foundation -extension FeaturevisorCLI.Benchmark { +extension Featurevisor.Benchmark { func benchmarkFeature(options: Options) { @@ -76,7 +76,7 @@ extension FeaturevisorCLI.Benchmark { } } -extension FeaturevisorCLI.Benchmark { +extension Featurevisor.Benchmark { func benchmarkFeatureFlag( _ f: FeaturevisorInstance, diff --git a/Sources/FeaturevisorCLI/FeaturevisorCLI+Evaluate.swift b/Sources/Featurevisor/Featurevisor+Evaluate.swift similarity index 97% rename from Sources/FeaturevisorCLI/FeaturevisorCLI+Evaluate.swift rename to Sources/Featurevisor/Featurevisor+Evaluate.swift index 7a862c8..1df42bf 100644 --- a/Sources/FeaturevisorCLI/FeaturevisorCLI+Evaluate.swift +++ b/Sources/Featurevisor/Featurevisor+Evaluate.swift @@ -3,7 +3,7 @@ import FeaturevisorSDK import FeaturevisorTypes import Foundation -extension FeaturevisorCLI.Evaluate { +extension Featurevisor.Evaluate { func evaluateFeature(options: Options) { @@ -88,7 +88,7 @@ extension FeaturevisorCLI.Evaluate { } } -extension FeaturevisorCLI.Evaluate { +extension Featurevisor.Evaluate { fileprivate func printHeader(_ message: String) { print("\n\n###############") diff --git a/Sources/FeaturevisorCLI/FeaturevisorCLI.swift b/Sources/Featurevisor/Featurevisor.swift similarity index 99% rename from Sources/FeaturevisorCLI/FeaturevisorCLI.swift rename to Sources/Featurevisor/Featurevisor.swift index f9eb81a..2986f68 100644 --- a/Sources/FeaturevisorCLI/FeaturevisorCLI.swift +++ b/Sources/Featurevisor/Featurevisor.swift @@ -7,7 +7,7 @@ import Foundation import Yams @main -struct FeaturevisorCLI: ParsableCommand { +struct Featurevisor: ParsableCommand { static let configuration = CommandConfiguration( abstract: "Featurevisor CLI.", @@ -15,7 +15,7 @@ struct FeaturevisorCLI: ParsableCommand { ) } -extension FeaturevisorCLI { +extension Featurevisor { struct Benchmark: ParsableCommand { @@ -95,7 +95,7 @@ extension FeaturevisorCLI { } } -extension FeaturevisorCLI { +extension Featurevisor { struct Evaluate: ParsableCommand { @@ -152,7 +152,7 @@ extension FeaturevisorCLI { } } -extension FeaturevisorCLI { +extension Featurevisor { struct Test: ParsableCommand { @@ -402,7 +402,7 @@ extension FeaturevisorCLI { } } -extension FeaturevisorCLI.Test { +extension Featurevisor.Test { func loadAllFeatures(featuresTestDirectoryPath: String) throws -> [Feature] { diff --git a/Sources/FeaturevisorCLI/Mappers/AssertionMapper.swift b/Sources/Featurevisor/Mappers/AssertionMapper.swift similarity index 100% rename from Sources/FeaturevisorCLI/Mappers/AssertionMapper.swift rename to Sources/Featurevisor/Mappers/AssertionMapper.swift diff --git a/Sources/FeaturevisorCLI/Mappers/VariableValueMapper.swift b/Sources/Featurevisor/Mappers/VariableValueMapper.swift similarity index 100% rename from Sources/FeaturevisorCLI/Mappers/VariableValueMapper.swift rename to Sources/Featurevisor/Mappers/VariableValueMapper.swift diff --git a/Sources/FeaturevisorCLI/Models/Assertion.swift b/Sources/Featurevisor/Models/Assertion.swift similarity index 100% rename from Sources/FeaturevisorCLI/Models/Assertion.swift rename to Sources/Featurevisor/Models/Assertion.swift diff --git a/Sources/FeaturevisorCLI/Models/Environment.swift b/Sources/Featurevisor/Models/Environment.swift similarity index 100% rename from Sources/FeaturevisorCLI/Models/Environment.swift rename to Sources/Featurevisor/Models/Environment.swift diff --git a/Sources/FeaturevisorCLI/Models/ExpectedVariableValue.swift b/Sources/Featurevisor/Models/ExpectedVariableValue.swift similarity index 100% rename from Sources/FeaturevisorCLI/Models/ExpectedVariableValue.swift rename to Sources/Featurevisor/Models/ExpectedVariableValue.swift diff --git a/Sources/FeaturevisorCLI/Models/Feature.swift b/Sources/Featurevisor/Models/Feature.swift similarity index 100% rename from Sources/FeaturevisorCLI/Models/Feature.swift rename to Sources/Featurevisor/Models/Feature.swift diff --git a/Sources/FeaturevisorCLI/Models/FeatureTestAssertionFile.swift b/Sources/Featurevisor/Models/FeatureTestAssertionFile.swift similarity index 100% rename from Sources/FeaturevisorCLI/Models/FeatureTestAssertionFile.swift rename to Sources/Featurevisor/Models/FeatureTestAssertionFile.swift diff --git a/Sources/FeaturevisorCLI/Models/FeatureTestSuitFile.swift b/Sources/Featurevisor/Models/FeatureTestSuitFile.swift similarity index 100% rename from Sources/FeaturevisorCLI/Models/FeatureTestSuitFile.swift rename to Sources/Featurevisor/Models/FeatureTestSuitFile.swift diff --git a/Sources/FeaturevisorCLI/Models/SDKProvider.swift b/Sources/Featurevisor/Models/SDKProvider.swift similarity index 100% rename from Sources/FeaturevisorCLI/Models/SDKProvider.swift rename to Sources/Featurevisor/Models/SDKProvider.swift diff --git a/Sources/FeaturevisorCLI/Utils/Combinations.swift b/Sources/Featurevisor/Utils/Combinations.swift similarity index 100% rename from Sources/FeaturevisorCLI/Utils/Combinations.swift rename to Sources/Featurevisor/Utils/Combinations.swift diff --git a/Sources/FeaturevisorCLI/Utils/FeatureResultOutputBuilder.swift b/Sources/Featurevisor/Utils/FeatureResultOutputBuilder.swift similarity index 100% rename from Sources/FeaturevisorCLI/Utils/FeatureResultOutputBuilder.swift rename to Sources/Featurevisor/Utils/FeatureResultOutputBuilder.swift diff --git a/Sources/FeaturevisorCLI/Utils/ShellExecutor.swift b/Sources/Featurevisor/Utils/ShellExecutor.swift similarity index 100% rename from Sources/FeaturevisorCLI/Utils/ShellExecutor.swift rename to Sources/Featurevisor/Utils/ShellExecutor.swift