terrafile 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4be422a234065c714ad67e455de5b3c330f8a21bfd4662d1913ad4e116bb8a0a
4
- data.tar.gz: '07939a6f15d164865a0debcb71885632dfa5eaec869e42d4467b4fdecfa542d6'
3
+ metadata.gz: ec435e7bda54bb9a01f56703378fe41f59149f4ab57348402339804110d242b1
4
+ data.tar.gz: a5fc874f164a976027417f38672ea11abaef537f0addc3f36c3ec9ec3d3b4fde
5
5
  SHA512:
6
- metadata.gz: 1326581ca3870aa2d4df2d930fd912c2339e826c1119f3674a2dbce608de52996d50556a62ca74f884ad43b21c7b6094ab0a88b07f0dbd007ae573cf93a728c5
7
- data.tar.gz: 0af82f425c8ad201bcb0e6f6b9f4c2cac656ca217aeede14ae43383a732f3af43e8bba17870212fafef88f31e272dd2631a53b37191d35b54d2aea14e1810a02
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- terrafile (0.1.1)
4
+ terrafile (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Ed Davey
3
+ Copyright (c) 2018 dxw
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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
- ## Development
37
+ ## Dependencies
38
+
39
+ - git
40
+ - Ruby (>= 2.5.1)
38
41
 
39
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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/[USERNAME]/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.
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
 
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Terrafile
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
@@ -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.2
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
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here