capssh 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/capssh +4 -0
- data/lib/capssh/version.rb +1 -1
- data/lib/capssh.rb +13 -1
- metadata +1 -1
data/bin/capssh
CHANGED
@@ -29,6 +29,10 @@ OptionParser.new do |opts|
|
|
29
29
|
options[:role] = role
|
30
30
|
end
|
31
31
|
|
32
|
+
opts.on("-c", "--console", "Fire up a rails console in the project's deployment directory after connecting to the machine.") do
|
33
|
+
options[:console] = true
|
34
|
+
end
|
35
|
+
|
32
36
|
opts.on_tail("-h", "--help", "Show this message") do
|
33
37
|
puts opts
|
34
38
|
exit
|
data/lib/capssh/version.rb
CHANGED
data/lib/capssh.rb
CHANGED
@@ -24,7 +24,19 @@ module Capssh
|
|
24
24
|
user = config[:user] || ENV['USER']
|
25
25
|
server = servers.first
|
26
26
|
puts "Connecting to #{environment} #{role} at #{user}@#{server}..."
|
27
|
-
|
27
|
+
|
28
|
+
command = nil
|
29
|
+
if options[:console]
|
30
|
+
command = "cd #{config[:deploy_to]}/current; bundle exec rails console #{config[:rails_env]}"
|
31
|
+
end
|
32
|
+
|
33
|
+
ssh_command = "ssh #{user}@#{server}"
|
34
|
+
if command
|
35
|
+
puts "Running command: #{command}"
|
36
|
+
ssh_command += " -t \"#{command}\""
|
37
|
+
end
|
38
|
+
|
39
|
+
exec ssh_command
|
28
40
|
end
|
29
41
|
|
30
42
|
def display_error_and_exit(error)
|