vagrant-clean 0.0.1 → 0.0.2

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: a6f134d19e87d6b5a9dc789fcc1c4c6749c517ee
4
- data.tar.gz: 03d5f1445d33fbe9cf031f72ebeadeeaed33cb04
3
+ metadata.gz: 880fc13835d666428427ffbafe1a1e3ecc9dcdf4
4
+ data.tar.gz: c99db95121112caf06948b7a3e7f735d16be6267
5
5
  SHA512:
6
- metadata.gz: 72e2455156de8f685c300bb6b886194f8c7ac625ec8970d0de061184bc57912a857620228fe374472485710f02d7592dca6bdf2e27a1c3d165220113c3a21417
7
- data.tar.gz: a74217740a065a0ab1d9865abc49342e620fa5e221e1d54b0e1ddf6d4c9cb7e501ae73881f84f7672d61c96ea40fbe38f6787b6a540027962f8f19e6cbcaedd6
6
+ metadata.gz: 0911cd6624b65f835c737ca7467b6766091dea8f7e542bc7d1d4114e2a4d5812b9bdc474ac86576dae03c06f0db7e76a346d69e853aed881270d7e68ad92b181
7
+ data.tar.gz: 8c881db5ce463880d76b0ca06a8e46325cd98fb4f04d01fa610bf4aea24a71dddc7a2f4a8d3ff00a29231c700dce093c585f6bd06887d2f8dadcfa0465bb949f
@@ -14,26 +14,31 @@ module VagrantPlugins
14
14
  prune = []
15
15
 
16
16
  @env.machine_index.each do |entry|
17
- env = entry.vagrant_env(entry.vagrantfile_path)
17
+ begin
18
+ env = entry.vagrant_env(@env.home_path)
19
+ rescue Vagrant::Errors::EnvironmentNonExistentCWD
20
+ entry = @env.machine_index.get(entry.id)
21
+ @env.machine_index.delete(entry) if entry
22
+ next
23
+ end
18
24
  machine = env.machine(entry.name.to_sym, entry.provider.to_sym)
19
- @env.ui.info("Destroying VM id #{entry.id[0..6]}")
25
+ @env.ui.info("==> Destroying vm #{entry.name}:#{entry.id[0..6]}", bold: true)
20
26
  action_env = machine.action(:destroy, force_confirm_destroy: true)
21
27
 
22
28
  # Remove machine from index if it was destroyed
23
29
  if action_env.key?(:force_confirm_destroy_result) && action_env[:force_confirm_destroy_result] == true
24
- @env.ui.info("Destroyed")
30
+ @env.ui.success("==> Destroyed")
25
31
  else
26
- @env.ui.warn("Failed to destroy VM id #{entry.id[0..6]}")
32
+ @env.ui.warn("==> Warning: failed to destroy #{entry.name}:#{entry.id[0..6]}")
27
33
  end
28
34
 
29
- prune << entry
35
+ prune << entry.id
30
36
  end
31
37
 
32
38
  # Must remove machine from the global index
33
- prune.each do |entry|
34
- e = @env.machine_index.get(entry.id)
35
- @env.machine_index.delete(e)
36
- @env.machine_index.release(e)
39
+ prune.each do |id|
40
+ entry = @env.machine_index.get(id)
41
+ @env.machine_index.delete(entry) if entry
37
42
  end
38
43
 
39
44
  return 0
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module CleanCommand
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-clean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Spaulding
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler