Corral

Use Corral to disable certain features in your application.
Is it any good?
What was your inspiration?
I love Paddock (for which Corral should be a nearly drop-in replacement), but found its Rails environment specific approach to be too concrete for my needs. Specifically, I wanted to toggle my features on arbitrary--or at least callable--Ruby expressions.
Setup
Put this somewhere like: config/initializers/corral.rb
include Corral
corral do
disable :torpedoes, when: -> { true }
disable :fun_and_games, when: -> { Rails.env.production? }
disable :cupcakes, if: ->(person) { person == "Bryan" }
end
("when" and "if" mean the same thing. Use whichever makes you happy.)
Usage
fire! if enabled?(:torpedoes)
sulk if disabled?(:cupcakes, "Bryan") # And I don't even *like* sweets!
Installation
Add this line to your application's Gemfile:
gem 'corral'
And then execute:
$ bundle
Or install it yourself as:
$ gem install corral
Contributing
- Fork it
- 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 new Pull Request