sdk-reforge 1.9.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 (103) hide show
  1. checksums.yaml +7 -0
  2. data/.envrc.sample +3 -0
  3. data/.github/CODEOWNERS +2 -0
  4. data/.github/pull_request_template.md +8 -0
  5. data/.github/workflows/ruby.yml +48 -0
  6. data/.gitmodules +3 -0
  7. data/.rubocop.yml +13 -0
  8. data/.tool-versions +1 -0
  9. data/CHANGELOG.md +257 -0
  10. data/CODEOWNERS +1 -0
  11. data/Gemfile +29 -0
  12. data/Gemfile.lock +182 -0
  13. data/LICENSE.txt +20 -0
  14. data/README.md +105 -0
  15. data/Rakefile +63 -0
  16. data/VERSION +1 -0
  17. data/compile_protos.sh +20 -0
  18. data/dev/allocation_stats +60 -0
  19. data/dev/benchmark +40 -0
  20. data/dev/console +12 -0
  21. data/dev/script_setup.rb +18 -0
  22. data/lib/prefab_pb.rb +77 -0
  23. data/lib/reforge/caching_http_connection.rb +95 -0
  24. data/lib/reforge/client.rb +133 -0
  25. data/lib/reforge/config_client.rb +275 -0
  26. data/lib/reforge/config_client_presenter.rb +18 -0
  27. data/lib/reforge/config_loader.rb +67 -0
  28. data/lib/reforge/config_resolver.rb +84 -0
  29. data/lib/reforge/config_value_unwrapper.rb +123 -0
  30. data/lib/reforge/config_value_wrapper.rb +18 -0
  31. data/lib/reforge/context.rb +241 -0
  32. data/lib/reforge/context_shape.rb +20 -0
  33. data/lib/reforge/context_shape_aggregator.rb +70 -0
  34. data/lib/reforge/criteria_evaluator.rb +345 -0
  35. data/lib/reforge/duration.rb +58 -0
  36. data/lib/reforge/encryption.rb +65 -0
  37. data/lib/reforge/error.rb +6 -0
  38. data/lib/reforge/errors/env_var_parse_error.rb +11 -0
  39. data/lib/reforge/errors/initialization_timeout_error.rb +12 -0
  40. data/lib/reforge/errors/invalid_sdk_key_error.rb +19 -0
  41. data/lib/reforge/errors/missing_default_error.rb +13 -0
  42. data/lib/reforge/errors/missing_env_var_error.rb +11 -0
  43. data/lib/reforge/errors/uninitialized_error.rb +13 -0
  44. data/lib/reforge/evaluation.rb +53 -0
  45. data/lib/reforge/evaluation_summary_aggregator.rb +86 -0
  46. data/lib/reforge/example_contexts_aggregator.rb +77 -0
  47. data/lib/reforge/exponential_backoff.rb +21 -0
  48. data/lib/reforge/feature_flag_client.rb +43 -0
  49. data/lib/reforge/fixed_size_hash.rb +14 -0
  50. data/lib/reforge/http_connection.rb +45 -0
  51. data/lib/reforge/internal_logger.rb +43 -0
  52. data/lib/reforge/javascript_stub.rb +99 -0
  53. data/lib/reforge/local_config_parser.rb +151 -0
  54. data/lib/reforge/murmer3.rb +50 -0
  55. data/lib/reforge/options.rb +191 -0
  56. data/lib/reforge/periodic_sync.rb +74 -0
  57. data/lib/reforge/prefab.rb +120 -0
  58. data/lib/reforge/rate_limit_cache.rb +41 -0
  59. data/lib/reforge/resolved_config_presenter.rb +86 -0
  60. data/lib/reforge/semver.rb +132 -0
  61. data/lib/reforge/sse_config_client.rb +112 -0
  62. data/lib/reforge/time_helpers.rb +7 -0
  63. data/lib/reforge/weighted_value_resolver.rb +42 -0
  64. data/lib/reforge/yaml_config_parser.rb +34 -0
  65. data/lib/reforge-sdk.rb +57 -0
  66. data/test/fixtures/datafile.json +87 -0
  67. data/test/integration_test.rb +171 -0
  68. data/test/integration_test_helpers.rb +114 -0
  69. data/test/support/common_helpers.rb +201 -0
  70. data/test/support/mock_base_client.rb +41 -0
  71. data/test/support/mock_config_client.rb +19 -0
  72. data/test/support/mock_config_loader.rb +1 -0
  73. data/test/test_caching_http_connection.rb +218 -0
  74. data/test/test_client.rb +351 -0
  75. data/test/test_config_client.rb +84 -0
  76. data/test/test_config_loader.rb +82 -0
  77. data/test/test_config_resolver.rb +502 -0
  78. data/test/test_config_value_unwrapper.rb +270 -0
  79. data/test/test_config_value_wrapper.rb +42 -0
  80. data/test/test_context.rb +271 -0
  81. data/test/test_context_shape.rb +50 -0
  82. data/test/test_context_shape_aggregator.rb +150 -0
  83. data/test/test_criteria_evaluator.rb +1180 -0
  84. data/test/test_duration.rb +37 -0
  85. data/test/test_encryption.rb +16 -0
  86. data/test/test_evaluation_summary_aggregator.rb +162 -0
  87. data/test/test_example_contexts_aggregator.rb +233 -0
  88. data/test/test_exponential_backoff.rb +18 -0
  89. data/test/test_feature_flag_client.rb +16 -0
  90. data/test/test_fixed_size_hash.rb +119 -0
  91. data/test/test_helper.rb +17 -0
  92. data/test/test_integration.rb +75 -0
  93. data/test/test_internal_logger.rb +25 -0
  94. data/test/test_javascript_stub.rb +176 -0
  95. data/test/test_local_config_parser.rb +147 -0
  96. data/test/test_logger_initialization.rb +12 -0
  97. data/test/test_options.rb +93 -0
  98. data/test/test_prefab.rb +16 -0
  99. data/test/test_rate_limit_cache.rb +44 -0
  100. data/test/test_semver.rb +108 -0
  101. data/test/test_sse_config_client.rb +211 -0
  102. data/test/test_weighted_value_resolver.rb +71 -0
  103. metadata +345 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1c692e3a481a6340630232b56282b7e2dfa1e55102a03e910bb2522cc49a7660
