StagingProtection
A simple gem is desinged to hide staging apps from search engines and public access.
Installation
Add this line to your application's Gemfile:
gem 'staging_protection'
And then execute:
$ bundle
Or install it yourself as:
$ gem install staging_protection
Then run:
$ rake staging_protection:initialize
Or create config file manualy.
Usage
Set up your credentials in config file.
Don't forget to restart web server. And that's it. Open http://localhost:3000
(or your site url) and you'll see it is forbidden.
Once use http://localhost:3000/?pass=<your password from config>
. Now you can walk trough your site without any password. Token is stored in cookies.
Customizing access
You can add an exclision conditions. For example, you don't want to protect action main from HomeController. This is very easy. Set method protection_exclusion
to your HomeController.
def protection_exclusion
params[:action] == 'main'
end
And here you are. Action main is not blocked now.
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