kumogata 0.4.8 → 0.4.9

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: cda577d33103a8aefd39ff524436244625263ccb
4
- data.tar.gz: 275b524fc1b7c7cdab22d38969d8b853b91c5bf1
3
+ metadata.gz: 3ae80fe8d0ad7f732542d8cef0073b9874ed71f8
4
+ data.tar.gz: d3fae446f4ea8d63b6767b1e2428c0d505709ae8
5
5
  SHA512:
6
- metadata.gz: 1e613daf8837305afeed85315f449d882c8829fa7c167762f6541d4d253a1896fa051521cc61f7b367a53735b00537bf0845705a0b4e686f8598b937fee099e2
7
- data.tar.gz: 3dff24b058d44d8e95a64cdcb29970023404f121c3285aa1da9c221fd5d87a4e0348d8149dfda2fbb787e82dd1d4bbc5624136741b67908f668fa661c2200518
6
+ metadata.gz: ef951fce6ac3edc1419723eeb65783ebc85248f5d2bdcb0b60dba8e78f91dd180ff475c374f589a0a832eba2f6fdfd7fbaa814f57229cea0e36aa5907f35f4fb
7
+ data.tar.gz: 8d7d1efb50beb83a314703c4886170ea37f4ea767611b9fd4af5be44dacd7ddec9b7730c65fb8539b31b6f6a37f9a00253e2ed8fde314437e3f8a096db3f090a
data/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
7
7
 
8
- [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403151823)](http://badge.fury.io/rb/kumogata)
9
- [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403151823)](https://drone.io/github.com/winebarrel/kumogata/latest)
8
+ [![Gem Version](https://badge.fury.io/rb/kumogata.png?201404180339)](http://badge.fury.io/rb/kumogata)
9
+ [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201404180339)](https://drone.io/github.com/winebarrel/kumogata/latest)
10
10
 
11
11
  It can define a template in Ruby DSL, such as:
12
12
 
@@ -82,6 +82,8 @@ Options:
82
82
  -k, --access-key ACCESS_KEY
83
83
  -s, --secret-key SECRET_KEY
84
84
  -r, --region REGION
85
+ --config PATH
86
+ --profile CONFIG_PROFILE
85
87
  --format TMPLATE_FORMAT
86
88
  --skip-replace-underscore
87
89
  --deletion-policy-retain
@@ -17,17 +17,43 @@ parsed = Kumogata::ArgumentParser.parse! {|parser, cmd, args, opts|
17
17
  begin
18
18
  command, arguments, options, output_result = parsed
19
19
 
20
+ String.colorize = options.color?
21
+ Diffy::Diff.default_format = options.color? ? :color : :text
22
+
20
23
  aws_opts = {}
21
24
 
25
+ # Set config file path
26
+ if options.config_path?
27
+ unless File.exist?(options.config_path)
28
+ raise "No such config file: #{options.config_path}"
29
+ end
30
+
31
+ AWSConfig.config_file = options.config_path
32
+ end
33
+
34
+ # Load .aws/config
35
+ # See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
36
+ if File.exist?(AWSConfig.config_file)
37
+ unless AWSConfig.has_profile?(options.config_profile)
38
+ raise "No profile : #{AWSConfig.config_file} => #{options.config_profile}"
39
+ end
40
+
41
+ {
42
+ 'aws_access_key_id' => :access_key_id,
43
+ 'aws_secret_access_key' => :secret_access_key,
44
+ 'region' => :region,
45
+ }.each do |config_key, option_key|
46
+ option_value = AWSConfig[options.config_profile][config_key]
47
+ aws_opts[option_key] = option_value if option_value
48
+ end
49
+ end
50
+
22
51
  [:access_key_id, :secret_access_key, :region].each do |key|
23
52
  aws_opts[key] = options[key] if options[key]
24
53
  end
25
54
 
26
55
  AWS.config(aws_opts) unless aws_opts.empty?
27
56
 
28
- String.colorize = options.color?
29
- Diffy::Diff.default_format = options.color? ? :color : :text
30
-
31
57
  if options.debug?
32
58
  Kumogata.logger.set_debug(true)
33
59
 
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'aws-sdk'
22
+ spec.add_dependency 'aws_config', '>= 0.0.2'
22
23
  spec.add_dependency 'coderay'
23
24
  spec.add_dependency 'diffy'
24
25
  spec.add_dependency 'dslh', '>= 0.2.6'
@@ -2,6 +2,7 @@ module Kumogata; end
2
2
  require 'kumogata/version'
3
3
 
4
4
  require 'aws-sdk'
5
+ require 'aws_config'
5
6
  require 'base64'
6
7
  require 'coderay'
7
8
  require 'diffy'
@@ -8,6 +8,7 @@ class Kumogata::ArgumentParser
8
8
  :command_result_log => File.join(Dir.pwd, 'command_result.json'),
9
9
  :color => $stdout.tty?,
10
10
  :debug => false,
11
+ :config_profile => :default,
11
12
  }
12
13
 
13
14
  COMMANDS = {
@@ -83,6 +84,8 @@ class Kumogata::ArgumentParser
83
84
  opt.on('-k', '--access-key ACCESS_KEY') {|v| options[:access_key_id] = v }
84
85
  opt.on('-s', '--secret-key SECRET_KEY') {|v| options[:secret_access_key] = v }
85
86
  opt.on('-r', '--region REGION') {|v| options[:region] = v }
87
+ opt.on('' , '--config PATH') {|v| options[:config_path] = v }
88
+ opt.on('' , '--profile CONFIG_PROFILE') {|v| options[:config_profile] = v }
86
89
  opt.on('' , '--format TMPLATE_FORMAT', [:ruby, :json]) {|v| options[:format] = v }
87
90
  opt.on('' , '--skip-replace-underscore') { options[:skip_replace_underscore] = false }
88
91
  opt.on('' , '--deletion-policy-retain') { options[:deletion_policy_retain] = true }
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.4.8'
2
+ VERSION = '0.4.9'
3
3
  end
metadata CHANGED
@@ -1,223 +1,237 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-30 00:00:00.000000000 Z
11
+ date: 2014-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws_config
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: coderay
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - '>='
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - '>='
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: diffy
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - '>='
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '>='
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: dslh
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: 0.2.6
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: 0.2.6
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: hashie
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>='
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - '>='
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: highline
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - '>='
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - '>='
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: json
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - '>='
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - '>='
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: net-ssh
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - '>='
129
+ - - ">="
116
130
  - !ruby/object:Gem::Version
117
131
  version: '0'
118
132
  type: :runtime
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - '>='
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: retryable
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - '>='
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  type: :runtime
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - '>='
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: term-ansicolor
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - '>='
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0'
146
160
  type: :runtime
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - '>='
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: uuidtools
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - '>='
171
+ - - ">="
158
172
  - !ruby/object:Gem::Version
159
173
  version: '0'
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - '>='
178
+ - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: bundler
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - '>='
185
+ - - ">="
172
186
  - !ruby/object:Gem::Version
173
187
  version: '0'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - '>='
192
+ - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: rake
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - '>='
199
+ - - ">="
186
200
  - !ruby/object:Gem::Version
187
201
  version: '0'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - '>='
206
+ - - ">="
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: rspec
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
- - - '>='
213
+ - - ">="
200
214
  - !ruby/object:Gem::Version
201
215
  version: 2.11.0
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
- - - '>='
220
+ - - ">="
207
221
  - !ruby/object:Gem::Version
208
222
  version: 2.11.0
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: timecop
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
- - - '>='
227
+ - - ">="
214
228
  - !ruby/object:Gem::Version
215
229
  version: '0'
216
230
  type: :development
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
- - - '>='
234
+ - - ">="
221
235
  - !ruby/object:Gem::Version
222
236
  version: '0'
223
237
  description: A tool for AWS CloudFormation. It can define a template in Ruby DSL.
@@ -228,8 +242,8 @@ executables:
228
242
  extensions: []
229
243
  extra_rdoc_files: []
230
244
  files:
231
- - .gitignore
232
- - .rspec
245
+ - ".gitignore"
246
+ - ".rspec"
233
247
  - Gemfile
234
248
  - LICENSE.txt
235
249
  - README.md
@@ -277,12 +291,12 @@ require_paths:
277
291
  - lib
278
292
  required_ruby_version: !ruby/object:Gem::Requirement
279
293
  requirements:
280
- - - '>='
294
+ - - ">="
281
295
  - !ruby/object:Gem::Version
282
296
  version: '0'
283
297
  required_rubygems_version: !ruby/object:Gem::Requirement
284
298
  requirements:
285
- - - '>='
299
+ - - ">="
286
300
  - !ruby/object:Gem::Version
287
301
  version: '0'
288
302
  requirements: []