vagrant-clean 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a6f134d19e87d6b5a9dc789fcc1c4c6749c517ee
4
+ data.tar.gz: 03d5f1445d33fbe9cf031f72ebeadeeaed33cb04
5
+ SHA512:
6
+ metadata.gz: 72e2455156de8f685c300bb6b886194f8c7ac625ec8970d0de061184bc57912a857620228fe374472485710f02d7592dca6bdf2e27a1c3d165220113c3a21417
7
+ data.tar.gz: a74217740a065a0ab1d9865abc49342e620fa5e221e1d54b0e1ddf6d4c9cb7e501ae73881f84f7672d61c96ea40fbe38f6787b6a540027962f8f19e6cbcaedd6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-destroyer.gemspec
4
+ gemspec
@@ -0,0 +1,8 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2016 Matt Spaulding
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ # vagrant-clean
2
+
3
+ This is a plugin that will destroy all vagrant resources for all environments currently running on your system
4
+
5
+ ## Usage
6
+
7
+ $ vagrant clean
8
+
@@ -0,0 +1,5 @@
1
+ require 'vagrant'
2
+
3
+ require 'vagrant-clean/version'
4
+ require 'vagrant-clean/plugin'
5
+
@@ -0,0 +1,43 @@
1
+ module VagrantPlugins
2
+ module CommandClean
3
+ class Command < Vagrant.plugin('2', :command)
4
+ def self.synopsis
5
+ 'destroys all vagrant resources'
6
+ end
7
+
8
+ def execute
9
+ opts = OptionParser.new do |o|
10
+ o.banner = "Usage: vagrant clean"
11
+ end
12
+
13
+ argv = parse_options(opts)
14
+ prune = []
15
+
16
+ @env.machine_index.each do |entry|
17
+ env = entry.vagrant_env(entry.vagrantfile_path)
18
+ machine = env.machine(entry.name.to_sym, entry.provider.to_sym)
19
+ @env.ui.info("Destroying VM id #{entry.id[0..6]}")
20
+ action_env = machine.action(:destroy, force_confirm_destroy: true)
21
+
22
+ # Remove machine from index if it was destroyed
23
+ if action_env.key?(:force_confirm_destroy_result) && action_env[:force_confirm_destroy_result] == true
24
+ @env.ui.info("Destroyed")
25
+ else
26
+ @env.ui.warn("Failed to destroy VM id #{entry.id[0..6]}")
27
+ end
28
+
29
+ prune << entry
30
+ end
31
+
32
+ # 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)
37
+ end
38
+
39
+ return 0
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ module VagrantPlugins
2
+ module CommandClean
3
+ class Plugin < Vagrant.plugin('2')
4
+ name 'vagrant-clean'
5
+ description 'clean up all vagrant resources'
6
+
7
+ command("clean") do
8
+ require_relative 'command'
9
+ Command
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module CleanCommand
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-clean/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-clean"
8
+ spec.version = VagrantPlugins::CleanCommand::VERSION
9
+ spec.authors = ["Matt Spaulding"]
10
+ spec.email = ["mspaulding06@gmail.com"]
11
+ spec.description = %q{Command to destroy all vagrant resources}
12
+ spec.summary = %q{Command to destroy all vagrant resources}
13
+ spec.homepage = "https://github.com/mspaulding06/vagrant-clean"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-clean
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matt Spaulding
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Command to destroy all vagrant resources
42
+ email:
43
+ - mspaulding06@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - Gemfile
49
+ - LICENSE.md
50
+ - README.md
51
+ - lib/vagrant-clean.rb
52
+ - lib/vagrant-clean/command.rb
53
+ - lib/vagrant-clean/plugin.rb
54
+ - lib/vagrant-clean/version.rb
55
+ - vagrant-clean.gemspec
56
+ homepage: https://github.com/mspaulding06/vagrant-clean
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.4.8
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Command to destroy all vagrant resources
80
+ test_files: []