Plug

A Rails engine to turn on/off features (Feature flipper).
Features
- Supports Rails 3 and above
- MySQL
- Set notices
Prerequisites
- Rails version 3 and above
- MySQL
Getting Started
Add this line to your application's Gemfile:
gem 'plug'
Execute:
→ bundle
And run the install generator:
→ rails g plug:install
→ rails g plug:install:migrations
→ rails db:migrate # Newer version of Rails
→ rake db:migrate # Older version of Rails
→ rails s
Usage
Go to localhost:3000/plug and start creating features.
Use the provided method to check if the feature is enabled.
Plug.enabled?('my-awesome-feature-slug')
If you wanted to restrict routes, you can use Plug::Constraint class
Rails.application.routes.draw do
resources :blog, constraint: Plug::Constraint.new('my-awesome-feature-slug')
end
Notices can be displayed using the Plug.notice method.
<%= Plug.notice('my-awesome-feature-slug') %>
If you have custom HTML for notice, you can pass a block.
<% Plug.notice('my-awesome-feature-slug') do |notice| %>
<div class="alert">
<p><%= notice %></p>
</div>
<% end %>
Running the tests
→ bundle exec rspec spec
Publishing to rubygems.org
Make sure to bump the version. Rubygems don't accept version overrides.
→ gem build plug.gemspec
→ gem push plug-<version>.gem
TODOs
- Ability to disable all features using one button
- Add screenshot
- Allow block parameters for
enabled?method - Versioning of features
- History of feature activities
Questions/Issues?
File a new issue if you have questions or issues.
Contributing
- Fork it ( https://github.com/boost/plug/fork )
- Create your feature branch (
git checkout -b my-awesome-feature) - Commit your changes (
git commit -am 'Add my awesome feature!') - Push to the branch (
git push origin my-awesome-feature) - Create a new Pull Request