featurevisor 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +77 -6
- data/lib/featurevisor/version.rb +1 -1
- metadata +13 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 202758e9fe9a2c81f67c3ea7456be5d068c1d9aa8ccf35f721a4ca447a94196a
|
|
4
|
+
data.tar.gz: bf2cae186ce5b6d3b483f4eab14768553cc5d2e09148c16ebbaf3ac60af7d7a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa565646ae2e3b54d018044a79e92d9172e0ac8478dbb2dbee1699605a9457fbea6b694dc42c9027b40d4d2a3358c3146be946cfe307319119ab6ba2d03657ed
|
|
7
|
+
data.tar.gz: e8e689efcc96ac4ca3bd0ec7469895fbb1c9b4e70737d0f56f87fa9f0733395c0e0de6938a7b6c7c4c6bd7daef9f9818daa9163e508b0242836b750aa83e82f4
|
data/README.md
CHANGED
|
@@ -43,6 +43,7 @@ This SDK is compatible with Featurevisor v3 projects and v2 datafiles.
|
|
|
43
43
|
- [Registering modules](#registering-modules)
|
|
44
44
|
- [Child instance](#child-instance)
|
|
45
45
|
- [Close](#close)
|
|
46
|
+
- [OpenFeature](#openfeature)
|
|
46
47
|
- [CLI usage](#cli-usage)
|
|
47
48
|
- [Test](#test)
|
|
48
49
|
- [Test against local monorepo's example-1](#test-against-local-monorepos-example-1)
|
|
@@ -778,7 +779,7 @@ All three commands accept repeatable `--target=<target>` options. `test` builds
|
|
|
778
779
|
|
|
779
780
|
```bash
|
|
780
781
|
$ cd /absolute/path/to/featurevisor-ruby
|
|
781
|
-
$ bundle exec ruby bin/featurevisor test --projectDirectoryPath
|
|
782
|
+
$ bundle exec ruby bin/featurevisor test --projectDirectoryPath=../featurevisor/examples/example-1 --onlyFailures
|
|
782
783
|
$ make test-example-1
|
|
783
784
|
```
|
|
784
785
|
|
|
@@ -811,30 +812,100 @@ $ bundle exec featurevisor assess-distribution \
|
|
|
811
812
|
--n=1000
|
|
812
813
|
```
|
|
813
814
|
|
|
815
|
+
## OpenFeature
|
|
816
|
+
|
|
817
|
+
The OpenFeature provider is published as a separate gem. This keeps OpenFeature code and dependencies out of applications that only use the Featurevisor SDK.
|
|
818
|
+
|
|
819
|
+
The provider currently requires Ruby 3.4 or newer because that is the minimum version supported by the official OpenFeature Ruby SDK.
|
|
820
|
+
|
|
821
|
+
Install the provider:
|
|
822
|
+
|
|
823
|
+
```ruby
|
|
824
|
+
gem "featurevisor-openfeature", "~> 1.1"
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
It installs the matching `featurevisor` gem and the official `openfeature-sdk` dependency. The provider and base SDK deliberately share the same version, and the provider requires that exact Featurevisor version.
|
|
828
|
+
|
|
829
|
+
```ruby
|
|
830
|
+
require "featurevisor/openfeature_provider"
|
|
831
|
+
|
|
832
|
+
provider = Featurevisor::OpenFeatureProvider.new(
|
|
833
|
+
datafile: datafile_content,
|
|
834
|
+
)
|
|
835
|
+
|
|
836
|
+
OpenFeature::SDK.configure do |config|
|
|
837
|
+
config.set_provider_and_wait(provider)
|
|
838
|
+
end
|
|
839
|
+
|
|
840
|
+
client = OpenFeature::SDK.build_client
|
|
841
|
+
enabled = client.fetch_boolean_value(
|
|
842
|
+
flag_key: "checkout",
|
|
843
|
+
default_value: false,
|
|
844
|
+
evaluation_context: OpenFeature::SDK::EvaluationContext.new(targeting_key: "user-123"),
|
|
845
|
+
)
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
Use `checkout` for a flag, `checkout:variation` for its variation, and `checkout:title` for its `title` variable. Boolean variables use the boolean resolver. Arrays, hashes, and JSON variables use the object resolver.
|
|
849
|
+
|
|
850
|
+
OpenFeature's targeting key maps to `userId` by default. `targeting_key_field`, `key_separator`, and `variation_key` can customize the mapping.
|
|
851
|
+
|
|
852
|
+
You can pass any Featurevisor initialization options directly to the provider. These options are used to create the Featurevisor instance owned by the provider:
|
|
853
|
+
|
|
854
|
+
```ruby
|
|
855
|
+
provider = Featurevisor::OpenFeatureProvider.new(
|
|
856
|
+
datafile: datafile_content,
|
|
857
|
+
targeting_key_field: "accountId",
|
|
858
|
+
key_separator: "/",
|
|
859
|
+
variation_key: "$variation",
|
|
860
|
+
)
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
You can also reuse an existing Featurevisor instance:
|
|
864
|
+
|
|
865
|
+
```ruby
|
|
866
|
+
featurevisor = Featurevisor.create_featurevisor(datafile: datafile_content)
|
|
867
|
+
provider = Featurevisor::OpenFeatureProvider.new(featurevisor: featurevisor)
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
The caller owns an instance passed this way. Provider shutdown does not close it. Call `featurevisor.close` when every consumer is finished with it. When the provider creates the instance from options, the provider owns and closes it. If both are supplied, `featurevisor` takes precedence over the options hash.
|
|
871
|
+
|
|
872
|
+
See the [OpenFeature provider guide](https://featurevisor.com/docs/sdks/openfeature/) for resolution reasons, errors, metadata, tracking, lifecycle, and providers for other languages.
|
|
873
|
+
|
|
814
874
|
<!-- FEATUREVISOR_DOCS_END -->
|
|
815
875
|
|
|
816
876
|
## Development
|
|
817
877
|
|
|
818
878
|
### Setting up
|
|
819
879
|
|
|
820
|
-
After checking out the
|
|
880
|
+
After checking out the repository, run `make install` to install dependencies.
|
|
821
881
|
|
|
822
882
|
### Running tests
|
|
823
883
|
|
|
824
884
|
```bash
|
|
825
885
|
$ bundle exec rspec
|
|
886
|
+
$ make test-base
|
|
887
|
+
$ make test-example-1
|
|
826
888
|
```
|
|
827
889
|
|
|
828
|
-
|
|
890
|
+
Build and verify both gems with:
|
|
891
|
+
|
|
892
|
+
```bash
|
|
893
|
+
$ make build
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
The build produces `featurevisor-VERSION.gem` and `featurevisor-openfeature-VERSION.gem`. The artifact verifier confirms that OpenFeature code and dependencies are absent from the base gem and present only in the provider gem.
|
|
829
897
|
|
|
830
898
|
### Releasing
|
|
831
899
|
|
|
832
|
-
- Update version in `lib/featurevisor/version.rb`
|
|
900
|
+
- Update the shared version in `lib/featurevisor/version.rb`
|
|
833
901
|
- Run `bundle install`
|
|
834
902
|
- Push commit to `main` branch
|
|
835
903
|
- Wait for CI to complete
|
|
836
|
-
- Tag the release with the version number
|
|
837
|
-
-
|
|
904
|
+
- Tag the release with the same version number, for example `v1.1.0`
|
|
905
|
+
- The workflow verifies that the tag matches the shared version
|
|
906
|
+
- The workflow publishes `featurevisor` first, followed by `featurevisor-openfeature`
|
|
907
|
+
|
|
908
|
+
The gems are separate RubyGems packages built from the same repository. Publishing the base gem first ensures the provider's exact Featurevisor dependency is available when the provider is published. If the second push fails, rerun or retry the provider publication without republishing the existing base version.
|
|
838
909
|
|
|
839
910
|
## License
|
|
840
911
|
|
data/lib/featurevisor/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: featurevisor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fahad Heylaal
|
|
@@ -16,6 +16,9 @@ dependencies:
|
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
18
|
version: '0'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '1'
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -23,6 +26,9 @@ dependencies:
|
|
|
23
26
|
- - ">="
|
|
24
27
|
- !ruby/object:Gem::Version
|
|
25
28
|
version: '0'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '1'
|
|
26
32
|
- !ruby/object:Gem::Dependency
|
|
27
33
|
name: rspec
|
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -82,7 +88,12 @@ files:
|
|
|
82
88
|
homepage: https://featurevisor.com
|
|
83
89
|
licenses:
|
|
84
90
|
- MIT
|
|
85
|
-
metadata:
|
|
91
|
+
metadata:
|
|
92
|
+
source_code_uri: https://github.com/featurevisor/featurevisor-ruby
|
|
93
|
+
documentation_uri: https://featurevisor.com/docs/sdks/ruby/
|
|
94
|
+
bug_tracker_uri: https://github.com/featurevisor/featurevisor-ruby/issues
|
|
95
|
+
allowed_push_host: https://rubygems.org
|
|
96
|
+
rubygems_mfa_required: 'true'
|
|
86
97
|
rdoc_options: []
|
|
87
98
|
require_paths:
|
|
88
99
|
- lib
|