Created
April 24, 2015 14:46
-
-
Save joshukraine/bb40168de26d0d99a917 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/capistrano/tasks/remote_rake_task.rake | |
# | |
# This task allows you to run rake tasks on the remote server using Capistrano. | |
# The rake task itself is passed in as an argument. | |
# Example: | |
# bin/cap staging "task:invoke[app:setup]" | |
# | |
# References: | |
# http://www.jetthoughts.com/blog/magic/2013/09/26/capistrano-3-passing-parameters-to-your-task.html | |
# http://stackoverflow.com/questions/23828950/how-to-run-custom-rake-task-via-capistrano-3 | |
namespace :task do | |
desc 'Execute a specific rake task' | |
task :invoke, :command do |task, args| | |
on roles(:app) do | |
within release_path do | |
with rails_env: fetch(:rails_env) do | |
execute :rake, args[:command] | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment