tacoma 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/bin/tacoma +5 -0
- data/lib/tacoma.rb +2 -0
- data/lib/tacoma/command.rb +66 -0
- data/lib/tacoma/version.rb +3 -0
- data/lib/template/tacoma.yml +20 -0
- data/tacoma.gemspec +26 -0
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7330005c3dd16bcf338c0d9aae63ec7afeb8c91
|
4
|
+
data.tar.gz: 75c4a068ffb0a9eac184ac3c26fcb8beab956e7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67d2f3e9b41b80ddca513e9a58991956747f0bd183bd2d7e47e37e0419353df24d9a6f160a2a546d95bb8583f3ad506ec032a770db2441db2523da4ced6c442b
|
7
|
+
data.tar.gz: bbf29a8439147711eb1e118306392ccd018edfee5c937f1d72638c2b9727f930fcf025470a1ac9eefd86bd6cc163ef081bce040332ba1300453dbf3e06147aef
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/bin/tacoma
ADDED
data/lib/tacoma.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'thor'
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
|
6
|
+
module Tacoma
|
7
|
+
|
8
|
+
module Tool
|
9
|
+
def self.config
|
10
|
+
filename = File.join(Dir.home, ".tacoma.yml")
|
11
|
+
return YAML::load_file(filename)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.switch(environment)
|
15
|
+
config = Tool.config
|
16
|
+
if config.keys.include?(environment) == false
|
17
|
+
puts "Cannot find #{environment} key, check your YAML config file"
|
18
|
+
return
|
19
|
+
end
|
20
|
+
|
21
|
+
puts "export AWS_IDENTITY_FILE=" + config[environment]['aws_identity_file'] if config[environment]['aws_identity_file']
|
22
|
+
puts "export AWS_SECRET_ACCESS_KEY=" + config[environment]['aws_secret_access_key'] if config[environment]['aws_secret_access_key']
|
23
|
+
puts "export AWS_ACCESS_KEY_ID=" + config[environment]['aws_access_key_id'] if config[environment]['aws_access_key_id']
|
24
|
+
puts "export REPO=" + config[environment]['repo'] if config[environment]['repo']
|
25
|
+
|
26
|
+
# run ssh-add for the pem file
|
27
|
+
system("ssh-add #{config[environment]['aws_identity_file']}")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
class Command < Thor
|
33
|
+
|
34
|
+
include Thor::Actions
|
35
|
+
|
36
|
+
desc "list", "Lists all known AWS environments"
|
37
|
+
def list
|
38
|
+
Tool.config.keys.each do |key|
|
39
|
+
puts key
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "switch ENVIRONMENT", "Loads AWS environment vars"
|
44
|
+
def switch(environment)
|
45
|
+
Tool.switch(environment)
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "install", "Create a sample ~/.tacoma.yml file"
|
49
|
+
def install
|
50
|
+
if (File.exists?(File.join(Dir.home, ".tacoma.yml")))
|
51
|
+
puts "File ~/.tacoma.yml already present, won't overwrite"
|
52
|
+
else
|
53
|
+
template_path=Pathname.new("#{self.class.source_root}/../template/tacoma.yml").realpath.to_s
|
54
|
+
new_path = File.join(Dir.home, ".tacoma.yml")
|
55
|
+
template template_path, new_path
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.source_root
|
60
|
+
File.dirname(__FILE__)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# This file was automatically generated at <%= Time.now %>
|
3
|
+
#
|
4
|
+
# tacoma command line options:
|
5
|
+
#
|
6
|
+
# tacoma list - list all available entries in this file
|
7
|
+
# tacoma switch <entry> - will load the environment variables and ssh-add the aws identity file
|
8
|
+
#
|
9
|
+
|
10
|
+
my_first_project:
|
11
|
+
aws_identity_file: "/path/to/pem/file/my_project.pem"
|
12
|
+
aws_secret_access_key: "YOURSECRETACCESSKEY"
|
13
|
+
aws_access_key_id: "YOURACCESSKEYID"
|
14
|
+
repo: "$HOME/projects/my_first_project"
|
15
|
+
|
16
|
+
my_second_project:
|
17
|
+
aws_identity_file: "/path/to/pem/file/my_second_project.pem"
|
18
|
+
aws_secret_access_key: "ANOTHERSECRETACCESSKEY"
|
19
|
+
aws_access_key_id: "ANOTHERACCESSKEYID"
|
20
|
+
repo: "/usr/share/projects/my_second_project"
|
data/tacoma.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'tacoma/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "tacoma"
|
9
|
+
spec.version = Tacoma::VERSION
|
10
|
+
spec.authors = ["Juan Lupión"]
|
11
|
+
spec.email = ["pantulis@gmail.com"]
|
12
|
+
spec.description = %q{Easy command line tool for AWS credentials management}
|
13
|
+
spec.summary = "This tool reads a YAML file with the credentials for your AWS accounts and loads them into your environment."
|
14
|
+
spec.homepage = "https://github.com/pantulis/tacoma"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($\)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency "thor"
|
23
|
+
spec.add_development_dependency "minitest"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Lupión
|
@@ -69,10 +69,19 @@ dependencies:
|
|
69
69
|
description: Easy command line tool for AWS credentials management
|
70
70
|
email:
|
71
71
|
- pantulis@gmail.com
|
72
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- tacoma
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
75
|
-
files:
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- bin/tacoma
|
80
|
+
- lib/tacoma.rb
|
81
|
+
- lib/tacoma/command.rb
|
82
|
+
- lib/tacoma/version.rb
|
83
|
+
- lib/template/tacoma.yml
|
84
|
+
- tacoma.gemspec
|
76
85
|
homepage: https://github.com/pantulis/tacoma
|
77
86
|
licenses:
|
78
87
|
- MIT
|