vagrant-export 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: b1122a5f92b1f785a5bc0d32aecaa8081d1bedc3
4
- data.tar.gz: eafee68a5a8575bba9adb5c2508aa4b347247cf3
3
+ metadata.gz: 081ac42c7d7c7fc536631f148a6169561e8ccd9a
4
+ data.tar.gz: 0a80a48a476b5e743a1f37ebd96dc02df126d844
5
5
  SHA512:
6
- metadata.gz: a2bbed4f4bac8dbf1ed8a63f2dbb82129422cf972ff82edce2dcffd69795b7e9843da9d181cd3ae30a9c3fd09476350e9bcf91cec147001bf86b0cb79302e441
7
- data.tar.gz: e01f513a7ce4000e45fbf592ddfdffed942904e69981daa376b7234270792a851074472177c617bfddc359700afeec447655f0e2fd23da649a5225af40017b7b
6
+ metadata.gz: 8b38d562b1d89947f8139811cf1b799e4c90261a0d1532525e9007db2f5effd3551281598e156fb717115b3e9a33bbffab3d4e2ccf565ddf65a6ab849bd0dc4f
7
+ data.tar.gz: 05981e87e43e6fcbacbd76928adc728ad61e30fa9d3c4586f8d5cb4a2eb3fb5f8d502091895a1ecb533d9b3e49d2ec3fc8741c280558c0ea6802f55bb42d25e5
@@ -23,9 +23,8 @@ module VagrantPlugins
23
23
  # @param bare Boolean
24
24
  # @return string
25
25
  def handle(fast, bare)
26
- @did_run = false
27
- @private_key = nil
28
- @tmp_path = nil
26
+ @private_key = nil
27
+ @tmp_path = nil
29
28
  @box_file_name = nil
30
29
 
31
30
  if @vm.state.short_description == 'not created'
@@ -66,9 +65,7 @@ module VagrantPlugins
66
65
  protected
67
66
 
68
67
  def can_compress
69
- if @vm.state.short_description == 'running'
70
- @did_run = true
71
- else
68
+ unless @vm.state.short_description == 'running'
72
69
  @vm.ui.info('Machine not running, bringing it up')
73
70
  @vm.action(:up)
74
71
  end
@@ -143,16 +140,16 @@ module VagrantPlugins
143
140
  @logger.debug("Using vmware method for provider #{provider_name}")
144
141
 
145
142
  current_dir = File.dirname(@vm.id)
146
- files = Dir.glob(File.join(current_dir, '**', '*'))
143
+ vm_data_files = Dir.glob(File.join(current_dir, '**', '*'))
147
144
 
148
- @logger.debug("Files found in #{current_dir}: #{files}")
145
+ @logger.debug("Files found in #{current_dir}: #{vm_data_files}")
149
146
 
150
- files.select! { |f| !File.directory?(f) }
151
- files.select! { |f| f ~ /\.(vmdk|nvram|vmtm|vmx|vmxf)$/ }
147
+ vm_data_files.select! { |f| !File.directory?(f) }
148
+ vm_data_files.select! { |f| f ~ /\.(vmdk|nvram|vmtm|vmx|vmxf)$/ }
152
149
 
153
150
  @logger.debug("Copying #{files} to #{exported_path}")
154
151
 
155
- FileUtils.cp_r(files, exported_path)
152
+ FileUtils.cp_r(vm_data_files, exported_path)
156
153
 
157
154
  @vm.ui.info('Compacting Vmware virtual disks')
158
155
 
@@ -179,8 +176,8 @@ module VagrantPlugins
179
176
  @logger.debug(d)
180
177
 
181
178
  unless io == :stdout
179
+ @env.ui.clear_line
182
180
  if /\d+%/ =~ d
183
- @env.ui.clear_line
184
181
  @env.ui.info(d.match(/\d+%/).to_a.pop, new_line: false)
185
182
  else
186
183
  @logger.error(d)
@@ -214,13 +211,17 @@ module VagrantPlugins
214
211
  end
215
212
 
216
213
  # Copy additional files
