flipper 0.22.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -0
  3. data/.github/dependabot.yml +6 -0
  4. data/.github/workflows/ci.yml +26 -20
  5. data/.github/workflows/examples.yml +62 -0
  6. data/.rspec +1 -0
  7. data/.tool-versions +1 -0
  8. data/Changelog.md +152 -3
  9. data/Dockerfile +1 -1
  10. data/Gemfile +9 -6
  11. data/README.md +15 -67
  12. data/Rakefile +4 -2
  13. data/benchmark/enabled_ips.rb +10 -0
  14. data/benchmark/enabled_multiple_actors_ips.rb +20 -0
  15. data/benchmark/enabled_profile.rb +20 -0
  16. data/benchmark/instrumentation_ips.rb +21 -0
  17. data/benchmark/typecast_ips.rb +19 -0
  18. data/docker-compose.yml +37 -34
  19. data/docs/README.md +1 -0
  20. data/docs/images/banner.jpg +0 -0
  21. data/examples/api/basic.ru +3 -4
  22. data/examples/api/custom_memoized.ru +3 -4
  23. data/examples/api/memoized.ru +3 -4
  24. data/examples/dsl.rb +3 -3
  25. data/examples/enabled_for_actor.rb +4 -2
  26. data/examples/instrumentation.rb +1 -0
  27. data/examples/instrumentation_last_accessed_at.rb +38 -0
  28. data/flipper.gemspec +2 -2
  29. data/lib/flipper/actor.rb +4 -0
  30. data/lib/flipper/adapter.rb +23 -7
  31. data/lib/flipper/adapters/dual_write.rb +10 -16
  32. data/lib/flipper/adapters/failover.rb +83 -0
  33. data/lib/flipper/adapters/failsafe.rb +76 -0
  34. data/lib/flipper/adapters/http/client.rb +18 -12
  35. data/lib/flipper/adapters/http/error.rb +19 -1
  36. data/lib/flipper/adapters/http.rb +14 -4
  37. data/lib/flipper/adapters/instrumented.rb +25 -2
  38. data/lib/flipper/adapters/memoizable.rb +27 -18
  39. data/lib/flipper/adapters/memory.rb +56 -39
  40. data/lib/flipper/adapters/operation_logger.rb +16 -3
  41. data/lib/flipper/adapters/poll/poller.rb +2 -0
  42. data/lib/flipper/adapters/poll.rb +39 -0
  43. data/lib/flipper/adapters/pstore.rb +2 -5
  44. data/lib/flipper/adapters/sync/interval_synchronizer.rb +1 -6
  45. data/lib/flipper/adapters/sync/synchronizer.rb +2 -1
  46. data/lib/flipper/adapters/sync.rb +9 -15
  47. data/lib/flipper/dsl.rb +9 -11
  48. data/lib/flipper/errors.rb +3 -20
  49. data/lib/flipper/export.rb +26 -0
  50. data/lib/flipper/exporter.rb +17 -0
  51. data/lib/flipper/exporters/json/export.rb +32 -0
  52. data/lib/flipper/exporters/json/v1.rb +33 -0
  53. data/lib/flipper/feature.rb +32 -26
  54. data/lib/flipper/feature_check_context.rb +10 -6
  55. data/lib/flipper/gate.rb +12 -11
  56. data/lib/flipper/gate_values.rb +0 -16
  57. data/lib/flipper/gates/actor.rb +10 -17
  58. data/lib/flipper/gates/boolean.rb +1 -1
  59. data/lib/flipper/gates/group.rb +5 -7
  60. data/lib/flipper/gates/percentage_of_actors.rb +10 -13
  61. data/lib/flipper/gates/percentage_of_time.rb +1 -2
  62. data/lib/flipper/identifier.rb +2 -2
  63. data/lib/flipper/instrumentation/log_subscriber.rb +7 -3
  64. data/lib/flipper/instrumentation/subscriber.rb +8 -1
  65. data/lib/flipper/instrumenters/memory.rb +6 -2
  66. data/lib/flipper/metadata.rb +1 -1
  67. data/lib/flipper/middleware/memoizer.rb +2 -12
  68. data/lib/flipper/poller.rb +117 -0
  69. data/lib/flipper/railtie.rb +23 -22
  70. data/lib/flipper/spec/shared_adapter_specs.rb +23 -0
  71. data/lib/flipper/test/shared_adapter_test.rb +24 -0
  72. data/lib/flipper/typecast.rb +28 -15
  73. data/lib/flipper/types/actor.rb +19 -13
  74. data/lib/flipper/types/group.rb +12 -5
  75. data/lib/flipper/version.rb +1 -1
  76. data/lib/flipper.rb +6 -4
  77. data/spec/fixtures/flipper_pstore_1679087600.json +46 -0
  78. data/spec/flipper/actor_spec.rb +10 -2
  79. data/spec/flipper/adapter_spec.rb +29 -4
  80. data/spec/flipper/adapters/dual_write_spec.rb +0 -2
  81. data/spec/flipper/adapters/failover_spec.rb +129 -0
  82. data/spec/flipper/adapters/failsafe_spec.rb +58 -0
  83. data/spec/flipper/adapters/http_spec.rb +64 -6
  84. data/spec/flipper/adapters/instrumented_spec.rb +28 -12
  85. data/spec/flipper/adapters/memoizable_spec.rb +30 -12
  86. data/spec/flipper/adapters/memory_spec.rb +3 -4
  87. data/spec/flipper/adapters/operation_logger_spec.rb +29 -12
  88. data/spec/flipper/adapters/pstore_spec.rb +0 -2
  89. data/spec/flipper/adapters/read_only_spec.rb +0 -1
  90. data/spec/flipper/adapters/sync/feature_synchronizer_spec.rb +0 -1
  91. data/spec/flipper/adapters/sync/interval_synchronizer_spec.rb +4 -5
  92. data/spec/flipper/adapters/sync/synchronizer_spec.rb +0 -1
  93. data/spec/flipper/adapters/sync_spec.rb +0 -2
  94. data/spec/flipper/configuration_spec.rb +0 -1
  95. data/spec/flipper/dsl_spec.rb +38 -12
  96. data/spec/flipper/export_spec.rb +13 -0
  97. data/spec/flipper/exporter_spec.rb +16 -0
  98. data/spec/flipper/exporters/json/export_spec.rb +60 -0
  99. data/spec/flipper/exporters/json/v1_spec.rb +33 -0
  100. data/spec/flipper/feature_check_context_spec.rb +17 -19
  101. data/spec/flipper/feature_spec.rb +76 -33
  102. data/spec/flipper/gate_spec.rb +0 -2
  103. data/spec/flipper/gate_values_spec.rb +2 -34
  104. data/spec/flipper/gates/actor_spec.rb +0 -2
  105. data/spec/flipper/gates/boolean_spec.rb +1 -3
  106. data/spec/flipper/gates/group_spec.rb +2 -5
  107. data/spec/flipper/gates/percentage_of_actors_spec.rb +61 -7
  108. data/spec/flipper/gates/percentage_of_time_spec.rb +2 -4
  109. data/spec/flipper/identifier_spec.rb +0 -1
  110. data/spec/flipper/instrumentation/log_subscriber_spec.rb +15 -6
  111. data/spec/flipper/instrumentation/statsd_subscriber_spec.rb +10 -1
  112. data/spec/flipper/instrumenters/memory_spec.rb +18 -1
  113. data/spec/flipper/instrumenters/noop_spec.rb +14 -8
  114. data/spec/flipper/middleware/memoizer_spec.rb +0 -23
  115. data/spec/flipper/middleware/setup_env_spec.rb +0 -2
  116. data/spec/flipper/poller_spec.rb +47 -0
  117. data/spec/flipper/railtie_spec.rb +73 -33
  118. data/spec/flipper/registry_spec.rb +0 -1
  119. data/spec/flipper/typecast_spec.rb +82 -4
  120. data/spec/flipper/types/actor_spec.rb +45 -46
  121. data/spec/flipper/types/boolean_spec.rb +0 -1
  122. data/spec/flipper/types/group_spec.rb +2 -3
  123. data/spec/flipper/types/percentage_of_actors_spec.rb +0 -1
  124. data/spec/flipper/types/percentage_of_time_spec.rb +0 -1
  125. data/spec/flipper/types/percentage_spec.rb +0 -1
  126. data/spec/flipper_integration_spec.rb +62 -51
  127. data/spec/flipper_spec.rb +7 -2
  128. data/spec/{helper.rb → spec_helper.rb} +4 -2
  129. data/spec/support/skippable.rb +18 -0
  130. data/spec/support/spec_helpers.rb +2 -6
  131. metadata +63 -19
  132. data/docs/Adapters.md +0 -124
  133. data/docs/Caveats.md +0 -4
  134. data/docs/Gates.md +0 -167
  135. data/docs/Instrumentation.md +0 -27
  136. data/docs/Optimization.md +0 -137
  137. data/docs/api/README.md +0 -884
  138. data/docs/http/README.md +0 -36
  139. data/docs/read-only/README.md +0 -24
@@ -1,4 +1,3 @@
1
- require 'helper'
2
1
  require 'flipper/feature'
3
2
 
4
3
  RSpec.describe Flipper do
@@ -8,17 +7,17 @@ RSpec.describe Flipper do
8
7
  let(:admin_group) { flipper.group(:admins) }
9
8
  let(:dev_group) { flipper.group(:devs) }
10
9
 
11
- let(:admin_thing) do
10
+ let(:admin_actor) do
12
11
  double 'Non Flipper Thing', flipper_id: 1, admin?: true, dev?: false
13
12
  end
14
- let(:dev_thing) do
13
+ let(:dev_actor) do
15
14
  double 'Non Flipper Thing', flipper_id: 10, admin?: false, dev?: true
16
15
  end
17
16
 
18
- let(:admin_truthy_thing) do
17
+ let(:admin_truthy_actor) do
19
18
  double 'Non Flipper Thing', flipper_id: 1, admin?: 'true-ish', dev?: false
20
19
  end
21
- let(:admin_falsey_thing) do
20
+ let(:admin_falsey_actor) do
22
21
  double 'Non Flipper Thing', flipper_id: 1, admin?: nil, dev?: false
23
22
  end
24
23
 
@@ -61,20 +60,20 @@ RSpec.describe Flipper do
61
60
  expect(@result).to eq(true)
