unleash 6.0.0 → 6.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99ad38f03714b601bac152cb56373ed6ec9c881aee7f0a7bc538a26f777b81d4
4
- data.tar.gz: b1b88a4cbd1bc03da617930046921e7c6ca1765506d65a38825c65d511b8a800
3
+ metadata.gz: 98e81af92481a67d0db0298f00d6733a7df5359f9e691e92b65e1bab489611f7
4
+ data.tar.gz: 045bd8a3f93853f9537ee60c22ce9324562778d0597bc755a2157f79b798b21f
5
5
  SHA512:
6
- metadata.gz: 2f263e80e4bd7259f0dfa90cdcd28b902b06b125552927c67be2937d1bd26fcf9b44b07321efa8ad83973daaa29b53a540fdca1daafb9978ce05a4907b9fe402
7
- data.tar.gz: 28994930969f57e529180a5562473066349d2c4a5db2f0b741d075adc5e229c0036a1b526464881e592d9cca1c2edbb0e9e4957bd61e8348bea5f7ab4bcd80db
6
+ metadata.gz: 6ab700dc87f42f566b42383e8c02171cf314e2b3879d066f0b2a2e3707900f336c629d49eafee1a009153e704b3bd0af99770f0fe397025e451dea0597ea5eb5
7
+ data.tar.gz: 1ec175c2bf02e6b6e02d81abb5ebc07c54c2db413dc5a0b73bbf958e81ae3ed43d2456cdaa5acbb8c53f03444ae139f90d162da055c5e579a9412a490ae6c0a9
@@ -29,11 +29,13 @@ jobs:
29
29
  - macos
30
30
  ruby-version:
31
31
  - jruby-9.4
32
+ - jruby-9.3
32
33
  - 3.3
33
34
  - 3.2
34
35
  - 3.1
35
36
  - '3.0'
36
37
  - 2.7
38
+ - 2.6
37
39
 
38
40
  needs:
39
41
  - lint
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  # inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.7
4
+ TargetRubyVersion: 2.6
5
5
 
6
6
  Naming/PredicateName:
7
7
  AllowedMethods:
data/CHANGELOG.md CHANGED
@@ -13,10 +13,6 @@ Note: These changes are not considered notable:
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
- ## [6.0.0] - 2024-09-25
17
- #### Fixed
18
- - Upgrade core engine library to support ARM on Linux
19
-
20
16
  ## [6.0.0.pre] - 2024-09-25
21
17
  #### Changed
