Project

togg

0.0
No commit activity in last 3 years
No release in over 3 years
Togg implements a simple feature toggler for a Rails application. Features are managed in a yaml configuration file, then wrapped in a toggle block.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

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.