unleash 6.0.0.pre → 6.0.0

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: 518b79d43627fa6a3de4b59eb7e6f445ebb09a7f8e96f963765ada55c827ac5b
4
- data.tar.gz: c1c284bee319185697a6eb16d0b10d62c141372b708baa34ad4de682795db1cc
3
+ metadata.gz: 99ad38f03714b601bac152cb56373ed6ec9c881aee7f0a7bc538a26f777b81d4
4
+ data.tar.gz: b1b88a4cbd1bc03da617930046921e7c6ca1765506d65a38825c65d511b8a800
5
5
  SHA512:
6
- metadata.gz: c17939c596ca7523d6d6abec6f36041555fcfbed36bfadcb105a7d6704822a85c3e673f53db23cedcdf560181591b69ec8b8f4bc009a29e6f4cbf39a943b0dda
7
- data.tar.gz: d61f27c3cf5e726bbcc85401512a3009b9ccfbaa289b12ebf930af30fe6606c340eed26b57aba84425cafcc792120bcf003e36512d56168ca7d2cac75eff9d90
6
+ metadata.gz: 2f263e80e4bd7259f0dfa90cdcd28b902b06b125552927c67be2937d1bd26fcf9b44b07321efa8ad83973daaa29b53a540fdca1daafb9978ce05a4907b9fe402
7
+ data.tar.gz: 28994930969f57e529180a5562473066349d2c4a5db2f0b741d075adc5e229c0036a1b526464881e592d9cca1c2edbb0e9e4957bd61e8348bea5f7ab4bcd80db
@@ -29,13 +29,11 @@ jobs:
29
29
  - macos
30
30
  ruby-version:
31
31
  - jruby-9.4
32
- - jruby-9.3
33
32
  - 3.3
34
33
  - 3.2
35
34
  - 3.1
36
35
  - '3.0'
37
36
  - 2.7
38
- - 2.6
39
37
 
40
38
  needs:
41
39
  - lint
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  # inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.6
4
+ TargetRubyVersion: 2.7
5
5
 
6
6
  Naming/PredicateName:
7
7
  AllowedMethods:
data/CHANGELOG.md CHANGED
@@ -13,6 +13,10 @@ 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
+
16
20
  ## [6.0.0.pre] - 2024-09-25
17
21
  #### Changed
