tacoma 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -0
- data/lib/tacoma/command.rb +35 -18
- data/lib/tacoma/version.rb +1 -1
- data/lib/template/fog +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b3322c88bf7f6a1f47f281617cadd049e76abf9
|
4
|
+
data.tar.gz: 06b2ff13c45e2762602e76c2da15d336516fd1d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e365906d7ae6ee658a669eee13409274fb731ab048bbac5b06f27174cb6570a22d438e77b1afa22b9b3ffb5a5ae788fb5d31db9225851b65b108012a88a769b
|
7
|
+
data.tar.gz: f79a3b6f993a63b66f1361cbf4beda0b5099f6f6b681f3774aaaf114bcd3f4528ba1328a67603fe95d8b455f1dc14db2b3f04d5f7d16eac079c3fa9b2e82a533
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Tacoma
|
2
|
+
|
3
|
+
Simple command-line tool for managing AWS credentials across different projects and tools.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install tacoma
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Tacoma needs a special file `.tacoma.yml` in your home directory. It can create a sample for you with
|
12
|
+
|
13
|
+
tacoma install
|
14
|
+
|
15
|
+
The format of the `.tacoma.yml` file is pretty straighforward
|
16
|
+
|
17
|
+
project:
|
18
|
+
aws_identity_file: "/path/to/pem/file/my_project.pem"
|
19
|
+
aws_secret_access_key: "YOURSECRETACCESSKEY"
|
20
|
+
aws_access_key_id: "YOURACCESSKEYID"
|
21
|
+
repo: "$HOME/projects/my_project"
|
22
|
+
another_project:
|
23
|
+
aws_identity_file: "/path/to/another_pem.pem"
|
24
|
+
aws_secret_access_key: "ANOTHERECRETACCESSKEY"
|
25
|
+
aws_access_key_id: "ANOTHERACCESSKEYID"
|
26
|
+
repo: "$HOME/projects/another_project"
|
27
|
+
|
28
|
+
Once setup with a file like this, you can run
|
29
|
+
|
30
|
+
tacoma list
|
31
|
+
|
32
|
+
And it will list all the configured entries. Running
|
33
|
+
|
34
|
+
tacoma switch project
|
35
|
+
|
36
|
+
Will display the export commands for the AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID credential environment variables, will add the specified identity file into the SSH agent, and will generate configuration files for the different available tools. At the time of this release the only provider is Fog, which should work with Capistrano's capify-ec2.
|
37
|
+
|
38
|
+
## TODO
|
39
|
+
|
40
|
+
- Check for errors in the `tacoma.yml` file
|
41
|
+
- Add other AWS tool providers (Knife, Boto, AWS cli, S3cmd, ...)
|
42
|
+
|
43
|
+
|
44
|
+
## THANKS
|
45
|
+
|
46
|
+
This tool is shamelessly inspired in Raul Murciano's [rack-generator](https://github.com/raul/rack-generator)
|
data/lib/tacoma/command.rb
CHANGED
@@ -6,27 +6,32 @@ require 'pathname'
|
|
6
6
|
module Tacoma
|
7
7
|
|
8
8
|
module Tool
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
class << self
|
10
|
+
attr_accessor :aws_identity_file
|
11
|
+
attr_accessor :aws_secret_access_key
|
12
|
+
attr_accessor :aws_access_key_id
|
13
|
+
attr_accessor :repo
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
puts "Cannot find #{environment} key, check your YAML config file"
|
18
|
-
return
|
15
|
+
def config
|
16
|
+
filename = File.join(Dir.home, ".tacoma.yml")
|
17
|
+
return YAML::load_file(filename)
|
19
18
|
end
|
19
|
+
|
20
|
+
def load_vars(environment)
|
21
|
+
config = Tool.config
|
22
|
+
if config.keys.include?(environment) == false
|
23
|
+
puts "Cannot find #{environment} key, check your YAML config file"
|
24
|
+
return
|
25
|
+
end
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
if config[environment]
|
28
|
+
@aws_identity_file = config[environment]['aws_identity_file']
|
29
|
+
@aws_secret_access_key = config[environment]['aws_secret_access_key']
|
30
|
+
@aws_access_key_id = config[environment]['aws_access_key_id']
|
31
|
+
@repo = config[environment]['repo']
|
32
|
+
end
|
33
|
+
end
|
28
34
|
end
|
29
|
-
|
30
35
|
end
|
31
36
|
|
32
37
|
class Command < Thor
|
@@ -42,7 +47,19 @@ module Tacoma
|
|
42
47
|
|
43
48
|
desc "switch ENVIRONMENT", "Loads AWS environment vars"
|
44
49
|
def switch(environment)
|
45
|
-
|
50
|
+
|
51
|
+
Tool.load_vars(environment)
|
52
|
+
@aws_identity_file = Tool.aws_identity_file
|
53
|
+
@aws_secret_access_key = Tool.aws_secret_access_key
|
54
|
+
@aws_access_key_id = Tool.aws_access_key_id
|
55
|
+
@repo = Tool.repo
|
56
|
+
|
57
|
+
# load fog configuration
|
58
|
+
fog_template_path = Pathname.new("#{self.class.source_root}/../template/fog").realpath.to_s
|
59
|
+
fog_file_path = File.join(Dir.home,".fog")
|
60
|
+
template fog_template_path, fog_file_path, :force => true
|
61
|
+
|
62
|
+
system("ssh-add #{@aws_identity_file}")
|
46
63
|
end
|
47
64
|
|
48
65
|
desc "install", "Create a sample ~/.tacoma.yml file"
|
data/lib/tacoma/version.rb
CHANGED
data/lib/template/fog
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tacoma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Lupión
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -76,10 +76,12 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- .gitignore
|
78
78
|
- Gemfile
|
79
|
+
- README.md
|
79
80
|
- bin/tacoma
|
80
81
|
- lib/tacoma.rb
|
81
82
|
- lib/tacoma/command.rb
|
82
83
|
- lib/tacoma/version.rb
|
84
|
+
- lib/template/fog
|
83
85
|
- lib/template/tacoma.yml
|
84
86
|
- tacoma.gemspec
|
85
87
|
homepage: https://github.com/pantulis/tacoma
|