4
+ data.tar.gz: e4485f45667650616b375e9b1d4aa76b03f3377744fb223d2807e4a30e99a7f4
5
+ SHA512:
6
+ metadata.gz: a378c5553acaf78760bdad194c3843f2d565a3cb8e66e4db3f462b5555748394674df9fa5a599eea144d533f6069dd3bc7a052bce3e604ede4193703e79fa719
7
+ data.tar.gz: 39b53e20a22e1c793bbb9bbe4dbde40c90dcea9ac0298be835fea3a22c222dec28e1cb12741fe8564952201de30db3e5700204430104df475c99c514cca3d611
data/.envrc.sample ADDED
@@ -0,0 +1,3 @@
1
+ export AWS_ACCESS_KEY_ID=
2
+ export AWS_SECRET_ACCESS_KEY=
3
+ export PREFAB_INTEGRATION_TEST_API_KEY=
@@ -0,0 +1,2 @@
1
+ # All changes require review from prefabdevs team
2
+ * @prefab-cloud/prefabdevs
@@ -0,0 +1,8 @@
1
+ ## Description
2
+ *(Brief overview of what this PR changes and/or why the changes are needed)*
3
+
4
+ ## Testing & Validation
5
+ *(Outline the steps needed to be taken to verify the changes.)*
6
+
7
+ ## Rollout
8
+ *(Optional section: Provide rollout and rollback procedures, when outside the bounds or requiring additional work beyond standard deployment)*
@@ -0,0 +1,48 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['3.1','3.2','3.3','3.4']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ with:
30
+ submodules: recursive
31
+ - name: Set up Ruby
32
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
33
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
34
+ # uses: ruby/setup-ruby@v1
35
+ # uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
36
+ uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: ${{ matrix.ruby-version }}
39
+ bundler-cache: false # runs 'bundle install' and caches installed gems automatically
40
+ - name: Install dependencies
41
+ run: bundle install --without development --jobs 4 --retry 3
42
+ - name: Run tests
43
+ run: bundle exec rake --trace
44
+ env:
45
+ REFORGE_INTEGRATION_TEST_SDK_KEY: ${{ secrets.REFORGE_INTEGRATION_TEST_SDK_KEY }}
46
+ REFORGE_INTEGRATION_TEST_ENCRYPTION_KEY: c87ba22d8662282abe8a0e4651327b579cb64a454ab0f4c170b45b15f049a221
47
+ NOT_A_NUMBER: "abcd"
48
+ IS_A_NUMBER: "1234"
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "test/shared-integration-test-data"]
2
+ path = test/shared-integration-test-data
3
+ url = git@github.com:ReforgeHQ/integration-test-data.git
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ Exclude:
4
+ - prefab-cloud-ruby.gemspec
5
+ - lib/prefab_pb.rb
6
+
7
+ Metrics:
8
+ Exclude:
9
+ - 'test/*.rb'
10
+
11
+ Layout/LineLength:
12
+ Exclude:
13
+ - 'test/*.rb'
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.7
data/CHANGELOG.md ADDED
@@ -0,0 +1,257 @@
1
+ # Changelog
2
+
3
+
4
+ ## 1.9.0 - 2025-08-23
5
+
6
+ - Moved to reforge gem name `sdk-reforge`
7
+ - Add automated gem publishing via GitHub Actions trusted publishing
8
+ - Add support for `reforge.current-time` virtual context
9
+ - Dropped the previous implementation of dynamic logging support
10
+ - Removed local file loading based on prefab-envs
11
+
12
+ ## 1.8.9 - 2025-04-15
13
+
14
+ - Fix support for virtual context `prefab.current-time` [#229]
15
+
16
+ ## 1.8.8 - 2025-02-28
17
+
18
+ - Add conditional fetch support for configurations [#226]
19
+ - Operator support for string starts with, contains [#212]
20
+ - Operator support for regex, semver (protobuf update) [#215]
21
+ - Operator support for date comparison (before/after) [#221]
22
+ - Operator support for numeric comparisons [#220]
23
+
24
+
25
+ ## 1.8.7 - 2024-10-25
26
+
27
+ - Add option symbolize_json_names [#211]
28
+
29
+
30
+ ## 1.8.6 - 2024-10-07
31
+
32
+ - Fix deprecation warning caused by x_datafile being set by default [#208]
33
+
34
+ ## 1.8.5 - 2024-09-27
35
+
36
+ - Fix JS bootstrapping and improve performance [#206]
37
+ - Promote `datafile` from `x_datafile` [#205]
38
+
39
+ ## 1.8.4 - 2024-09-19
40
+
41
+ - Use `stream` subdomain for SSE [#203]
42
+
43
+ ## 1.8.3 - 2024-09-16
44
+
45
+ - Add JavaScript stub & bootstrapping [#200]
46
+
47
+ ## 1.8.2 - 2024-09-03
48
+
49
+ - Forbid bad semantic_logger version [#198]
50
+
51
+ ## 1.8.1 - 2024-09-03
52
+
53
+ - Fix SSE reconnection bug [#197]
54
+
55
+ ## 1.8.0 - 2024-08-22
56
+
57
+ - Load config from belt and failover to suspenders [#195]
58
+
59
+ ## 1.7.2 - 2024-06-24
60
+
61
+ - Support JSON config values [#194]
62
+
63
+ ## 1.7.1 - 2024-04-11
64
+
65
+ - Ergonomics [#191]
66
+
67
+ ## 1.7.0 - 2024-04-10
68
+
69
+ - Add duration support [#187]
70
+
71
+ ## 1.6.2 - 2024-03-29
72
+
73
+ - Fix context telemetry when JIT and Block contexts are combined [#185]
74
+ - Remove logger prefix [#186]
75
+
76
+ ## 1.6.1 - 2024-03-28
77
+
78
+ - Performance optimizations [#178]
79
+ - Global context [#182]
80
+
81
+ ## 1.6.0 - 2024-03-27
82
+
83
+ - Use semantic_logger for internal logging [#173]
84
+ - Remove Prefab::LoggerClient as a logger for end users [#173]
85
+ - Provide log_filter for end users [#173]
86
+
87
+ ## 1.5.1 - 2024-02-22
88
+
89
+ - Fix: Send context shapes by default [#174]
90
+
91
+ ## 1.5.0 - 2024-02-12
92
+
93
+ - Fix potential inconsistent Context behavior [#172]
94
+
95
+ ## 1.4.5 - 2024-01-31
96
+
97
+ - Refactor out a `should_log?` method [#170]
98
+
99
+ ## 1.4.4 - 2024-01-26
100
+
101
+ - Raise when ENV var is missing
102
+
103
+ ## 1.4.3 - 2024-01-17
104
+
105
+ - Updated proto definition file
106
+
107
+ ## 1.4.2 - 2023-12-14
108
+
109
+ - Use reportable value even for invalid data [#166]
110
+
111
+ ## 1.4.1 - 2023-12-08
112
+
113
+ - Include version in `get` request [#165]
114
+
115
+ ## 1.4.0 - 2023-11-28
116
+
117
+ - ActiveJob tagged logger issue [#164]
118
+ - Compact Log Format [#163]
119
+ - Tagged Logging [#161]
120
+ - ContextKey logging thread safety [#162]
121
+
122
+ ## 1.3.2 - 2023-11-15
123
+
124
+ - Send back cloud.prefab logging telemetry [#160]
125
+
126
+ ## 1.3.1 - 2023-11-14
127
+
128
+ - Improve path of rails.controller logging & fix strong param include [#159]
129
+
130
+ ## 1.3.0 - 2023-11-13
131
+
132
+ - Less logging when wifi is off and we load from cache [#157]
133
+ - Alpha: Add Provided & Secret Support [#152]
134
+ - Alpha: x_datafile [#156]
135
+ - Add single line action-controller output under rails.controller [#158]
136
+
137
+ ## 1.2.1 - 2023-11-01
138
+
139
+ - Update protobuf definitions [#154]
140
+
141
+ ## 1.2.0 - 2023-10-30
142
+
143
+ - Add `Prefab.get('key')` style usage after a `Prefab.init()` call [#151]
144
+ - Add `add_context_keys` and `with_context_keys` method for LoggerClient [#145]
145
+
146
+ ## 1.1.2 - 2023-10-13
147
+
148
+ - Add `cloud.prefab.client.criteria_evaluator` `debug` logging of evaluations [#150]
149
+ - Add `x_use_local_cache` for local caching [#148]
150
+ - Tests run in RubyMine [#147]
151
+
152
+ ## 1.1.1 - 2023-10-11
153
+
154
+ - Migrate happy-path client-initialization logging to `DEBUG` level rather than `INFO` [#144]
155
+ - Add `ConfigClientPresenter` for logging out stats upon successful client initialization [#144]
156
+ - Add support for default context [#146]
157
+
158
+ ## 1.1.0 - 2023-09-18
159
+
160
+ - Add support for structured logging [#143]
161
+ - Ability to pass a hash of key/value context pairs to any of the user-facing log methods
162
+
163
+ ## 1.0.1 - 2023-08-17
164
+
165
+ - Bug fix for StringList w/ ExampleContextsAggregator [#141]
166
+
167
+ ## 1.0.0 - 2023-08-10
168
+
169
+ - Removed EvaluatedKeysAggregator [#137]
170
+ - Change `collect_evaluation_summaries` default to true [#136]
171
+ - Removed some backwards compatibility shims [#133]
172
+ - Standardizing options [#132]
173
+ - Note that the default value for `context_upload_mode` is `:periodic_example` which means example contexts will be collected.
174
+ This enables easy variant override assignment in our UI. More at https://prefab.cloud/blog/feature-flag-variant-assignment/
175
+
176
+ ## 0.24.6 - 2023-07-31
177
+
178
+ - Logger Client compatibility [#129]
179
+ - Replace EvaluatedConfigs with ExampleContexts [#128]
180
+ - Add ConfigEvaluationSummaries (opt-in for now) [#123]
181
+
182
+ ## 0.24.5 - 2023-07-10
183
+
184
+ - Report Client Version [#121]
185
+
186
+ ## [0.24.4] - 2023-07-06
187
+
188
+ - Support Timed Loggers [#119]
189
+ - Added EvaluatedConfigsAggregator (disabled by default) [#118]
190
+ - Added EvaluatedKeysAggregator (disabled by default) [#117]
191
+ - Dropped Ruby 2.6 support [#116]
192
+ - Capture/report context shapes [#115]
193
+ - Added bin/console [#114]
194
+
195
+ ## [0.24.3] - 2023-05-15
196
+
197
+ - Add JSON log formatter [#106]
198
+
199
+ # [0.24.2] - 2023-05-12
200
+
201
+ - Fix bug in FF rollout eval consistency [#108]
202
+ - Simplify forking [#107]
203
+
204
+ # [0.24.1] - 2023-04-26
205
+
206
+ - Fix misleading deprecation warning [#105]
207
+
208
+ # [0.24.0] - 2023-04-26
209
+
210
+ - Backwards compatibility for JIT context [#104]
211
+ - Remove upsert [#103]
212
+ - Add resolver presenter and `on_update` callback [#102]
213
+ - Deprecate `lookup_key` and introduce Context [#99]
214
+
215
+ # [0.23.8] - 2023-04-21
216
+
217
+ - Update protobuf [#101]
218
+
219
+ # [0.23.7] - 2023-04-21
220
+
221
+ - Guard against ActiveJob not being loaded [#100]
222
+
223
+ # [0.23.6] - 2023-04-17
224
+
225
+ - Fix bug in FF rollout eval consistency [#98]
226
+ - Add tests for block-form of logging [#96]
227
+
228
+ # [0.23.5] - 2023-04-13
229
+
230
+ - Cast the value to string when checking presence in string list [#95]
231
+
232
+ # [0.23.4] - 2023-04-12
233
+
234
+ - Remove GRPC [#93]
235
+
236
+ # [0.23.3] - 2023-04-07
237
+
238
+ - Use exponential backoff for log level uploading [#92]
239
+
240
+ # [0.23.2] - 2023-04-04
241
+
242
+ - Move log collection logs from INFO to DEBUG [#91]
243
+ - Fix: Handle trailing slash in PREFAB_API_URL [#90]
244
+
245
+ # [0.23.1] - 2023-03-30
246
+
247
+ - ActiveStorage not defined in Rails < 5.2 [#87]
248
+
249
+ # [0.23.0] - 2023-03-28
250
+
251
+ - Convenience for setting Rails.logger [#85]
252
+ - Log evaluation according to rules [#81]
253
+
254
+ # [0.22.0] - 2023-03-15
255
+
256
+ - Report log paths and usages [#79]
257
+ - Accept hash or keyword args in `initialize` [#78]
data/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @prefab-cloud/prefabdevs @prefab-cloud/prefabmaintainers @prefab-cloud/prefabadmins
data/Gemfile ADDED
@@ -0,0 +1,29 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'concurrent-ruby', '~> 1.0', '>= 1.0.5'
4
+ gem 'faraday'
5
+ gem 'googleapis-common-protos-types', platforms: :ruby
6
+ gem 'google-protobuf', platforms: :ruby
7
+ gem 'ld-eventsource'
8
+ gem 'uuid'
9
+
10
+ gem 'activesupport', '>= 4'
11
+
12
+ gem 'semantic_logger', '!= 4.16.0', require: "semantic_logger/sync"
13
+
14
+ group :development do
15
+ gem 'allocation_stats'
16
+ gem 'benchmark-ips'
17
+ gem 'bundler'
18
+ gem 'juwelier', '~> 2.4.9'
19
+ gem 'rdoc'
20
+ gem 'simplecov', '>= 0'
21
+ end
22
+
23
+ group :test do
24
+ gem 'minitest'
25
+ gem 'minitest-focus'
26
+ gem 'minitest-reporters'
27
+ gem 'timecop'
28
+ gem 'webrick'
29
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,182 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (7.1.3.2)
5
+ base64
6
+ bigdecimal
7
+ concurrent-ruby (~> 1.0, >= 1.0.2)
8
+ connection_pool (>= 2.2.5)
9
+ drb
10
+ i18n (>= 1.6, < 2)
11
+ minitest (>= 5.1)
12
+ mutex_m
13
+ tzinfo (~> 2.0)
14
+ addressable (2.8.6)
15
+ public_suffix (>= 2.0.2, < 6.0)
16
+ allocation_stats (0.1.5)
17
+ ansi (1.5.0)
18
+ base64 (0.2.0)
19
+ benchmark-ips (2.13.0)
20
+ bigdecimal (3.1.7)
21
+ builder (3.2.4)
22
+ concurrent-ruby (1.2.3)
23
+ connection_pool (2.4.1)
24
+ descendants_tracker (0.0.4)
25
+ thread_safe (~> 0.3, >= 0.3.1)
26
+ docile (1.4.0)
27
+ domain_name (0.6.20240107)
28
+ drb (2.2.1)
29
+ faraday (1.10.3)
30
+ faraday-em_http (~> 1.0)
31
+ faraday-em_synchrony (~> 1.0)
32
+ faraday-excon (~> 1.1)
33
+ faraday-httpclient (~> 1.0)
34
+ faraday-multipart (~> 1.0)
35
+ faraday-net_http (~> 1.0)
36
+ faraday-net_http_persistent (~> 1.0)
37
+ faraday-patron (~> 1.0)
38
+ faraday-rack (~> 1.0)
39
+ faraday-retry (~> 1.0)
40
+ ruby2_keywords (>= 0.0.4)
41
+ faraday-em_http (1.0.0)
42
+ faraday-em_synchrony (1.0.0)
43
+ faraday-excon (1.1.0)
44
+ faraday-httpclient (1.0.1)
45
+ faraday-multipart (1.0.4)
46
+ multipart-post (~> 2)
47
+ faraday-net_http (1.0.1)
48
+ faraday-net_http_persistent (1.2.0)
49
+ faraday-patron (1.0.0)
50
+ faraday-rack (1.0.0)
51
+ faraday-retry (1.0.3)
52
+ ffi (1.16.3)
53
+ ffi-compiler (1.3.2)
54
+ ffi (>= 1.15.5)
55
+ rake
56
+ git (1.19.1)
57
+ addressable (~> 2.8)
58
+ rchardet (~> 1.8)
59
+ github_api (0.19.0)
60
+ addressable (~> 2.4)
61
+ descendants_tracker (~> 0.0.4)
62
+ faraday (>= 0.8, < 2)
63
+ hashie (~> 3.5, >= 3.5.2)
64
+ oauth2 (~> 1.0)
65
+ google-protobuf (3.25.5)
66
+ googleapis-common-protos-types (1.14.0)
67
+ google-protobuf (~> 3.18)
68
+ hashie (3.6.0)
69
+ highline (3.0.1)
70
+ http (5.2.0)
71
+ addressable (~> 2.8)
72
+ base64 (~> 0.1)
73
+ http-cookie (~> 1.0)
74
+ http-form_data (~> 2.2)
75
+ llhttp-ffi (~> 0.5.0)
76
+ http-cookie (1.0.5)
77
+ domain_name (~> 0.5)
78
+ http-form_data (2.3.0)
79
+ i18n (1.14.4)
80
+ concurrent-ruby (~> 1.0)
81
+ juwelier (2.4.9)
82
+ builder
83
+ bundler
84
+ git
85
+ github_api
86
+ highline
87
+ kamelcase (~> 0)
88
+ nokogiri
89
+ psych
90
+ rake
91
+ rdoc
92
+ semver2
93
+ jwt (2.8.1)
94
+ base64
95
+ kamelcase (0.0.2)
96
+ semver2 (~> 3)
97
+ ld-eventsource (2.2.2)
98
+ concurrent-ruby (~> 1.0)
99
+ http (>= 4.4.1, < 6.0.0)
100
+ llhttp-ffi (0.5.0)
101
+ ffi-compiler (~> 1.0)
102
+ rake (~> 13.0)
103
+ macaddr (1.7.2)
104
+ systemu (~> 2.6.5)
105
+ mini_portile2 (2.8.7)
106
+ minitest (5.22.3)
107
+ minitest-focus (1.4.0)
108
+ minitest (>= 4, < 6)
109
+ minitest-reporters (1.6.1)
110
+ ansi
111
+ builder
112
+ minitest (>= 5.0)
113
+ ruby-progressbar
114
+ multi_json (1.15.0)
115
+ multi_xml (0.6.0)
116
+ multipart-post (2.4.0)
117
+ mutex_m (0.2.0)
118
+ nokogiri (1.16.7)
119
+ mini_portile2 (~> 2.8.2)
120
+ racc (~> 1.4)
121
+ oauth2 (1.4.11)
122
+ faraday (>= 0.17.3, < 3.0)
123
+ jwt (>= 1.0, < 3.0)
124
+ multi_json (~> 1.3)
125
+ multi_xml (~> 0.5)
126
+ rack (>= 1.2, < 4)
127
+ psych (5.1.2)
128
+ stringio
129
+ public_suffix (5.0.4)
130
+ racc (1.8.1)
131
+ rack (3.0.16)
132
+ rake (13.1.0)
133
+ rchardet (1.8.0)
134
+ rdoc (6.6.3.1)
135
+ psych (>= 4.0.0)
136
+ ruby-progressbar (1.13.0)
137
+ ruby2_keywords (0.0.5)
138
+ semantic_logger (4.15.0)
139
+ concurrent-ruby (~> 1.0)
140
+ semver2 (3.4.2)
141
+ simplecov (0.22.0)
142
+ docile (~> 1.1)
143
+ simplecov-html (~> 0.11)
144
+ simplecov_json_formatter (~> 0.1)
145
+ simplecov-html (0.12.3)
146
+ simplecov_json_formatter (0.1.4)
147
+ stringio (3.1.0)
148
+ systemu (2.6.5)
149
+ thread_safe (0.3.6)
150
+ timecop (0.9.8)
151
+ tzinfo (2.0.6)
152
+ concurrent-ruby (~> 1.0)
153
+ uuid (2.3.9)
154
+ macaddr (~> 1.0)
155
+ webrick (1.8.2)
156
+
157
+ PLATFORMS
158
+ ruby
159
+
160
+ DEPENDENCIES
161
+ activesupport (>= 4)
162
+ allocation_stats
163
+ benchmark-ips
164
+ bundler
165
+ concurrent-ruby (~> 1.0, >= 1.0.5)
166
+ faraday
167
+ google-protobuf
168
+ googleapis-common-protos-types
169
+ juwelier (~> 2.4.9)
170
+ ld-eventsource
171
+ minitest
172
+ minitest-focus
173
+ minitest-reporters
174
+ rdoc
175
+ semantic_logger (!= 4.16.0)
176
+ simplecov
177
+ timecop
178
+ uuid
179
+ webrick
180
+
181
+ BUNDLED WITH
182
+ 2.3.5
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2023 Prefab, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # Reforge SDK for Ruby
2
+
3
+ Ruby Client for Reforge Feature Flags and Config as a Service: https://launch.reforge.com
4
+
5
+ ```ruby
6
+ client = Reforge::Client.new
7
+
8
+ context = {
9
+ user: {
10
+ team_id: 432,
11
+ id: 123,
12
+ subscription_level: 'pro',
13
+ email: "alice@example.com"
14
+ }
15
+ }
16
+
17
+ result = client.enabled? "my-first-feature-flag", context
18
+
19
+ puts "my-first-feature-flag is: #{result}"
20
+ ```
21
+
22
+ See full documentation https://docs.prefab.cloud/docs/sdks/ruby
23
+
24
+ ## Supports
25
+
26
+ - Feature Flags
27
+ - Live Config
28
+ - WebUI for tweaking config and feature flags
29
+
30
+ ## Installation
31
+
32
+ Add the gem to your Gemfile:
33
+
34
+ ```ruby
35
+ gem 'sdk-reforge'
36
+ ```
37
+
38
+ Or install directly:
39
+
40
+ ```bash
41
+ gem install sdk-reforge
42
+ ```
43
+
44
+ ## Important note about Forking and realtime updates
45
+
46
+ Many ruby web servers fork. When the process is forked, the current realtime update stream is disconnected. If you're using Puma or Unicorn, do the following.
47
+
48
+ ```ruby
49
+ #config/application.rb
50
+ Prefab.init # reads REFORGE_SDK_KEY env var by default
51
+ ```
52
+
53
+ ```ruby
54
+ #puma.rb
55
+ on_worker_boot do
56
+ Reforge.fork
57
+ end
58
+ ```
59
+
60
+ ```ruby
61
+ # unicorn.rb
62
+ after_fork do |server, worker|
63
+ Reforge.fork
64
+ end
65
+ ```
66
+
67
+
68
+
69
+ ## Contributing to reforge sdk for ruby
70
+
71
+ - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
72
+ - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
73
+ - Fork the project.
74
+ - Start a feature/bugfix branch.
75
+ - Commit and push until you are happy with your contribution.
76
+ - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
77
+ - Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
78
+
79
+ ## Release
80
+
81
+ Release is automated via GitHub Actions using RubyGems trusted publishing. When tests pass on the main branch, a new version is automatically published to RubyGems.
82
+
83
+ To release a new version:
84
+
85
+ ```shell
86
+ # Update the version
87
+ echo "1.9.1" > VERSION
88
+
89
+ # Update the changelog with your changes
90
+ # Edit CHANGELOG.md
91
+
92
+ # Regenerate the gemspec
93
+ bundle exec rake gemspec:generate
94
+
95
+ # Create PR with changes
96
+ git checkout -b release-1.9.1
97
+ git commit -am "Release 1.9.1"
98
+ git push origin release-1.9.1
99
+ # Then create and merge PR to main
100
+ ```
101
+
102
+ ## Copyright
103
+
104
+ Copyright (c) 2025 Reforge Inc. See LICENSE.txt for further details.
105
+