lono 3.2.1 → 3.3.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: 1fcfb65ffb6cccd0eb663bbe404f30f139348df2
4
- data.tar.gz: a63760ba51191ed56fb91e0bf016291092155c4c
3
+ metadata.gz: 3b2d67a85fee4daded65c65028dbd094486a0101
4
+ data.tar.gz: e33e494d68616a33ec6f784bf661f1f339a3f6f5
5
5
  SHA512:
6
- metadata.gz: 9931cd07307ec8eb0d9b9f49f66d29d338e5617af43c5d99dc3a51704bae702df62c5e58388b39b8f1ce2c93a25605072b72fc325399b78ca15e44b92145b7a0
7
- data.tar.gz: 6b8213235b3e8c403ee3415566d3f6f76be399f333146738bb3224fa562158e60ccb2653a8fafadc16daeace959d3e17688621549ac26d3425dc34d8adff4f58
6
+ metadata.gz: cbc8ef84810384771bb86715934b8acdbffa4f4705ffbb1efda5e3c543e16c9d68e5b71d2dc97009e29f2c6f50fbbb7cf1984258d9ac557b1f35f4b73b6e54f8
7
+ data.tar.gz: ac729217bb028c95417e42beb3009d12ee807a07b3f49da4e0468328bcdf08262b8f84652da78069d3e35b5c79a1103f06610770abd834c2127f20b168491ab6
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [3.3.0]
7
+ - add lono inspect summary
8
+ - remove lono inspect params
9
+
6
10
  ## [3.2.1]
7
11
  - fix lono inspect params
8
12
 
@@ -3,24 +3,23 @@ require "thor"
3
3
  class Lono::Inspector < Lono::Command
4
4
  autoload :Help, 'lono/inspector/help'
5
5
  autoload :Base, 'lono/inspector/base'
6
- autoload :Params, 'lono/inspector/params'
7
6
  autoload :Depends, 'lono/inspector/depends'
7
+ autoload :Summary, 'lono/inspector/summary'
8
8
 
9
9
  class_option :verbose, type: :boolean
10
10
  class_option :noop, type: :boolean
11
11
  class_option :project_root, desc: "Project folder. Defaults to current directory", default: "."
12
12
 
13
- desc "params STACK", "Prints report of CloudFormation template parameters"
14
- option :type, type: :string, desc: "type can be: all, required, optional", default: "all"
15
- long_desc Help.params
16
- def params(name)
17
- Params.new(name, options).run
18
- end
19
-
20
13
  desc "depends STACK", "Prints dependencies tree of CloudFormation template resources"
21
14
  long_desc Help.depends
22
15
  option :display, type: :string, desc: "graph or text", default: "graph"
23
16
  def depends(name)
24
17
  Depends.new(name, options).run
25
18
  end
19
+
20
+ desc "summary STACK", "Prints summary of CloudFormation template"
21
+ long_desc Help.params
22
+ def summary(name)
23
+ Summary.new(name, options).run
24
+ end
26
25
  end
@@ -0,0 +1,52 @@
1
+ class Lono::Inspector::Summary < Lono::Inspector::Base
2
+ def perform
3
+ puts "CloudFormation Template Summary:".colorize(:green)
4
+ return if @options[:noop]
5
+
6
+ puts "Parameters:"
7
+ print_parameters("Required", required_parameters)
8
+ print_parameters("Optional", optional_parameters)
9
+
10
+ puts "Resources:"
11
+ print_resource_types
12
+ end
13
+
14
+ def print_parameters(label, parameters)
15
+ puts "#{label}:"
16
+ if parameters.empty?
17
+ puts " There are no #{label.downcase} parameters"
18
+ else
19
+ parameters.each do |logical_id, p|
20
+ output = " #{logical_id} (#{p["Type"]})"
21
+ if p["Default"]
22
+ output << " Default: #{p["Default"]}"
23
+ end
24
+ puts output
25
+ end
26
+ end
27
+ end
28
+
29
+ def required_parameters
30
+ data["Parameters"].reject { |logical_id, p| p["Default"] }
31
+ end
32
+
33
+ def optional_parameters
34
+ data["Parameters"].select { |logical_id, p| p["Default"] }
35
+ end
36
+
37
+ def resource_types
38
+ types = Hash.new(0)
39
+ data["Resources"].each do |logical_id, resource|
40
+ types[resource["Type"]] += 1
41
+ end
42
+ types
43
+ end
44
+
45
+ def print_resource_types
46
+ types = resource_types.sort_by {|r| r[1] * -1} # Hash -> 2D Array
47
+ types.each do |a|
48
+ type, count = a
49
+ printf "%3s %s\n", count, type
50
+ end
51
+ end
52
+ end
data/lib/lono/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "3.2.1"
2
+ VERSION = "3.3.0"
3
3
  end
@@ -1 +1,3 @@
1
1
  # this file is just in here to get the lono-cfn spec to pass
2
+
3
+ template "aws-waf-security-automations"
@@ -11,9 +11,9 @@ describe Lono::Inspector do
11
11
  expect(out).to include("Generating dependencies tree")
12
12
  end
13
13
 
14
- it "params" do
15
- out = execute("bin/lono inspect params my-stack #{@args}")
16
- expect(out).to include("Parameters Summary")
14
+ it "summary" do
15
+ out = execute("bin/lono inspect summary my-stack #{@args}")
16
+ expect(out).to include("Summary")
17
17
  end
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-17 00:00:00.000000000 Z
11
+ date: 2017-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -280,7 +280,7 @@ files:
280
280
  - lib/lono/inspector/base.rb
281
281
  - lib/lono/inspector/depends.rb
282
282
  - lib/lono/inspector/help.rb
283
- - lib/lono/inspector/params.rb
283
+ - lib/lono/inspector/summary.rb
284
284
  - lib/lono/new.rb
285
285
  - lib/lono/param.rb
286
286
  - lib/lono/param/generator.rb
@@ -1,28 +0,0 @@
1
- class Lono::Inspector::Params < Lono::Inspector::Base
2
- def perform
3
- puts "Parameters Summary:".colorize(:green)
4
- return if @options[:noop]
5
-
6
- print_parameters("Required", required_parameters)
7
- print_parameters("Optional", optional_parameters)
8
- end
9
-
10
- def print_parameters(label, parameters)
11
- puts "#{label}:"
12
- if parameters.empty?
13
- puts " There are no #{label.downcase} parameters"
14
- else
15
- parameters.each do |logical_id, p|
16
- puts " #{logical_id}"
17
- end
18
- end
19
- end
20
-
21
- def required_parameters
22
- data["Parameters"].reject { |logical_id, p| p["Default"] }
23
- end
24
-
25
- def optional_parameters
26
- data["Parameters"].select { |logical_id, p| p["Default"] }
27
- end
28
- end