18
22
  - No longer possible to override built in strategies with custom strategies (#152)
data/README.md CHANGED
@@ -6,42 +6,19 @@
6
6
 
7
7
  Ruby client for the [Unleash](https://github.com/Unleash/unleash) feature management service.
8
8
 
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
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
36
15
 
37
16
  - MRI 3.3
38
17
  - MRI 3.2
39
18
  - MRI 3.1
40
19
  - MRI 3.0
41
20
  - MRI 2.7
42
- - MRI 2.6
43
21
  - jruby 9.4
44
- - jruby 9.3
45
22
 
46
23
  ## Installation
47
24
 
@@ -59,72 +36,70 @@ Or install it yourself as:
59
36
 
60
37
  $ gem install unleash
61
38
 
62
- ## Configure
39
+ ## Configuration
63
40
 
64
41
  It is **required** to configure:
65
42
 
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.
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+
71
46
 
72
47
  It is **highly recommended** to configure:
73
48
 
74
- - `instance_id` parameter with a unique identifier for the running instance.
49
+ - `instance_id` parameter with a unique identifier for the running instance
75
50
 
76
51
  ```ruby
77
52
  Unleash.configure do |config|
78
53
  config.app_name = 'my_ruby_app'
79
- config.url = 'https://unleash.herokuapp.com/api'
80
- config.custom_http_headers = {'Authorization': '<API token>'}
54
+ config.url = '<YOUR_UNLEASH_URL>/api'
55
+ config.custom_http_headers = {'Authorization': '<YOUR_API_TOKEN>'}
81
56
  end
82
57
  ```
83
58
 
84
59
  or instantiate the client with the valid configuration:
85
60
 
86
61
  ```ruby
87
- UNLEASH = Unleash::Client.new(url: 'https://unleash.herokuapp.com/api', app_name: 'my_ruby_app', custom_http_headers: {'Authorization': '<API token>'})
62
+ UNLEASH = Unleash::Client.new(url: '<YOUR_UNLEASH_URL>/api', app_name: 'my_ruby_app', custom_http_headers: {'Authorization': '<YOUR_API_TOKEN>'})
88
63
  ```
89
64
 
90
65
  ## Dynamic custom HTTP headers
91
66
 
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`.
67
+ If you need custom HTTP headers that change during the lifetime of the client, you can pass `custom_http_headers` as a `Proc`.
93
68
 
94
69
  ```ruby
95
70
  Unleash.configure do |config|
96
71
  config.app_name = 'my_ruby_app'
97
- config.url = 'https://unleash.herokuapp.com/api'
72
+ config.url = '<YOUR_UNLEASH_URL>/api'
98
73
  config.custom_http_headers = proc do
99
74
  {
100
- 'Authorization': '<API token>',
75
+ 'Authorization': '<YOUR_API_TOKEN>',
101
76
  'X-Client-Request-Time': Time.now.iso8601
102
77
  }
103
78
  end
104
79
  end
105
80
  ```
106
81
 
107
- #### List of Arguments
82
+ #### List of arguments
108
83
 
109
- | Argument | Description | Required? | Type | Default Value |
84
+ | Argument | Description | Required? | Type | Default value |
110
85
  | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------- | ---------------------------------------------- |
111
86
  | `url` | Unleash server URL. | Y | String | N/A |
112
87
  | `app_name` | Name of your program. | Y | String | N/A |
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` |
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` |
119
94
  | `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` |
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 | {} |
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 | {} |
121
96
  | `timeout` | How long to wait for the connection to be established or wait in reading state (open_timeout/read_timeout) | N | Integer | 30 |
122
97
  | `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 |
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` |
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` |
124
99
  | `logger` | Specify a custom `Logger` class to handle logs for the Unleash client. | N | Class | `Logger.new(STDOUT)` |
125
100
  | `log_level` | Change the log level for the `Logger` class. Constant from `Logger::Severity`. | N | Constant | `Logger::WARN` |
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` |
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` |
128
103
 
129
104
  For a more in-depth look, please see `lib/unleash/configuration.rb`.
130
105
 
@@ -133,13 +108,13 @@ For a more in-depth look, please see `lib/unleash/configuration.rb`.
133
108
  | `UNLEASH_BOOTSTRAP_FILE` | File to read bootstrap data from |
134
109
  | `UNLEASH_BOOTSTRAP_URL` | URL to read bootstrap data from |
135
110
 
136
- ## Usage in a plain Ruby Application
111
+ ## Usage in a plain Ruby application
137
112
 
138
113
  ```ruby
139
114
  require 'unleash'
140
115
  require 'unleash/context'
141
116
 
142
- @unleash = Unleash::Client.new(app_name: 'my_ruby_app', url: 'https://unleash.herokuapp.com/api', custom_http_headers: { 'Authorization': '<API token>' })
117
+ @unleash = Unleash::Client.new(app_name: 'my_ruby_app', url: '<YOUR_UNLEASH_URL>/api', custom_http_headers: { 'Authorization': '<YOUR_API_TOKEN>' })
143
118
 
144
119
  feature_name = "AwesomeFeature"
145
120
  unleash_context = Unleash::Context.new
@@ -158,7 +133,7 @@ else
158
133
  end
159
134
  ```
160
135
 
161
- ## Usage in a Rails Application
136
+ ## Usage in a Rails application
162
137
 
163
138
  ### 1. Add Initializer
164
139
 
@@ -183,10 +158,8 @@ UNLEASH = Unleash::Client.new
183
158
  # Rails.configuration.unleash = Unleash::Client.new
184
159
  ```
185
160
 
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.
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.
190
163
 
191
164
  To have it available in the `rails console` command as well, also add to the file above:
192
165
 
@@ -213,12 +186,12 @@ Then you may keep the client configuration still in `config/initializers/unleash
213
186
  ```ruby
214
187
  Unleash.configure do |config|
215
188
  config.app_name = Rails.application.class.parent.to_s
216
- config.url = 'https://unleash.herokuapp.com/api'
217
- config.custom_http_headers = {'Authorization': '<API token>'}
189
+ config.url = '<YOUR_UNLEASH_URL>/api'
190
+ config.custom_http_headers = {'Authorization': '<YOUR_API_TOKEN>'}
218
191
  end
219
192
  ```
220
193
 
221
- But you must ensure that the unleash client is instantiated only after the process is forked.
194
+ But you must ensure that the Unleash client is instantiated only after the process is forked.
222
195
  This is done by creating the client inside the `on_worker_boot` code block in `puma.rb` as below:
223
196
 
224
197
  ```ruby
@@ -241,14 +214,14 @@ end
241
214
 
242
215
  By not using `preload_app!`:
243
216
 
244
- - the `Rails` constant will NOT be available.
245
- - but phased restarts will be possible.
217
+ - The `Rails` constant will **not** be available.
218
+ - Phased restarts will be possible.
246
219
 
247
220
  You need to ensure that in `puma.rb`:
248
221
 
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.
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.
252
225
 
253
226
  Example for `puma.rb`:
254
227
 
@@ -263,8 +236,8 @@ on_worker_boot do
263
236
 
264
237
  ::UNLEASH = Unleash::Client.new(
265
238
  app_name: 'my_rails_app',
266
- url: 'https://unleash.herokuapp.com/api',
267
- custom_http_headers: {'Authorization': '<API token>'},
239
+ url: '<YOUR_UNLEASH_URL>/api',
240
+ custom_http_headers: {'Authorization': '<YOUR_API_TOKEN>'},
268
241
  )
269
242
  end
270
243
 
@@ -277,7 +250,7 @@ Note that we also added shutdown hooks in `on_worker_shutdown`, to ensure a clea
277
250
 
278
251
  #### 1.c Add Initializer if using [Phusion Passenger](https://github.com/phusion/passenger)
279
252
 
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):
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):
281
254
 
282
255
  The initializer in `config/initializers/unleash.rb` should look like:
283
256
 
@@ -288,8 +261,8 @@ PhusionPassenger.on_event(:starting_worker_process) do |forked|
288
261
  config.app_name = Rails.application.class.parent.to_s
289
262
  # config.instance_id = "#{Socket.gethostname}"
290
263
  config.logger = Rails.logger
291
- config.url = 'https://unleash.herokuapp.com/api'
292
- config.custom_http_headers = {'Authorization': '<API token>'}
264
+ config.url = '<YOUR_UNLEASH_URL>/api'
265
+ config.custom_http_headers = {'Authorization': '<YOUR_API_TOKEN>'}
293
266
  end
294
267
 
295
268
  UNLEASH = Unleash::Client.new
@@ -299,7 +272,7 @@ end
299
272
 
300
273
  #### 1.d Add Initializer hooks when using within [Sidekiq](https://github.com/mperham/sidekiq)
301
274
 
302
- Note that in this case we require that the code block for `Unleash.configure` is set beforehand.
275
+ Note that in this case, we require that the code block for `Unleash.configure` is set beforehand.
303
276
  For example in `config/initializers/unleash.rb`.
304
277
 
305
278
  ```ruby
@@ -316,7 +289,7 @@ end
316
289
 
317
290
  ### 2. Set Unleash::Context
318
291
 
319
- Be sure to add the following method and callback in the application controller to have `@unleash_context` set for all requests:
292
+ Add the following method and callback in the application controller to have `@unleash_context` set for all requests:
320
293
 
321
294
  Add in `app/controllers/application_controller.rb`:
322
295
 
@@ -333,7 +306,7 @@ Add in `app/controllers/application_controller.rb`:
333
306
  end
334
307
  ```
335
308
 
336
- Or if you see better fit, only in the controllers that you will be using unleash.
309
+ Alternatively, you can add this method only to the controllers that use Unleash.
337
310
 
338
311
  ### 3. Sample usage
339
312
 
@@ -406,11 +379,11 @@ end
406
379
 
407
380
  Note:
408
381
 
409
- - The block/lambda/proc can use feature name and context as an arguments.
382
+ - The block/lambda/proc can use the feature name and context as arguments.
410
383
  - The client will evaluate the fallback function once per call of `is_enabled()`.
411
- Please keep this in mind when creating your fallback function!
384
+ Please keep this in mind when creating your fallback function.
412
385
  - The returned value of the block should be a boolean.
413
- However, the client will coerce the result to boolean via `!!`.
386
+ However, the client will coerce the result to a boolean via `!!`.
414
387
  - If both a `default_value` and `fallback_function` are supplied,
415
388
  the client will define the default value by `OR`ing the default value and the output of the fallback function.
416
389
 
@@ -442,21 +415,21 @@ Bootstrapping can be configured by providing a bootstrap configuration when init
442
415
 
443
416
  ```ruby
444
417
  @unleash = Unleash::Client.new(
445
- url: 'https://unleash.herokuapp.com/api',
418
+ url: '<YOUR_UNLEASH_URL>/api',
446
419
  app_name: 'my_ruby_app',
447
- custom_http_headers: { 'Authorization': '<API token>' },
420
+ custom_http_headers: { 'Authorization': '<YOUR_API_TOKEN>' },
448
421
  bootstrap_config: Unleash::Bootstrap::Configuration.new({
449
- url: "https://unleash.herokuapp.com/api/client/features",
450
- url_headers: {'Authorization': '<API token>'}
422
+ url: "<YOUR_UNLEASH_URL>/api/client/features",
423
+ url_headers: {'Authorization': '<YOUR_API_TOKEN>'}
451
424
  })
452
425
  )
453
426
  ```
454
427
 
455
428
  The `Bootstrap::Configuration` initializer takes a hash with one of the following options specified:
456
429
 
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.
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.
460
433
  - `data` - A raw JSON string as returned by the Unleash server.
461
434
  - `block` - A lambda containing custom logic if you need it, an example is provided below.
462
435
 
@@ -470,13 +443,13 @@ The order of preference is as follows:
470
443
 
471
444
  Example usage:
472
445
 
473
- First saving the toggles locally:
446
+ First, save the toggles locally:
474
447
 
475
448
  ```shell
476
- curl -H 'Authorization: <API token>' -XGET 'https://unleash.herokuapp.com/api' > ./default-toggles.json
449
+ curl -H 'Authorization: <YOUR_API_TOKEN>' -XGET '<YOUR_UNLEASH_URL>/api' > ./default-toggles.json
477
450
  ```
478
451
 
479
- Now using them on start up:
452
+ Then use them on startup:
480
453
 
481
454
  ```ruby
482
455
 
@@ -486,8 +459,8 @@ custom_boostrapper = lambda {
486
459
 
487
460
  @unleash = Unleash::Client.new(
488
461
  app_name: 'my_ruby_app',
489
- url: 'https://unleash.herokuapp.com/api',
490
- custom_http_headers: { 'Authorization': '<API token>' },
462
+ url: '<YOUR_UNLEASH_URL>/api',
463
+ custom_http_headers: { 'Authorization': '<YOUR_API_TOKEN>' },
491
464
  bootstrap_config: Unleash::Bootstrap::Configuration.new({
492
465
  block: custom_boostrapper
493
466
  })
@@ -499,19 +472,19 @@ Be aware that the client initializer will block until bootstrapping is complete.
499
472
 
500
473
  #### Client methods
501
474
 
502
- | Method Name | Description | Return Type |
475
+ | Method name | Description | Return type |
503
476
  | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
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)
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).
515
488
 
516
489
  ## Local test client
517
490
 
@@ -523,9 +496,9 @@ bundle exec bin/unleash-client --help
523
496
  bundle exec examples/simple.rb
524
497
  ```
525
498
 
526
- ## Available Strategies
499
+ ## Available strategies
527
500
 
528
- This client comes with the all the required strategies out of the box:
501
+ This client comes with all the required strategies out of the box:
529
502
 
530
503
  - ApplicationHostnameStrategy
531
504
  - DefaultStrategy
@@ -537,10 +510,10 @@ This client comes with the all the required strategies out of the box:
537
510
  - UnknownStrategy
538
511
  - UserWithIdStrategy
539
512
 
540
- ## Custom Strategies
513
+ ## Custom strategies
541
514
 
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?`
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?`.
544
517
 
545
518
  ```ruby
546
519
  class MyCustomStrategy
@@ -575,16 +548,17 @@ To install this gem onto your local machine, run `bundle exec rake install`.
575
548
 
576
549
  ## Releasing
577
550
 
578
- Choose a new version number following [Semantic Versioning](https://semver.org/spec/v2.0.0.html) semantics and then:
551
+ To release a new version, follow these steps:
579
552
 
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)
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).
588
562
 
589
563
  ## Contributing
590
564
 
@@ -594,4 +568,4 @@ Be sure to run both `bundle exec rspec` and `bundle exec rubocop` in your branch
594
568
 
595
569
  Please include tests with any pull requests, to avoid regressions.
596
570
 
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)
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).
@@ -1,3 +1,3 @@
1
1
  module Unleash
