Build Status Code Climate Issue Count

FeatureFlagger

Partial release your features.

Installation

Add this line to your application's Gemfile:

gem 'feature_flagger'

And then execute:

$ bundle

Or install it yourself as:

$ gem install feature_flagger

Configuration

  1. Configure redis by adding config/initializers/feature_flagger.rb:

    FeatureFlagger.configure do |config|
    config.storage.redis = $redis
    end
    
  2. Create a rollout.yml in config path and declare a rollout:

    account: # model name
    email_marketing: # namespace (optional)
    new_email_flow: # feature key
      description:
        @dispatch team uses this rollout to introduce a new email flow for certains users. Read more at [link]
    
  3. Adds rollout funcionality to your model:

    class  < ActiveRecord::Base
    include FeatureFlagger::Model
    # ....
    end
    

Usage

 = .first

# Release feature for account
.release!([:email_marketing, :new_email_flow])
#=> true

# Check feature for a given account
.rollout?([:email_marketing, :new_email_flow])
#=> true

# Remove feature for given account
.unrelease!([:email_marketing, :new_email_flow])
#=> true

# If you try to check an inexistent rollout key it will raise an error.
.rollout?([:email_marketing, :new_email_flo])
FeatureFlagger::KeyNotFoundError: ["account", "email_marketing", "new_email_flo"]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ResultadosDigitais/feature_flagger.