vagrant-pristine 0.3.0 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a1eba2103a27b3adfff2db14e001cb3c9f341ea
4
- data.tar.gz: eba0c58d58cbb435742eb0fa60dc4e62d11fecb9
3
+ metadata.gz: e333755710294665bae18486f2efe8d3df32a9a1
4
+ data.tar.gz: 749f1b5e9c0a4f95fec7bf813005b0eacdc79acb
5
5
  SHA512:
6
- metadata.gz: cd76399d91d0cbcc8375d883ba99c454c5bb9f5b8de080aceab55e6931aa33a009466aac26ee0a03838986e9784940e7a9387c34a593afc7e79059c9cd89857d
7
- data.tar.gz: 3641c7b8fec81cff51de84d4f1ec0927d835bf99ba39bca66c4e1f2b9b0644f74fa024f99bc5253cebd65c5eae8fc749fb1dfd6699d2f08b213f5958fe73a949
6
+ metadata.gz: d653ba0da79230d421b375ee401ac7d24971465ab4a137a955dcc09c5323c0653a1fdff763e6e4590b63cbde7e42e9b9a0d50987d1227af6c90daa975c2d01ae
7
+ data.tar.gz: 9178803e4c36777c4fd492f3bb31b6dff3092bf24a37b15bdcbcb4533c0ff002e97907b00e41ab643ff5ec7a384b646c088687accbbe86c67253c81c5b7fb1a1
data/Gemfile CHANGED
@@ -5,6 +5,4 @@ gemspec
5
5
 
6
6
  group :development do
7
7
  gem 'vagrant', github: 'mitchellh/vagrant'
8
- gem 'vagrant-lxc', github: 'fgrehm/vagrant-lxc'
9
- gem 'vagrant-cachier', github: 'fgrehm/vagrant-cachier'
10
8
  end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Fabio Rehm
1
+ Copyright (c) 2013-2014 Fabio Rehm
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -3,6 +3,11 @@
3
3
  Restore your vagrant machines to a pristine state with a single command. Basically
4
4
  the same as runnning a `vagrant destroy && vagrant up`.
5
5
 
6
+ Similar functionality may be provided by a future Vagrant release, see the issues below for more information:
7
+ - https://github.com/mitchellh/vagrant/issues/5378
8
+ - https://github.com/mitchellh/vagrant/pull/5410
9
+ - https://github.com/mitchellh/vagrant/pull/5613
10
+
6
11
  ## Installation
7
12
 
8
13
  Make sure you have Vagrant 1.2+ and run:
@@ -21,6 +26,7 @@ Usage: vagrant pristine [vm-name]
21
26
  -f, --force Destroy without confirmation.
22
27
  --[no-]parallel Enable or disable parallelism if provider supports it.
23
28
  --provider provider Back the machine with a specific provider.
29
+ --[no-]update Enable or disable box update.
24
30
  -h, --help Print this help
