awskeyring 1.8.5 → 1.9.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 +4 -4
- data/Rakefile +3 -3
- data/lib/awskeyring.rb +14 -3
- data/lib/awskeyring/awsapi.rb +1 -1
- data/lib/awskeyring/version.rb +1 -1
- data/lib/awskeyring_command.rb +4 -7
- data/man/awskeyring.5 +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c40aae37a636dc9f09930e87a9c592d85b19889d96f0550875954d460bc7e9fe
|
4
|
+
data.tar.gz: 6d18d87a6301f6fe6f9cd8976da5bc80dbaf3cffe8570997b341d99426f56dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 621e70e88839085be03c4c0cc30c8fe1e338392f46eca028c5a4fd244eac3d9f7c8cf68458730a154837408c9bd5cdc3d1da8625989c1b7de69bd007b3d91ecc
|
7
|
+
data.tar.gz: bac9058e92069e9206a070eb6fde527aeb1254e9135742cbbc7bd23a4666b27c6ee01da09f72083acff8e6b7fb0fc995e2553d2ebee196e05fc01e5f81419c4f
|
data/Rakefile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
|
-
require 'rspec/core/rake_task'
|
5
4
|
require 'rubocop/rake_task'
|
6
5
|
require 'ronn'
|
7
6
|
require 'github_changelog_generator/task'
|
@@ -49,8 +48,9 @@ end
|
|
49
48
|
desc 'generate manpage'
|
50
49
|
task :ronn do
|
51
50
|
puts 'Running Ronn...'
|
52
|
-
|
53
|
-
|
51
|
+
doc = Ronn::Document.new('man/awskeyring.5.ronn')
|
52
|
+
doc.date = Time.parse(`git show -s --format=%ad --date=short`)
|
53
|
+
File.write('man/awskeyring.5', doc.to_roff)
|
54
54
|
puts "done\n\n"
|
55
55
|
end
|
56
56
|
|
data/lib/awskeyring.rb
CHANGED
@@ -97,6 +97,17 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
97
97
|
all_items.where(account: account).first
|
98
98
|
end
|
99
99
|
|
100
|
+
# return item that matches a prefix if only one.
|
101
|
+
def self.solo_select(list, prefix)
|
102
|
+
return prefix if list.include?(prefix)
|
103
|
+
|
104
|
+
list.select! { |elem| elem.start_with?(prefix) }
|
105
|
+
|
106
|
+
return list.first if list.length == 1
|
107
|
+
|
108
|
+
nil
|
109
|
+
end
|
110
|
+
|
100
111
|
# Add an account item
|
101
112
|
#
|
102
113
|
# @param [String] account The account name to create
|
@@ -317,7 +328,7 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
317
328
|
# @param [String] account_name the associated account name.
|
318
329
|
def self.account_exists(account_name)
|
319
330
|
Awskeyring::Validate.account_name(account_name)
|
320
|
-
raise 'Account does not exist' unless
|
331
|
+
raise 'Account does not exist' unless (account_name = solo_select(list_account_names, account_name))
|
321
332
|
|
322
333
|
account_name
|
323
334
|
end
|
@@ -347,7 +358,7 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
347
358
|
# @param [String] role_name the associated role name.
|
348
359
|
def self.role_exists(role_name)
|
349
360
|
Awskeyring::Validate.role_name(role_name)
|
350
|
-
raise 'Role does not exist' unless
|
361
|
+
raise 'Role does not exist' unless (role_name = solo_select(list_role_names, role_name))
|
351
362
|
|
352
363
|
role_name
|
353
364
|
end
|
@@ -367,7 +378,7 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
|
|
367
378
|
# @param [String] token_name the associated account name.
|
368
379
|
def self.token_exists(token_name)
|
369
380
|
Awskeyring::Validate.account_name(token_name)
|
370
|
-
raise 'Token does not exist' unless
|
381
|
+
raise 'Token does not exist' unless (token_name = solo_select(list_token_names, token_name))
|
371
382
|
|
372
383
|
token_name
|
373
384
|
end
|
data/lib/awskeyring/awsapi.rb
CHANGED
@@ -209,7 +209,7 @@ module Awskeyring
|
|
209
209
|
# Get the signin token param
|
210
210
|
private_class_method def self.token_param(session_json:)
|
211
211
|
get_signin_token_url = AWS_SIGNIN_URL + '?Action=getSigninToken' \
|
212
|
-
|
212
|
+
'&Session=' + CGI.escape(session_json)
|
213
213
|
|
214
214
|
uri = URI(get_signin_token_url)
|
215
215
|
request = Net::HTTP.new(uri.host, uri.port)
|
data/lib/awskeyring/version.rb
CHANGED
data/lib/awskeyring_command.rb
CHANGED
@@ -16,7 +16,6 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
16
16
|
I18n.backend.load_translations
|
17
17
|
|
18
18
|
map %w[--version -v] => :__version
|
19
|
-
map %w[--help -h] => :help
|
20
19
|
map 'adr' => :add_role
|
21
20
|
map 'assume-role' => :token
|
22
21
|
map 'ls' => :list
|
@@ -491,15 +490,13 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
491
490
|
|
492
491
|
# catch the command from prefixes and aliases
|
493
492
|
def sub_command(comp_lines)
|
494
|
-
return '' if comp_lines.
|
493
|
+
return '' if comp_lines.length < 2
|
495
494
|
|
496
|
-
sub_cmd = comp_lines[1]
|
495
|
+
sub_cmd = comp_lines[1]
|
497
496
|
|
498
|
-
|
497
|
+
return self.class.map[sub_cmd].to_s if self.class.map.key? sub_cmd
|
499
498
|
|
500
|
-
|
501
|
-
|
502
|
-
self.class.map[sub_cmd].to_s
|
499
|
+
(Awskeyring.solo_select(list_commands, sub_cmd) || '').tr('-', '_')
|
503
500
|
end
|
504
501
|
|
505
502
|
# given a type return the right list for completions
|
data/man/awskeyring.5
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "AWSKEYRING" "5" "
|
4
|
+
.TH "AWSKEYRING" "5" "July 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBAwskeyring\fR \- is a small tool to manage AWS account keys in the macOS Keychain
|
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: 1.
|
4
|
+
version: 1.9.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: 2021-
|
11
|
+
date: 2021-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-iam
|
@@ -93,8 +93,8 @@ licenses:
|
|
93
93
|
metadata:
|
94
94
|
bug_tracker_uri: https://github.com/servian/awskeyring/issues
|
95
95
|
changelog_uri: https://github.com/servian/awskeyring/blob/main/CHANGELOG.md
|
96
|
-
documentation_uri: https://rubydoc.info/gems/awskeyring/1.
|
97
|
-
source_code_uri: https://github.com/servian/awskeyring/tree/v1.
|
96
|
+
documentation_uri: https://rubydoc.info/gems/awskeyring/1.9.0
|
97
|
+
source_code_uri: https://github.com/servian/awskeyring/tree/v1.9.0
|
98
98
|
wiki_uri: https://github.com/servian/awskeyring/wiki
|
99
99
|
post_install_message:
|
100
100
|
rdoc_options: []
|