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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +77 -6
  3. data/lib/featurevisor/version.rb +1 -1
  4. metadata +13 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5951351cf7893e83e9f3994999f48389e1998bb8dec84092f3e7627f986bfd02
4
- data.tar.gz: 3d24e02b8fd0708084b7716863396119728bcd83cbd0ac209b7a1c62fb982f68
3
+ metadata.gz: 202758e9fe9a2c81f67c3ea7456be5d068c1d9aa8ccf35f721a4ca447a94196a
4
+ data.tar.gz: bf2cae186ce5b6d3b483f4eab14768553cc5d2e09148c16ebbaf3ac60af7d7a0
5
5
  SHA512:
6
- metadata.gz: 368e45cb26cb6a98d13bc14b4fe9116bd36af47acadad3fbc99fc1926c8ce768edf5c9ade31aa36dd3c85ff95fc6dab2d3433d4d607bbeee99076a21838e0dae
7
- data.tar.gz: 160b9eb960915113e3f9dfa3507b9f06664224ac3517d7a84432ec64d2d26d26c2ba379a09aeba64efe78a310972b5f497ad5d5ef1bbef1cc41ffa1408ffa70f
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=/Users/fahad/Projects/featurevisor/featurevisor/examples/example-1 --onlyFailures
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 repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
- - This will trigger a new release to [RubyGems](https://rubygems.org/gems/featurevisor)
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
 
@@ -1,3 +1,3 @@
1
1
  module Featurevisor
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
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.0.0
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