Created
December 13, 2013 16:01
-
-
Save stas/7946457 to your computer and use it in GitHub Desktop.
Capistrano 3 console (Rails/SSH) tasks
This file contains 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
namespace :rails do | |
desc 'Opens the Rails console' | |
task :console => ['deploy:set_rails_env'] do | |
on primary fetch(:migration_role) do | |
within release_path do | |
with rails_env: fetch(:rails_env) do | |
cmd_string = command(:rails, 'console').to_command | |
exec 'ssh %s -l %s -p %s -t "%s"' % [ | |
host.hostname, host.username, host.port, cmd_string] | |
end | |
end | |
end | |
end | |
end | |
namespace :deploy do | |
desc 'Opens an interactive remote shell' | |
task :console do | |
on roles(:all) do | |
exec 'ssh %s -l %s -p %s' % [ | |
host.hostname, host.username, host.port] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment