tacoma 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +2 -0
- data/lib/tacoma/command.rb +9 -4
- data/lib/tacoma/version.rb +1 -1
- data/spec/fixtures/.tacoma.yml +18 -0
- data/spec/tacoma_spec.rb +62 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16fe925f21fbd64e12ab1ad37e16db5b70e89a0
|
4
|
+
data.tar.gz: b755765b4f25633a46c1d98d1cfbf249e8d62c8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee9f6bdcac04bf11f6868dc1069603c01d6890b1abffff3f6c025b4e2223df138659ee5650227ad377c9049c5ef0cba87f3483ce073d3b74ecc81451a597b27b
|
7
|
+
data.tar.gz: 74df50e25064d1b6a462f8148d50b1828b93d20ad760d2619b05790ad27fd011d4340550c883b3bdb99b5cb96fd6d8311dc0a7ab906e2deea63f82fe63697b7b
|
data/CHANGELOG
CHANGED
data/lib/tacoma/command.rb
CHANGED
@@ -158,12 +158,17 @@ module Tacoma
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
def build_template_path(template_name)
|
162
|
-
"#{self.class.source_root}/../template/#{template_name}".realpath.to_s
|
163
|
-
end
|
164
|
-
|
165
161
|
def self.source_root
|
166
162
|
File.dirname(__FILE__)
|
167
163
|
end
|
164
|
+
|
165
|
+
# private
|
166
|
+
no_commands do
|
167
|
+
def build_template_path(template_name)
|
168
|
+
Pathname.new(
|
169
|
+
"#{self.class.source_root}/../template/#{template_name}"
|
170
|
+
).realpath.to_s
|
171
|
+
end
|
172
|
+
end
|
168
173
|
end
|
169
174
|
end
|
data/lib/tacoma/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
project:
|
2
|
+
aws_identity_file: "/path/to/pem/file/my_project.pem"
|
3
|
+
aws_secret_access_key: "YOURSECRETACCESSKEY"
|
4
|
+
aws_access_key_id: "YOURACCESSKEYID"
|
5
|
+
region: "REGION"
|
6
|
+
repo: "$HOME/projects/my_project"
|
7
|
+
another_project:
|
8
|
+
aws_identity_file: "/path/to/another_pem.pem"
|
9
|
+
aws_secret_access_key: "ANOTHERECRETACCESSKEY"
|
10
|
+
aws_access_key_id: "ANOTHERACCESSKEYID"
|
11
|
+
repo: "$HOME/projects/another_project"
|
12
|
+
s3cfg:
|
13
|
+
gpg_passphrase: my_gpg_passphrase
|
14
|
+
error_project:
|
15
|
+
aws_identity_file: "/path/to/another_pem.pem"
|
16
|
+
repo: "$HOME/projects/another_project"
|
17
|
+
s3cfg:
|
18
|
+
gpg_passphrase: my_gpg_passphrase
|
data/spec/tacoma_spec.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'tacoma'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
describe "Tacoma::Tool" do
|
5
|
+
|
6
|
+
let(:tacoma_config) {
|
7
|
+
YAML.load_file("spec/fixtures/.tacoma.yml")
|
8
|
+
}
|
9
|
+
|
10
|
+
it "default values" do
|
11
|
+
expect(Tacoma::Tool::DEFAULT_AWS_REGION).to eq("eu-west-1")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "#config" do
|
15
|
+
allow(Tacoma::Tool).to receive(:config) { tacoma_config }
|
16
|
+
expect(Tacoma::Tool.config).to eq(tacoma_config)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "#load_vars" do
|
20
|
+
allow(Tacoma::Tool).to receive(:config) { tacoma_config }
|
21
|
+
Tacoma::Tool.load_vars("another_project")
|
22
|
+
expect(Tacoma::Tool.aws_identity_file).to eq("/path/to/another_pem.pem")
|
23
|
+
expect(Tacoma::Tool.aws_secret_access_key).to eq("ANOTHERECRETACCESSKEY")
|
24
|
+
expect(Tacoma::Tool.aws_access_key_id).to eq("ANOTHERACCESSKEYID")
|
25
|
+
expect(Tacoma::Tool.region).to eq(Tacoma::Tool::DEFAULT_AWS_REGION)
|
26
|
+
expect(Tacoma::Tool.repo).to eq("$HOME/projects/another_project")
|
27
|
+
expect(Tacoma::Tool.s3cfg).to eq({"gpg_passphrase" => "my_gpg_passphrase" })
|
28
|
+
end
|
29
|
+
|
30
|
+
it "#load_vars validate_vars fail" do
|
31
|
+
allow(Tacoma::Tool).to receive(:config) { tacoma_config }
|
32
|
+
expect(STDOUT).to receive(:puts).with("Cannot find @aws_secret_access_key key, check your YAML config file.\nCannot find @aws_access_key_id key, check your YAML config file.")
|
33
|
+
subject = Tacoma::Tool.load_vars("error_project")
|
34
|
+
expect(subject).to eq(false)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "#build_template_path build a absolute path" do
|
38
|
+
allow(Tacoma::Tool).to receive(:config) { tacoma_config }
|
39
|
+
tacoma_command = Tacoma::Command.new
|
40
|
+
subject = tacoma_command.build_template_path("s3cfg")
|
41
|
+
expect(subject).to_not match(/\.\./)
|
42
|
+
expect(subject).to match(/template\/s3cfg/)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "#switch to another_project render tools templates" do
|
46
|
+
tacoma_command = Tacoma::Command.new
|
47
|
+
allow(Tacoma::Tool).to receive(:config) { tacoma_config }
|
48
|
+
expect(tacoma_command).to receive(:template).at_least(5).times
|
49
|
+
|
50
|
+
response = tacoma_command.switch("another_project")
|
51
|
+
|
52
|
+
expect(tacoma_command.instance_variable_get("@aws_identity_file")).to be_a(String)
|
53
|
+
expect(tacoma_command.instance_variable_get("@aws_secret_access_key")).to be_a(String)
|
54
|
+
expect(tacoma_command.instance_variable_get("@aws_access_key_id")).to be_a(String)
|
55
|
+
expect(tacoma_command.instance_variable_get("@region")).to be_a(String)
|
56
|
+
expect(tacoma_command.instance_variable_get("@repo")).to be_a(String)
|
57
|
+
expect(tacoma_command.instance_variable_get("@s3cfg")).to be_a(Hash)
|
58
|
+
|
59
|
+
expect(response).to eq(true)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
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.15
|
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:
|
11
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -90,6 +90,8 @@ files:
|
|
90
90
|
- lib/template/route53
|
91
91
|
- lib/template/s3cfg
|
92
92
|
- lib/template/tacoma.yml
|
93
|
+
- spec/fixtures/.tacoma.yml
|
94
|
+
- spec/tacoma_spec.rb
|
93
95
|
- tacoma.gemspec
|
94
96
|
homepage: https://github.com/pantulis/tacoma
|
95
97
|
licenses:
|
@@ -116,4 +118,6 @@ signing_key:
|
|
116
118
|
specification_version: 4
|
117
119
|
summary: This tool reads a YAML file with the credentials for your AWS accounts and
|
118
120
|
loads them into your environment.
|
119
|
-
test_files:
|
121
|
+
test_files:
|
122
|
+
- spec/fixtures/.tacoma.yml
|
123
|
+
- spec/tacoma_spec.rb
|