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

Commit 78909a2

Browse files
committed
Slightly more idiomatic implementation
No functional change, just implementing in a more typical style for a capistrano task.
1 parent 8cf382d commit 78909a2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
namespace :rails do
22

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

1213
end

0 commit comments

Comments
 (0)