62
61
  end
63
62
 
64
- it 'enables feature for non flipper thing in group' do
65
- expect(feature.enabled?(admin_thing)).to eq(true)
63
+ it 'enables feature for non flipper actor in group' do
64
+ expect(feature.enabled?(admin_actor)).to eq(true)
66
65
  end
67
66
 
68
- it 'does not enable feature for non flipper thing in other group' do
69
- expect(feature.enabled?(dev_thing)).to eq(false)
67
+ it 'does not enable feature for non flipper actor in other group' do
68
+ expect(feature.enabled?(dev_actor)).to eq(false)
70
69
  end
71
70
 
72
71
  it 'enables feature for flipper actor in group' do
73
- expect(feature.enabled?(flipper.actor(admin_thing))).to eq(true)
72
+ expect(feature.enabled?(flipper.actor(admin_actor))).to eq(true)
74
73
  end
75
74
 
76
75
  it 'does not enable for flipper actor not in group' do
77
- expect(feature.enabled?(flipper.actor(dev_thing))).to eq(false)
76
+ expect(feature.enabled?(flipper.actor(dev_actor))).to eq(false)
78
77
  end
79
78
 
80
79
  it 'does not enable feature for all' do
@@ -119,8 +118,8 @@ RSpec.describe Flipper do
119
118
 
120
119
  it 'enables feature for actor within percentage' do
121
120
  enabled = (1..100).select do |i|
122
- thing = Flipper::Actor.new(i)
123
- feature.enabled?(thing)
121
+ actor = Flipper::Actor.new(i)
122
+ feature.enabled?(actor)
124
123
  end.size
125
124
 
126
125
  expect(enabled).to be_within(2).of(5)
@@ -142,8 +141,8 @@ RSpec.describe Flipper do
142
141
 
143
142
  it 'enables feature for actor within percentage' do
144
143
  enabled = (1..100).select do |i|
145
- thing = Flipper::Actor.new(i)
146
- feature.enabled?(thing)
144
+ actor = Flipper::Actor.new(i)
145
+ feature.enabled?(actor)
147
146
  end.size
148
147
 
149
148
  expect(enabled).to be_within(2).of(5)
@@ -181,10 +180,10 @@ RSpec.describe Flipper do
181
180
 
182
181
  context 'with argument that has no gate' do
183
182
  it 'raises error' do
184
- thing = Object.new
183
+ actor = Object.new
185
184
  expect do
186
- feature.enable(thing)
187
- end.to raise_error(Flipper::GateNotFound, "Could not find gate for #{thing.inspect}")
185
+ feature.enable(actor)
186
+ end.to raise_error(Flipper::GateNotFound, "Could not find gate for #{actor.inspect}")
188
187
  end
189
188
  end
190
189
  end
@@ -216,13 +215,13 @@ RSpec.describe Flipper do
216
215
  end
217
216
 
218
217
  it 'disables actor in group' do
219
- expect(feature.enabled?(admin_thing)).to eq(false)
218
+ expect(feature.enabled?(admin_actor)).to eq(false)
220
219
  end
221
220
 
222
221
  it 'disables actor in percentage of actors' do
223
222
  enabled = (1..100).select do |i|
