Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Slightly more idiomatic implementation
Browse files Browse the repository at this point in the history
No functional change, just implementing in a more typical style for a
capistrano task.
  • Loading branch information
bendilley committed Sep 19, 2014
1 parent 8cf382d commit 1972047
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/capistrano/rails/console/tasks/remote.cap
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ namespace :rails do

desc "Interact with a remote rails console"
task console: ['deploy:set_rails_env'] do
app_server = primary :app
ssh_cmd = "ssh #{app_server.netssh_options[:user]}@#{app_server.hostname} -p #{app_server.port || 22}"
cmd = SSHKit::Command.new(:rails, "console #{fetch :rails_env}")
SSHKit.config.output << cmd
exec %Q(#{ssh_cmd} -t "cd #{current_path} && (#{cmd.environment_string} #{cmd})")
on primary :app do |host|
ssh_cmd = "ssh #{host.netssh_options[:user]}@#{host.hostname} -p #{host.port || 22}"
cmd = SSHKit::Command.new(:rails, "console #{fetch :rails_env}")
SSHKit.config.output << cmd
exec %Q(#{ssh_cmd} -t "cd #{current_path} && (#{cmd.environment_string} #{cmd})")
end
end

end

0 comments on commit 1972047

Please sign in to comment.