I already have a deploy.rb that can deploy my app on my production server.
My app contains a custom rake task (a .rake file in the lib/tasks directory).
I\
This worked for me:
task :invoke, :command do |task, args| on roles(:app) do within current_path do with rails_env: fetch(:rails_env) do execute :rake, args[:command] end end end end
Then simply run cap production "invoke[task_name]"
cap production "invoke[task_name]"