2
- VERSION = "6.0.0.pre".freeze
2
+ VERSION = "6.0.0".freeze
3
3
  end
@@ -21,10 +21,9 @@ 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.6"
24
+ spec.required_ruby_version = ">= 2.7"
25
25
 
26
- spec.add_dependency "murmurhash3", "~> 0.1.7"
27
- spec.add_dependency "yggdrasil-engine", "~> 0.0.5"
26
+ spec.add_dependency "yggdrasil-engine", "~> 0.0.6"
28
27
 
29
28
  spec.add_development_dependency "bundler", "~> 2.1"
30
29
  spec.add_development_dependency "rake", "~> 12.3"
@@ -0,0 +1,21 @@
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.
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unleash
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.pre
4
+ version: 6.0.0
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-09-25 00:00:00.000000000 Z
11
+ date: 2024-10-03 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
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: yggdrasil-engine
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: 0.0.5
19
+ version: 0.0.6
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: 0.0.5
26
+ version: 0.0.6
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -197,6 +183,7 @@ files:
197
183
  - lib/unleash/variant.rb
198
184
  - lib/unleash/version.rb
199
185
  - unleash-client.gemspec
186
+ - v6_MIGRATION_GUIDE.md
200
187
  homepage: https://github.com/unleash/unleash-client-ruby
201
188
  licenses:
202
189
  - Apache-2.0
@@ -209,7 +196,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
196
  requirements:
210
197
  - - ">="
211
198
  - !ruby/object:Gem::Version
212
- version: '2.6'
199
+ version: '2.7'
213
200
  required_rubygems_version: !ruby/object:Gem::Requirement
214
201
  requirements:
215
202
  - - ">="