22
18
  - No longer possible to override built in strategies with custom strategies (#152)
data/README.md CHANGED
@@ -6,19 +6,42 @@
6
6
 
7
7
  Ruby client for the [Unleash](https://github.com/Unleash/unleash) feature management service.
8
8
 
9
- > **Migrating to v6**
10
- >
11
- > If you use [custom strategies](#custom-strategies) or override built-in ones, read the complete [migration guide](./v6_MIGRATION_GUIDE.md) before upgrading to v6.
12
-
13
-
14
- ## Supported Ruby interpreters
9
+ - [Supported Ruby Interpreters](#supported-ruby-interpreters)
10
+ - [Installation](#installation)
11
+ - [Configure](#configure)
12
+ - [Dynamic custom HTTP headers](#dynamic-custom-http-headers)
13
+ - [List of Arguments](#list-of-arguments)
14
+ - [Usage in a plain Ruby Application](#usage-in-a-plain-ruby-application)
15
+ - [Usage in a Rails Application](#usage-in-a-rails-application)
16
+ - [1. Add Initializer](#1-add-initializer)
17
+ - [1.a Initializer for standard Rails applications](#1a-initializer-for-standard-rails-applications)
18
+ - [1.b Add Initializer if using Puma in clustered mode](#1b-add-initializer-if-using-puma-in-clustered-mode)
19
+ - [with `preload_app!`](#with-preload_app)
20
+ - [without `preload_app!`](#without-preload_app)
21
+ - [1.c Add Initializer if using Phusion Passenger](#1c-add-initializer-if-using-phusion-passenger)
22
+ - [1.d Add Initializer hooks when using within Sidekiq](#1d-add-initializer-hooks-when-using-within-sidekiq)
23
+ - [2. Set Unleash::Context](#2-set-unleashcontext)
24
+ - [3. Sample usage](#3-sample-usage)
25
+ - [Variations](#variations)
26
+ - [Bootstrapping](#bootstrapping)
27
+ - [Client methods](#client-methods)
28
+ - [Local test client](#local-test-client)
29
+ - [Available Strategies](#available-strategies)
30
+ - [Custom Strategies](#custom-strategies)
31
+ - [Development](#development)
32
+ - [Releasing](#releasing)
33
+ - [Contributing](#contributing)
34
+
35
+ ## Supported Ruby Interpreters
15
36
 
16
37
  - MRI 3.3
17
38
  - MRI 3.2
18
39
  - MRI 3.1
19
40
  - MRI 3.0
20
41
  - MRI 2.7
42
+ - MRI 2.6
21
43
  - jruby 9.4
44
+ - jruby 9.3
22
45
 
23
46
  ## Installation
24
47
 
@@ -36,70 +59,72 @@ Or install it yourself as:
36
59
 
37
60
  $ gem install unleash
38
61
 
39
- ## Configuration
62
+ ## Configure
40
63
 
41
64
  It is **required** to configure:
42
65
 
43
- - `app_name` with the name of the running application
44
- - `url` of your Unleash server
45
- - `custom_http_headers` with `{'Authorization': '<YOUR_API_TOKEN>'}` when using Unleash v4+
66
+ - `url` of the unleash server
67
+ - `app_name` with the name of the runninng application.
68
+ - `custom_http_headers` with `{'Authorization': '<API token>'}` when using Unleash v4.0.0 and later.
69
+
70
+ Please substitute the example `'https://unleash.herokuapp.com/api'` for the url of your own instance.
46
71
 
47
72
  It is **highly recommended** to configure:
48
73
 
49
- - `instance_id` parameter with a unique identifier for the running instance
74
+ - `instance_id` parameter with a unique identifier for the running instance.
50
75
 
51
76
  ```ruby
52
77
  Unleash.configure do |config|
53
78
  config.app_name = 'my_ruby_app'
54
- config.url = '<YOUR_UNLEASH_URL>/api'
55
- config.custom_http_headers = {'Authorization': '<YOUR_API_TOKEN>'}
79
+ config.url = 'https://unleash.herokuapp.com/api'
80
+ config.custom_http_headers = {'Authorization': '<API token>'}
56
81
  end
57
82
  ```
58
83
 
59
84
  or instantiate the client with the valid configuration:
60
85
 
61
86
  ```ruby
62
- UNLEASH = Unleash::Client.new(url: '<YOUR_UNLEASH_URL>/api', app_name: 'my_ruby_app', custom_http_headers: {'Authorization': '<YOUR_API_TOKEN>'})
87
+ UNLEASH = Unleash::Client.new(url: 'https://unleash.herokuapp.com/api', app_name: 'my_ruby_app', custom_http_headers: {'Authorization': '<API token>'})
63
88
  ```
64
89
 
65
90
  ## Dynamic custom HTTP headers
66
91
 
67
- If you need custom HTTP headers that change during the lifetime of the client, you can pass `custom_http_headers` as a `Proc`.
92
+ If you need custom HTTP headers that change during the lifetime of the client, the `custom_http_headers` can be given as a `Proc`.
68
93
 
69
94
  ```ruby
70
95
  Unleash.configure do |config|
71
96
  config.app_name = 'my_ruby_app'
72
- config.url = '<YOUR_UNLEASH_URL>/api'
97
+ config.url = 'https://unleash.herokuapp.com/api'
73
98
  config.custom_http_headers = proc do
74
99
  {
75
- 'Authorization': '<YOUR_API_TOKEN>',
100
+ 'Authorization': '<API token>',
76
101
  'X-Client-Request-Time': Time.now.iso8601
77
102
  }
78
103
  end
79
104
  end
80
105
  ```
81
106
 
82
- #### List of arguments
107
+ #### List of Arguments
83
108
 
84
- | Argument | Description | Required? | Type | Default value |
109
+ | Argument | Description | Required? | Type | Default Value |
85
110
  | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------- | ---------------------------------------------- |
86
111
  | `url` | Unleash server URL. | Y | String | N/A |
87
112
  | `app_name` | Name of your program. | Y | String | N/A |
88
- | `instance_id` | Identifier for the running instance of your program—set this to be able trace where metrics are being collected from. | N | String | random UUID |
89
- | `environment` | Unleash context option, for example, `prod` or `dev`. Not yet in use. **Not** the same as the SDK's [Unleash environment](https://docs.getunleash.io/reference/environments). | N | String | `default` |
90
- | `project_name` | Name of the project to retrieve feature flags from. If not set, all feature flags will be retrieved. | N | String | nil |
91
- | `refresh_interval` | How often the Unleash client should check with the server for configuration changes. | N | Integer | 15 |
92
- | `metrics_interval` | How often the Unleash client should send metrics to server. | N | Integer | 60 |
93
- | `disable_client` | Disables all communication with the Unleash server, effectively taking it _offline_. If set, `is_enabled?` always answer with the `default_value` and configuration validation is skipped. Will also forcefully set `disable_metrics` to `true`. Defeats the entire purpose of using Unleash, except when running tests. | N | Boolean | `false` |
113
+ | `instance_id` | Identifier for the running instance of program. Important so you can trace back to where metrics are being collected from. **Highly recommended be be set.** | N | String | random UUID |
114
+ | `environment` | Unleash context option. Could be for example `prod` or `dev`. Not yet in use. **Not** the same as the SDK's [Unleash environment](https://docs.getunleash.io/reference/environments). | N | String | `default` |
115
+ | `project_name` | Name of the project to retrieve features from. If not set, all feature flags will be retrieved. | N | String | nil |
116
+ | `refresh_interval` | How often the unleash client should check with the server for configuration changes. | N | Integer | 15 |
117
+ | `metrics_interval` | How often the unleash client should send metrics to server. | N | Integer | 60 |
118
+ | `disable_client` | Disables all communication with the Unleash server, effectively taking it _offline_. If set, `is_enabled?` will always answer with the `default_value` and configuration validation is skipped. Will also forcefully set `disable_metrics` to `true`. Defeats the entire purpose of using unleash, except when running tests. | N | Boolean | `false` |
94
119
  | `disable_metrics` | Disables sending metrics to Unleash server. If the `disable_client` option is set to `true`, then this option will also be set to `true`, regardless of the value provided. | N | Boolean | `false` |
95
- | `custom_http_headers` | Custom headers to send to Unleash. As of Unleash v4.0.0, the `Authorization` header is required. For example: `{'Authorization': '<YOUR_API_TOKEN>'}`. | N | Hash/Proc | {} |
120
+ | `custom_http_headers` | Custom headers to send to Unleash. As of Unleash v4.0.0, the `Authorization` header is required. For example: `{'Authorization': '<API token>'}` | N | Hash/Proc | {} |
96
121
  | `timeout` | How long to wait for the connection to be established or wait in reading state (open_timeout/read_timeout) | N | Integer | 30 |
97
122
  | `retry_limit` | How many consecutive failures in connecting to the Unleash server are allowed before giving up. The default is to retry indefinitely. | N | Float::INFINITY | 5 |
98
- | `backup_file` | Filename to store the last known state from the Unleash server. It is best to not change this from the default. | N | String | `Dir.tmpdir + "/unleash-#{app_name}-repo.json` |
123
+ | `backup_file` | Filename to store the last known state from the Unleash server. Best to not change this from the default. | N | String | `Dir.tmpdir + "/unleash-#{app_name}-repo.json` |
99
124
  | `logger` | Specify a custom `Logger` class to handle logs for the Unleash client. | N | Class | `Logger.new(STDOUT)` |
100
125
  | `log_level` | Change the log level for the `Logger` class. Constant from `Logger::Severity`. | N | Constant | `Logger::WARN` |
101
- | `bootstrap_config` | Bootstrap config for loading data on startup—useful for loading large states on startup without (or before) hitting the network. | N | Unleash::Bootstrap::Configuration | `nil` |
102
- | `strategies` | Strategies manager that holds all strategies and allows to add custom strategies. | N | Unleash::Strategies | `Unleash::Strategies.new` |
126
+ | `bootstrap_config` | Bootstrap config on how to loaded data on start-up. This is useful for loading large states on startup without (or before) hitting the network. | N | Unleash::Bootstrap::Configuration | `nil` |
127
+ | `strategies` | Strategies manager that holds all strategies and allows to add custom strategies | N | Unleash::Strategies | `Unleash::Strategies.new` |
103
128
 
104
129
  For a more in-depth look, please see `lib/unleash/configuration.rb`.
105
130
 
@@ -108,13 +133,13 @@ For a more in-depth look, please see `lib/unleash/configuration.rb`.
108
133
  | `UNLEASH_BOOTSTRAP_FILE` | File to read bootstrap data from |
109
134
  | `UNLEASH_BOOTSTRAP_URL` | URL to read bootstrap data from |
110
135
 
111
- ## Usage in a plain Ruby application
136
+ ## Usage in a plain Ruby Application
112
137
 
113
138
  ```ruby
114
139
  require 'unleash'
115
140
  require 'unleash/context'
116
141
 
117
- @unleash = Unleash::Client.new(app_name: 'my_ruby_app', url: '<YOUR_UNLEASH_URL>/api', custom_http_headers: { 'Authorization': '<YOUR_API_TOKEN>' })
142
+ @unleash = Unleash::Client.new(app_name: 'my_ruby_app', url: 'https://unleash.herokuapp.com/api', custom_http_headers: { 'Authorization': '<API token>' })
118
143
 
119
144
  feature_name = "AwesomeFeature"
120
145
  unleash_context = Unleash::Context.new
@@ -133,7 +158,7 @@ else
133
158
  end
134
159
  ```
135
160
 
136
- ## Usage in a Rails application
161
+ ## Usage in a Rails Application
137
162
 
138
163
  ### 1. Add Initializer
139
164
 
@@ -158,8 +183,10 @@ UNLEASH = Unleash::Client.new
158
183
  # Rails.configuration.unleash = Unleash::Client.new
159
184
  ```
160
185
 
161
- For `config.instance_id` use a string with a unique identification for the running instance. For example, it could be the hostname if you only run one App per host, or the docker container ID, if you are running in Docker.
162
- If not set, the client will generate a unique UUID for each execution.
186
+ For `config.instance_id` use a string with a unique identification for the running instance.
187
+ For example: it could be the hostname, if you only run one App per host.
188
+ Or the docker container id, if you are running in docker.
189
+ If it is not set the client will generate an unique UUID for each execution.
163
190
 
164
191
  To have it available in the `rails console` command as well, also add to the file above:
165
192
 
@@ -186,12 +213,12 @@ Then you may keep the client configuration still in `config/initializers/unleash
186
213
  ```ruby
187
214
  Unleash.configure do |config|
188
215
  config.app_name = Rails.application.class.parent.to_s
189
- config.url = '<YOUR_UNLEASH_URL>/api'
190
- config.custom_http_headers = {'Authorization': '<YOUR_API_TOKEN>'}
216
+ config.url = 'https://unleash.herokuapp.com/api'
217
+ config.custom_http_headers = {'Authorization': '<API token>'}
191
218
  end
192
219
  ```
193
220
 
194
- But you must ensure that the Unleash client is instantiated only after the process is forked.
221
+ But you must ensure that the unleash client is instantiated only after the process is forked.
195
222
  This is done by creating the client inside the `on_worker_boot` code block in `puma.rb` as below:
196
223
 
197
224
  ```ruby
@@ -214,14 +241,14 @@ end
214
241
 
215
242
  By not using `preload_app!`:
216
243
 
217
- - The `Rails` constant will **not** be available.
218
- - Phased restarts will be possible.
244
+ - the `Rails` constant will NOT be available.
245
+ - but phased restarts will be possible.
219
246
 
220
247
  You need to ensure that in `puma.rb`:
221
248
 
222
- - The Unleash SDK is loaded with `require 'unleash'` explicitly, as it will not be pre-loaded.
223
- - All parameters are set explicitly in the `on_worker_boot` block, as `config/initializers/unleash.rb` is not read.
224
- - There are no references to `Rails` constant, as that is not yet available.
249
+ - loading unleash sdk with `require 'unleash'` explicitly, as it will not be pre-loaded.
250
+ - all parameters must be explicitly set in the `on_worker_boot` block, as `config/initializers/unleash.rb` is not read.
251
+ - there are no references to `Rails` constant, as that is not yet available.
225
252
 
226
253
  Example for `puma.rb`:
227
254
 
@@ -236,8 +263,8 @@ on_worker_boot do
236
263
 
237
264
  ::UNLEASH = Unleash::Client.new(
238
265
  app_name: 'my_rails_app',
239
- url: '<YOUR_UNLEASH_URL>/api',
240
- custom_http_headers: {'Authorization': '<YOUR_API_TOKEN>'},
266
+ url: 'https://unleash.herokuapp.com/api',
267
+ custom_http_headers: {'Authorization': '<API token>'},
241
268
  )
242
269
  end
243
270
 
@@ -250,7 +277,7 @@ Note that we also added shutdown hooks in `on_worker_shutdown`, to ensure a clea
250
277
 
251
278
  #### 1.c Add Initializer if using [Phusion Passenger](https://github.com/phusion/passenger)
252
279
 
253
- The Unleash client needs to be configured and instantiated inside the `PhusionPassenger.on_event(:starting_worker_process)` code block due to [smart spawning](https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/#smart-spawning-caveats):
280
+ The unleash client needs to be configured and instantiated inside the `PhusionPassenger.on_event(:starting_worker_process)` code block due to [smart spawning](https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/#smart-spawning-caveats):
254
281
 
255
282
  The initializer in `config/initializers/unleash.rb` should look like:
256
283
 
@@ -261,8 +288,8 @@ PhusionPassenger.on_event(:starting_worker_process) do |forked|
261
288
  config.app_name = Rails.application.class.parent.to_s
262
289
  # config.instance_id = "#{Socket.gethostname}"
263
290
  config.logger = Rails.logger
264
- config.url = '<YOUR_UNLEASH_URL>/api'
265
- config.custom_http_headers = {'Authorization': '<YOUR_API_TOKEN>'}
291
+ config.url = 'https://unleash.herokuapp.com/api'
292
+ config.custom_http_headers = {'Authorization': '<API token>'}
266
293
  end
267
294
 
268
295
  UNLEASH = Unleash::Client.new
@@ -272,7 +299,7 @@ end
272
299
 
273
300
  #### 1.d Add Initializer hooks when using within [Sidekiq](https://github.com/mperham/sidekiq)
274
301
 
275
- Note that in this case, we require that the code block for `Unleash.configure` is set beforehand.
302
+ Note that in this case we require that the code block for `Unleash.configure` is set beforehand.
276
303
  For example in `config/initializers/unleash.rb`.
277
304
 
278
305
  ```ruby
@@ -289,7 +316,7 @@ end
289
316
 
290
317
  ### 2. Set Unleash::Context
291
318
 
292
- Add the following method and callback in the application controller to have `@unleash_context` set for all requests:
319
+ Be sure to add the following method and callback in the application controller to have `@unleash_context` set for all requests:
293
320
 
294
321
  Add in `app/controllers/application_controller.rb`:
295
322
 
@@ -306,7 +333,7 @@ Add in `app/controllers/application_controller.rb`:
306
333
  end
307
334
  ```
308
335
 
309
- Alternatively, you can add this method only to the controllers that use Unleash.
336
+ Or if you see better fit, only in the controllers that you will be using unleash.
310
337
 
311
338
  ### 3. Sample usage
312
339
 
@@ -379,11 +406,11 @@ end
379
406
 
380
407
  Note:
381
408
 
382
- - The block/lambda/proc can use the feature name and context as arguments.
409
+ - The block/lambda/proc can use feature name and context as an arguments.
383
410
  - The client will evaluate the fallback function once per call of `is_enabled()`.
384
- Please keep this in mind when creating your fallback function.
411
+ Please keep this in mind when creating your fallback function!
385
412
  - The returned value of the block should be a boolean.
386
- However, the client will coerce the result to a boolean via `!!`.
413
+ However, the client will coerce the result to boolean via `!!`.
387
414
  - If both a `default_value` and `fallback_function` are supplied,
388
415
  the client will define the default value by `OR`ing the default value and the output of the fallback function.
389
416
 
@@ -415,21 +442,21 @@ Bootstrapping can be configured by providing a bootstrap configuration when init
415
442
 
416
443
  ```ruby
417
444
  @unleash = Unleash::Client.new(
418
- url: '<YOUR_UNLEASH_URL>/api',
445
+ url: 'https://unleash.herokuapp.com/api',
419
446
  app_name: 'my_ruby_app',
420
- custom_http_headers: { 'Authorization': '<YOUR_API_TOKEN>' },
447
+ custom_http_headers: { 'Authorization': '<API token>' },
421
448
  bootstrap_config: Unleash::Bootstrap::Configuration.new({
422
- url: "<YOUR_UNLEASH_URL>/api/client/features",
423
- url_headers: {'Authorization': '<YOUR_API_TOKEN>'}
449
+ url: "https://unleash.herokuapp.com/api/client/features",
450
+ url_headers: {'Authorization': '<API token>'}
424
451
  })
425
452
  )
426
453
  ```
427
454
 
428
455
  The `Bootstrap::Configuration` initializer takes a hash with one of the following options specified:
429
456
 
430
- - `file_path` - An absolute or relative path to a file containing a JSON string of the response body from the Unleash server. This can also be set through the `UNLEASH_BOOTSTRAP_FILE` environment variable.
431
- - `url` - A url pointing to an Unleash server's features endpoint, the code sample above is illustrative. This can also be set through the `UNLEASH_BOOTSTRAP_URL` environment variable.
432
- - `url_headers` - Headers for the GET HTTP request to the `url` above. Only used if the `url` parameter is also set. If this option isn't set then the bootstrapper will use the same url headers as the Unleash client.
457
+ - `file_path` - An absolute or relative path to a file containing a JSON string of the response body from the Unleash server. This can also be set though the `UNLEASH_BOOTSTRAP_FILE` environment variable.
458
+ - `url` - A url pointing to an Unleash server's features endpoint, the code sample above is illustrative. This can also be set though the `UNLEASH_BOOTSTRAP_URL` environment variable.
459
+ - `url_headers` - Headers for the GET http request to the `url` above. Only used if the `url` parameter is also set. If this option isn't set then the bootstrapper will use the same url headers as the Unleash client.
433
460
  - `data` - A raw JSON string as returned by the Unleash server.
434
461
  - `block` - A lambda containing custom logic if you need it, an example is provided below.
435
462
 
@@ -443,13 +470,13 @@ The order of preference is as follows:
443
470
 
444
471
  Example usage:
445
472
 
446
- First, save the toggles locally:
473
+ First saving the toggles locally:
447
474
 
448
475
  ```shell
449
- curl -H 'Authorization: <YOUR_API_TOKEN>' -XGET '<YOUR_UNLEASH_URL>/api' > ./default-toggles.json
476
+ curl -H 'Authorization: <API token>' -XGET 'https://unleash.herokuapp.com/api' > ./default-toggles.json
450
477
  ```
451
478
 
452
- Then use them on startup:
479
+ Now using them on start up:
453
480
 
454
481
  ```ruby
455
482
 
@@ -459,8 +486,8 @@ custom_boostrapper = lambda {
459
486
 
460
487
  @unleash = Unleash::Client.new(
461
488
  app_name: 'my_ruby_app',
462
- url: '<YOUR_UNLEASH_URL>/api',
463
- custom_http_headers: { 'Authorization': '<YOUR_API_TOKEN>' },
489
+ url: 'https://unleash.herokuapp.com/api',
490
+ custom_http_headers: { 'Authorization': '<API token>' },
464
491
  bootstrap_config: Unleash::Bootstrap::Configuration.new({
465
492
  block: custom_boostrapper
466
493
  })
@@ -472,19 +499,19 @@ Be aware that the client initializer will block until bootstrapping is complete.
472
499
 
473
500
  #### Client methods
474
501
 
475
- | Method name | Description | Return type |
502
+ | Method Name | Description | Return Type |
476
503
  | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
477
- | `is_enabled?` | Checks if a feature toggle is enabled or not | Boolean |
478
- | `enabled?` | A more idiomatic Ruby alias for the `is_enabled?` method | Boolean |
479
- | `if_enabled` | Runs a code block, if a feature is enabled | `yield` |
480
- | `is_disabled?` | Checks if feature toggle is enabled or not | Boolean |
481
- | `disabled?` | A more idiomatic Ruby alias for the `is_disabled?` method | Boolean |
482
- | `if_disabled` | Runs a code block, if a feature is disabled | `yield` |
483
- | `get_variant` | Gets variant for a given feature | `Unleash::Variant` |
484
- | `shutdown` | Saves metrics to disk, flushes metrics to server, and then kills `ToggleFetcher` and `MetricsReporter` threads—a safe shutdown, not generally needed in long-running applications, like web applications | nil |
485
- | `shutdown!` | Kills `ToggleFetcher` and `MetricsReporter` threads immediately | nil |
486
-
487
- For the full method signatures, see [client.rb](lib/unleash/client.rb).
504
+ | `is_enabled?` | Check if feature toggle is to be enabled or not. | Boolean |
505
+ | `enabled?` | Alias to the `is_enabled?` method. But more ruby idiomatic. | Boolean |
506
+ | `if_enabled` | Run a code block, if a feature is enabled. | `yield` |
507
+ | `is_disabled?` | Check if feature toggle is to be enabled or not. | Boolean |
508
+ | `disabled?` | Alias to the `is_disabled?` method. But more ruby idiomatic. | Boolean |
509
+ | `if_disabled` | Run a code block, if a feature is disabled. | `yield` |
510
+ | `get_variant` | Get variant for a given feature | `Unleash::Variant` |
511
+ | `shutdown` | Save metrics to disk, flush metrics to server, and then kill ToggleFetcher and MetricsReporter threads. A safe shutdown. Not really useful in long running applications, like web applications. | nil |
512
+ | `shutdown!` | Kill ToggleFetcher and MetricsReporter threads immediately. | nil |
513
+
514
+ For the full method signatures, please see [client.rb](lib/unleash/client.rb)
488
515
 
489
516
  ## Local test client
490
517
 
@@ -496,9 +523,9 @@ bundle exec bin/unleash-client --help
496
523
  bundle exec examples/simple.rb
497
524
  ```
498
525
 
499
- ## Available strategies
526
+ ## Available Strategies
500
527
 
501
- This client comes with all the required strategies out of the box:
528
+ This client comes with the all the required strategies out of the box:
502
529
 
503
530
  - ApplicationHostnameStrategy
504
531
  - DefaultStrategy
@@ -510,10 +537,10 @@ This client comes with all the required strategies out of the box:
510
537
  - UnknownStrategy
511
538
  - UserWithIdStrategy
512
539
 
513
- ## Custom strategies
540
+ ## Custom Strategies
514
541
 
515
- You can add [custom activation strategies](https://docs.getunleash.io/advanced/custom_activation_strategy) using configuration.
516
- In order for the strategy to work correctly it should support two methods `name` and `is_enabled?`.
542
+ Client allows to add [custom activation strategies](https://docs.getunleash.io/advanced/custom_activation_strategy) using configuration.
543
+ In order for strategy to work correctly it should support two methods `name` and `is_enabled?`
517
544
 
518
545
  ```ruby
519
546
  class MyCustomStrategy
@@ -548,17 +575,16 @@ To install this gem onto your local machine, run `bundle exec rake install`.
548
575
 
549
576
  ## Releasing
550
577
 
551
- To release a new version, follow these steps:
578
+ Choose a new version number following [Semantic Versioning](https://semver.org/spec/v2.0.0.html) semantics and then:
552
579
 
553
- 1. Update version number:
554
- - Increment the version number in the `./lib/unleash/version.rb` file according to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) guidelines.
555
- 2. Update documentation:
556
- - If the update includes a major or minor version change, update the [Installation section](#installation) in [README.md](README.md).
557
- - Update [CHANGELOG.md](CHANGELOG.md) following the format on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
558
- 3. Commit changes:
559
- - Commit the changes with a message like: `chore: bump version to x.y.z.`
560
- 4. Release the gem:
561
- - On the `main` branch, run `bundle exec rake release` to create a git tag for the new version, push commits and tags to origin, and publish `.gem` file to [rubygems.org](https://rubygems.org).
580
+ - update the version number in [./lib/unleash/version.rb](./lib/unleash/version.rb),
581
+ - if a major or minor version bump, update the [Installation section](#installation) in [README.md](README.md)
582
+ - update [CHANGELOG.md](CHANGELOG.md) following the format on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
583
+ - commit with message `chore: bump version to x.y.z`
584
+ - then run `bundle exec rake release`
585
+ - This will create a git tag for the version on the current commit,
586
+ - push git commits and tags to origin and
587
+ - push the `.gem` file to [rubygems.org](https://rubygems.org)
562
588
 
563
589
  ## Contributing
564
590
 
@@ -568,4 +594,4 @@ Be sure to run both `bundle exec rspec` and `bundle exec rubocop` in your branch
568
594
 
569
595
  Please include tests with any pull requests, to avoid regressions.
570
596
 
571
- Check out our guide for more information on how to build and scale [feature flag systems](https://docs.getunleash.io/topics/feature-flags/feature-flag-best-practices).
597
+ Check out our guide for more information on how to build and scale [feature flag systems](https://docs.getunleash.io/topics/feature-flags/feature-flag-best-practices)
@@ -1,3 +1,3 @@
1
1
  module Unleash
2
- VERSION = "6.0.0".freeze
2
+ VERSION = "6.0.1.pre".freeze
3
3
  end
@@ -21,9 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.bindir = 'bin'
22
22
  spec.executables = spec.files.grep(%r{^bin/unleash}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
- spec.required_ruby_version = ">= 2.7"
24
+ spec.required_ruby_version = ">= 2.6"
25
25
 
26
- spec.add_dependency "yggdrasil-engine", "~> 0.0.6"
26
+ spec.add_dependency "murmurhash3", "~> 0.1.7"
27
+ spec.add_dependency "yggdrasil-engine", "~> 0.0.6.beta.2"
27
28
 
28
29
  spec.add_development_dependency "bundler", "~> 2.1"
29
30
  spec.add_development_dependency "rake", "~> 12.3"
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unleash
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renato Arruda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2024-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: murmurhash3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.7
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: yggdrasil-engine
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 0.0.6
33
+ version: 0.0.6.beta.2
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 0.0.6
40
+ version: 0.0.6.beta.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -183,7 +197,6 @@ files:
183
197
  - lib/unleash/variant.rb
184
198
  - lib/unleash/version.rb
185
199
  - unleash-client.gemspec
186
- - v6_MIGRATION_GUIDE.md
187
200
  homepage: https://github.com/unleash/unleash-client-ruby
188
201
  licenses:
189
202
  - Apache-2.0
@@ -196,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
209
  requirements:
197
210
  - - ">="
198
211
  - !ruby/object:Gem::Version
199
- version: '2.7'
212
+ version: '2.6'
200
213
  required_rubygems_version: !ruby/object:Gem::Requirement
201
214
  requirements:
202
215
  - - ">="
@@ -1,21 +0,0 @@
1
- # Migrating to Unleash-Client-Ruby 6.0.0
2
-
3
- This guide highlights the key changes you should be aware of when upgrading to v6.0.0 of the Unleash client.
4
-
5
- ## Custom strategy changes
6
-
7
- In version 6+, custom strategies cannot override the built-in strategies. Specifically, strategies `applicationHostname`, `default`, `flexibleRollout`, `gradualRolloutRandom`, `gradualRolloutSessionId`, `gradualRolloutUserId`, `remoteAddress` or `userWithId` throw an error on startup. Previously, creating a custom strategy would only generate a warning in the logs.
8
-
9
- The deprecated `register_custom_strategies` method has been removed. You can continue to [register custom strategies](./README.md#custom-strategies) using configuration.
10
-
11
- ## Direct access to strategy objects
12
-
13
- **Note:** If you're not using the method `known_strategies` this section doesn't affect you
14
-
15
- The objects for base strategies are no longer directly accessible via the SDK. The `known_strategies` method only returns custom strategies registered by the user. To check if a custom strategy will override either a built-in or custom strategy, use the `includes?` method (returns false if the name is available).
16
-
17
- It is strongly discouraged to access or modify any properties of the built-in strategies other than the name. In version 6+, this is a hard requirement.
18
-
19
- ## ARM requirements
20
-
21
- Version 6.0.0 introduces a new dependency on a native binary. Currently, only ARM binaries for macOS are distributed. If you require ARM support for Linux or Windows, please open a GitHub issue.