terrafile 0.1.2 → 0.1.3
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 +4 -4
- data/CODEOWNERS +1 -0
- data/Gemfile.lock +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +20 -3
- data/lib/terrafile/dependency.rb +5 -0
- data/lib/terrafile/installer.rb +1 -1
- data/lib/terrafile/version.rb +1 -1
- data/spec/unit/dependency_spec.rb +37 -0
- metadata +2 -2
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec435e7bda54bb9a01f56703378fe41f59149f4ab57348402339804110d242b1
|
4
|
+
data.tar.gz: a5fc874f164a976027417f38672ea11abaef537f0addc3f36c3ec9ec3d3b4fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cba7f959571593cd0102937473696a7991dd6e500db77011f05faac8ec89089d9745de5fb39c380201bcd3d738dd15dfc39088216c750c538d02b9d9274747fc
|
7
|
+
data.tar.gz: 5ea1f7e281c0b136de80b4b978e188233fa3a18ae8ab5c5af77fd2d24ba8450fb0c03ac30798fc906273c1e266f1b6ecf8fcd14108c05de6bfa041a35664259f
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @dxw/ops @dxw/dalmatian @edavey
|
data/Gemfile.lock
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -34,9 +34,13 @@ Invoke the executable from your shell:
|
|
34
34
|
|
35
35
|
to install the modules listed in `Terrafile` into `vendor/terraform_modules`.
|
36
36
|
|
37
|
-
##
|
37
|
+
## Dependencies
|
38
|
+
|
39
|
+
- git
|
40
|
+
- Ruby (>= 2.5.1)
|
38
41
|
|
39
|
-
|
42
|
+
|
43
|
+
## Development
|
40
44
|
|
41
45
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
42
46
|
|
@@ -47,9 +51,22 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
47
51
|
|
48
52
|
Then you can run `$ terrafile` to run the latest version
|
49
53
|
|
54
|
+
### Tests
|
55
|
+
|
56
|
+
Run the test suite with:
|
57
|
+
|
58
|
+
rake test
|
59
|
+
|
60
|
+
The task will:
|
61
|
+
|
62
|
+
- run unit tests with 'rspec'
|
63
|
+
- enforce 100% coverage with 'simplecov'
|
64
|
+
- lint the Ruby code with 'rubocop'
|
65
|
+
- run integration tests with 'cucumber'
|
66
|
+
|
50
67
|
## Contributing
|
51
68
|
|
52
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
69
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dxw/terrafile. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
53
70
|
|
54
71
|
## License
|
55
72
|
|
data/lib/terrafile/dependency.rb
CHANGED
@@ -30,6 +30,11 @@ module Terrafile
|
|
30
30
|
Dir.chdir(name) do
|
31
31
|
Helper.run!("git checkout #{version} 1> /dev/null")
|
32
32
|
end
|
33
|
+
rescue Error => error
|
34
|
+
raise unless error.message.match?(/reference is not a tree/)
|
35
|
+
|
36
|
+
Kernel.puts "[*] WARN: #{error} ." \
|
37
|
+
"The 'version' should be the branch name or tag, rather than the SHA."
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
data/lib/terrafile/installer.rb
CHANGED
@@ -28,7 +28,7 @@ module Terrafile
|
|
28
28
|
Dir.chdir(Terrafile::MODULES_PATH) do
|
29
29
|
dependencies.each do |dependency|
|
30
30
|
msg = "Checking out #{dependency.version} from #{dependency.source}"
|
31
|
-
Kernel.puts msg
|
31
|
+
Kernel.puts "[*] #{msg}"
|
32
32
|
dependency.fetch
|
33
33
|
dependency.checkout
|
34
34
|
end
|
data/lib/terrafile/version.rb
CHANGED
@@ -146,6 +146,43 @@ module Terrafile
|
|
146
146
|
|
147
147
|
expect(Helper).to have_received(:run!).with('git checkout 1.2.3 1> /dev/null')
|
148
148
|
end
|
149
|
+
|
150
|
+
describe 'error handling' do
|
151
|
+
context 'when git checkout reports a "reference is not a tree" error' do
|
152
|
+
let(:msg) { 'fatal: reference is not a tree:' }
|
153
|
+
let(:notice) do
|
154
|
+
"The 'version' should be the branch name or tag, " \
|
155
|
+
'rather than the SHA.'
|
156
|
+
end
|
157
|
+
|
158
|
+
before do
|
159
|
+
allow(Kernel).to receive(:puts)
|
160
|
+
allow(Helper).to receive(:run!).and_raise(Error, msg)
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'logs the suspected use of a SHA rather than a tag or branch name' do
|
164
|
+
dependency.checkout
|
165
|
+
expect(Kernel).to have_received(:puts).with(/WARN: #{msg}/)
|
166
|
+
expect(Kernel).to have_received(:puts).with(/#{notice}/)
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'allows execution to continue' do
|
170
|
+
expect { dependency.checkout }.not_to raise_error
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'when git checkout reports some other error' do
|
175
|
+
let(:msg) { 'fatal: some other problem:' }
|
176
|
+
|
177
|
+
before do
|
178
|
+
allow(Helper).to receive(:run!).and_raise(Error, msg)
|
179
|
+
end
|
180
|
+
|
181
|
+
it 're-raises the Terraform::Error' do
|
182
|
+
expect { dependency.checkout }.to raise_error(Error, msg)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
149
186
|
end
|
150
187
|
end
|
151
188
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terrafile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dxw
|
@@ -121,13 +121,13 @@ files:
|
|
121
121
|
- ".rubocop.yml"
|
122
122
|
- ".ruby-version"
|
123
123
|
- ".travis.yml"
|
124
|
+
- CODEOWNERS
|
124
125
|
- CODE_OF_CONDUCT.md
|
125
126
|
- Gemfile
|
126
127
|
- Gemfile.lock
|
127
128
|
- LICENSE.txt
|
128
129
|
- README.md
|
129
130
|
- Rakefile
|
130
|
-
- bin/setup
|
131
131
|
- bin/terrafile
|
132
132
|
- features/processes_a_terrafile.feature
|
133
133
|
- features/step_definitions/terrafile_steps.rb
|