oneaws 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 3b5cdbbf6859ec90de78c5452beeb47d7b7f55bbaaabfdedcd17db81e2c9f47b
4
- data.tar.gz: a05a3d7470c4fe913c52568a820f0acffa551609c77f336d0194c7e2e788e325
3
+ metadata.gz: 206db80babfc5a4ec457c5f4f6a3a5d39c27d80651174f23a527b93601c16f39
4
+ data.tar.gz: 0daa2f9d03f81cd2a43b0e5474b2987346b2fbf21b6824b8a7f7dc7c7642b096
5
5
  SHA512:
6
- metadata.gz: 854fad5d4bd924fb013aace3d1ed0efeac8a225cde6210851f0abebee2eda0dfb643fb6570af33c5de53a694de9f848488d838d6fe29b5c0c540516475f6551c
7
- data.tar.gz: b430d35a80808e8fba8ae98e87192bc2aa170dafbe27753df4343ca9f05ee3c784053770f922e7ed9b5f26e4b9ad010dde4caa10fa7aaa5f488243d050feb6d4
6
+ metadata.gz: 8a43e2ccf892638a0565e1b81998c08367298f017e09bfb8c9013b8a9f71746e84607b95899fd09a96edeaec73cac4b7805a973e1119bc14a7ff3b21142fdfef
7
+ data.tar.gz: 8eb123cd6ad1130c70bdb8d085668a4b66f1fc4030d88861e722d1294a0f48a8d72fb51ff8029ee6150c90dc33a9067ce5fb65cec7c2b3f206374b551d5b3573
@@ -22,7 +22,7 @@ module Oneaws
22
22
  credential = client.issue_credential(params)
23
23
 
24
24
  if options["update_aws_credentials"]
25
- credential_file = File.expand_path("~/.aws/credentials")
25
+ credential_file = File.expand_path(find_credentials)
26
26
  unless inifile = IniFile.load(credential_file)
27
27
  FileUtils.mkdir_p(File.dirname(credential_file))
28
28
  inifile = IniFile.new
@@ -51,5 +51,21 @@ module Oneaws
51
51
  EOS
52
52
  end
53
53
  end
54
+
55
+ private
56
+
57
+ # AWS の credential を以下の順番で存在チェックをする
58
+ # 1. ~/.aws/credentials
59
+ # 2. ~/.config/aws/credentials
60
+ # 存在しない場合は順番1つ目のものを用いる
61
+ def find_credentials
62
+ credentials = ["~/.aws/credentials", "~/.config/aws/credentials"]
63
+ credential = credentials.find{|c| File.exists? File.expand_path(c) }
64
+ if credential
65
+ credential
66
+ else
67
+ credentials.first
68
+ end
69
+ end
54
70
  end
55
71
  end
@@ -1,3 +1,3 @@
1
1
  module Oneaws
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oneaws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Koya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-15 00:00:00.000000000 Z
11
+ date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor