ffe 1.0.1 → 1.1.1

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: 62134d82b78fed902a3390a6ceed90c803c7de2030bcd148170d2ee8a00b9de3
4
+ data.tar.gz: d8991bdd7f059ecd3b62e564beb20f64ed2e3ac8b0bf6350ea9ed042628b5214
5
5
  SHA512:
6
- metadata.gz: c95f548a1454295b6d2cb3b44094ea1cf1c9f9ff7b47f581e0b505a98a764b4aac1ddea369b5f5dfdb46e80ecaa2ee3b928aa466824f933657a690c9ffed5cba
7
- data.tar.gz: 0c0af9624635f4c398a24822d77ea08ade783dee0c5e8ef901e74e9ae19575d615782353ab5f4d28677d20f26de549687b94cc8c8f8abf5f3293f78c22a85690
6
+ metadata.gz: 60b2d15d75fc98affa4e44fd8617d0e1dbfa8991ba724c28205e65ec3310d2b76fd3b0776443e81f99bc460a2805cc7ad39f7c05c2d2ef30de94e77fb0bf3168
7
+ data.tar.gz: '0528ad0aa840e05741bb350b6bd14439a5c2c14648185556e092a7e12665f9fcb5718ed4cf0c12e708a01d49ab986be5b79464e577bef4eedcd8d6808973ba27'
data/README.md CHANGED
@@ -41,7 +41,7 @@ $ bin/rails db:migrate
41
41
 
42
42
  Mount the engine in your application's `config/routes.rb` file:
43
43
  ```ruby
44
- mount Ffe::Engine => "/feature_flags"
44
+ mount Ffe::Engine => "/ffe"
45
45
  ```
46
46
 
47
47
  ### Views
@@ -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.
@@ -20,7 +20,7 @@ module Ffe
20
20
  @feature_flag = Ffe::FeatureFlag.new(feature_flag_params.except(:milieus, :clear_expires_at))
21
21
 
22
22
  if @feature_flag.save
23
- redirect_to feature_flag_path(@feature_flag), notice: 'FFE wurde erstellt.'
23
+ redirect_to feature_flag_path(@feature_flag), notice: 'FFE created.'
24
24
  else
25
25
  render :new, status: :unprocessable_content
26
26
  end
@@ -28,7 +28,7 @@ module Ffe
28
28
 
29
29
  def update
30
30
  if @feature_flag.update(feature_flag_params.except(:milieus, :clear_expires_at))
31
- redirect_to feature_flag_path(@feature_flag), notice: 'FFE wurde aktualisiert.'
31
+ redirect_to feature_flag_path(@feature_flag), notice: 'FFE updated.'
32
32
  else
33
33
  render :edit, status: :unprocessable_content
34
34
  end
@@ -36,11 +36,11 @@ module Ffe
36
36
 
37
37
  def destroy
38
38
  @feature_flag.destroy
39
- redirect_to feature_flags_path, notice: 'FFE wurde gelöscht.'
39
+ redirect_to feature_flags_path, notice: 'FFE destroyed.'
40
40
  end
41
41
 
42
42
  def dump
43
- render json: Ffe::FeatureFlag.order(:name).map { |ff| ff.attributes.slice('name', 'description', 'enabled', 'milieu', 'expires_at', 'percentage') }
43
+ render json: Ffe::FeatureFlag.order(:name).map { |ff| ff.attributes.slice('name', 'description', 'enabled', 'milieu', 'expires_at') }
44
44
  end
45
45
 
46
46
  private
@@ -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.1'
5
5
  end
@@ -4,6 +4,6 @@
4
4
  "description": "A general testing FF.",
5
5
  "enabled": true,
6
6
  "milieu": "1000",
7
- "expires_at": null,
7
+ "expires_at": null
8
8
  }
9
9
  ]
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.1
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