Togl
Installation
Add this line to your application's Gemfile:
gem 'togl'
And then execute:
$ gem install -g
Or install it directly:
$ gem install togl
Usage
First have a configuration file where you add features as you introduce them
Togl.configure do
use Togl::Adapter::RackSession.new
feature :recommendations
feature :threaded_comments
end
This example uses only one adapter, one that monitors get parameters for special
enable_features
or disable_features
keys. To make it work, add the
Togl::Rack::Middleware
to your Rack stack.
use Togl::Rack::Middleware
Now in your code you can check if a feature is on
if Togl.on? :recommendations
# ... implement the feature ...
end
Have a look at the rails_example/
directory for how to use it with Rails, in
particular how to have a "features" model, so you can do this on the console:
> Feature.enable! :recommendations
> Feature.disable! :recommendations
> Feature.reset! :recommendations
Contributing
- Fork it ( https://github.com/plexus/togl/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