Sha256: 5e3bdc60fb2dd0f0b1e608c049f66103d7eb9b850be6147ca2a8cce96442c537

Contents?: true

Size: 981 Bytes

Versions: 36

Compression:

Stored size: 981 Bytes

Contents

require 'bundler/setup'
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.adapter { Flipper::Adapters::Redis.new(redis) }
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

36 entries across 36 versions & 1 rubygems

Version Path
flipper-rollout-1.3.2 examples/rollout/import.rb
flipper-rollout-1.3.1 examples/rollout/import.rb
flipper-rollout-1.3.0 examples/rollout/import.rb
flipper-rollout-1.3.0.pre examples/rollout/import.rb
flipper-rollout-1.2.2 examples/rollout/import.rb
flipper-rollout-1.2.1 examples/rollout/import.rb
flipper-rollout-1.2.0 examples/rollout/import.rb
flipper-rollout-1.1.2 examples/rollout/import.rb
flipper-rollout-1.1.1 examples/rollout/import.rb
flipper-rollout-1.1.0 examples/rollout/import.rb
flipper-rollout-1.0.0 examples/rollout/import.rb
flipper-rollout-1.0.0.pre examples/rollout/import.rb
flipper-rollout-0.28.3 examples/rollout/import.rb
flipper-rollout-0.28.2 examples/rollout/import.rb
flipper-rollout-0.28.1 examples/rollout/import.rb
flipper-rollout-0.28.0 examples/rollout/import.rb
flipper-rollout-0.27.1 examples/rollout/import.rb
flipper-rollout-0.27.0 examples/rollout/import.rb
flipper-rollout-0.26.2 examples/rollout/import.rb
flipper-rollout-0.26.0 examples/rollout/import.rb