vagrant-vbox-snapshot 0.0.6 → 0.0.7

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: 9f5697ed4cc9a5098074e816fba4ddc0b98a4fe0
4
- data.tar.gz: ac257a20df8ac544797565d9c3f4e6b85bacab3e
3
+ metadata.gz: 16213a5e9ee2cba54ec7d0a6cba605674b26b0cb
4
+ data.tar.gz: 142f34c2bb981ada29393907138e777c73ca9e3a
5
5
  SHA512:
6
- metadata.gz: 50dc4b43b9c86153eb1ab851ab06b0dca923afbbfc9f4592fc7304853670913b6cd0d558d910f1050c7de19ab25940e09aa87e465b4a67d0f3f84f3bcd97fc19
7
- data.tar.gz: 1dd9996540e99465b35b544a9161bda82eb99e9ea6450e9083c88aa4b6c971cd3562e90ebdbf5fce0cb3533554aaf4097ee55de892bf5a198d0b345700ed83ad
6
+ metadata.gz: f8f04b167c1d1034c5faf19a4ee5e036d5998a1972c5cb8447a13a9c9caa9e0d4c7777d706e90efda61750f0c8c7a54dfce99f49e44fb7d76acd23b88ba4ad1c
7
+ data.tar.gz: 7a68aeec72c54647c4cb9c542582164641fe6b74648d0409dc2f8f22caf35dfc3121d6a7f64008fdc98f52cd3f6929cde74ee7cdd7dd222598ecae5a2d233e8e
data/Vagrantfile CHANGED
@@ -6,7 +6,7 @@ require_relative 'lib/vagrant-vbox-snapshot.rb'
6
6
 
7
7
  Vagrant.configure("2") do |config|
8
8
 
9
- TEST_MULTI_VM = false
9
+ TEST_MULTI_VM = true
10
10
  TEST_SHARED_FOLDERS = false
11
11
 
12
12
  if TEST_MULTI_VM
@@ -17,6 +17,7 @@ Vagrant.configure("2") do |config|
17
17
  web.vm.box = "precise64"
18
18
  end
19
19
  else
20
+ raise "FALSE"
20
21
  config.vm.box = "precise64"
21
22
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
22
23
  end
@@ -1,7 +1,12 @@
1
+ require_relative 'multi_vm_args'
2
+ require_relative 'check_runnable'
3
+
1
4
  module VagrantPlugins
2
5
  module VBoxSnapshot
3
6
  module Command
4
7
  class Back < Vagrant.plugin(2, :command)
8
+ include CheckRunnable
9
+
5
10
  def execute
6
11
  options = {}
7
12
 
@@ -15,6 +20,7 @@ module VagrantPlugins
15
20
  return if !argv
16
21
 
17
22
  with_target_vms(argv, single_target: true) do |machine|
23
+ check_runnable_on(machine)
18
24
 
19
25
  if machine.state.id != :poweroff
20
26
  machine.provider.driver.execute("controlvm", machine.id, "poweroff")
@@ -0,0 +1,24 @@
1
+ # Adapted from https://github.com/dotless-de/vagrant-vbguest/
2
+
3
+ require Vagrant.source_root.join("plugins/commands/up/start_mixins")
4
+
5
+ module VagrantPlugins
6
+ module VBoxSnapshot
7
+ module Command
8
+
9
+ module CheckRunnable
10
+
11
+ include VagrantPlugins::CommandUp::StartMixins
12
+
13
+ class NoVirtualBoxMachineError < Vagrant::Errors::VagrantError
14
+ error_message "The VBGuest plugin must be used with VirtualBox Machines only."
15
+ end
16
+
17
+ def check_runnable_on(vm)
18
+ raise NoVirtualBoxMachineError if vm.provider.class != VagrantPlugins::ProviderVirtualBox::Provider
19
+ raise Vagrant::Errors::VMNotCreatedError if vm.state.id == :not_created
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -2,12 +2,14 @@
2
2
  # consider removing it; or replacing with this idea: http://superuser.com/questions/590968/quickest-way-to-merge-snapshots-in-virtualbox
