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