aws_cred_vault 0.0.1
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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/aws_cred_vault.gemspec +25 -0
- data/lib/aws_cred_vault.rb +5 -0
- data/lib/aws_cred_vault/toml.rb +37 -0
- data/lib/aws_cred_vault/version.rb +3 -0
- data/spec/files/accounts.toml +12 -0
- data/spec/lib/aws_cred_vault/toml.rb +54 -0
- data/spec/lib/aws_cred_vault_spec.rb +5 -0
- data/spec/spec_helper.rb +7 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8f18052c7c70445d864dc5f74b4a2d1bc14385ab
|
4
|
+
data.tar.gz: d63f2499210a770bee24c3ab9c5ef9b75b643b73
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 34ca2bfe6e4f92449f48bce23f2bc6f53a6bb15bb86b317c36157e449cc41d7f023b22621222b40d5e28b4f33790219447482d931bc07eab2d2f26a8905420a3
|
7
|
+
data.tar.gz: 2871e70be9fe85efeff6597db498d209337107b4f6f961af40fe9719ca6bbf926b674c769bd2e2328fd6eec90a5935a2eb81678571a92c998c5bbd42a0c086c9
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Clarke Brunsdon
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# AwsCredVault
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'aws_cred_vault'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install aws_cred_vault
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/AwsCredVault/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'aws_cred_vault/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "aws_cred_vault"
|
8
|
+
spec.version = AwsCredVault::VERSION
|
9
|
+
spec.authors = ["Clarke Brunsdon"]
|
10
|
+
spec.email = ["clarke@freerunningtechnologies.com"]
|
11
|
+
spec.summary = %q{Stores your amazon credentials for multiple IAM accounts.}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "toml", "~> 0.1"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'toml'
|
2
|
+
|
3
|
+
module AwsCredVault
|
4
|
+
class Toml
|
5
|
+
attr_reader :file
|
6
|
+
def initialize file
|
7
|
+
@file = file
|
8
|
+
end
|
9
|
+
|
10
|
+
def accounts
|
11
|
+
toml["accounts"] || {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_account site, name, access_key, secret
|
15
|
+
new_accounts = accounts || {}
|
16
|
+
new_accounts[site] = {
|
17
|
+
name => {
|
18
|
+
'access_key' => access_key,
|
19
|
+
'secret' => secret,
|
20
|
+
}
|
21
|
+
}
|
22
|
+
save new_accounts
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def toml
|
27
|
+
return {} unless File.exists? file
|
28
|
+
::TOML.load_file(file)
|
29
|
+
end
|
30
|
+
|
31
|
+
def save accounts
|
32
|
+
File.open file, 'w' do |file|
|
33
|
+
file.write(::TOML::Generator.new(accounts).body)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AwsCredVault::Toml do
|
4
|
+
|
5
|
+
describe '#new' do
|
6
|
+
subject { AwsCredVault::Toml.new 'sups' }
|
7
|
+
it 'has the right file' do
|
8
|
+
expect(subject.file).to eq('sups')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#accounts' do
|
13
|
+
let(:file) { 'spec/files/accounts.toml' }
|
14
|
+
|
15
|
+
subject { AwsCredVault::Toml.new(file).accounts }
|
16
|
+
|
17
|
+
it 'lists all the accounts' do
|
18
|
+
expect(subject.length).to eq 2
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'file does not exist' do
|
22
|
+
let(:file) { '/notthing/here' }
|
23
|
+
|
24
|
+
it 'has no accounts' do
|
25
|
+
expect(subject).to eq({})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#add_account' do
|
31
|
+
let(:file) { '/tmp/working_file' }
|
32
|
+
|
33
|
+
let(:site) { 'frt' }
|
34
|
+
let(:account_name) { 'clarke' }
|
35
|
+
let(:key) { 'key' }
|
36
|
+
let(:secret) { 'password' }
|
37
|
+
|
38
|
+
let(:vault) { AwsCredVault::Toml.new(file) }
|
39
|
+
subject { vault.add_account(site, account_name, key, secret) }
|
40
|
+
|
41
|
+
it 'saves to a file' do
|
42
|
+
subject
|
43
|
+
expect(::TOML.load(File.read(file))).to eq({
|
44
|
+
'frt' => {
|
45
|
+
'clarke' => {
|
46
|
+
'access_key' => 'key',
|
47
|
+
'secret' => 'password'
|
48
|
+
}
|
49
|
+
}
|
50
|
+
})
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws_cred_vault
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Clarke Brunsdon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: toml
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- clarke@freerunningtechnologies.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- aws_cred_vault.gemspec
|
82
|
+
- lib/aws_cred_vault.rb
|
83
|
+
- lib/aws_cred_vault/toml.rb
|
84
|
+
- lib/aws_cred_vault/version.rb
|
85
|
+
- spec/files/accounts.toml
|
86
|
+
- spec/lib/aws_cred_vault/toml.rb
|
87
|
+
- spec/lib/aws_cred_vault_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
homepage: ''
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.2.2
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Stores your amazon credentials for multiple IAM accounts.
|
113
|
+
test_files:
|
114
|
+
- spec/files/accounts.toml
|
115
|
+
- spec/lib/aws_cred_vault/toml.rb
|
116
|
+
- spec/lib/aws_cred_vault_spec.rb
|
117
|
+
- spec/spec_helper.rb
|