awskeyring 0.10.0 → 1.0.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
2
  SHA1:
3
- metadata.gz: d9ba390ba84576e3ec79b6e60fc5da80363faa36
4
- data.tar.gz: 4a6352ace35cad42d6a11fd0624646d958211e1c
3
+ metadata.gz: 9ba83a2dbfa7ff7613421c1f3fbe82c695a67055
4
+ data.tar.gz: 4b12ee81c5a56095407c68d25f064a5466fd3d46
5
5
  SHA512:
6
- metadata.gz: ec365e5dbe6349195131b07fb65ef7665d3c310894e5a0a08f1f58bf3fbcba0586ec385d46b1c1b1c7c095cb76c792bb1855c44ed01c590825532453f5f459d0
7
- data.tar.gz: 67adf2badf660187fafad8ee55f8a743d312abc4fab491f1181fb54736b8530c2886275e37990971073970f45d0c2606a866eca8806949b862c3f1cb73d1437e
6
+ metadata.gz: 6c5e2cc15bb1adb771b1d8bc6282fd62bf2285932a14bd7bb498606d290fc3d4ccc3b58e7207a73cde0fadabca1c5e827a6a5b8a976b3ab4371bb0c4eb9f3234
7
+ data.tar.gz: bb684835c14ed7621bc57ffac0ec05390d0563efee66ea9a2b216d667766406f7821ee508993ffe08d71ecab974b6a5b68abcbb563fecc928bd772eb8e71ad28
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.0.0](https://github.com/vibrato/awskeyring/tree/v1.0.0) (2019-05-20)
4
+ [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.10.0...v1.0.0)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - More RuboCop changes and tweaked version string. [\#45](https://github.com/vibrato/awskeyring/pull/45) ([tristanmorgan](https://github.com/tristanmorgan))
9
+
3
10
  ## [v0.10.0](https://github.com/vibrato/awskeyring/tree/v0.10.0) (2019-04-24)
4
11
  [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.9.0...v0.10.0)
5
12
 
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in awskeyring.gemspec
@@ -9,5 +11,6 @@ group :development do
9
11
  gem 'rake'
10
12
  gem 'rspec'
11
13
  gem 'rubocop'
14
+ gem 'rubocop-performance'
12
15
  gem 'yard'
13
16
  end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Awskeyring
2
2
 
3
+ ![Awskeyring](https://raw.githubusercontent.com/vibrato/awskeyring/master/awskeyring-144.png)
4
+
3
5
  * [![Build Status](https://travis-ci.org/vibrato/awskeyring.svg?branch=master)](https://travis-ci.org/vibrato/awskeyring)
4
6
  * [![Gem Version](https://badge.fury.io/rb/awskeyring.svg)](https://badge.fury.io/rb/awskeyring)
5
7
  * [![license MIT](http://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
@@ -83,7 +85,7 @@ To set your environment easily the following bash function helps:
83
85
 
84
86
  ## Development
85
87
 
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.
88
+ 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
89
 
88
90
  To install this gem onto your local machine, run `bundle exec rake install`.
89
91
 
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'
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/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.
@@ -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,7 @@ 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'
22
24
 
23
25
  # AWS Env vars
24
26
  AWS_ENV_VARS = %w[
@@ -149,8 +151,8 @@ module Awskeyring
149
151
  ENV['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
150
152
  sts = Aws::STS::Client.new(access_key_id: key, secret_access_key: secret)
151
153
  sts.get_caller_identity
152
- rescue Aws::Errors::ServiceError => err
153
- warn err.to_s
154
+ rescue Aws::Errors::ServiceError => e
155
+ warn e.to_s
154
156
  exit 1
155
157
  end
156
158
  true
@@ -257,13 +259,13 @@ module Awskeyring
257
259
  retries ||= 1
258
260
  begin
259
261
  yield block
260
- rescue Aws::IAM::Errors::InvalidClientTokenId => err
262
+ rescue Aws::IAM::Errors::InvalidClientTokenId => e
261
263
  if retries < 4
262
264
  sleep 2**retries
263
265
  retries += 1
264
266
  retry
265
267
  end
266
- warn err.message
268
+ warn e.message
267
269
  exit 1
268
270
  end
269
271
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'io/console'
2
4
 
3
5
  # Awskeyring Module,
@@ -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.10.0'.freeze
4
+ # The Gem's version number
5
+ VERSION = '1.0.0'
6
+ # The Gem's homepage
7
+ HOMEPAGE = 'https://github.com/vibrato/awskeyring'
4
8
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'i18n'
2
4
  require 'thor'
3
5
 
@@ -14,6 +16,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
14
16
 
15
17
  map %w[--version -v] => :__version
16
18
  map ['init'] => :initialise
19
+ map ['adr'] => :add_role
17
20
  map ['con'] => :console
18
21
  map ['ls'] => :list
19
22
  map ['lsr'] => :list_role
@@ -27,7 +30,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
27
30
  desc '--version, -v', I18n.t('__version.desc')
28
31
  # print the version number
29
32
  def __version
30
- puts Awskeyring::VERSION
33
+ puts "Awskeyring v#{Awskeyring::VERSION}"
34
+ puts "Homepage #{Awskeyring::HOMEPAGE}"
31
35
  end
32
36
 
33
37
  desc 'initialise', I18n.t('initialise.desc')
@@ -237,8 +241,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
237
241
  secret: cred[:secret],
238
242
  key_message: I18n.t('message.rotate', account: account)
239
243
  )
240
- rescue Aws::Errors::ServiceError => err
241
- warn err.to_s
244
+ rescue Aws::Errors::ServiceError => e
245
+ warn e.to_s
242
246
  exit 1
243
247
  end
244
248
 
@@ -291,8 +295,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
291
295
  user: ENV['USER']
292
296
  )
293
297
  Awskeyring.delete_token(account: account, message: '# Removing STS credentials')
294
- rescue Aws::Errors::ServiceError => err
295
- warn err.to_s
298
+ rescue Aws::Errors::ServiceError => e
299
+ warn e.to_s
296
300
  exit 1
297
301
  end
298
302
 
@@ -329,8 +333,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
329
333
  path: path,
330
334
  user: ENV['USER']
331
335
  )
332
- rescue Aws::Errors::ServiceError => err
333
- warn err.to_s
336
+ rescue Aws::Errors::ServiceError => e
337
+ warn e.to_s
334
338
  exit 1
335
339
  end
336
340
 
@@ -436,8 +440,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
436
440
  begin
437
441
  value = ask_missing(existing: existing, message: message, secure: secure, optional: optional)
438
442
  value = validator.call(value) unless value.empty? && optional
439
- rescue RuntimeError => err
440
- warn err.message
443
+ rescue RuntimeError => e
444
+ warn e.message
441
445
  existing = nil
442
446
  retry unless (retries -= 1).zero?
443
447
  exit 1
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.10.0
4
+ version: 1.0.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-24 00:00:00.000000000 Z
11
+ date: 2019-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-iam