This gem was design to just one thing and do it well. (me thinks)
This gem is an overly simple implementation of feature flagging. The reason for that was, I found it easier to write a gem and learn how feature flagging works as opposed to learning from one of the existing feature gems.
Add this line to your application's Gemfile:
gem 'simple_features'
And then execute:
$ bundle
Or install it yourself as:
$ gem install simple_features
this can be assigned any where in code as
features = SimpleFeatures::Features.new( { feature_a: true, feature_a: false } )
puts "feature_a" if features.feature_a?
puts "feature_b" if features.feature_b?
features = SimpleFeatures::Features.load_config('config/simple_features.yml')
production:
feature_one: true
feature_two: false
feature_three: true
puts features.feature_one?
>> true
puts features.feature_two?
>> false
puts features.feature_three?
>> true
Rails
only needs to have the config file in config/simple_features.yml
rails generate simple_features
this will drop a template config: config/simple_features.yml
if you want to use the generator to create with feature names do the following
rails generate simple_features --features new_tool old_tool new_idea
puts features.new_idea?
>> true
<body>
<%= link_to 'New Feature', new_feature_path if features.new_feature? %>
</body>
“it’s simple” using simple features wrap around debugging coding (dont do this , its an example )
logger.debug "some aweomse words!" if features.debugging?
Some!. “it’s simple...” ok you got me I should write MOAR! tests.