awskeyring 0.9.0 → 1.1.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
- SHA1:
3
- metadata.gz: 9871d5b6d30539c178819acbd9142004c85443b7
4
- data.tar.gz: fb497258e4204746dae39bdd4d5af529de0d354b
2
+ SHA256:
3
+ metadata.gz: b87abef9f85c6701db2bd73209be0d385ac426b5421aeff5c0f81b1d67b695d9
4
+ data.tar.gz: 63e772094af9ad179f44b254ccf607418bc33577e67d6fd35c304708bdcf7a43
5
5
  SHA512:
6
- metadata.gz: b04ba2c7c9f369aba46e44f8621f447e79235ff4a42a5e225e80e2353d3cc22a8d32b11017639a415e7bc1824b082c09917e994cca9798ac93b4688c945e3112
7
- data.tar.gz: a0fcdbfbce47d4e6e876f0e26766b3dd2f8f1a6d79fc913ceb11f8b63ae2099de82a070ecb7bcb373a715830e6f3fc9daaa20a8831b0493dd01d9d95ee80e819
6
+ metadata.gz: b78466f81f87df9e9dd48ac5755ed58b9ea35a84d2f87b4c1fc3e9501cf4545cdc5a4730b412967ef8e2ccae2cf641d4fa05decff75d966b7b47d3e1955c30a5
7
+ data.tar.gz: 550148fee86d1dcb7bdf3c52b14400ab9d8bdf1e84361b5f77ad0a05c9d43e86cd539a3a0d6617eff288f9a70925f99cf775f4d150596f308e4f16361325dc1d
data/CHANGELOG.md CHANGED
@@ -1,195 +1,43 @@
1
- # Change Log
1
+ # Changelog
2
2
 
3
- ## [v0.9.0](https://github.com/vibrato/awskeyring/tree/v0.9.0) (2019-04-09)
4
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.8.1...v0.9.0)
3
+ ## [v1.1.0](https://github.com/servian/awskeyring/tree/v1.1.0) (2019-11-06)
5
4
 
