opzworks 0.3.13 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4842a0d4127d8d78a1040a56028fa0ad273d0a2c
4
- data.tar.gz: 2531e2da175452bb75a8b65e141a67f6675c3019
3
+ metadata.gz: 80563c605a5de8f932029a8991137546de482d48
4
+ data.tar.gz: 225f1ecd7111ed50dcdd45dccca4ebda492d894b
5
5
  SHA512:
6
- metadata.gz: 3df130cf28634525c08e0a1298c2cb8b53530958f380ef375e35e26e989e60aafd3b0026ce6d69d583e11c93c895be8531a9f163c8cd340e5effab9ac088b37a
7
- data.tar.gz: e7f1bc0d2e92d9759ffcbf3cf3b6b6bfa31609d7acc84e00e3c8bdd199cd3a748f563a2ecd48a669fb84ac42b541674795b575c0ab29fbbfbf6b007f333ddc0e
6
+ metadata.gz: 78433773119c6dbefcfe1840b02e116595f1fd8f30cdbc6db04166c13f9928b029855af8e9fd22d54058fb64b16740d023d415412ce5f97e0a1a822e1ff3b3d2
7
+ data.tar.gz: 04a3612efdc14da926762cda8ccdf7443c18a0da7c312b4feb0e886699ceddc37b6d30f34767d5503b0bb199f46eadcf26f6c2894156dff2b7d40bddd80ec5b8
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  changelog
2
2
  =========
3
3
 
4
+ 0.4.0
5
+ -----
6
+ * add framework for opsworks cmd structure
7
+ * add list-stacks option
8
+
4
9
  0.3.9
5
10
  -----
6
11
  * add remote management berkshelf option back in: if there is a Berksfile.opsworks present in the
data/lib/opzworks/cli.rb CHANGED
@@ -4,6 +4,8 @@ require 'opzworks'
4
4
  module OpzWorks
5
5
  class CLI
6
6
  def self.start
7
+ commands = %w(ssh cmd json berks elastic)
8
+
7
9
  Trollop.options do
8
10
  version "opzworks #{OpzWorks::VERSION} (c) #{OpzWorks::AUTHORS.join(', ')}"
9
11
  banner <<-EOS.unindent
@@ -13,6 +15,7 @@ module OpzWorks
13
15
 
14
16
  Commands
15
17
  ssh #{OpzWorks::Commands::SSH.banner}
18
+ cmd #{OpzWorks::Commands::CMD.banner}
16
19
  json #{OpzWorks::Commands::JSON.banner}
17
20
  berks #{OpzWorks::Commands::BERKS.banner}
18
21
  elastic #{OpzWorks::Commands::ELASTIC.banner}
@@ -22,7 +25,7 @@ module OpzWorks
22
25
 
23
26
  Options:
24
27
  EOS
25
- stop_on @commands
28
+ stop_on commands
26
29
  end
27
30
 
28
31
  command = ARGV.shift
@@ -35,6 +38,8 @@ module OpzWorks
35
38
  OpzWorks::Commands::BERKS.run
36
39
  when 'elastic'
37
40
  OpzWorks::Commands::ELASTIC.run
41
+ when 'cmd'
42
+ OpzWorks::Commands::CMD.run
38
43
  when nil
39
44
  Trollop.die 'no command specified'
40
45
  else
@@ -0,0 +1,40 @@
1
+ require 'aws-sdk'
2
+ require 'trollop'
3
+ require 'opzworks'
4
+ require 'rainbow/ext/string'
5
+
6
+ module OpzWorks
7
+ class Commands
8
+ class CMD
9
+ def self.banner
10
+ 'Run various OpsWorks commands'
11
+ end
12
+
13
+ def self.run
14
+ options = Trollop.options do
15
+ banner <<-EOS.unindent
16
+ #{CMD.banner}
17
+
18
+ opzworks cmd [option]
19
+
20
+ Options:
21
+ EOS
22
+ opt :'list-stacks', 'List all our stacks', default: false
23
+ end
24
+
25
+ config = OpzWorks.config
26
+ client = Aws::OpsWorks::Client.new(region: config.aws_region, profile: config.aws_profile)
27
+
28
+ if options[:'list-stacks']
29
+ list = []
30
+ response = client.describe_stacks
31
+ response[:stacks].each { |stack| list << stack[:name] }
32
+
33
+ puts list.sort
34
+ else
35
+ puts 'No options specified'.foreground(:yellow)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
data/lib/opzworks/meta.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module OpzWorks
2
- VERSION = '0.3.13'
2
+ VERSION = '0.4.0'
3
3
  AUTHORS = ['Grant Heffernan', 'Mapzen']
4
4
  EMAIL = ['grant@mapzen.com']
5
5
  DESCRIPTION = 'OpzWorks Utilities'
data/lib/opzworks.rb CHANGED
@@ -2,8 +2,7 @@ require 'opzworks/meta'
2
2
  require 'opzworks/config'
3
3
 
4
4
  # require our commands
5
- @commands = %w(ssh json berks elastic)
6
- @commands.each do |cmd|
5
+ %w(ssh cmd json berks elastic).each do |cmd|
7
6
  require "opzworks/commands/#{cmd}"
8
7
  end
9
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opzworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Heffernan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-11 00:00:00.000000000 Z
12
+ date: 2016-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -198,6 +198,7 @@ files:
198
198
  - lib/opzworks.rb
199
199
  - lib/opzworks/cli.rb
200
200
  - lib/opzworks/commands/berks.rb
201
+ - lib/opzworks/commands/cmd.rb
201
202
  - lib/opzworks/commands/elastic.rb
202
203
  - lib/opzworks/commands/include/elastic.rb
203
204
  - lib/opzworks/commands/include/manage_berks_repos.rb