tacoma 1.0.14 → 1.0.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2cc55778f5dd0d7e576f56f0483072d248a209c
4
- data.tar.gz: ea54584fe182d4cfa754d721892d52d968035964
3
+ metadata.gz: f16fe925f21fbd64e12ab1ad37e16db5b70e89a0
4
+ data.tar.gz: b755765b4f25633a46c1d98d1cfbf249e8d62c8a
5
5
  SHA512:
6
- metadata.gz: 0393a9b07ac4a55666859553037e39fddc37cea4521cac1d78ce95d087663e8eca4f9eb2a107934930c9f182bc82eb0121c8849c4a3de2dbd68ef281ba37f22f
7
- data.tar.gz: a0f8319b113b50a59f13ea5b5c1ff5ef5c974f806e83be3dcb19d7f0ec31b42b6a8d3e88bc7af2031c4b4875c029002184728b6d0534323a52a3bb17e82ee372
6
+ metadata.gz: ee9f6bdcac04bf11f6868dc1069603c01d6890b1abffff3f6c025b4e2223df138659ee5650227ad377c9049c5ef0cba87f3483ce073d3b74ecc81451a597b27b
7
+ data.tar.gz: 74df50e25064d1b6a462f8148d50b1828b93d20ad760d2619b05790ad27fd011d4340550c883b3bdb99b5cb96fd6d8311dc0a7ab906e2deea63f82fe63697b7b
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 1.0.15
2
+ - Fixed regression when there is no tacoma.yml present in $HOME
1
3
  1.0.14
2
4
  - New subsection in tacoma.yml file, allowing to define settings for s3cmd on a per-project basis. See the
3
5
  README for more info
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Tacoma
2
- VERSION = '1.0.14'.freeze
2
+ VERSION = '1.0.15'.freeze
3
3
  end
@@ -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
@@ -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.14
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: 2018-12-19 00:00:00.000000000 Z
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