Update Feature Flags with Capistrano and Rake

After you have feature flags setup in your app, you’re likely to want to enable/disable them easily. Frequently this is done on more of an ad-hoc basis and doesn’t necessarily warrant an interface from within your app.

This sort of ad-hoc activity is a good match for Rake and Capistrano.

Rake Tasks

Here is a basic set of Rake tasks for enabling/disabling feature flags. Note – I’m using Mongoid for the ORM.

[gist id=”7229954″]

 Capistrano Recipe

We can leverage Capistrano to make the Rake tasks available remotely.

[gist id=”7230011″]

Running the Recipe

Now, enabling or disabling a feature flag on an account is as easy as running a Capistrano recipe.

[gist id=”7230054″]