kumogata 0.4.19 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a626076a8776de3b3f80ff1627fa21753236f73c
4
- data.tar.gz: 2b532df5a2e844ceb3ea69d791fb1d2fcc30fc5b
3
+ metadata.gz: 421af9c3a404389c7a1bba39c9431421967f355c
4
+ data.tar.gz: b05d0704cf79f758e8cd870605ac4cf37b43cf57
5
5
  SHA512:
6
- metadata.gz: cfbc840b9761ff339e536a6e4e43c8a27866c910454ffb8f0783ff2ec446d3a691025dd9db4ae9c16d2f85f1310e6b864a74442cbb7f00bf0356833a9902b163
7
- data.tar.gz: 71cc9feed08e69b16523136b607f5c7f2184ac7a8f5855dd0d3d9a53e59bcfd7c3dcebe55f47f30f351124624f5385788a4f86a4f317f6fb9796e46ba077db1d
6
+ metadata.gz: d481e6b9ed516bfbd8f0593b8a7f10eff3fe7d11a902ae6d4a4d09e6f6f31b0afbaab3c061ae0324c1fb10724b9d25f4d3eedbe23791981befbc0d3619ed04b4
7
+ data.tar.gz: e2c3c0b2f7d6e1010a423f1c579a283a32f050caf8a89370d1c424fa3c3423aea6b5515acd0910299d57aa40790a36f518009d0519df09a4b3c1ca0c71b99055
@@ -3,7 +3,6 @@ $: << File.expand_path("#{File.dirname __FILE__}/../lib")
3
3
  require 'rubygems'
4
4
  require 'kumogata'
5
5
  require 'kumogata/argument_parser'
6
- require 'kumogata/config_parser'
7
6
 
8
7
  options = nil
9
8
 
@@ -22,38 +21,13 @@ begin
22
21
  Diffy::Diff.default_format = options.color? ? :color : :text
23
22
 
24
23
  aws_opts = {}
25
- config_parser = Kumogata::ConfigParser.new
26
24
 
27
- # Set config file path
28
- if options.config_path?
29
- unless File.exist?(options.config_path)
30
- raise "No such config file: #{options.config_path}"
31
- end
32
-
33
- config_parser.path = options.config_path
34
- end
35
-
36
- # Load .aws/config
37
- # See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
38
- if config_parser.path.exist?
39
- config_parser.parse!
25
+ if options.config_profile
26
+ provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(
27
+ :profile_name => profile_name
28
+ )
40
29
 
41
- if options.config_profile and not config_parser[options.config_profile]
42
- raise "No profile: #{config_parser.path} => #{options.config_profile}"
43
- end
44
-
45
- profile_name = options.config_profile || :default
46
-
47
- if (profile = config_parser[profile_name])
48
- {
49
- 'aws_access_key_id' => :access_key_id,
50
- 'aws_secret_access_key' => :secret_access_key,
51
- 'region' => :region,
52
- }.each do |config_key, option_key|
53
- option_value = profile[config_key]
54
- aws_opts[option_key] = option_value if option_value
55
- end
56
- end
30
+ aws_opts[:credential_provider] = provider
57
31
  end
58
32
 
59
33
  [:access_key_id, :secret_access_key, :region].each do |key|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'aws-sdk'
21
+ spec.add_dependency 'aws-sdk', '>= 1.48.0', '< 2.0.0'
22
22
  spec.add_dependency 'coderay'
23
23
  spec.add_dependency 'coffee-script'
24
24
  spec.add_dependency 'diffy'
@@ -187,7 +187,8 @@ class Kumogata::Client
187
187
 
188
188
  Kumogata::Utils.stringify(obj.to_hash)
189
189
  when :json5
190
- JSON5.parse(f.read)
190
+ parsed = JSON5.parse(f.read)
191
+ Kumogata::Utils.stringify(parsed)
191
192
  else
192
193
  raise "Unknown format: #{format}"
193
194
  end
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.4.19'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -1,6 +1,5 @@
1
1
  require 'kumogata'
2
2
  require 'kumogata/argument_parser'
3
- require 'kumogata/config_parser'
4
3
  require 'tempfile'
5
4
  require 'time'