25
31
  ```
26
32
 
@@ -31,3 +37,4 @@ Usage: vagrant pristine [vm-name]
31
37
  3. Commit your changes (`git commit -am 'Add some feature'`)
32
38
  4. Push to the branch (`git push origin my-new-feature`)
33
39
  5. Create new Pull Request
40
+
@@ -1,6 +1,7 @@
1
1
  require_relative 'version'
2
2
  require 'vagrant'
3
3
  require Vagrant.source_root.join('plugins/commands/up/start_mixins')
4
+ require Vagrant.source_root.join('plugins/commands/box/command/download_mixins')
4
5
 
5
6
  module VagrantPlugins
6
7
  module Pristine
@@ -14,11 +15,13 @@ module VagrantPlugins
14
15
 
15
16
  class Command < Vagrant.plugin(2, :command)
16
17
  include VagrantPlugins::CommandUp::StartMixins
18
+ include VagrantPlugins::CommandBox::DownloadMixins
17
19
 
18
20
  def execute
19
21
  options = {
20
22
  force: false,
21
- parallel: true
23
+ parallel: true,
24
+ update: true
22
25
  }
23
26
 
24
27
  opts = OptionParser.new do |o|
@@ -40,6 +43,10 @@ module VagrantPlugins
40
43
  "Back the machine with a specific provider.") do |provider|
41
44
  options[:provider] = provider
42
45
  end
46
+
47
+ o.on("--[no-]update", "Enable or disable box update.") do |update|
48
+ options[:update] = update
49
+ end
43
50
  end
44
51
 
45
52
  # Parse the options
@@ -59,14 +66,54 @@ module VagrantPlugins
59
66
  # Success if no confirms were declined
60
67
  return 1 if declined
61
68
 
62
- # Build up the batch job of what we'll do
63
- @env.batch(options[:parallel]) do |batch|
64
- with_target_vms(argv, :provider => options[:provider]) do |machine|
65
- FileUtils.mkdir_p machine.data_dir.to_s
66
- @env.ui.info(I18n.t(
67
- "vagrant.commands.up.upping",
68
- :name => machine.name,
69
- :provider => machine.provider_name))
69
+ # Build up the batch job of what we'll do
70
+ @env.batch(options[:parallel]) do |batch|
71
+ with_target_vms(argv, :provider => options[:provider]) do |machine|
72
+ if options[:update]
73
+ begin
74
+ box = machine.box
75
+ if box
76
+ @env.ui.output(I18n.t("vagrant.box_update_checking", name: machine.name))
77
+
78
+ update = box.has_update?
79
+ if !update
80
+ @env.ui.success(I18n.t(
81
+ "vagrant.box_up_to_date_single",
82
+ name: box.name, version: box.version))
83
+ else
84
+ @env.ui.output(I18n.t(
85
+ "vagrant.box_updating",
86
+ name: update[0].name,
87
+ provider: update[2].name,
88
+ old: box.version,
89
+ new: update[1].version))
90
+ @env.action_runner.run(Vagrant::Action.action_box_add, {
91
+ box_url: box.metadata_url,
92
+ box_provider: update[2].name,
93
+ box_version: update[1].version,
94
+ ui: @env.ui
95
+ })
96
+
97
+ machine.box = @env.boxes.find(update[0].name, update[2].name, update[1].version)
98
+ end
99
+ end
100
+ rescue Exception => e
101
+ # exception will be logged to ui but not thrown, box update failure is not fatal
102
+ @env.ui.warn e
103
+ end
104
+ else
105
+ @env.ui.output(I18n.t("vagrant.box_update_checking", name: machine.name)+" skipped")
106
+ end
107
+
108
+ # turn off default update check
109
+ machine.config.instance_variable_get(:@keys)[:vm].instance_variable_set(:@box_check_update, false)
110
+
111
+ FileUtils.mkdir_p machine.data_dir.to_s
112
+
113
+ @env.ui.info(I18n.t(
114
+ "vagrant.commands.up.upping",
115
+ :name => machine.name,
116
+ :provider => machine.provider_name))
70
117
 
71
118
  batch.action(machine, :up, options)
72
119
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Pristine
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["fgrehm@gmail.com"]
11
11
  spec.description = %q{Vagrant destroy && up made simple}
12
12
  spec.summary = spec.description
13
- spec.homepage = "https://github.com/fgrehm/vagrant-recreate"
13
+ spec.homepage = "https://github.com/fgrehm/vagrant-pristine"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-pristine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2018-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Vagrant destroy && up made simple
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
48
+ - ".gitignore"
49
49
  - Gemfile
50
50
  - LICENSE.txt
51
51
  - README.md
@@ -54,7 +54,7 @@ files:
54
54
  - lib/vagrant-pristine/plugin.rb
55
55
  - lib/vagrant-pristine/version.rb
56
56
  - vagrant-pristine.gemspec
57
- homepage: https://github.com/fgrehm/vagrant-recreate
57
+ homepage: https://github.com/fgrehm/vagrant-pristine
58
58
  licenses:
59
59
  - MIT
60
60
  metadata: {}
@@ -64,17 +64,17 @@ require_paths:
64
64
  - lib
65
65
  required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.0.7
77
+ rubygems_version: 2.5.2
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Vagrant destroy && up made simple