Last Updated: February 25, 2016
·
2.777K
· subosito

Invoke any rake tasks on capistrano

Add below lines to deploy.rb

namespace :deploy do
  desc "Invoke rake task"
  task :invoke do
    run "cd '#{current_path}' && #{rake} #{ENV['task']} RAILS_ENV=#{rails_env}"
  end
end

Sample usages:

cap deploy:invoke task=db:seed
cap deploy:invoce task=another:rake-task

That's it :)