217
- additional_files = Dir.glob(File.join(@vm.box.directory, '**', '*'))
218
- additional_files.select! { |f| !File.directory?(f) }
219
- additional_files.select! { |f| f !~ /(tar|gz|core|lck|log|vmdk|ovf|ova)$/ }
220
- additional_files.select! { |f| f !~ /(nvram|vmem|vmsd|vmsn|vmss|vmtm|vmx|vmxf)$/ }
214
+ unless bare
215
+ additional_files = Dir.glob(File.join(@vm.box.directory, '**', '*'))
216
+ additional_files.select! { |f| !File.directory?(f) }
217
+ additional_files.select! { |f| f !~ /(gz|core|lck|log|vmdk|ovf|ova)$/ }
218
+ additional_files.select! { |f| f !~ /(nvram|vmem|vmsd|vmsn|vmss|vmtm|vmx|vmxf)$/ }
219
+ additional_files.select! { |f| !File.file?(f.gsub(@vm.box.directory.to_s, @tmp_path.to_s)) }
220
+
221
+ @logger.debug("Copy includes #{additional_files} to #{@tmp_path}")
221
222
 
222
- @logger.debug("Copy includes #{additional_files} to #{@tmp_path}")
223
- FileUtils.cp_r(additional_files, @tmp_path)
223
+ FileUtils.cp_r(additional_files, @tmp_path)
224
+ end
224
225
 
225
226
  # Make sure the Vagrantfile includes a HMAC when the provider is virtualbox
226
227
  if @vm.provider_name.to_s == 'virtualbox'
@@ -245,7 +246,7 @@ module VagrantPlugins
245
246
 
246
247
  @logger.debug("Found HMAC setting in file #{vagrantfile_name.to_s}")
247
248
 
248
- vagrantfile_name.open(mode) { |f|
249
+ File.open(vagrantfile_name.to_s, mode) { |f|
249
250
  hmac_address = @vm.provider.driver.read_mac_address
250
251
  f.binmode
251
252
  f.puts
@@ -264,8 +265,8 @@ module VagrantPlugins
264
265
 
265
266
  Vagrant::Util::SafeChdir.safe_chdir(@tmp_path) do
266
267
 
267
- files = Dir.glob(File.join(@tmp_path, '**', '*'))
268
- @logger.debug("Create box file #{@box_file_name} containing #{files}")
268
+ box_files = Dir.glob(File.join(@tmp_path, '**', '*'))
269
+ @logger.debug("Create box file #{@box_file_name} containing #{box_files}")
269
270
  bash_exec = Vagrant::Util::Which.which('bash').to_s;
270
271
 
271
272
  if File.executable?(bash_exec) && ['pv', 'tar', 'gzip'].all? {|cmd| Vagrant::Util::Which.which(cmd) != nil }
@@ -275,7 +276,7 @@ module VagrantPlugins
275
276
  @logger.debug('Using custom packaging command to create progress output')
276
277
  @env.ui.info('Starting compression', new_line: false)
277
278
 
278
- files.each { |f|
279
+ box_files.each { |f|
279
280
  total_size += File.size(f)
280
281
  files_list.push(f.to_s.gsub(@tmp_path.to_s, '').gsub(/^[\/\\]+/, ''))
281
282
  }
@@ -306,7 +307,7 @@ module VagrantPlugins
306
307
  @env.ui.clear_line
307
308
 
308
309
  else
309
- Vagrant::Util::Subprocess.execute('bsdtar', '-czf', @box_file_name, *files)
310
+ Vagrant::Util::Subprocess.execute('bsdtar', '-czf', @box_file_name, *box_files)
310
311
  end
311
312
  end
312
313
 
@@ -322,12 +323,6 @@ module VagrantPlugins
322
323
  FileUtils.mv(@box_file_name, target)
323
324
  @vm.ui.info('Created ' + target)
324
325
  end
325
-
326
- # Resume the machine
327
- if @did_run
328
- @vm.ui.info('Bringing the machine back up')
329
- @vm.action(:up)
330
- end
331
326
  end
332
327
  end
333
328
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module VagrantPlugins
7
7
  module Export
8
- VERSION = '0.4.0'
8
+ VERSION = '0.4.1'
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-export
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
  - Georg Grossberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-30 00:00:00.000000000 Z
11
+ date: 2015-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Export boxes to .box files including the original Vagrantfile and some
14
14
  cleanups inside the VM