224
- thing = Flipper::Actor.new(i)
225
- feature.enabled?(thing)
223
+ actor = Flipper::Actor.new(i)
224
+ feature.enabled?(actor)
226
225
  end.size
227
226
 
228
227
  expect(enabled).to be(0)
@@ -248,20 +247,20 @@ RSpec.describe Flipper do
248
247
  expect(@result).to eq(true)
249
248
  end
250
249
 
251
- it 'disables the feature for non flipper thing in the group' do
252
- expect(feature.enabled?(admin_thing)).to eq(false)
250
+ it 'disables the feature for non flipper actor in the group' do
251
+ expect(feature.enabled?(admin_actor)).to eq(false)
253
252
  end
254
253
 
255
- it 'does not disable feature for non flipper thing in other groups' do
256
- expect(feature.enabled?(dev_thing)).to eq(true)
254
+ it 'does not disable feature for non flipper actor in other groups' do
255
+ expect(feature.enabled?(dev_actor)).to eq(true)
257
256
  end
258
257
 
259
258
  it 'disables feature for flipper actor in group' do
260
- expect(feature.enabled?(flipper.actor(admin_thing))).to eq(false)
259
+ expect(feature.enabled?(flipper.actor(admin_actor))).to eq(false)
261
260
  end
262
261
 
263
262
  it 'does not disable feature for flipper actor in other groups' do
264
- expect(feature.enabled?(flipper.actor(dev_thing))).to eq(true)
263
+ expect(feature.enabled?(flipper.actor(dev_actor))).to eq(true)
265
264
  end
266
265
 
267
266
  it 'adds feature to set of features' do
@@ -304,8 +303,8 @@ RSpec.describe Flipper do
304
303
 
305
304
  it 'disables feature' do
306
305
  enabled = (1..100).select do |i|
307
- thing = Flipper::Actor.new(i)
308
- feature.enabled?(thing)
306
+ actor = Flipper::Actor.new(i)
307
+ feature.enabled?(actor)
309
308
  end.size
310
309
 
311
310
  expect(enabled).to be(0)
@@ -343,10 +342,10 @@ RSpec.describe Flipper do
343
342
 
344
343
  context 'with argument that has no gate' do
345
344
  it 'raises error' do
346
- thing = Object.new
345
+ actor = Object.new
347
346
  expect do
348
- feature.disable(thing)
349
- end.to raise_error(Flipper::GateNotFound, "Could not find gate for #{thing.inspect}")
347
+ feature.disable(actor)
348
+ end.to raise_error(Flipper::GateNotFound, "Could not find gate for #{actor.inspect}")
350
349
  end
351
350
  end
352
351
  end
@@ -374,23 +373,27 @@ RSpec.describe Flipper do
374
373
  end
375
374
 
376
375
  it 'returns true' do
377
- expect(feature.enabled?(flipper.actor(admin_thing))).to eq(true)
378
- expect(feature.enabled?(admin_thing)).to eq(true)
376
+ expect(feature.enabled?(flipper.actor(admin_actor))).to eq(true)
377
+ expect(feature.enabled?(admin_actor)).to eq(true)
379
378
  end
380
379
 
381
380
  it 'returns true for truthy block values' do
382
- expect(feature.enabled?(flipper.actor(admin_truthy_thing))).to eq(true)
381
+ expect(feature.enabled?(flipper.actor(admin_truthy_actor))).to eq(true)
382
+ end
383
+
384
+ it 'returns true if any actor is in enabled group' do
385
+ expect(feature.enabled?(dev_actor, admin_actor)).to be(true)
383
386
  end
384
387
  end
385
388
 
386
389
  context 'for actor in disabled group' do
387
390
  it 'returns false' do
388
- expect(feature.enabled?(flipper.actor(dev_thing))).to eq(false)
389
- expect(feature.enabled?(dev_thing)).to eq(false)
391
+ expect(feature.enabled?(flipper.actor(dev_actor))).to eq(false)
392
+ expect(feature.enabled?(dev_actor)).to eq(false)
390
393
  end
391
394
 
392
395
  it 'returns false for falsey block values' do
393
- expect(feature.enabled?(flipper.actor(admin_falsey_thing))).to eq(false)
396
+ expect(feature.enabled?(flipper.actor(admin_falsey_actor))).to eq(false)
394
397
  end
395
398
  end
396
399
 
@@ -409,6 +412,10 @@ RSpec.describe Flipper do
409
412
  expect(feature.enabled?(clooney)).to eq(false)
410
413
  end
411
414
 
