Commit b51e6d6d authored by Rémy Coutable's avatar Rémy Coutable

Update flipper to 0.11.0 and take advantage of the new features

- Added an ActiveSupport (using Rails.cache) caching adapter
- Overview of the new features can be found at https://johnnunemaker.com/flippin-features-at-runtime/
- Full Changelog can be found at https://github.com/jnunemaker/flipper/blob/v0.11.0/Changelog.mdSigned-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 54c2d7bd
......@@ -405,8 +405,9 @@ gem 'gitaly-proto', '~> 0.59.0', require: 'gitaly'
gem 'toml-rb', '~> 0.3.15', require: false
# Feature toggles
gem 'flipper', '~> 0.10.2'
gem 'flipper-active_record', '~> 0.10.2'
gem 'flipper', '~> 0.11.0'
gem 'flipper-active_record', '~> 0.11.0'
gem 'flipper-active_support_cache_store', '~> 0.11.0'
# Structured logging
gem 'lograge', '~> 0.5'
......
......@@ -215,10 +215,13 @@ GEM
path_expander (~> 1.0)
ruby_parser (~> 3.0)
sexp_processor (~> 4.0)
flipper (0.10.2)
flipper-active_record (0.10.2)
flipper (0.11.0)
flipper-active_record (0.11.0)
activerecord (>= 3.2, < 6)
flipper (~> 0.10.2)
flipper (~> 0.11.0)
flipper-active_support_cache_store (0.11.0)
activesupport (>= 3.2, < 6)
flipper (~> 0.11.0)
flowdock (0.7.1)
httparty (~> 0.7)
multi_json
......@@ -1021,8 +1024,9 @@ DEPENDENCIES
faraday (~> 0.12)
ffaker (~> 2.4)
flay (~> 2.8.0)
flipper (~> 0.10.2)
flipper-active_record (~> 0.10.2)
flipper (~> 0.11.0)
flipper-active_record (~> 0.11.0)
flipper-active_support_cache_store (~> 0.11.0)
fog-aliyun (~> 0.2.0)
fog-aws (~> 1.4)
fog-core (~> 1.44)
......
require 'flipper/middleware/memoizer'
require 'flipper/adapters/active_record'
require 'flipper/adapters/active_support_cache_store'
unless Rails.env.test?
Rails.application.config.middleware.use Flipper::Middleware::Memoizer,
lambda { Feature.flipper }
Flipper.configure do |config|
config.default do
adapter = Flipper::Adapters::ActiveRecord.new(
feature_class: Feature::FlipperFeature, gate_class: Feature::FlipperGate)
cached_adapter = Flipper::Adapters::ActiveSupportCacheStore.new(
adapter,
Rails.cache,
expires_in: 10.seconds)
Flipper.new(cached_adapter)
end
end
Feature.register_feature_groups
Feature.register_feature_groups
unless Rails.env.test?
require 'flipper/middleware/memoizer'
Rails.application.config.middleware.use Flipper::Middleware::Memoizer
end
require 'flipper/adapters/active_record'
class Feature
# Classes to override flipper table names
class FlipperFeature < Flipper::Adapters::ActiveRecord::Feature
......@@ -62,12 +60,7 @@ class Feature
end
def flipper
@flipper ||= begin
adapter = Flipper::Adapters::ActiveRecord.new(
feature_class: FlipperFeature, gate_class: FlipperGate)
Flipper.new(adapter)
end
@flipper ||= Flipper.instance
end
# This method is called from config/initializers/flipper.rb and can be used
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment