LouisSayers / feature-toggles

Ruby gem to Toggle a feature on or off in a certain rails environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FeatureToggles

Toggle a feature on or off in an environment.

This gem is made to be used in Rails projects.

  1. Add the gem to your project (in Gemfile place gem ‘feature-toggles’)

  2. In your config folder place a file named “feature_toggles.yml”

  3. Set features for various environments like so:

development:
    my_cool_feature:
      enabled: true

    another_feature:
      enabled: true
test:
  my_cool_feature:
    enabled: false

  another_feature:
    enabled: true
  1. require ‘feature_toggles’ #in application.rb after Bundler.require(*Rails.groups)

  2. Test if a feature is enabled like the following:

if FeatureToggles::Feature.is_enabled?(:my_cool_feature)
   render 'my_new_feature' and return
end

And don’t forget to delete your toggles if they’re no longer needed ;)

About

Ruby gem to Toggle a feature on or off in a certain rails environment.

License:MIT License


Languages

Language:Ruby 94.5%Language:JavaScript 2.9%Language:CSS 2.6%