vagrant-pristine 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/lib/vagrant-pristine.rb +1 -0
- data/lib/vagrant-pristine/plugin.rb +73 -0
- data/lib/vagrant-pristine/version.rb +5 -0
- data/vagrant-pristine.gemspec +23 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 54c9fc961f9b05f0962578a9243cddba88291dd7
|
4
|
+
data.tar.gz: 99266c6657ac754357404455c245269496af0d33
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e2b0b9ef96af3ed3564bbaada8adfde8817a6628a429a710274056f9bb594b0b07482eb331f56b39eb4a1d8e0711185ce14ee29b52e7170dfb4597a99b426045
|
7
|
+
data.tar.gz: 57600e55137799ce8c43d92cab51367697aba6a3f25a9017ebebe7105e10bd931c3f745197efa1e6cc284478f57b9403bb37ce5d51ff027c19849c81b351a7d1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in vagrant-pristine.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'vagrant', github: 'mitchellh/vagrant'
|
8
|
+
gem 'vagrant-lxc', github: 'fgrehm/vagrant-lxc'
|
9
|
+
gem 'vagrant-cachier', github: 'fgrehm/vagrant-cachier'
|
10
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Fabio Rehm
|
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,31 @@
|
|
1
|
+
# vagrant-pristine
|
2
|
+
|
3
|
+
Restore your vagrant machines to a pristine state with a single command. Basically
|
4
|
+
the same as runnning a `vagrant destroy && vagrant up`.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Make sure you have Vagrant 1.2+ and run:
|
9
|
+
|
10
|
+
```
|
11
|
+
vagrant plugin install vagrant-pristine
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
```
|
17
|
+
Usage: vagrant pristine [vm-name]
|
18
|
+
|
19
|
+
-f, --force Destroy without confirmation.
|
20
|
+
--[no-]parallel Enable or disable parallelism if provider supports it.
|
21
|
+
--provider provider Back the machine with a specific provider.
|
22
|
+
-h, --help Print this help
|
23
|
+
```
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'vagrant-pristine/plugin'
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative 'version'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module Pristine
|
5
|
+
class Plugin < Vagrant.plugin('2')
|
6
|
+
name 'vagrant-pristine'
|
7
|
+
|
8
|
+
command("pristine") do
|
9
|
+
Command
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Command < Vagrant.plugin(2, :command)
|
14
|
+
def execute
|
15
|
+
options = {
|
16
|
+
force: false,
|
17
|
+
parallel: true
|
18
|
+
}
|
19
|
+
|
20
|
+
opts = OptionParser.new do |o|
|
21
|
+
o.banner = "Usage: vagrant pristine [vm-name]"
|
22
|
+
o.separator ""
|
23
|
+
|
24
|
+
o.on("-f", "--force", "Destroy without confirmation.") do |f|
|
25
|
+
options[:force] = f
|
26
|
+
end
|
27
|
+
|
28
|
+
o.on("--[no-]parallel",
|
29
|
+
"Enable or disable parallelism if provider supports it.") do |parallel|
|
30
|
+
options[:parallel] = parallel
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
o.on("--provider provider", String,
|
35
|
+
"Back the machine with a specific provider.") do |provider|
|
36
|
+
options[:provider] = provider
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Parse the options
|
41
|
+
argv = parse_options(opts)
|
42
|
+
return 1 if !argv
|
43
|
+
|
44
|
+
@logger.debug("'Destroy' each target VM...")
|
45
|
+
declined = false
|
46
|
+
with_target_vms(argv, :reverse => true) do |vm|
|
47
|
+
action_env = vm.action(
|
48
|
+
:destroy, :force_confirm_destroy => options[:force])
|
49
|
+
|
50
|
+
declined = true if action_env.has_key?(:force_confirm_destroy_result) &&
|
51
|
+
action_env[:force_confirm_destroy_result] == false
|
52
|
+
end
|
53
|
+
|
54
|
+
# Success if no confirms were declined
|
55
|
+
return 1 if declined
|
56
|
+
|
57
|
+
# Build up the batch job of what we'll do
|
58
|
+
@env.batch(options[:parallel]) do |batch|
|
59
|
+
with_target_vms(argv, :provider => options[:provider]) do |machine|
|
60
|
+
@env.ui.info(I18n.t(
|
61
|
+
"vagrant.commands.up.upping",
|
62
|
+
:name => machine.name,
|
63
|
+
:provider => machine.provider_name))
|
64
|
+
|
65
|
+
batch.action(machine, :up, options)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
return 0
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
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-pristine/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-pristine"
|
8
|
+
spec.version = VagrantPlugins::Pristine::VERSION
|
9
|
+
spec.authors = ["Fabio Rehm"]
|
10
|
+
spec.email = ["fgrehm@gmail.com"]
|
11
|
+
spec.description = %q{Vagrant destroy && up made simple}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = "https://github.com/fgrehm/vagrant-recreate"
|
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,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-pristine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabio Rehm
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-12 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: Vagrant destroy && up made simple
|
42
|
+
email:
|
43
|
+
- fgrehm@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/vagrant-pristine.rb
|
54
|
+
- lib/vagrant-pristine/plugin.rb
|
55
|
+
- lib/vagrant-pristine/version.rb
|
56
|
+
- vagrant-pristine.gemspec
|
57
|
+
homepage: https://github.com/fgrehm/vagrant-recreate
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.0.0
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Vagrant destroy && up made simple
|
81
|
+
test_files: []
|