We are using Mina to deploy our Rails4 app after switching from Capistrano. On cap we could do cap production deploy:invoke task="namespace:taskname"
where invoke task was a custom deploy task that took arguments to execute a specified rake task on a given environment.
How to pass arguments to mina to run specified rake tasks?
So far the closest to argument passing in mina I have seen is mina deploy to=staging
.
I am looking for usage close to mina invoke namespace:taskname
that would cd into app's /current directory and do a bundle exec rake namespace:taskname
.
This seems simple enough, what am I missing?
Edit As per Guy Teube's suggestion in /config/deploy.rb I now have
set :task, ENV['TASK']
set :current, "#{deploy_to}/current"
desc "Invokes a raketask"
task :invoke => :environment do
queue "cd #{current} && bundle exec rake #{task}"
end
Running mina invoke TASK=old:votes --simulate
does not work yet, outputs "cd /home/deployer/apps/manabalss/current && bundle exec rake
"
(Notice the string terminating without TASK environmental variable not having been taken into account.