ec2-ssh 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ec2-ssh.rb +1 -1
- data/lib/ec2-ssh/cli.rb +4 -1
- data/lib/ec2-ssh/ssh.rb +20 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30ebd411bd39993aa0375b74cfdeddd0c8320b14
|
4
|
+
data.tar.gz: 1a6e3704a9c57f0a5bc5c8aca455f8b4662faba6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1d38276a5e2dceb6d3f02a2399ad76abaa2601effc09caac196266c4bf717dc5a24aa6352b50946e0e889f83ea668bb20c9ebb3f6386b2b5eb1e3a1a22f220
|
7
|
+
data.tar.gz: 19d8aa349f32b64ec61ce1ddc45ec7eaf80e05c6deed939320feef614d30008dce589c17d4b0d05875e75340a5926534514b06911cf2a1737ed6dc283ba227f8
|
data/lib/ec2-ssh.rb
CHANGED
data/lib/ec2-ssh/cli.rb
CHANGED
@@ -31,6 +31,9 @@ class Ec2Ssh::Cli < Thor
|
|
31
31
|
method_option :tag_value, :desc => 'tag value to filter instances by'
|
32
32
|
method_option :terminal, :aliases => 't', :desc => 'open terminal tabs for all servers'
|
33
33
|
method_option :capture_output, :aliases => 'c', :desc => 'capture output'
|
34
|
+
method_option :upload, :desc => 'upload a file - source,destination (make sure seperate these by comma)', :banner => 'source,destination'
|
35
|
+
method_option :download, :desc => 'download a file - source,destination (make sure seperate these by comma)', :banner => 'source,destination'
|
36
|
+
|
34
37
|
def connect
|
35
38
|
extend Aws
|
36
39
|
extend Ssh
|
@@ -68,7 +71,7 @@ class Ec2Ssh::Cli < Thor
|
|
68
71
|
dsl_options[:limit] = options[:groups_limit] if options[:groups_limit]
|
69
72
|
|
70
73
|
say "dsl opts: #{dsl_options}", color = :cyan
|
71
|
-
ssh_to(options[:user], dsl_options, options[:cmd], options[:capture_output])
|
74
|
+
ssh_to(options[:user], dsl_options, options[:cmd], options[:capture_output], options[:upload], options[:download])
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
data/lib/ec2-ssh/ssh.rb
CHANGED
@@ -12,12 +12,29 @@ module Ec2Ssh::Cli::Ssh
|
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
15
|
-
def ssh_to(user, dsl_options, cmd, capture_output)
|
15
|
+
def ssh_to(user, dsl_options, cmd, capture_output, upload, download)
|
16
16
|
say "Running #{cmd} via ssh in #{dsl_options}", color = :cyan
|
17
17
|
on @all_servers, dsl_options do |host|
|
18
|
-
|
18
|
+
|
19
|
+
if upload
|
20
|
+
file = upload.split(',').map { |e| e.strip }
|
21
|
+
source = File.expand_path(file.first)
|
22
|
+
destination = file.last
|
23
|
+
puts "uploading #{source} to #{destination}..."
|
24
|
+
upload! source, destination
|
25
|
+
end
|
26
|
+
|
27
|
+
if download
|
28
|
+
file = download.split(',').map { |e| e.strip }
|
29
|
+
source = file.first
|
30
|
+
destination = File.expand_path(file.last)
|
31
|
+
puts "downloading #{source} to #{destination}..."
|
32
|
+
download! source, destination
|
33
|
+
end
|
34
|
+
|
35
|
+
if capture_output
|
19
36
|
puts capture cmd
|
20
|
-
|
37
|
+
elsif upload.nil? && download.nil?
|
21
38
|
execute cmd
|
22
39
|
end
|
23
40
|
end
|