Sometimes we need to execute set of commands (tasks) after/before deployment. Most likely you use migrations for such things, but that is not what is related to migration at all. Also sometimes you need to execute some code before migration or later, after migration without blocking of main thread.
deploy_pins is exactly what you need.
To generate new task template file
rails g deploy_pin:task
# or
rails g deploy_pin:task --parallel
To list all pending tasks
rake deploy_pin:list
To run all pending tasks
rake deploy_pin:run
Please define allowed groups in config/initializers/deploy_pin.rb
if you want to group tasks around "allowed_group"
rails g deploy_pin:task allowed_group
# or
rails g deploy_pin:task allowed_group --parallel
To list all pending tasks
rake deploy_pin:list[allowed_group]
To run all pending tasks
rake deploy_pin:run[allowed_group]
To run some specific task by uuid
rake deploy_pin:run['uuid_1, uuid_2']
Or you can combine uuid and group
rake deploy_pin:run['uuid, allowed_group']
In case if you want to rerun task you should add exclamation mark in the end of uuid
rake deploy_pin:run['uuid_1!, uuid_2!']
Add this line to your application's Gemfile:
gem 'deploy_pin'
And then execute:
$ bundle
Or install it yourself as:
$ gem install deploy_pin
then generate configuration file
rails g deploy_pin:install
and run migration
rake db:migrate
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.