Experiment::Light
Turn features on or off in various rails environments
Installation
Add this line to your application's Gemfile:
gem 'experiment_light'
And then execute:
$ bundle
Or install it yourself as:
$ gem install experiment_light
Usage
Run install generator:
$ rails generate experiment_light:install
A yaml file named experiment.yml will be added into config/ after running install generator, now your can define your experimental features:
foo:
development: true
test: true
production: false
bar:
development: false
test: true
production: false
Now you can use it in your views like this:
<% if ExperimentLight::Experiment.on?(:foo) %>
<p>Experiment foo is on</p>
<% end %>
<% if ExperimentLight::Experiment.off?(:bar) %>
<p>Experiment bar is off</p>
<% end %>
Contributing
- Fork it ( https://github.com/[my-github-username]/experiment_light/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request