vagrant-puppetfile 0.4.0 → 0.4.1

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
  SHA1:
3
- metadata.gz: d630dfea4265619b7d7011cc3ca686893bd92159
4
- data.tar.gz: ce55251db0c8d90e18aefb0cb01d43c465ba7e95
3
+ metadata.gz: 8d5eeaa153d6998bc5003e12dd77d8c36de9e40f
4
+ data.tar.gz: 9aa4016927c8a1bae872f5f357e3779c1b52629c
5
5
  SHA512:
6
- metadata.gz: bb7211571ab50f91db3b13ced038517a6b90c8e7844edaa0d327e13867b5d16fe07635bb8eedde310c3d59c1a562d3005a8d3479c79bf3643f470542906e05eb
7
- data.tar.gz: 2979bf2e51e9ac37773a55c13d9b17b32553957939290f87b8ef8f1daf7048eeef40849b3192596028d2b65f7106f1cbc783d5852271256369d7af861e0709d3
6
+ metadata.gz: 9080b1ee8a5c5adf04b3ed5b0045b115d864d3f439ba7aa7034ed868e64303063b20b9745d0d936c37519aa70e7d58a79b0157a2ae0f724af8f5b90e90a15908
7
+ data.tar.gz: 8b706134b0534f732121a2f7af6bb0a8efb17e935dd503dc4165a3c4cef8d4e7a0f1860e0ab528d1e3b698c04766d40b1023c980e350525ecbe8a29f6a0da211
@@ -21,6 +21,6 @@
21
21
  module Vagrant
22
22
  module Puppetfile
23
23
  NAME = 'vagrant-puppetfile'
24
- VERSION = '0.4.0'
24
+ VERSION = '0.4.1'
25
25
  end
26
26
  end
@@ -104,7 +104,13 @@ module Vagrant
104
104
  provisioner(:puppetfile) { Provisioner }
105
105
  end
106
106
 
107
- class Puppetfile < File
107
+ class Puppetfile
108
+ attr_reader :path
109
+
110
+ def initialize(path)
111
+ @path = path
112
+ end
113
+
108
114
  def evaluator(type, logger)
109
115
  case File.basename(type)
110
116
  when 'librarian-puppet'
@@ -153,7 +159,15 @@ module Vagrant
153
159
  @logger = logger
154
160
  @path = path
155
161
  @puppetfile = puppetfile
162
+
163
+ # Make sure the evaluator actually exists and can be called.
156
164
  fail NoEvaluatorError, path unless available?
165
+
166
+ # Check for the puppetfile and bomb if it doesn't exist.
167
+ unless File.readable?(puppetfile)
168
+ logger.error("Unable to read puppetfile: #{puppetfile}")
169
+ fail ConfigurationError, puppetfile
170
+ end
157
171
  end
158
172
 
159
173
  def command(*args)
@@ -187,6 +201,17 @@ module Vagrant
187
201
  end
188
202
 
189
203
  class Librarian < Base
204
+ SUPPORTED_PUPPETFILE_NAMES = %w{Puppetfile Modulefile metadata.json}
205
+
206
+ def initialize(path, puppetfile, logger)
207
+ super
208
+ unless SUPPORTED_PUPPETFILE_NAMES.include? File.basename(puppetfile)
209
+ logger.error("The 'librarian-puppet' evaluator cannot install from a file named #{puppetfile.inspect}")
210
+ logger.error("Please use one of these names instead: #{SUPPORTED_PUPPETFILE_NAMES.map(&:inspect).join(', ')}")
211
+ fail ConfigurationError, puppetfile
212
+ end
213
+ end
214
+
190
215
  def available?
191
216
  command('version').last.success?
192
217
  rescue
@@ -194,12 +219,15 @@ module Vagrant
194
219
  end
195
220
 
196
221
  def install!
197
- run('install', '--verbose')
222
+ dir = File.dirname(puppetfile)
223
+ Dir.chdir(dir) do
224
+ run('install', '--verbose')
225
+ end
198
226
  end
199
227
  end
200
228
 
201
229
  class Puppet < Base
202
- def initialize(path, puppetlabs, logger)
230
+ def initialize(path, puppetfile, logger)
203
231
  super
204
232
  @moduledir = 'modules'
205
233
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-puppetfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Hanson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-07 00:00:00.000000000 Z
11
+ date: 2017-05-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Automatically installs puppet modules from a Puppetfile during Vagrant
14
14
  provisioning