ffe 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6257e0d5cca9bdc5562b54fc2d0495e3e5bd0faacf6ffd5e1fcb32723a602ad
4
- data.tar.gz: 5df5936bd8f0b7ca43cb5d1183416db4e8d9db688ddf46b89c3648a5367516b4
3
+ metadata.gz: bc9df5fa6a078e973d4438f204a8553788e7de77b2950b50217a47fbc5a5266b
4
+ data.tar.gz: 58aac8290a5110258baeba62751fc9140e8cf169b3f8dc2114fd50a5cabae3ef
5
5
  SHA512:
6
- metadata.gz: c95f548a1454295b6d2cb3b44094ea1cf1c9f9ff7b47f581e0b505a98a764b4aac1ddea369b5f5dfdb46e80ecaa2ee3b928aa466824f933657a690c9ffed5cba
7
- data.tar.gz: 0c0af9624635f4c398a24822d77ea08ade783dee0c5e8ef901e74e9ae19575d615782353ab5f4d28677d20f26de549687b94cc8c8f8abf5f3293f78c22a85690
6
+ metadata.gz: '0081895d477c3c7e6aba7094b4e2fe1236cbdab2004d13038c44cb646549c2e4aa59f91a0463b75c5a96a1a0a9c0abf6a6cca6928b3f172fdd0bd3afb597251b'
7
+ data.tar.gz: b2bf253a661d493ca8682ddf437d8270334f17c1952b376263f8f947d906bc06eb8a14cbbc0f1ff4b5d21bc12272925b3fb32d286217b85075582c0a9ea5f16e
data/README.md CHANGED
@@ -93,7 +93,7 @@ Run your app and go to [http://localhost:3000/ffe/feature_flags](http://localhos
93
93
 
94
94
  **Use Case**: Set a feature flag for an announcement, or something similar, for a specific period of time.
95
95
 
96
- > This requires the use of ActiveJob; currently, only `SolidQueue` and `Sidekiq` are supported. But feel free to add more.
96
+ > This requires the use of ActiveJob; currently, only `SolidQueue` and `Sidekiq` adapters are supported. But feel free to add more.
97
97
 
98
98
  1. Create a feature flag in production, but without setting the expires date.
99
99
  2. Dump the flags, then replace the `config/feature_flags.json` file locally and commit it.
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AsyncAdapter
4
+ extend ActiveSupport::Concern
5
+
6
+ def adapter_job # rubocop:disable Naming/PredicateMethod
7
+ false
8
+ end
9
+ end
@@ -2,10 +2,13 @@
2
2
 
3
3
  module Ffe
4
4
  class FeatureFlag < ApplicationRecord
5
- if Ffe.config.queue_adapter == :solid_queue
5
+ case Ffe.config.queue_adapter
6
+ when :solid_queue
6
7
  include SolidQueueAdapter
7
- elsif Ffe.config.queue_adapter == :sidekiq
8
+ when :sidekiq
8
9
  include SidekiqAdapter
10
+ else
11
+ include AsyncAdapter
9
12
  end
10
13
 
11
14
  self.table_name = 'feature_flags'
@@ -16,7 +19,7 @@ module Ffe
16
19
  validates :expires_at, comparison: { greater_than: Time.current.end_of_day }, if: -> { expires_at.present? && expires_at_changed? } # rubocop:disable Layout/LineLength
17
20
 
18
21
  # callbacks
19
- after_save_commit :handle_change_job, unless: -> { Rails.env.test? }
22
+ after_save_commit :handle_change_job, if: -> { %i[solid_queue sidekiq].include?(Ffe.config.queue_adapter) }
20
23
  before_destroy :destroy_job
21
24
 
22
25
  # the Flag functionality itself
data/lib/ffe/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ffe
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - LeFnord
@@ -40,6 +40,7 @@ files:
40
40
  - app/jobs/ffe/application_job.rb
41
41
  - app/jobs/ffe/expired_handling_job.rb
42
42
  - app/mailers/ffe/application_mailer.rb
43
+ - app/models/concerns/async_adapter.rb
43
44
  - app/models/concerns/sidekiq_adapter.rb
44
45
  - app/models/concerns/solid_queue_adapter.rb
45
46
  - app/models/ffe/application_record.rb