415
+ it 'returns false if all actors are disabled' do
416
+ expect(feature.enabled?(clooney, pitt)).to be(false)
417
+ end
418
+
412
419
  it 'returns true if boolean enabled' do
413
420
  feature.enable
414
421
  expect(feature.enabled?(clooney)).to eq(true)
@@ -429,7 +436,7 @@ RSpec.describe Flipper do
429
436
  expect(feature.enabled?).to eq(true)
430
437
  expect(feature.enabled?(nil)).to eq(true)
431
438
  expect(feature.enabled?(pitt)).to eq(true)
432
- expect(feature.enabled?(admin_thing)).to eq(true)
439
+ expect(feature.enabled?(admin_actor)).to eq(true)
433
440
  end
434
441
  end
435
442
 
@@ -447,7 +454,7 @@ RSpec.describe Flipper do
447
454
  expect(feature.enabled?).to eq(true)
448
455
  expect(feature.enabled?(nil)).to eq(true)
449
456
  expect(feature.enabled?(pitt)).to eq(true)
450
- expect(feature.enabled?(admin_thing)).to eq(true)
457
+ expect(feature.enabled?(admin_actor)).to eq(true)
451
458
  end
452
459
  end
453
460
 
@@ -464,7 +471,7 @@ RSpec.describe Flipper do
464
471
  expect(feature.enabled?).to eq(false)
465
472
  expect(feature.enabled?(nil)).to eq(false)
466
473
  expect(feature.enabled?(pitt)).to eq(false)
467
- expect(feature.enabled?(admin_thing)).to eq(false)
474
+ expect(feature.enabled?(admin_actor)).to eq(false)
468
475
  end
469
476
 
470
477
  it 'returns true if boolean enabled' do
@@ -472,7 +479,7 @@ RSpec.describe Flipper do
472
479
  expect(feature.enabled?).to eq(true)
473
480
  expect(feature.enabled?(nil)).to eq(true)
474
481
  expect(feature.enabled?(pitt)).to eq(true)
475
- expect(feature.enabled?(admin_thing)).to eq(true)
482
+ expect(feature.enabled?(admin_actor)).to eq(true)
476
483
  end
477
484
  end
478
485
 
@@ -489,7 +496,7 @@ RSpec.describe Flipper do
489
496
  expect(feature.enabled?).to eq(false)
490
497
  expect(feature.enabled?(nil)).to eq(false)
491
498
  expect(feature.enabled?(pitt)).to eq(false)
492
- expect(feature.enabled?(admin_thing)).to eq(false)
499
+ expect(feature.enabled?(admin_actor)).to eq(false)
493
500
  end
494
501
 
495
502
  it 'returns true if boolean enabled' do
@@ -497,27 +504,31 @@ RSpec.describe Flipper do
497
504
  expect(feature.enabled?).to eq(true)
498
505
  expect(feature.enabled?(nil)).to eq(true)
499
506
  expect(feature.enabled?(pitt)).to eq(true)
500
- expect(feature.enabled?(admin_thing)).to eq(true)
507
+ expect(feature.enabled?(admin_actor)).to eq(true)
501
508
  end
502
509
  end
503
510
 
504
- context 'for a non flipper thing' do
511
+ context 'for a non flipper actor' do
505
512
  before do
506
513
  feature.enable admin_group
507
514
  end
508
515
 
509
516
  it 'returns true if in enabled group' do
510
- expect(feature.enabled?(admin_thing)).to eq(true)
517
+ expect(feature.enabled?(admin_actor)).to eq(true)
511
518
  end
512
519
 
513
520
  it 'returns false if not in enabled group' do
514
- expect(feature.enabled?(dev_thing)).to eq(false)
521
+ expect(feature.enabled?(dev_actor)).to eq(false)
522
+ end
523
+
524
+ it 'retruns true if any actor is true' do
525
+ expect(feature.enabled?(admin_actor, dev_actor)).to eq(true)
515
526
  end
516
527
 
517
528
  it 'returns true if boolean enabled' do
518
529
  feature.enable
519
- expect(feature.enabled?(admin_thing)).to eq(true)
520
- expect(feature.enabled?(dev_thing)).to eq(true)
530
+ expect(feature.enabled?(admin_actor)).to eq(true)
531
+ expect(feature.enabled?(dev_actor)).to eq(true)
521
532
  end
522
533
  end
523
534
  end
@@ -531,11 +542,11 @@ RSpec.describe Flipper do
531
542
  end
532
543
 
533
544
  it 'enables feature for object in enabled group' do
534
- expect(feature.enabled?(admin_thing)).to eq(true)
545
+ expect(feature.enabled?(admin_actor)).to eq(true)
535
546
  end