6
- **Implemented enhancements:**
7
-
8
- - Strip whitespace from user input [\#43](https://github.com/vibrato/awskeyring/pull/43) ([tristanmorgan](https://github.com/tristanmorgan))
9
-
10
- ## [v0.8.1](https://github.com/vibrato/awskeyring/tree/v0.8.1) (2019-02-06)
11
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.8.0...v0.8.1)
12
-
13
- **Fixed bugs:**
14
-
15
- - Fix usage behind PROXIES [\#42](https://github.com/vibrato/awskeyring/pull/42) ([tristanmorgan](https://github.com/tristanmorgan))
16
-
17
- ## [v0.8.0](https://github.com/vibrato/awskeyring/tree/v0.8.0) (2018-12-19)
18
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.7.2...v0.8.0)
19
-
20
- **Implemented enhancements:**
21
-
22
- - Provide input feedback for secret fields. [\#41](https://github.com/vibrato/awskeyring/pull/41) ([tristanmorgan](https://github.com/tristanmorgan))
23
-
24
- **Fixed bugs:**
25
-
26
- - Cannot enter secret access key when adding new accounts in 0.7.0 [\#36](https://github.com/vibrato/awskeyring/issues/36)
27
-
28
- ## [v0.7.2](https://github.com/vibrato/awskeyring/tree/v0.7.2) (2018-12-17)
29
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.7.1...v0.7.2)
30
-
31
- **Fixed bugs:**
32
-
33
- - Validate that account doesn't already exists. [\#40](https://github.com/vibrato/awskeyring/pull/40) ([tristanmorgan](https://github.com/tristanmorgan))
34
- - Check for COMMAND param to exec. [\#38](https://github.com/vibrato/awskeyring/pull/38) ([tristanmorgan](https://github.com/tristanmorgan))
35
-
36
- ## [v0.7.1](https://github.com/vibrato/awskeyring/tree/v0.7.1) (2018-12-03)
37
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.7.0...v0.7.1)
38
-
39
- **Fixed bugs:**
40
-
41
- - Trailing LF was being passed to validator [\#37](https://github.com/vibrato/awskeyring/pull/37) ([tristanmorgan](https://github.com/tristanmorgan))
42
-
43
- ## [v0.7.0](https://github.com/vibrato/awskeyring/tree/v0.7.0) (2018-11-26)
44
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.6.0...v0.7.0)
45
-
46
- **Implemented enhancements:**
47
-
48
- - Validate existing account. [\#35](https://github.com/vibrato/awskeyring/pull/35) ([tristanmorgan](https://github.com/tristanmorgan))
49
- - Swap Highline for Thor::LineEditor [\#34](https://github.com/vibrato/awskeyring/pull/34) ([tristanmorgan](https://github.com/tristanmorgan))
50
-
51
- ## [v0.6.0](https://github.com/vibrato/awskeyring/tree/v0.6.0) (2018-10-18)
52
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.3...v0.6.0)
53
-
54
- **Fixed bugs:**
55
-
56
- - Use a default Region for Rotate. [\#33](https://github.com/vibrato/awskeyring/pull/33) ([tristanmorgan](https://github.com/tristanmorgan))
57
- - Fix JSON time format to use ISO8601. [\#32](https://github.com/vibrato/awskeyring/pull/32) ([tristanmorgan](https://github.com/tristanmorgan))
58
-
59
- ## [v0.5.3](https://github.com/vibrato/awskeyring/tree/v0.5.3) (2018-10-03)
60
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.2...v0.5.3)
61
-
62
- **Implemented enhancements:**
63
-
64
- - Console favourites [\#31](https://github.com/vibrato/awskeyring/pull/31) ([tristanmorgan](https://github.com/tristanmorgan))
65
-
66
- ## [v0.5.2](https://github.com/vibrato/awskeyring/tree/v0.5.2) (2018-09-18)
67
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.1...v0.5.2)
68
-
69
- **Implemented enhancements:**
70
-
71
- - More robust autocomplete. [\#30](https://github.com/vibrato/awskeyring/pull/30) ([tristanmorgan](https://github.com/tristanmorgan))
72
-
73
- ## [v0.5.1](https://github.com/vibrato/awskeyring/tree/v0.5.1) (2018-09-12)
74
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.0...v0.5.1)
75
-
76
- **Implemented enhancements:**
77
-
78
- - Autocomplete flags too. [\#29](https://github.com/vibrato/awskeyring/pull/29) ([tristanmorgan](https://github.com/tristanmorgan))
79
-
80
- ## [v0.5.0](https://github.com/vibrato/awskeyring/tree/v0.5.0) (2018-09-10)
81
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.4.0...v0.5.0)
5
+ [Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.2...v1.1.0)
82
6
 
83
7
  **Implemented enhancements:**
84
8
 
85
- - Separate update account from add account. [\#28](https://github.com/vibrato/awskeyring/pull/28) ([tristanmorgan](https://github.com/tristanmorgan))
9
+ - Add completion to input prompts [\#53](https://github.com/servian/awskeyring/pull/53) ([tristanmorgan](https://github.com/tristanmorgan))
10
+ - Check for existing \(or not\) role names [\#52](https://github.com/servian/awskeyring/pull/52) ([tristanmorgan](https://github.com/tristanmorgan))
86
11
 
87
- **Merged pull requests:**
12
+ ## [v1.0.2](https://github.com/servian/awskeyring/tree/v1.0.2) (2019-10-18)
88
13
 
89
- - Refactor [\#27](https://github.com/vibrato/awskeyring/pull/27) ([tristanmorgan](https://github.com/tristanmorgan))
90
-
91
- ## [v0.4.0](https://github.com/vibrato/awskeyring/tree/v0.4.0) (2018-08-21)
92
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.3.1...v0.4.0)
14
+ [Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.1...v1.0.2)
93
15
 
94
16
  **Implemented enhancements:**
95
17
 
96
- - I18n - Internationalisation [\#26](https://github.com/vibrato/awskeyring/pull/26) ([tristanmorgan](https://github.com/tristanmorgan))
97
- - Adds no token flag to skip saved token [\#25](https://github.com/vibrato/awskeyring/pull/25) ([tristanmorgan](https://github.com/tristanmorgan))
98
-
99
- ## [v0.3.1](https://github.com/vibrato/awskeyring/tree/v0.3.1) (2018-07-25)
100
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.3.0...v0.3.1)
18
+ - Move to a new home, Servian. [\#51](https://github.com/servian/awskeyring/pull/51) ([tristanmorgan](https://github.com/tristanmorgan))
19
+ - Use RuboCop-RSpec too and expect\(\) more. [\#48](https://github.com/servian/awskeyring/pull/48) ([tristanmorgan](https://github.com/tristanmorgan))
101
20
 
102
- **Implemented enhancements:**
21
+ ## [v1.0.1](https://github.com/servian/awskeyring/tree/v1.0.1) (2019-05-23)
103
22
 
104
- - Warn about key-age [\#24](https://github.com/vibrato/awskeyring/pull/24) ([tristanmorgan](https://github.com/tristanmorgan))
105
-
106
- **Fixed bugs:**
107
-
108
- - Error adding account when region is not specified [\#21](https://github.com/vibrato/awskeyring/issues/21)
109
- - Check more locations for current region. [\#23](https://github.com/vibrato/awskeyring/pull/23) ([tristanmorgan](https://github.com/tristanmorgan))
110
-
111
- **Merged pull requests:**
112
-
113
- - Set a default region on cred verify. [\#22](https://github.com/vibrato/awskeyring/pull/22) ([tristanmorgan](https://github.com/tristanmorgan))
114
-
115
- ## [v0.3.0](https://github.com/vibrato/awskeyring/tree/v0.3.0) (2018-04-12)
116
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.2.0...v0.3.0)
23
+ [Full Changelog](https://github.com/servian/awskeyring/compare/v1.0.0...v1.0.1)
117
24
 
118
25
  **Implemented enhancements:**
119
26
 
120
- - Validate tokens upon adding them to the keychain [\#18](https://github.com/vibrato/awskeyring/issues/18)
121
- - Generate a token from IAM User credentials using the GetFederationToken API [\#17](https://github.com/vibrato/awskeyring/issues/17)
122
- - Test creds against AWS API \(optionally\). [\#20](https://github.com/vibrato/awskeyring/pull/20) ([tristanmorgan](https://github.com/tristanmorgan))
123
- - Allow STS get\_session\_token without role [\#19](https://github.com/vibrato/awskeyring/pull/19) ([tristanmorgan](https://github.com/tristanmorgan))
124
-
125
- ## [v0.2.0](https://github.com/vibrato/awskeyring/tree/v0.2.0) (2018-04-05)
126
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.1.1...v0.2.0)
127
-
128
- **Implemented enhancements:**
129
-
130
- - Add AWS CLI credential\_process compatible JSON output [\#16](https://github.com/vibrato/awskeyring/pull/16) ([tristanmorgan](https://github.com/tristanmorgan))
131
-
132
- ## [v0.1.1](https://github.com/vibrato/awskeyring/tree/v0.1.1) (2018-03-25)
133
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.1.0...v0.1.1)
134
-
135
- **Merged pull requests:**
136
-
137
- - More coverage with tests. [\#15](https://github.com/vibrato/awskeyring/pull/15) ([tristanmorgan](https://github.com/tristanmorgan))
138
- - Validate MFA code and tweak Autocomplete [\#14](https://github.com/vibrato/awskeyring/pull/14) ([tristanmorgan](https://github.com/tristanmorgan))
139
-
140
- ## [v0.1.0](https://github.com/vibrato/awskeyring/tree/v0.1.0) (2018-03-14)
141
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.6...v0.1.0)
142
-
143
- **Implemented enhancements:**
144
-
145
- - Item refactor [\#13](https://github.com/vibrato/awskeyring/pull/13) ([tristanmorgan](https://github.com/tristanmorgan))
146
- - Aws refactor [\#12](https://github.com/vibrato/awskeyring/pull/12) ([tristanmorgan](https://github.com/tristanmorgan))
147
-
148
- ## [v0.0.6](https://github.com/vibrato/awskeyring/tree/v0.0.6) (2018-03-01)
149
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.5...v0.0.6)
150
-
151
- **Implemented enhancements:**
152
-
153
- - Credential Rotation Feature [\#4](https://github.com/vibrato/awskeyring/issues/4)
154
- - Rotate credentials feature. [\#11](https://github.com/vibrato/awskeyring/pull/11) ([tristanmorgan](https://github.com/tristanmorgan))
155
-
156
- **Merged pull requests:**
157
-
158
- - Input validation [\#10](https://github.com/vibrato/awskeyring/pull/10) ([tristanmorgan](https://github.com/tristanmorgan))
159
- - Adding a check for incorrect file modes. [\#9](https://github.com/vibrato/awskeyring/pull/9) ([tristanmorgan](https://github.com/tristanmorgan))
160
-
161
- ## [v0.0.5](https://github.com/vibrato/awskeyring/tree/v0.0.5) (2018-02-15)
162
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.4...v0.0.5)
27
+ - auto-complete the --version [\#47](https://github.com/servian/awskeyring/pull/47) ([tristanmorgan](https://github.com/tristanmorgan))
163
28
 
164
29
  **Fixed bugs:**
165
30
 
166
- - Issue on add [\#7](https://github.com/vibrato/awskeyring/issues/7)
167
-
168
- **Merged pull requests:**
31
+ - Unfreeze secret strings. [\#46](https://github.com/servian/awskeyring/pull/46) ([tristanmorgan](https://github.com/tristanmorgan))
169
32
 
170
- - fix issue \#7 and add a path to open console. [\#8](https://github.com/vibrato/awskeyring/pull/8) ([tristanmorgan](https://github.com/tristanmorgan))
33
+ ## [v1.0.0](https://github.com/servian/awskeyring/tree/v1.0.0) (2019-05-19)
171
34
 
172
- ## [v0.0.4](https://github.com/vibrato/awskeyring/tree/v0.0.4) (2018-01-29)
173
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.3...v0.0.4)
174
-
175
- ## [v0.0.3](https://github.com/vibrato/awskeyring/tree/v0.0.3) (2018-01-28)
176
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.2...v0.0.3)
35
+ [Full Changelog](https://github.com/servian/awskeyring/compare/v0.10.0...v1.0.0)
177
36
 
178
37
  **Implemented enhancements:**
179
38
 
180
- - Remove Token feature [\#5](https://github.com/vibrato/awskeyring/issues/5)
181
- - Implement exec command [\#2](https://github.com/vibrato/awskeyring/issues/2)
182
- - Add Remove token feature [\#6](https://github.com/vibrato/awskeyring/pull/6) ([tristanmorgan](https://github.com/tristanmorgan))
183
- - Implement exec feature. [\#3](https://github.com/vibrato/awskeyring/pull/3) ([tristanmorgan](https://github.com/tristanmorgan))
184
-
185
- ## [v0.0.2](https://github.com/vibrato/awskeyring/tree/v0.0.2) (2018-01-18)
186
- [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.0.1...v0.0.2)
187
-
188
- **Merged pull requests:**
189
-
190
- - Sledgehammer disable of rubocop metrics. [\#1](https://github.com/vibrato/awskeyring/pull/1) ([tristanmorgan](https://github.com/tristanmorgan))
39
+ - More RuboCop changes and tweaked version string. [\#45](https://github.com/servian/awskeyring/pull/45) ([tristanmorgan](https://github.com/tristanmorgan))
191
40
 
192
- ## [v0.0.1](https://github.com/vibrato/awskeyring/tree/v0.0.1) (2017-12-25)
193
41
 
194
42
 
195
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
43
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,48 @@
1
+ # How to contribute
2
+
3
+ Bug reports and pull requests from users are what keep this project working.
4
+
5
+ ## Basics
6
+
7
+ 1. Create an issue and describe your idea
8
+ 2. [Fork it](https://github.com/servian/awskeyring/fork)
9
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
10
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
11
+ 5. Publish the branch (`git push origin my-new-feature`)
12
+ 6. Create a new Pull Request
13
+
14
+ ## Checking your work
15
+
16
+ You can run the test suite.
17
+
18
+ You can run [RuboCop] to check code style.
19
+
20
+ You can run [RSpec] to see if anything broke.
21
+
22
+ You can run [YARD] to see of your code is documented.
23
+
24
+ The default Rake task, runnable using `rake`.
25
+
26
+ ## Write documentation
27
+
28
+ This project has documentation in a few places:
29
+
30
+ ### Introduction and usage
31
+
32
+ A friendly `README.md` written for many audiences.
33
+
34
+ ### Examples and advanced usage
35
+
36
+ The [wiki].
37
+
38
+ ### API documentation
39
+
40
+ API documentation is written as [YARD] docblocks in the Ruby code.
41
+
42
+ This is rendered as Web pages on [Rubydoc.info][awskeyring on Rubydoc.info].
43
+
44
+ [wiki]: https://github.com/servian/awskeyring/wiki
45
+ [YARD]: https://yardoc.org/
46
+ [awskeyring on Rubydoc.info]: https://www.rubydoc.info/gems/awskeyring
47
+ [RuboCop]: https://rubocop.readthedocs.io/en/latest/
48
+ [Rspec]: https://rspec.info
data/Gemfile CHANGED
@@ -1,13 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in awskeyring.gemspec
4
6
  gemspec
5
7
 
6
8
  group :development do
7
- gem 'bundler'
8
9
  gem 'github_changelog_generator'
9
10
  gem 'rake'
10
11
  gem 'rspec'
11
12
  gem 'rubocop'
13
+ gem 'rubocop-performance'
14
+ gem 'rubocop-rspec'
12
15
  gem 'yard'
13
16
  end
data/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Awskeyring
2
2
 
3
- * [![Build Status](https://travis-ci.org/vibrato/awskeyring.svg?branch=master)](https://travis-ci.org/vibrato/awskeyring)
3
+ ![Awskeyring](https://raw.githubusercontent.com/servian/awskeyring/master/awskeyring-144.png)
4
+
5
+ * [![Build Status](https://travis-ci.org/servian/awskeyring.svg?branch=master)](https://travis-ci.org/servian/awskeyring)
4
6
  * [![Gem Version](https://badge.fury.io/rb/awskeyring.svg)](https://badge.fury.io/rb/awskeyring)
5
- * [![license MIT](http://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
6
- * [![All Downloads](http://ruby-gem-downloads-badge.herokuapp.com/awskeyring?type=total)](https://rubygems.org/gems/awskeyring)
7
- * [![Version Downloads](http://ruby-gem-downloads-badge.herokuapp.com/awskeyring?label=downloads-current-version)](https://rubygems.org/gems/awskeyring)
8
- * [![Documentation](http://img.shields.io/badge/yard-docs-brightgreen.svg)](http://www.rubydoc.info/gems/awskeyring)
7
+ * [![license MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
8
+ * [![All Downloads](https://ruby-gem-downloads-badge.herokuapp.com/awskeyring?type=total)](https://rubygems.org/gems/awskeyring)
9
+ * [![Version Downloads](https://ruby-gem-downloads-badge.herokuapp.com/awskeyring?label=downloads-current-version)](https://rubygems.org/gems/awskeyring)
10
+ * [![Documentation](https://img.shields.io/badge/yard-docs-brightgreen.svg)](https://www.rubydoc.info/gems/awskeyring)
9
11
 
10
12
  Awskeyring is a small tool to manage AWS account keys in the macOS Keychain.
11
13
 
@@ -24,6 +26,10 @@ Install it with:
24
26
 
25
27
  $ gem install awskeyring --user-install
26
28
 
29
+ ## Wiki
30
+
31
+ Please see the [Wiki](https://github.com/servian/awskeyring/wiki) for full usage instructions and tips.
32
+
27
33
  ## Quick start
28
34
 
29
35
  First you need to initialise your keychain to hold your AWS credentials.
@@ -38,14 +44,12 @@ Now your keys are stored safely in the macOS keychain. To print environment vari
38
44
 
39
45
  awskeyring env personal-aws
40
46
 
41
- Alternatively you can create a profile using the credential_process config variable. See the [AWS CLI Config docs](http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars) for more details on this config option.
47
+ Alternatively you can create a profile using the credential_process config variable. See the [AWS CLI Config docs](https://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars) for more details on this config option.
42
48
 
43
49
  [profile personal]
44
50
  region = us-west-1
45
51
  credential_process = /usr/local/bin/awskeyring json personal-aws
46
52
 
47
- See below and in the [wiki](https://github.com/vibrato/awskeyring/wiki) for more details on usage.
48
-
49
53
  ## Usage
50
54
 
51
55
  The CLI is using [Thor](http://whatisthor.com) with help provided interactively.
@@ -83,7 +87,7 @@ To set your environment easily the following bash function helps:
83
87
 
84
88
  ## Development
85
89
 
86
- After checking out the repo, run `bundle update` to install dependencies. Then, run `rake` to run the tests. Run `bundle exec awskeyring` to use the gem in this directory, ignoring other installed copies of this gem.
90
+ After checking out the repo, run `bundle update` to install dependencies. Then, run `rake` to run the tests. Run `bundle exec awskeyring` to use the gem in this directory, ignoring other installed copies of this gem. Awskeyring is tested against the last two versions of Ruby shipped with macOS.
87
91
 
88
92
  To install this gem onto your local machine, run `bundle exec rake install`.
89
93
 
@@ -93,9 +97,9 @@ If you believe you have found a security issue in Awskeyring, please responsibly
93
97
 
94
98
  ## Contributing
95
99
 
96
- Bug reports and pull requests are welcome on GitHub at https://github.com/vibrato/awskeyring. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
100
+ Bug reports and pull requests are welcome on GitHub at https://github.com/servian/awskeyring. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://contributor-covenant.org) code of conduct.
97
101
 
98
102
  ## License
99
103
 
100
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
104
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
101
105
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
@@ -5,7 +7,10 @@ require 'github_changelog_generator/task'
5
7
  require 'yard'
6
8
 
7
9
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
10
+ config.user = 'servian'
11
+ config.project = 'awskeyring'
8
12
  config.future_release = "v#{Awskeyring::VERSION}"
13
+ config.since_tag = 'v0.10.0'
9
14
  end
10
15
 
11
16
  RuboCop::RakeTask.new do |rubocop|
data/awskeyring.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'awskeyring/version'
@@ -10,10 +12,10 @@ Gem::Specification.new do |spec|
10
12
 
11
13
  spec.summary = 'Manages AWS credentials in the macOS keychain'
12
14
  spec.description = 'Manages AWS credentials in the macOS keychain'
13
- spec.homepage = 'https://github.com/vibrato/awskeyring'
15
+ spec.homepage = Awskeyring::HOMEPAGE
14
16
  spec.license = 'MIT'
15
17
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/|^\..*}) }
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/|^\..*|^.*\.png}) }
17
19
  spec.bindir = 'exe'
18
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
21
  spec.require_paths = ['lib']
data/exe/awskeyring CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require_relative '../lib/awskeyring_command'
4
5
 
data/i18n/en.yml CHANGED
@@ -47,6 +47,7 @@ en:
47
47
  path: 'The service PATH to open.'
48
48
  role: 'The ROLE to assume.'
49
49
  secret: 'AWS account secret.'
50
+ unset: 'Unset environment variables.'
50
51
  message:
51
52
  keychain: 'Name for new keychain (default: awskeyring)'
52
53
  account: 'account name'
data/lib/awskeyring.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'keychain'
3
5
  require 'awskeyring/validate'
@@ -8,13 +10,13 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
8
10
  # Default rpeferences fole path
9
11
  PREFS_FILE = (File.expand_path '~/.awskeyring').freeze
10
12
  # Prefix for Roles
11
- ROLE_PREFIX = 'role '.freeze
13
+ ROLE_PREFIX = 'role '
12
14
  # Prefix for Accounts
13
- ACCOUNT_PREFIX = 'account '.freeze
15
+ ACCOUNT_PREFIX = 'account '
14
16
  # Prefix for Session Keys
15
- SESSION_KEY_PREFIX = 'session-key '.freeze
17
+ SESSION_KEY_PREFIX = 'session-key '
16
18
  # Prefix for Session Tokens
17
- SESSION_TOKEN_PREFIX = 'session-token '.freeze
19
+ SESSION_TOKEN_PREFIX = 'session-token '
18
20
  # Default keychain Lock period
19
21
  FIVE_MINUTES = 300
20
22
  # Default warning of key age in days.
@@ -300,4 +302,24 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
300
302
 
301
303
  account_name
302
304
  end
305
+
306
+ # Validate role exists
307
+ #
308
+ # @param [String] role_name the associated role name.
309
+ def self.role_exists(role_name)
310
+ Awskeyring::Validate.role_name(role_name)
311
+ raise 'Role does not exist' unless list_role_names.include?(role_name)
312
+
313
+ role_name
314
+ end
315
+
316
+ # Validate role does not exists
317
+ #
318
+ # @param [String] role_name the associated role name.
319
+ def self.role_not_exists(role_name)
320
+ Awskeyring::Validate.role_name(role_name)
321
+ raise 'Role already exists' if list_role_names.include?(role_name)
322
+
323
+ role_name
324
+ end
303
325
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aws-sdk-iam'
2
4
  require 'cgi'
3
5
  require 'json'
@@ -18,7 +20,17 @@ module Awskeyring
18
20
  }.to_json.freeze
19
21
 
20
22
  # AWS Signin url
21
- AWS_SIGNIN_URL = 'https://signin.aws.amazon.com/federation'.freeze
23
+ AWS_SIGNIN_URL = 'https://signin.aws.amazon.com/federation'
24
+
25
+ # AWS Env vars
26
+ AWS_ENV_VARS = %w[
27
+ AWS_ACCESS_KEY_ID
28
+ AWS_ACCESS_KEY
29
+ AWS_SECRET_ACCESS_KEY
30
+ AWS_SECRET_KEY
31
+ AWS_SECURITY_TOKEN
32
+ AWS_SESSION_TOKEN
33
+ ].freeze
22
34
 
23
35
  # Twelve hours in seconds
24
36
  TWELVE_HOUR = (60 * 60 * 12)
@@ -101,6 +113,35 @@ module Awskeyring
101
113
  )
102
114
  end
103
115
 
116
+ # Generates Environment Variables for the AWS CLI
117
+ #
118
+ # @param [Hash] params including
119
+ # [String] account The aws_access_key_id
120
+ # [String] secret The aws_secret_access_key
121
+ # [String] token The aws_session_token
122
+ # @return [Hash] env_var hash
123
+ def self.get_env_array(params = {})
124
+ env_var = {}
125
+ env_var['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
126
+ env_var['AWS_ACCOUNT_NAME'] = params[:account] if params[:account]
127
+
128
+ if params[:key]
129
+ env_var['AWS_ACCESS_KEY_ID'] = params[:key]
130
+ env_var['AWS_ACCESS_KEY'] = params[:key]
131
+ end
132
+
133
+ if params[:secret]
134
+ env_var['AWS_SECRET_ACCESS_KEY'] = params[:secret]
135
+ env_var['AWS_SECRET_KEY'] = params[:secret]
136
+ end
137
+
138
+ if params[:token]
139
+ env_var['AWS_SECURITY_TOKEN'] = params[:token]
140
+ env_var['AWS_SESSION_TOKEN'] = params[:token]
141
+ end
142
+ env_var
143
+ end
144
+
104
145
  # Verify Credentials are active and valid
105
146
  #
106
147
  # @param [String] key The aws_access_key_id
@@ -110,8 +151,8 @@ module Awskeyring
110
151
  ENV['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
111
152
  sts = Aws::STS::Client.new(access_key_id: key, secret_access_key: secret)
112
153
  sts.get_caller_identity
113
- rescue Aws::Errors::ServiceError => err
114
- warn err.to_s
154
+ rescue Aws::Errors::ServiceError => e
155
+ warn e.to_s
115
156
  exit 1
116
157
  end
117
158
  true
@@ -218,13 +259,13 @@ module Awskeyring
218
259
  retries ||= 1
219
260
  begin
220
261
  yield block
221
- rescue Aws::IAM::Errors::InvalidClientTokenId => err
262
+ rescue Aws::IAM::Errors::InvalidClientTokenId => e
222
263
  if retries < 4
223
264
  sleep 2**retries
224
265
  retries += 1
225
266
  retry
226
267
  end
227
- warn err.message
268
+ warn e.message
228
269
  exit 1
229
270
  end
230
271
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'io/console'
2
4
 
3
5
  # Awskeyring Module,
@@ -13,7 +15,7 @@ module Awskeyring
13
15
  end
14
16
 
15
17
  private_class_method def self.hide_input # rubocop:disable Metrics/MethodLength
16
- password = ''
18
+ password = +''
17
19
  loop do
18
20
  character = $stdin.getch
19
21
  break unless character
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Awskeyring Module,
2
4
  # gives you an interface to access keychains and items.
3
5
  module Awskeyring
@@ -1,4 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Awskeyring
2
- # The Gems version number
3
- VERSION = '0.9.0'.freeze
4
+ # The Gem's version number
5
+ VERSION = '1.1.0'
6
+ # The Gem's homepage
7
+ HOMEPAGE = 'https://github.com/servian/awskeyring'
4
8
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'i18n'
2
4
  require 'thor'
3
5
 
@@ -13,7 +15,9 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
13
15
  I18n.backend.load_translations
14
16
 
15
17
  map %w[--version -v] => :__version
18
+ map %w[--help -h] => :help
16
19
  map ['init'] => :initialise
20
+ map ['adr'] => :add_role
17
21
  map ['con'] => :console
18
22
  map ['ls'] => :list
19
23
  map ['lsr'] => :list_role
@@ -27,7 +31,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
27
31
  desc '--version, -v', I18n.t('__version.desc')
28
32
  # print the version number
29
33
  def __version
30
- puts Awskeyring::VERSION
34
+ puts "Awskeyring v#{Awskeyring::VERSION}"
35
+ puts "Homepage #{Awskeyring::HOMEPAGE}"
31
36
  end
32
37
 
33
38
  desc 'initialise', I18n.t('initialise.desc')
@@ -39,7 +44,12 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
39
44
  exit 1
40
45
  end
41
46
 
42
- keychain = ask_missing(existing: options[:keychain], message: I18n.t('message.keychain'))
47
+ keychain = ask_check(
48
+ existing: options[:keychain],
49
+ flags: 'optional',
50
+ message: I18n.t('message.keychain'),
51
+ validator: Awskeyring::Validate.method(:account_name)
52
+ )
43
53
  keychain = 'awskeyring' if keychain.empty?
44
54
 
45
55
  puts I18n.t('message.newkeychain')
@@ -65,19 +75,26 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
65
75
 
66
76
  desc 'env ACCOUNT', I18n.t('env.desc')
67
77
  method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
78
+ method_option 'unset', type: :boolean, aliases: '-u', desc: I18n.t('method_option.unset'), default: false
68
79
  # Print Env vars
69
80
  def env(account = nil)
70
- account = ask_check(
71
- existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
72
- )
73
- cred = age_check_and_get(account: account, no_token: options['no-token'])
74
- put_env_string(cred)
81
+ if options['unset']
82
+ put_env_string(account: nil, key: nil, secret: nil, token: nil)
83
+ else
84
+ account = ask_check(
85
+ existing: account, message: I18n.t('message.account'),
86
+ validator: Awskeyring.method(:account_exists),
87
+ limited_to: Awskeyring.list_account_names
88
+ )
89
+ cred = age_check_and_get(account: account, no_token: options['no-token'])
90
+ put_env_string(cred)
91
+ end
75
92
  end
76
93
 
77
94
  desc 'json ACCOUNT', I18n.t('json.desc')
78
95
  method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
79
96
  # Print JSON for use with credential_process
80
- def json(account = nil)
97
+ def json(account)
81
98
  account = ask_check(
82
99
  existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
83
100
  )
@@ -100,7 +117,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
100
117
  exit 1
101
118
  end
102
119
  cred = age_check_and_get(account: account, no_token: options['no-token'])
103
- env_vars = env_vars(cred)
120
+ env_vars = Awskeyring::Awsapi.get_env_array(cred)
104
121
  begin
105
122
  pid = Process.spawn(env_vars, command.join(' '))
106
123
  Process.wait pid
@@ -126,11 +143,11 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
126
143
  )
127
144
  secret = ask_check(
128
145
  existing: options[:secret], message: I18n.t('message.secret'),
129
- secure: true, validator: Awskeyring::Validate.method(:secret_access_key)
146
+ flags: 'secure', validator: Awskeyring::Validate.method(:secret_access_key)
130
147
  )
131
148
  mfa = ask_check(
132
149
  existing: options[:mfa], message: I18n.t('message.mfa'),
133
- optional: true, validator: Awskeyring::Validate.method(:mfa_arn)
150
+ flags: 'optional', validator: Awskeyring::Validate.method(:mfa_arn)
134
151
  )
135
152
  Awskeyring::Awsapi.verify_cred(key: key, secret: secret) unless options['no-remote']
136
153
  Awskeyring.add_account(
@@ -147,16 +164,18 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
147
164
  method_option :secret, type: :string, aliases: '-s', desc: I18n.t('method_option.secret')
148
165
  method_option 'no-remote', type: :boolean, aliases: '-r', desc: I18n.t('method_option.noremote'), default: false
149
166
  # Update an Account
150
- def update(account = nil) # rubocop:disable Metrics/MethodLength
167
+ def update(account = nil) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
151
168
  account = ask_check(
152
- existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
169
+ existing: account, message: I18n.t('message.account'),
170
+ validator: Awskeyring.method(:account_exists),
171
+ limited_to: Awskeyring.list_account_names
153
172
  )
154
173
  key = ask_check(
155
174
  existing: options[:key], message: I18n.t('message.key'), validator: Awskeyring::Validate.method(:access_key)
156
175
  )
157
176
  secret = ask_check(
158
177
  existing: options[:secret], message: I18n.t('message.secret'),
159
- secure: true, validator: Awskeyring::Validate.method(:secret_access_key)
178
+ flags: 'secure', validator: Awskeyring::Validate.method(:secret_access_key)
160
179
  )
161
180
  Awskeyring::Awsapi.verify_cred(key: key, secret: secret) unless options['no-remote']
162
181
  Awskeyring.update_account(
@@ -174,7 +193,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
174
193
  def add_role(role = nil)
175
194
  role = ask_check(
176
195
  existing: role, message: I18n.t('message.role'),
177
- validator: Awskeyring::Validate.method(:role_name)
196
+ validator: Awskeyring.method(:role_not_exists)
178
197
  )
179
198
  arn = ask_check(
180
199
  existing: options[:arn], message: I18n.t('message.arn'),
@@ -192,7 +211,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
192
211
  # Remove an account
193
212
  def remove(account = nil)
194
213
  account = ask_check(
195
- existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
214
+ existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists),
215
+ limited_to: Awskeyring.list_account_names
196
216
  )
197
217
  Awskeyring.delete_account(account: account, message: I18n.t('message.delaccount', account: account))
198
218
  end
@@ -201,7 +221,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
201
221
  # remove a session token
202
222
  def remove_token(account = nil)
203
223
  account = ask_check(
204
- existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
224
+ existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists),
225
+ limited_to: Awskeyring.list_account_names
205
226
  )
206
227
  Awskeyring.delete_token(account: account, message: I18n.t('message.deltoken', account: account))
207
228
  end
@@ -211,7 +232,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
211
232
  # remove a role
212
233
  def remove_role(role = nil)
213
234
  role = ask_check(
214
- existing: role, message: I18n.t('message.role'), validator: Awskeyring::Validate.method(:role_name)
235
+ existing: role, message: I18n.t('message.role'), validator: Awskeyring.method(:role_exists),
236
+ limited_to: Awskeyring.list_role_names
215
237
  )
216
238
  Awskeyring.delete_role(role_name: role, message: I18n.t('message.delrole', role: role))
217
239
  end
@@ -220,7 +242,10 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
220
242
  # rotate Account keys
221
243
  def rotate(account = nil) # rubocop:disable Metrics/MethodLength
222
244
  account = ask_check(
223
- existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
245
+ existing: account,
246
+ message: I18n.t('message.account'),
247
+ validator: Awskeyring.method(:account_exists),
248
+ limited_to: Awskeyring.list_account_names
224
249
  )
225
250
  cred = Awskeyring.get_valid_creds(account: account, no_token: true)
226
251
 
@@ -231,8 +256,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
231
256
  secret: cred[:secret],
232
257
  key_message: I18n.t('message.rotate', account: account)
233
258
  )
234
- rescue Aws::Errors::ServiceError => err
235
- warn err.to_s
259
+ rescue Aws::Errors::ServiceError => e
260
+ warn e.to_s
236
261
  exit 1
237
262
  end
238
263
 
@@ -252,12 +277,16 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
252
277
  # generate a sessiopn token
253
278
  def token(account = nil, role = nil, code = nil) # rubocop:disable all
254
279
  account = ask_check(
255
- existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
280
+ existing: account,
281
+ message: I18n.t('message.account'),
282
+ validator: Awskeyring.method(:account_exists),
283
+ limited_to: Awskeyring.list_account_names
256
284
  )
257
285
  role ||= options[:role]
258
286
  if role
259
287
  role = ask_check(
260
- existing: role, message: I18n.t('message.role'), validator: Awskeyring::Validate.method(:role_name)
288
+ existing: role, message: I18n.t('message.role'), validator: Awskeyring.method(:role_exists),
289
+ limited_to: Awskeyring.list_role_names
261
290
  )
262
291
  end
263
292
  code ||= options[:code]
@@ -285,8 +314,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
285
314
  user: ENV['USER']
286
315
  )
287
316
  Awskeyring.delete_token(account: account, message: '# Removing STS credentials')
288
- rescue Aws::Errors::ServiceError => err
289
- warn err.to_s
317
+ rescue Aws::Errors::ServiceError => e
318
+ warn e.to_s
290
319
  exit 1
291
320
  end
292
321
 
@@ -309,7 +338,10 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
309
338
  # Open the AWS Console
310
339
  def console(account = nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
311
340
  account = ask_check(
312
- existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_exists)
341
+ existing: account,
342
+ message: I18n.t('message.account'),
343
+ validator: Awskeyring.method(:account_exists),
344
+ limited_to: Awskeyring.list_account_names
313
345
  )
314
346
  cred = age_check_and_get(account: account, no_token: options['no-token'])
315
347
 
@@ -323,8 +355,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
323
355
  path: path,
324
356
  user: ENV['USER']
325
357
  )
326
- rescue Aws::Errors::ServiceError => err
327
- warn err.to_s
358
+ rescue Aws::Errors::ServiceError => e
359
+ warn e.to_s
328
360
  exit 1
329
361
  end
330
362
 
@@ -369,7 +401,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
369
401
  comp_len = 3 if curr.start_with?('-')
370
402
 
371
403
  case prev
372
- when 'help'
404
+ when 'help', File.basename($PROGRAM_NAME)
373
405
  comp_len = 0
374
406
  when 'remove-role', '-r', 'rmr'
375
407
  comp_len = 2
@@ -419,36 +451,25 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
419
451
  self.class.all_commands[command].options.values.map(&:switch_name)
420
452
  end
421
453
 
422
- def env_vars(cred)
423
- env_var = {}
424
- env_var['AWS_DEFAULT_REGION'] = 'us-east-1' unless Awskeyring::Awsapi.region
425
- env_var['AWS_ACCOUNT_NAME'] = cred[:account]
426
- env_var['AWS_ACCESS_KEY_ID'] = cred[:key]
427
- env_var['AWS_ACCESS_KEY'] = cred[:key]
428
- env_var['AWS_SECRET_ACCESS_KEY'] = cred[:secret]
429
- env_var['AWS_SECRET_KEY'] = cred[:secret]
430
- if cred[:token]
431
- env_var['AWS_SECURITY_TOKEN'] = cred[:token]
432
- env_var['AWS_SESSION_TOKEN'] = cred[:token]
433
- end
434
- env_var
435
- end
436
-
437
454
  def put_env_string(cred)
438
- env_var = env_vars(cred)
455
+ env_var = Awskeyring::Awsapi.get_env_array(cred)
439
456
  env_var.each { |var, value| puts "export #{var}=\"#{value}\"" }
440
-
441
- puts 'unset AWS_SECURITY_TOKEN' unless cred[:token]
442
- puts 'unset AWS_SESSION_TOKEN' unless cred[:token]
457
+ Awskeyring::Awsapi::AWS_ENV_VARS.each { |key| puts "unset #{key}" unless env_var.key?(key) }
443
458
  end
444
459
 
445
- def ask_check(existing:, message:, secure: false, optional: false, validator: nil)
460
+ def ask_check(existing:, message:, flags: nil, validator: nil, limited_to: nil) # rubocop:disable Metrics/MethodLength
446
461
  retries ||= 3
447
462
  begin
448
- value = ask_missing(existing: existing, message: message, secure: secure, optional: optional)
449
- value = validator.call(value) unless value.empty? && optional
450
- rescue RuntimeError => err
451
- warn err.message
463
+ value = ask_missing(
464
+ existing: existing,
465
+ message: message,
466
+ secure: 'secure'.eql?(flags),
467
+ optional: 'optional'.eql?(flags),
468
+ limited_to: limited_to
469
+ )
470
+ value = validator.call(value) unless value.empty? && 'optional'.eql?(flags)
471
+ rescue RuntimeError => e
472
+ warn e.message
452
473
  existing = nil
453
474
  retry unless (retries -= 1).zero?
454
475
  exit 1
@@ -456,15 +477,17 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
456
477
  value
457
478
  end
458
479
 
459
- def ask_missing(existing:, message:, secure: false, optional: false)
460
- existing || ask(message: message, secure: secure, optional: optional).strip
480
+ def ask_missing(existing:, message:, secure: false, optional: false, limited_to: nil)
481
+ existing || ask(message: message, secure: secure, optional: optional, limited_to: limited_to).strip
461
482
  end
462
483
 
463
- def ask(message:, secure: false, optional: false)
484
+ def ask(message:, secure: false, optional: false, limited_to: nil)
464
485
  if secure
465
486
  Awskeyring::Input.read_secret(message.rjust(20) + ': ')
466
487
  elsif optional
467
488
  Thor::LineEditor.readline((message + ' (optional)').rjust(20) + ': ')
489
+ elsif limited_to
490
+ Thor::LineEditor.readline(message.rjust(20) + ': ', limited_to: limited_to)
468
491
  else
469
492
  Thor::LineEditor.readline(message.rjust(20) + ': ')
470
493
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awskeyring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Morgan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-09 00:00:00.000000000 Z
11
+ date: 2019-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-iam
@@ -76,6 +76,7 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - CHANGELOG.md
78
78
  - CODE_OF_CONDUCT.md
79
+ - CONTRIBUTING.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
81
82
  - README.md
@@ -89,7 +90,7 @@ files:
89
90
  - lib/awskeyring/validate.rb
90
91
  - lib/awskeyring/version.rb
91
92
  - lib/awskeyring_command.rb
92
- homepage: https://github.com/vibrato/awskeyring
93
+ homepage: https://github.com/servian/awskeyring
93
94
  licenses:
94
95
  - MIT
95
96
  metadata: {}
@@ -108,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.5.2.3
112
+ rubygems_version: 3.0.3
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Manages AWS credentials in the macOS keychain