owssh 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/owssh.rb +22 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 119757f4df66b0ce7363d69327d32c34ed7eed12
4
- data.tar.gz: 07248084f1163c85906794fd5d6a6a0bc18fac68
3
+ metadata.gz: 660754a1350eb09b581b100f6eddd9f0ddb17321
4
+ data.tar.gz: 98d3cb4b997f4315ce10549b1556e16eb9cb1ed2
5
5
  SHA512:
6
- metadata.gz: de09fcb9d6dfd78287994ebc0dbc4ee5958ba9b707fc05116f16b091e2f7ea475aae200d66e2291aecfb302b535bd4768252d9749870ab36f6edf0eda4b65b0b
7
- data.tar.gz: 3dce13b0fc61e967d2050cc88e2fa5aa4e621f3a4e444f1e223af5be6e09dd1470bdf93dde50c88a5c3b171f54827004b235b3b97913f45fc9a784d59e980dad
6
+ metadata.gz: 9efe9cc6596060271d5bdef9ff1d61d725e1903bf1ff5f7940f0937d00dc929d351a64dc5f9bb341e6e369e756d9fd7eda50d5e691325ab9430c3ef9a5c09fac
7
+ data.tar.gz: d75f6cf39afa3a37065607f5b22fc030ba68c6ef89058a2f4c814d4ba49584dba46e6ad1563ef224399dba5ee9c206dc16293c36d45f255e01e34deb6a8f5f45
data/lib/owssh.rb CHANGED
@@ -66,6 +66,19 @@ class Owssh
66
66
  end
67
67
  end
68
68
 
69
+ def print_help
70
+ puts "Usage:"
71
+ puts "owssh list - List all environments"
72
+ puts "owssh describe - Show details of hosts in all stacks"
73
+ puts "owssh describe [Stack Name] - Show details of a specific stack"
74
+ puts "owssh [Stack Name] [Hostname or Type] - SSH to a host in a stack"
75
+ puts "owssh [Stack Name] [Hostname or Type] \"Your command here\" - SSH to a host in a stack and run a command"
76
+ puts ""
77
+ puts " Type - The type of host. I.E. rails-app, resque, etc..."
78
+ puts " Hostname - The name of the host. I.E. rails-app1, resque1, etc..."
79
+ exit
80
+ end
81
+
69
82
  def owssh
70
83
  # Export environment variables for AWS CLI here
71
84
  $debug = false
@@ -73,12 +86,7 @@ class Owssh
73
86
  $owssh_config = "~/.owssh_conf"
74
87
 
75
88
  if ARGV.empty?
76
- puts "Usage:"
77
- puts "owssh list - List all environments"
78
- puts "owssh describe - Show details of hosts in all stacks"
79
- puts "owssh describe [Stack Name] - Show details of a specific stack"
80
- puts "owssh [Stack Name] [Hostname] - SSH to a host in a stack"
81
- puts "owssh [Stack Name] [Hostname] [Command]- SSH to a host in a stack and run a command"
89
+ puts "Please supply some options. Try 'owssh help' for available commands"
82
90
  exit
83
91
  end
84
92
 
@@ -87,7 +95,9 @@ class Owssh
87
95
 
88
96
  $stacks = get_stacks
89
97
 
90
- if ARGV[0] == "list" then
98
+ if ARGV[0] == "help" then
99
+ print_help
100
+ elsif ARGV[0] == "list" then
91
101
  puts "Getting list of stacks..."
92
102
  print_stacks($stacks)
93
103
  exit
@@ -142,7 +152,11 @@ class Owssh
142
152
  puts "Could not find host with name or type of '#{ARGV[1]}'"
143
153
  exit
144
154
  else
145
- puts "Running comand #{ARGV[2]} on first host of type #{ARGV[1]} which is #{$first_instance}..."
155
+ if ARGV[2].nil? then
156
+ puts "Running command '#{ARGV[2]}' on first host of type '#{ARGV[1]}' which is '#{$first_instance}'..."
157
+ else
158
+ puts "Running comand #{ARGV[2]} on host #{ARGV[1]}..."
159
+ end
146
160
  exec("ssh -i ~/.ssh/id_rsa_dev ubuntu@#{$instances[$first_instance.to_s]} '#{ARGV[2]}'")
147
161
  end
148
162
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: owssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hutchins