3
3
 
4
4
  require_relative 'multi_vm_args'
5
+ require_relative 'check_runnable'
5
6
 
6
7
  module VagrantPlugins
7
8
  module VBoxSnapshot
8
9
  module Command
9
10
  class Delete < Vagrant.plugin(2, :command)
10
11
  include MultiVmArgs
12
+ include CheckRunnable
11
13
 
12
14
  def execute
13
15
  options = {}
@@ -25,6 +27,7 @@ module VagrantPlugins
25
27
  return if !snapshot_name
26
28
 
27
29
  with_target_vms(vm_name, single_target: true) do |machine|
30
+ check_runnable_on(machine)
28
31
  machine.provider.driver.execute("snapshot", machine.id, "delete", snapshot_name) do |type, data|
29
32
  machine.env.ui.info(data, :color => type == :stderr ? :red : :white)
30
33
  end
@@ -1,10 +1,12 @@
1
1
  require_relative 'multi_vm_args'
2
+ require_relative 'check_runnable'
2
3
 
3
4
  module VagrantPlugins
4
5
  module VBoxSnapshot
5
6
  module Command
6
7
  class Go < Vagrant.plugin(2, :command)
7
8
  include MultiVmArgs
9
+ include CheckRunnable
8
10
 
9
11
  def get_shared_folders(machine)
10
12
  shared_folders = []
@@ -52,6 +54,7 @@ module VagrantPlugins
52
54
  return if !snapshot_name
53
55
 
54
56
  with_target_vms(vm_name, single_target: true) do |machine|
57
+ check_runnable_on(machine)
55
58
  vm_id = machine.id
56
59
 
57
60
  before_restore(machine)
@@ -1,7 +1,10 @@
1
+ require_relative 'check_runnable'
2
+
1
3
  module VagrantPlugins
2
4
  module VBoxSnapshot
3
5
  module Command
4
6
  class List < Vagrant.plugin(2, :command)
7
+ include CheckRunnable
5
8
  def execute
6
9
  options = {}
7
10
 
@@ -15,6 +18,7 @@ module VagrantPlugins
15
18
  return if !argv
16
19
 
17
20
  with_target_vms(argv, single_target: true) do |machine|
21
+ check_runnable_on(machine)
18
22
  puts "Listing snapshots for '#{machine.name}':"
19
23
 
20
24
  begin
@@ -1,10 +1,12 @@
1
1
  require_relative 'multi_vm_args'
2
+ require_relative 'check_runnable'
2
3
 
3
4
  module VagrantPlugins
4
5
  module VBoxSnapshot
5
6
  module Command
6
7
  class Take < Vagrant.plugin(2, :command)
7
8
  include MultiVmArgs
9
+ include CheckRunnable
8
10
 
9
11
  def execute
10
12
  options = {}
@@ -22,6 +24,7 @@ module VagrantPlugins
22
24
  return if !snapshot_name
23
25
 
24
26
  with_target_vms(vm_name, single_target: true) do |machine|
27
+ check_runnable_on(machine)
25
28
  machine.env.ui.info("Taking snapshot #{snapshot_name}")
26
29
  machine.provider.driver.execute("snapshot", machine.id, "take", snapshot_name, "--pause") do |type, data|
27
30
  machine.env.ui.info(data, :color => type == :stderr ? :red : :white, :new_line => false)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VBoxSnapshot
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vbox-snapshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dergachev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,6 +54,7 @@ files:
54
54
  - Vagrantfile
55
55
  - lib/vagrant-vbox-snapshot.rb
56
56
  - lib/vagrant-vbox-snapshot/commands/back.rb
57
+ - lib/vagrant-vbox-snapshot/commands/check_runnable.rb
57
58
  - lib/vagrant-vbox-snapshot/commands/delete.rb
58
59
  - lib/vagrant-vbox-snapshot/commands/go.rb
59
60
  - lib/vagrant-vbox-snapshot/commands/list.rb