Feature toggle for Ruby on Rails applications
Ruby JavaScript
Switch branches/tags
Nothing to show
Latest commit 4e8c8e8 Mar 21, 2012 @jaymcaliley jaymcaliley Update README.md
Permalink
Failed to load latest commit information.
lib Initial commit Mar 16, 2012
test_app Initial commit Mar 16, 2012
LICENSE.txt Add license & update gemspec Mar 16, 2012
README.md Update README.md Mar 21, 2012
togg.gemspec Add license & update gemspec Mar 16, 2012

README.md

Togg

Togg implements feature toggle for Ruby on Rails applications. Martin Fowler has a good article that discusses feature toggle: http://martinfowler.com/bliki/FeatureToggle.html

Usage

Include togg in the Gemfile for your Rails 3 application:

gem 'togg'

To use togg, simply create a YAML configuration file that lists your application features, then wrap your feature-specific code in blocks.

Example

The settings file is based on the yettings gem. You define features for each of your Rails environments:

# File: config/yettings/togg.yml

defaults: &defaults
  some_active_feature: true
  some_pending_feature: false

development:
  <<: *defaults

test:
  <<: *defaults

production:
  <<: *defaults

Then, in your Rails application, wrap feature-specific code like this:

Togg.le(:some_active_feature) do
  puts "Look at this feature go"
end

Togg.le(:some_pending_feature) do
  puts "Wait, this feature isn't ready yet"
end

The features with keys that evaluate to true in your yaml file get executed, and the others don't.