Sha256: 5725d557d537920f1ec713b27288a7d326af06b068030eb50362be750239b709

Contents?: true

Size: 1.11 KB

Versions: 21

Compression:

Stored size: 1.11 KB

Contents

require 'pathname'
require 'logger'

root_path = Pathname(__FILE__).dirname.join('..').expand_path
lib_path  = root_path.join('lib')
$:.unshift(lib_path)

require 'redis'
require 'rollout'
require 'flipper'
require 'flipper/adapters/redis'
require 'flipper/adapters/rollout'

# setup redis, rollout and rollout flipper
redis = Redis.new
rollout = Rollout.new(redis)
rollout_adapter = Flipper::Adapters::Rollout.new(rollout)
rollout_flipper = Flipper.new(rollout_adapter)

# setup flipper default instance
Flipper.configure do |config|
  config.default do
    Flipper.new(Flipper::Adapters::Redis.new(redis))
  end
end

# flush redis so we have clean state for script
redis.flushdb

# activate some rollout stuff to show that importing works
rollout.activate(:stats)
rollout.activate_user(:search, Struct.new(:id).new(1))
rollout.activate_group(:admin, :admins)

# import rollout into redis flipper
Flipper.import(rollout_flipper)

# demonstrate that the rollout enablements made it into flipper
p Flipper[:stats].boolean_value # true
p Flipper[:search].actors_value # #<Set: {"1"}>
p Flipper[:admin].groups_value # #<Set: {"admins"}>

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
flipper-rollout-0.20.4 examples/rollout/import.rb
flipper-rollout-0.20.3 examples/rollout/import.rb
flipper-rollout-0.20.2 examples/rollout/import.rb
flipper-rollout-0.20.1 examples/rollout/import.rb
flipper-rollout-0.20.0 examples/rollout/import.rb
flipper-rollout-0.20.0.beta3 examples/rollout/import.rb
flipper-rollout-0.20.0.beta2 examples/rollout/import.rb
flipper-rollout-0.20.0.beta1 examples/rollout/import.rb
flipper-rollout-0.19.1 examples/rollout/import.rb
flipper-rollout-0.19.0 examples/rollout/import.rb
flipper-rollout-0.18.0 examples/rollout/import.rb
flipper-rollout-0.17.2 examples/rollout/import.rb
flipper-rollout-0.17.1 examples/rollout/import.rb
flipper-rollout-0.16.2 examples/rollout/import.rb
flipper-rollout-0.16.1 examples/rollout/import.rb
flipper-rollout-0.16.0 examples/rollout/import.rb
flipper-rollout-0.15.0 examples/rollout/import.rb
flipper-rollout-0.14.0 examples/rollout/import.rb
flipper-rollout-0.13.0 examples/rollout/import.rb
flipper-rollout-0.13.0.beta1 examples/rollout/import.rb