aws-keychain-util 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "aws-keychain-util"
7
- gem.version = '0.0.5'
7
+ gem.version = '0.0.6'
8
8
  gem.authors = ["Zach Wily"]
9
9
  gem.email = ["zach@zwily.com"]
10
10
  gem.description = %q{Helps manage a keychain of AWS credentials on OS X.}
data/bin/aws-creds CHANGED
@@ -13,18 +13,11 @@ def ask_secure(question)
13
13
  HighLine.new.ask(question) { |q| q.echo = '*' }
14
14
  end
15
15
 
16
- PREFS_FILE = File.expand_path "~/.aws-keychain-util"
17
-
18
16
  def load_keychain
19
- keychain = if File.exist? PREFS_FILE
20
- prefs = JSON.parse(File.read(PREFS_FILE))
21
- Keychain.open(prefs['aws_keychain_name'])
22
- else
23
- Keychain.default
24
- end
25
- if keychain.lock_interval > 300
17
+ keychain = AwsKeychainUtil.load_keychain
18
+ if keychain && keychain.lock_interval > 300
26
19
  $stderr.puts "Your keychain is *not* set to lock automatically in under five minutes. This could be dangerous."
27
- if !File.exist? PREFS_FILE
20
+ if !File.exist? AwsKeychainUtil::PREFS_FILE
28
21
  $stderr.puts "You should probably run `#{$0} init` to create a new, secure keychain."
29
22
  end
30
23
  end
@@ -57,8 +50,8 @@ command = ARGV.shift
57
50
 
58
51
  case command
59
52
  when 'init'
60
- if File.exist? PREFS_FILE
61
- puts "#{PREFS_FILE} already exists. Please remove it to run init again."
53
+ if File.exist? AwsKeychainUtil::PREFS_FILE
54
+ puts "#{AwsKeychainUtil::PREFS_FILE} already exists. Please remove it to run init again."
62
55
  exit 1
63
56
  end
64
57
 
@@ -71,7 +64,7 @@ when 'init'
71
64
  keychain.lock_on_sleep = true
72
65
 
73
66
  $prefs = { 'aws_keychain_name' => name }
74
- File.new(PREFS_FILE, "w").write JSON.dump($prefs)
67
+ File.new(AwsKeychainUtil::PREFS_FILE, "w").write JSON.dump($prefs)
75
68
 
76
69
  puts "Your AWS keychain has been created and configured to auto-lock after"
77
70
  puts "5 minutes, and when sleeping. You can change those options in"
@@ -0,0 +1,15 @@
1
+ require 'aws-keychain-util/credential_provider'
2
+
3
+ module AwsKeychainUtil
4
+ PREFS_FILE = File.expand_path "~/.aws-keychain-util"
5
+
6
+ def self.load_keychain
7
+ keychain = if File.exist? PREFS_FILE
8
+ prefs = JSON.parse(File.read(PREFS_FILE))
9
+ Keychain.open(prefs['aws_keychain_name'])
10
+ else
11
+ Keychain.default
12
+ end
13
+ keychain
14
+ end
15
+ end
@@ -11,7 +11,7 @@ module AwsKeychainUtil
11
11
  end
12
12
 
13
13
  def get_credentials
14
- keychain = @keychain ? Keychain.open(@keychain) : Keychain.default
14
+ keychain = @keychain ? Keychain.open(@keychain) : AwsKeychainUtil.load_keychain
15
15
  item = keychain.generic_passwords.where(:label => @item).first
16
16
  return {} unless item
17
17
  {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-keychain-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-08 00:00:00.000000000 Z
12
+ date: 2013-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-keychain
@@ -58,6 +58,7 @@ files:
58
58
  - Rakefile
59
59
  - aws-keychain-util.gemspec
60
60
  - bin/aws-creds
61
+ - lib/aws-keychain-util.rb
61
62
  - lib/aws-keychain-util/credential_provider.rb
62
63
  homepage: ''
63
64
  licenses: []