lono-cfn 0.0.6 → 0.0.7

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: 15502b5cd0ce076c8866ee2495d2d23e8e856b4d
4
- data.tar.gz: '0715039ad6cceb813f049b22a15de5056fa81e42'
3
+ metadata.gz: 1bbea5b4e9a4b1acf40f572ed5e62be663c7cf5e
4
+ data.tar.gz: a43798916772163887f372b59ea0cc64dc438f7a
5
5
  SHA512:
6
- metadata.gz: 82482c93760d52309c2f50933eb6f22af933ff0eb5e8d7260d14fbcdb88b1961518eafa41219b56df823f532749ee3e5db0500c0851f7c72132655dbadfaaff8
7
- data.tar.gz: fff6fd771a4346cd9e22bbf1cc4910f8f2bd5b28dd54281c0b32bcdc931183ea5becc51e24b6e8d96d182a55d6c10e03a795a04b3e245f9880ea8d9014140d61
6
+ metadata.gz: 14817108aeaea0ba518b8f6fe1dea24d305b60fb5f1b284f14df112603c8ba25988564a8fb4961f73028c03607230d19b2a2782a729fb8e34ff345abccc74b96
7
+ data.tar.gz: cc484dba6eebe9f3d5d3fd78339b827acb00533a564aa80576c7f3371af0b73fc42b3508034623a428f1e34ab4991300a0acd82a360c9d7466c1caf802dd2114
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
+ ## [0.0.6]
7
+
8
+ - allow missing params file
9
+
6
10
  ## [0.0.6] add delete stack command
7
11
 
8
12
  - add delete stack command
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lono-cfn (0.0.6)
4
+ lono-cfn (0.0.7)
5
5
  aws-sdk
6
6
  colorize
7
7
  hashie
@@ -20,13 +20,13 @@ GEM
20
20
  minitest (~> 5.1)
21
21
  thread_safe (~> 0.3, >= 0.3.4)
22
22
  tzinfo (~> 1.1)
23
- aws-sdk (2.9.11)
24
- aws-sdk-resources (= 2.9.11)
25
- aws-sdk-core (2.9.11)
23
+ aws-sdk (2.9.14)
24
+ aws-sdk-resources (= 2.9.14)
25
+ aws-sdk-core (2.9.14)
26
26
  aws-sigv4 (~> 1.0)
27
27
  jmespath (~> 1.0)
28
- aws-sdk-resources (2.9.11)
29
- aws-sdk-core (= 2.9.11)
28
+ aws-sdk-resources (2.9.14)
29
+ aws-sdk-core (= 2.9.14)
30
30
  aws-sigv4 (1.0.0)
31
31
  builder (3.2.3)
32
32
  byebug (9.0.6)
@@ -79,7 +79,7 @@ GEM
79
79
  rake
80
80
  rb-fsevent
81
81
  thor
82
- lono-params (0.0.4)
82
+ lono-params (0.0.5)
83
83
  colorize
84
84
  hashie
85
85
  plissken
data/lib/lono_cfn/base.rb CHANGED
@@ -36,29 +36,33 @@ module LonoCfn
36
36
  generator = LonoParams::Generator.new(@stack_name,
37
37
  project_root: @project_root,
38
38
  path: @params_path,
39
- allow_no_file: false)
39
+ allow_no_file: true)
40
40
  generator.generate # Writes the json file in CamelCase keys format
41
41
  generator.params # Returns Array in underscore keys format
42
42
  end
43
43
 
44
44
  def check_for_errors
45
- errors = check_files
45
+ errors, warns = check_files
46
46
  unless errors.empty?
47
47
  puts "Please double check the command you ran. There were some errors."
48
- puts "#{errors.join("\n")}"
48
+ puts "ERROR: #{errors.join("\n")}".colorize(:red)
49
49
  exit
50
50
  end
51
+ unless errors.empty?
52
+ puts "Please double check the command you ran. There were some warnings."
53
+ puts "WARN: #{errors.join("\n")}".colorize(:yellow)
54
+ end
51
55
  end
52
56
 
53
57
  def check_files
54
- errors = []
58
+ errors, warns = [], []
55
59
  unless File.exist?(@template_path)
56
60
  errors << "Template file missing: could not find #{@template_path}"
57
61
  end
58
62
  if @options[:params] && !File.exist?(@params_path)
59
- errors << "Parameters file missing: could not find #{@params_path}"
63
+ warns << "Parameters file missing: could not find #{@params_path}"
60
64
  end
61
- errors
65
+ [errors, warns]
62
66
  end
63
67
 
64
68
  def stack_exists?
@@ -95,7 +99,8 @@ module LonoCfn
95
99
  def convention_path(name, type)
96
100
  case type
97
101
  when :template
98
- "#{@project_root}/output/#{name}.json"
102
+ format = detect_format
103
+ "#{@project_root}/output/#{name}.#{format}"
99
104
  when :params
100
105
  "#{@project_root}/params/#{name}.txt"
101
106
  else
@@ -103,6 +108,22 @@ module LonoCfn
103
108
  end
104
109
  end
105
110
 
111
+ # Returns String with value of "yml" or "json".
112
+ def detect_format
113
+ formats = Dir.glob("#{@project_root}/output/**/*").map { |path| path }.
114
+ reject { |s| s =~ %r{/params/} }. # reject output/params folder
115
+ map { |path| File.extname(path) }.
116
+ reject { |s| s.empty? }. # reject ""
117
+ uniq
118
+ if formats.size > 1
119
+ puts "ERROR: Detected multiple formats: #{formats.join(", ")}".colorize(:red)
120
+ puts "All the output files must use the same format. Either all json or all yml."
121
+ exit 1
122
+ else
123
+ formats.first.sub(/^\./,'')
124
+ end
125
+ end
126
+
106
127
  def testing_update?
107
128
  ENV['TEST'] && self.class.name == "LonoCfn::Update"
108
129
  end
@@ -1,3 +1,3 @@
1
1
  module LonoCfn
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono-cfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
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-04-25 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  version: '0'
234
234
  requirements: []
235
235
  rubyforge_project:
236
- rubygems_version: 2.6.8
236
+ rubygems_version: 2.5.2
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: Wrapper cfn tool to quickly create CloudFormation stacks from lono templates