vagrant-destroyer 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
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
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Terrance
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Vagrant::Destroyer
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'vagrant-destroyer'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install vagrant-destroyer
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ Bundler::GemHelper.install_tasks
data/etc/Vagrantfile ADDED
@@ -0,0 +1,10 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant.configure("2") do |config|
5
+
6
+ config.vm.box = "precise32"
7
+ config.vm.box_url = "http://files.vagrantup.com/precise32.box"
8
+ config.destroy.enable = true
9
+
10
+ end
@@ -0,0 +1,4 @@
1
+ require 'vagrant'
2
+
3
+ require "vagrant-destroyer/version"
4
+ require "vagrant-destroyer/plugin"
@@ -0,0 +1,24 @@
1
+ module VagrantPlugins
2
+ module Destroyer
3
+ class Action
4
+ class Destroy
5
+ def initialize(app, env)
6
+ @app = app
7
+ @logger = Log4r::Logger.new("vagrant::destroyer::action::destroy")
8
+ end
9
+
10
+ def call(env)
11
+ return @app.call(env) if !env[:machine].config.destroy.enable
12
+
13
+ @env = env
14
+
15
+ @env[:machine].action(:destroy,:force_confirm_destroy => true)
16
+
17
+ @app.call env
18
+
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ module VagrantPlugins
2
+ module Destroyer
3
+ class Config < Vagrant.plugin(2, :config)
4
+ attr_accessor :enable
5
+
6
+ def initialize
7
+ @enable = false
8
+
9
+ end
10
+
11
+ def finalize!
12
+ @enable = false if @enable == UNSET_VALUE || @enable == nil || @enable == false
13
+ end
14
+
15
+ #def enabled?
16
+ # @enabled ||= @enable != UNSET_VALUE ||
17
+ # @enable != nil
18
+ #end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ module VagrantPlugins
2
+ module Destroyer
3
+ class Plugin < Vagrant.plugin('2')
4
+ name 'vagrant-destroy'
5
+
6
+ config 'destroy' do
7
+ require_relative "config"
8
+ Config
9
+ end
10
+
11
+ install_action_hook = lambda do |hook|
12
+ require_relative 'action'
13
+ hook.append VagrantPlugins::Destroyer::Action::Destroy
14
+ end
15
+ action_hook 'destroy-on-machine-up', :machine_action_up, &install_action_hook
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module Destroyer
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-destroyer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-destroyer"
8
+ spec.version = VagrantPlugins::Destroyer::VERSION
9
+ spec.authors = ["Terrance"]
10
+ spec.email = ["tscanausa@gmail.com"]
11
+ spec.description = %q{If enable calls vagrant destroy following a vagrant up}
12
+ spec.summary = %q{This plugin is useful for testing code: create a box, provision it, run tests, destroy. Guarantees a consistant enviroment by making sure it is destroyed automatically.}
13
+ spec.homepage = "https://github.com/canausa/vagrant-destroyer"
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,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-destroyer
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Terrance
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-06-13 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ hash: 9
27
+ segments:
28
+ - 1
29
+ - 3
30
+ version: "1.3"
31
+ version_requirements: *id001
32
+ name: bundler
33
+ type: :development
34
+ prerelease: false
35
+ - !ruby/object:Gem::Dependency
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ version_requirements: *id002
46
+ name: rake
47
+ type: :development
48
+ prerelease: false
49
+ description: If enable calls vagrant destroy following a vagrant up
50
+ email:
51
+ - tscanausa@gmail.com
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files: []
57
+
58
+ files:
59
+ - .gitignore
60
+ - Gemfile
61
+ - LICENSE.txt
62
+ - README.md
63
+ - Rakefile
64
+ - etc/Vagrantfile
65
+ - lib/vagrant-destroyer.rb
66
+ - lib/vagrant-destroyer/action.rb
67
+ - lib/vagrant-destroyer/config.rb
68
+ - lib/vagrant-destroyer/plugin.rb
69
+ - lib/vagrant-destroyer/version.rb
70
+ - vagrant-destroyer.gemspec
71
+ homepage: https://github.com/canausa/vagrant-destroyer
72
+ licenses:
73
+ - MIT
74
+ post_install_message:
75
+ rdoc_options: []
76
+
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ requirements: []
98
+
99
+ rubyforge_project:
100
+ rubygems_version: 1.8.15
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: "This plugin is useful for testing code: create a box, provision it, run tests, destroy. Guarantees a consistant enviroment by making sure it is destroyed automatically."
104
+ test_files: []
105
+