6
5
  require 'timecop'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.19
4
+ version: 0.5.0
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-07-15 00:00:00.000000000 Z
11
+ date: 2014-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.48.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - '>='
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: 1.48.0
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: coderay
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -282,7 +288,6 @@ files:
282
288
  - lib/kumogata.rb
283
289
  - lib/kumogata/argument_parser.rb
284
290
  - lib/kumogata/client.rb
285
- - lib/kumogata/config_parser.rb
286
291
  - lib/kumogata/crypt.rb
287
292
  - lib/kumogata/ext/coderay_ext.rb
288
293
  - lib/kumogata/ext/json_ext.rb
@@ -300,7 +305,6 @@ files:
300
305
  - spec/Drupal_Single_Instance.template
301
306
  - spec/Drupal_Single_Instance.template.rb
302
307
  - spec/Drupal_Single_Instance.template.yml
303
- - spec/kumogata_config_parser_spec.rb
304
308
  - spec/kumogata_convert_spec.rb
305
309
  - spec/kumogata_create_spec.rb
306
310
  - spec/kumogata_crypt_spec.rb
@@ -337,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
341
  version: '0'
338
342
  requirements: []
339
343
  rubyforge_project:
340
- rubygems_version: 2.0.14
344
+ rubygems_version: 2.4.1
341
345
  signing_key:
342
346
  specification_version: 4
343
347
  summary: A tool for AWS CloudFormation.
@@ -345,7 +349,6 @@ test_files:
345
349
  - spec/Drupal_Single_Instance.template
346
350
  - spec/Drupal_Single_Instance.template.rb
347
351
  - spec/Drupal_Single_Instance.template.yml
348
- - spec/kumogata_config_parser_spec.rb
349
352
  - spec/kumogata_convert_spec.rb
350
353
  - spec/kumogata_create_spec.rb
351
354
  - spec/kumogata_crypt_spec.rb
@@ -1,33 +0,0 @@
1
- class Kumogata::ConfigParser
2
- attr_reader :path
3
-
4
- def initialize(path = '~/.aws/config')
5
- self.path = path
6
- @profiles = {}
7
- end
8
-
9
- def path=(v)
10
- @path = Pathname.new(v).expand_path
11
- end
12
-
13
- def [](profile_name)
14
- @profiles[profile_name.to_s]
15
- end
16
-
17
- def parse!
18
- profile_name = nil
19
-
20
- @path.each_line do |line|
21
- line.strip!
22
- next if line.empty?
23
-
24
- if line =~ /\A\[(.+)\]\z/
25
- profile_name = $1
26
- elsif profile_name
27
- key, value = line.split('=', 2).map {|i| i.strip }
28
- @profiles[profile_name] ||= {}
29
- @profiles[profile_name][key] = value
30
- end
31
- end
32
- end
33
- end
@@ -1,38 +0,0 @@
1
- describe Kumogata::ConfigParser do
2
- subject { Kumogata::ConfigParser.new }
3
-
4
- it 'parse aws/config' do
5
- content = <<-EOS
6
- [default]
7
- aws_access_key_id = AKIAIOSFODNN7EXAMPLE
8
- aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
9
- aws_security_token = texample123324
10
-
11
- [profile2]
12
- aws_access_key_id = xAKIAIOSFODNN7EXAMPLE
13
- aws_secret_access_key = xwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
14
- aws_security_token = xtexample123324
15
-
16
- [invalid]
17
- EOS
18
-
19
- tempfile(content) do |config|
20
- subject.path = config.path
21
- subject.parse!
22
-
23
- expect(subject[:default]).to eq(
24
- 'aws_access_key_id' => 'AKIAIOSFODNN7EXAMPLE',
25
- 'aws_secret_access_key' => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
26
- 'aws_security_token' => 'texample123324',
27
- )
28
-
29
- expect(subject['profile2']).to eq(
30
- 'aws_access_key_id' => 'xAKIAIOSFODNN7EXAMPLE',
31
- 'aws_secret_access_key' => 'xwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
32
- 'aws_security_token' => 'xtexample123324',
33
- )
34
-
35
- expect(subject['invalid']).to be_nil
36
- end
37
- end
38
- end