536
547
 
537
548
  it 'does not enable feature for object in not enabled group' do
538
- expect(feature.enabled?(dev_thing)).to eq(false)
549
+ expect(feature.enabled?(dev_actor)).to eq(false)
539
550
  end
540
551
  end
541
552
  end
data/spec/flipper_spec.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'helper'
2
1
  require 'flipper/cloud'
3
2
 
4
3
  RSpec.describe Flipper do
@@ -203,6 +202,12 @@ RSpec.describe Flipper do
203
202
  expect(described_class.enabled?(:search)).to be(true)
204
203
  end
205
204
 
205
+ it 'delegates export to instance' do
206
+ described_class.enable(:search)
207
+ expect(described_class.export).to eq(described_class.adapter.export)
208
+ expect(described_class.export(format: :json)).to eq(described_class.adapter.export(format: :json))
209
+ end
210
+
206
211
  it 'delegates adapter to instance' do
207
212
  expect(described_class.adapter).to eq(described_class.instance.adapter)
208
213
  end
@@ -223,7 +228,7 @@ RSpec.describe Flipper do
223
228
  end
224
229
 
225
230
  it 'delegates sync stuff to instance for Flipper::Cloud' do
226
- stub = stub_request(:get, "https://www.flippercloud.io/adapter/features").
231
+ stub = stub_request(:get, "https://www.flippercloud.io/adapter/features?exclude_gate_names=true").
227
232
  with({
228
233
  headers: {
229
234
  'Flipper-Cloud-Token'=>'asdf',
@@ -9,18 +9,20 @@ require 'bundler'
9
9
 
10
10
  Bundler.setup(:default)
11
11
 
12
- require 'pry'
12
+ require 'debug'
13
13
  require 'webmock/rspec'
14
14
  WebMock.disable_net_connect!(allow_localhost: true)
15
15
 
16
16
  require 'flipper'
17
- require 'flipper/ui'
18
17
  require 'flipper/api'
18
+ require 'flipper/spec/shared_adapter_specs'
19
+ require 'flipper/ui'
19
20
 
20
21
  Dir[FlipperRoot.join('spec/support/**/*.rb')].sort.each { |f| require f }
21
22
 
22
23
  RSpec.configure do |config|
23
24
  config.before(:example) do
25
+ Flipper::Poller.reset if defined?(Flipper::Poller)
24
26
  Flipper.unregister_groups
25
27
  Flipper.configuration = nil
26
28
  end
@@ -0,0 +1,18 @@
1
+ RSpec.configure do |config|
2
+ config.before(:all) do
3
+ $skip = false
4
+ end
5
+
6
+ def skip_on_error(error, message, &block)
7
+ # Premptively skip if we've already skipped
8
+ skip(message) if $skip
9
+ block.call
10
+ rescue error
11
+ if ENV["CI"]
12
+ raise
13
+ else
14
+ $skip = true
15
+ skip(message)
16
+ end
17
+ end
18
+ end
@@ -1,4 +1,4 @@
1
- require 'climate_control'
1
+ require 'ice_age'
2
2
  require 'json'
3
3
  require 'rack/test'
4
4
 
@@ -31,7 +31,7 @@ module SpecHelpers
31
31
  end
32
32
 
33
33
  def api_error_code_reference_url
34
- 'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference'
34
+ 'https://flippercloud.io/docs/api#error-code-reference'
35
35
  end
36
36
 
37
37
  def api_not_found_response
@@ -58,10 +58,6 @@ module SpecHelpers
58
58
  }
59
59
  end
60
60
 
61
- def with_modified_env(options, &block)
62
- ClimateControl.modify(options, &block)
63
- end
64
-
65
61
  def silence
66
62
  # Store the original stderr and stdout in order to restore them later
67
63
  original_stderr = $stderr
metadata CHANGED
@@ -1,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-08 00:00:00.000000000 Z
12
- dependencies: []
13
- description:
11
+ date: 2023-03-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: concurrent-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ description:
14
28
  email:
15
29
  - nunemaker@gmail.com
16
30
  executables: []
@@ -18,7 +32,11 @@ extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
20
34
  - ".codeclimate.yml"
35
+ - ".github/dependabot.yml"
21
36
  - ".github/workflows/ci.yml"
37
+ - ".github/workflows/examples.yml"
38
+ - ".rspec"
39
+ - ".tool-versions"
22
40
  - CODE_OF_CONDUCT.md
23
41
  - Changelog.md
24
42
  - Dockerfile
@@ -26,17 +44,15 @@ files:
26
44
  - LICENSE
27
45
  - README.md
28
46
  - Rakefile
47
+ - benchmark/enabled_ips.rb
48
+ - benchmark/enabled_multiple_actors_ips.rb
49
+ - benchmark/enabled_profile.rb
50
+ - benchmark/instrumentation_ips.rb
51
+ - benchmark/typecast_ips.rb
29
52
  - docker-compose.yml
30
- - docs/Adapters.md
31
- - docs/Caveats.md
32
53
  - docs/DockerCompose.md
33
- - docs/Gates.md
34
- - docs/Instrumentation.md
35
- - docs/Optimization.md
36
- - docs/api/README.md
37
- - docs/http/README.md
54
+ - docs/README.md
38
55
  - docs/images/banner.jpg
39
- - docs/read-only/README.md
40
56
  - examples/api/basic.ru
41
57
  - examples/api/custom_memoized.ru
42
58
  - examples/api/memoized.ru
@@ -50,6 +66,7 @@ files:
50
66
  - examples/importing.rb
51
67
  - examples/individual_actor.rb
52
68
  - examples/instrumentation.rb
69
+ - examples/instrumentation_last_accessed_at.rb
53
70
  - examples/memoizing.rb
54
71
  - examples/percentage_of_actors.rb
55
72
  - examples/percentage_of_actors_enabled_check.rb
@@ -60,6 +77,8 @@ files:
60
77
  - lib/flipper/actor.rb
61
78
  - lib/flipper/adapter.rb
62
79
  - lib/flipper/adapters/dual_write.rb
80
+ - lib/flipper/adapters/failover.rb
81
+ - lib/flipper/adapters/failsafe.rb
63
82
  - lib/flipper/adapters/http.rb
64
83
  - lib/flipper/adapters/http/client.rb
65
84
  - lib/flipper/adapters/http/error.rb
@@ -67,6 +86,8 @@ files:
67
86
  - lib/flipper/adapters/memoizable.rb
68
87
  - lib/flipper/adapters/memory.rb
69
88
  - lib/flipper/adapters/operation_logger.rb
89
+ - lib/flipper/adapters/poll.rb
90
+ - lib/flipper/adapters/poll/poller.rb
70
91
  - lib/flipper/adapters/pstore.rb
71
92
  - lib/flipper/adapters/read_only.rb
72
93
  - lib/flipper/adapters/sync.rb
@@ -76,6 +97,10 @@ files:
76
97
  - lib/flipper/configuration.rb
77
98
  - lib/flipper/dsl.rb
78
99
  - lib/flipper/errors.rb
100
+ - lib/flipper/export.rb
101
+ - lib/flipper/exporter.rb
102
+ - lib/flipper/exporters/json/export.rb
103
+ - lib/flipper/exporters/json/v1.rb
79
104
  - lib/flipper/feature.rb
80
105
  - lib/flipper/feature_check_context.rb
81
106
  - lib/flipper/gate.rb
@@ -95,6 +120,7 @@ files:
95
120
  - lib/flipper/metadata.rb
96
121
  - lib/flipper/middleware/memoizer.rb
97
122
  - lib/flipper/middleware/setup_env.rb
123
+ - lib/flipper/poller.rb
98
124
  - lib/flipper/railtie.rb
99
125
  - lib/flipper/registry.rb
100
126
  - lib/flipper/spec/shared_adapter_specs.rb
@@ -109,9 +135,12 @@ files:
109
135
  - lib/flipper/types/percentage_of_time.rb
110
136
  - lib/flipper/version.rb
111
137
  - spec/fixtures/feature.json
138
+ - spec/fixtures/flipper_pstore_1679087600.json
112
139
  - spec/flipper/actor_spec.rb
113
140
  - spec/flipper/adapter_spec.rb
114
141
  - spec/flipper/adapters/dual_write_spec.rb
142
+ - spec/flipper/adapters/failover_spec.rb
143
+ - spec/flipper/adapters/failsafe_spec.rb
115
144
  - spec/flipper/adapters/http_spec.rb
116
145
  - spec/flipper/adapters/instrumented_spec.rb
117
146
  - spec/flipper/adapters/memoizable_spec.rb
@@ -125,6 +154,10 @@ files:
125
154
  - spec/flipper/adapters/sync_spec.rb
126
155
  - spec/flipper/configuration_spec.rb
127
156
  - spec/flipper/dsl_spec.rb
157
+ - spec/flipper/export_spec.rb
158
+ - spec/flipper/exporter_spec.rb
159
+ - spec/flipper/exporters/json/export_spec.rb
160
+ - spec/flipper/exporters/json/v1_spec.rb
128
161
  - spec/flipper/feature_check_context_spec.rb
129
162
  - spec/flipper/feature_spec.rb
130
163
  - spec/flipper/gate_spec.rb
@@ -141,6 +174,7 @@ files:
141
174
  - spec/flipper/instrumenters/noop_spec.rb
142
175
  - spec/flipper/middleware/memoizer_spec.rb
143
176
  - spec/flipper/middleware/setup_env_spec.rb
177
+ - spec/flipper/poller_spec.rb
144
178
  - spec/flipper/railtie_spec.rb
145
179
  - spec/flipper/registry_spec.rb
146
180
  - spec/flipper/typecast_spec.rb
@@ -152,9 +186,10 @@ files:
152
186
  - spec/flipper/types/percentage_spec.rb
153
187
  - spec/flipper_integration_spec.rb
154
188
  - spec/flipper_spec.rb
155
- - spec/helper.rb
189
+ - spec/spec_helper.rb
156
190
  - spec/support/descriptions.yml
157
191
  - spec/support/fake_udp_socket.rb
192
+ - spec/support/skippable.rb
158
193
  - spec/support/spec_helpers.rb
159
194
  - test/adapters/memory_test.rb
160
195
  - test/adapters/pstore_test.rb
@@ -164,8 +199,8 @@ homepage: https://github.com/jnunemaker/flipper
164
199
  licenses:
165
200
  - MIT
166
201
  metadata:
167
- changelog_uri: https://github.com/jnunemaker/flipper/blob/master/Changelog.md
168
- post_install_message:
202
+ changelog_uri: https://github.com/jnunemaker/flipper/blob/main/Changelog.md
203
+ post_install_message:
169
204
  rdoc_options: []
170
205
  require_paths:
171
206
  - lib
@@ -180,15 +215,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
215
  - !ruby/object:Gem::Version
181
216
  version: '0'
182
217
  requirements: []
183
- rubygems_version: 3.0.3
184
- signing_key:
218
+ rubygems_version: 3.3.7
219
+ signing_key:
185
220
  specification_version: 4
186
221
  summary: Feature flipper for ANYTHING
187
222
  test_files:
188
223
  - spec/fixtures/feature.json
224
+ - spec/fixtures/flipper_pstore_1679087600.json
189
225
  - spec/flipper/actor_spec.rb
190
226
  - spec/flipper/adapter_spec.rb
191
227
  - spec/flipper/adapters/dual_write_spec.rb
228
+ - spec/flipper/adapters/failover_spec.rb
229
+ - spec/flipper/adapters/failsafe_spec.rb
192
230
  - spec/flipper/adapters/http_spec.rb
193
231
  - spec/flipper/adapters/instrumented_spec.rb
194
232
  - spec/flipper/adapters/memoizable_spec.rb
@@ -202,6 +240,10 @@ test_files:
202
240
  - spec/flipper/adapters/sync_spec.rb
203
241
  - spec/flipper/configuration_spec.rb
204
242
  - spec/flipper/dsl_spec.rb
243
+ - spec/flipper/export_spec.rb
244
+ - spec/flipper/exporter_spec.rb
245
+ - spec/flipper/exporters/json/export_spec.rb
246
+ - spec/flipper/exporters/json/v1_spec.rb
205
247
  - spec/flipper/feature_check_context_spec.rb
206
248
  - spec/flipper/feature_spec.rb
207
249
  - spec/flipper/gate_spec.rb
@@ -218,6 +260,7 @@ test_files:
218
260
  - spec/flipper/instrumenters/noop_spec.rb
219
261
  - spec/flipper/middleware/memoizer_spec.rb
220
262
  - spec/flipper/middleware/setup_env_spec.rb
263
+ - spec/flipper/poller_spec.rb
221
264
  - spec/flipper/railtie_spec.rb
222
265
  - spec/flipper/registry_spec.rb
223
266
  - spec/flipper/typecast_spec.rb
@@ -229,9 +272,10 @@ test_files:
229
272
  - spec/flipper/types/percentage_spec.rb
230
273
  - spec/flipper_integration_spec.rb
231
274
  - spec/flipper_spec.rb
232
- - spec/helper.rb
275
+ - spec/spec_helper.rb
233
276
  - spec/support/descriptions.yml
234
277
  - spec/support/fake_udp_socket.rb
278
+ - spec/support/skippable.rb
235
279
  - spec/support/spec_helpers.rb
236
280
  - test/adapters/memory_test.rb
237
281
  - test/adapters/pstore_test.rb