DeployHooks
This tiny gem allows to define tasks which will start before and/or after deployment app to heroku.
Installation
Add this line to your application's Gemfile:
gem 'deploy_hooks'
And then execute:
$ bundle
Usage
At first u should have rake or thor tasks that will be used as hooks.
You need to define your hooks in initializer initializers/deploy_hooks.rb
like that:
DeployHooks.config do |config|
config.environments = { stage: 'your-appname-at-stage', production: 'your-appname-at-production' }
config.before_deploy = { rake: %w[ your_rake_task ], thor: %w[ your_thor_task ] }
config.after_deploy = { rake: %w[ db:migrate another_your_rake_task ], thor: %w[ another_your_thor_task ] }
end
Also make sure that [push] default = tracking
has been added to .git/config
in your_project_folder
After that, you can execute rake deploy:<environment>
(for example rake deploy:stage
) for pushing your app to heroku with before_deploy and/or after_deploy hooks.
Notice
This gem was created for personal educational purposes and I'll be glad if it could find application in any other projects.
Gratitude
Thanks to Michael Dwan and his Article Thanks to ExReanimator for guiding
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