vagrant-vbguest 0.2.0 → 0.2.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/Readme.md CHANGED
@@ -4,20 +4,22 @@
4
4
 
5
5
  ## Installation
6
6
 
7
- Requires vagrant 0.9.4 or later
7
+ Requires vagrant 0.9.4 or later (including 1.0)
8
+ Since vagrant v1.0.0 the prefered installation method for vagrant is using the provided packages or installers.
9
+ If you installed vagrant that way, you need to use vagrant's gem wrapper:
8
10
 
9
- gem install vagrant-vbguest
11
+ vagrant gem install vagrant-vbguest
10
12
 
11
- or, using vagrant's gem wrapper
13
+ If you installed vagrant using RubyGems simply:
12
14
 
13
- vagrant gem install vagrant-vbguest
15
+ gem install vagrant-vbguest
14
16
 
15
17
  Compatibly for vagrant 0.8 is provided by version 0.0.3 (which lacks a bunch of new options)
16
18
 
17
19
  ## Configuration / Usage
18
20
 
19
21
  If you're lucky, `vagrant-vbguest` does not require any configurations.
20
- Hoever, here is an example for your `Vagrantfile`:
22
+ However, here is an example for your `Vagrantfile`:
21
23
 
22
24
  Vagrant::Config.run do |config|
23
25
  # we will try to autodetect this path.
@@ -1,30 +1,29 @@
1
1
  require 'optparse'
2
2
 
3
3
  module VagrantVbguest
4
-
4
+
5
5
  class Command < Vagrant::Command::Base
6
-
6
+
7
7
  # Executes the given rake command on the VMs that are represented
8
8
  # by this environment.
9
9
  def execute
10
10
  options = {}
11
11
  opts = OptionParser.new do |opts|
12
- puts opts.inspect
13
12
  opts.banner = "Usage: vagrant vbguest [vm-name] [-f|--force] [-I|--no-install] [-R|--no-remote] [--iso VBoxGuestAdditions.iso]"
14
13
  opts.separator ""
15
14
 
16
15
  opts.on("-f", "--force", "Whether to force the installation") do
17
16
  options[:force] = true
18
17
  end
19
-
18
+
20
19
  opts.on("--no-install", "-I", "Only check for the installed version. Do not attempt to install anything") do
21
20
  options[:no_install] = true
22
21
  end
23
-
22
+
24
23
  opts.on("--no-remote", "-R", "Do not attempt do download the iso file from a webserver") do
25
24
  options[:no_remote] = true
26
25
  end
27
-
26
+
28
27
  opts.on("--iso file_or_uri", "Full path or URI to the VBoxGuestAdditions.iso") do |file_or_uri|
29
28
  options[:iso_path] = file_or_uri
30
29
  end
@@ -36,11 +35,11 @@ module VagrantVbguest
36
35
  if argv.empty?
37
36
  with_target_vms(nil) { |vm| execute_on_vm(vm, options) }
38
37
  else
39
- argv.each do |vm_name|
38
+ argv.each do |vm_name|
40
39
  with_target_vms(vm_name) { |vm| execute_on_vm(vm, options) }
41
40
  end
42
41
  end
43
-
42
+
44
43
  end
45
44
 
46
45
  protected
@@ -30,10 +30,10 @@ module VagrantVbguest
30
30
  protected
31
31
 
32
32
  def autodetect_iso
33
- media_magager_iso || guess_iso || web_iso
33
+ media_manager_iso || guess_iso || web_iso
34
34
  end
35
35
 
36
- def media_magager_iso
36
+ def media_manager_iso
37
37
  dvd = VirtualBox::DVD.all.find do |d|
38
38
  !!(d.location =~ /VBoxGuestAdditions.iso$/)
39
39
  end
@@ -41,14 +41,14 @@ module VagrantVbguest
41
41
  end
42
42
 
43
43
  def guess_iso
44
- guess_path = if Vagrant::Util::Platform.linux?
44
+ path_platform = if Vagrant::Util::Platform.linux?
45
45
  "/usr/share/virtualbox/VBoxGuestAdditions.iso"
46
46
  elsif Vagrant::Util::Platform.darwin?
47
47
  "/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso"
48
48
  elsif Vagrant::Util::Platform.windows?
49
49
  File.join((ENV["PROGRAM_FILES"] || ENV["PROGRAMFILES"]), "/Oracle/VirtualBox/VBoxGuestAdditions.iso")
50
50
  end
51
- File.exists?(guess_path) ? guess_path : nil
51
+ File.exists?(path_platform) ? path_platform : nil
52
52
  end
53
53
 
54
54
  def web_iso
@@ -1,7 +1,7 @@
1
1
  module VagrantVbguest
2
2
 
3
3
  # This implementation is based on Action::Box::Download by vagrant
4
- #
4
+ #
5
5
  # This adoption does not run as a action/middleware, but is called manually
6
6
  #
7
7
  # MIT License - Mitchell Hashimoto and John Bender - https://github.com/mitchellh/vagrant
@@ -80,4 +80,4 @@ module VagrantVbguest
80
80
  end
81
81
 
82
82
  end
83
- end
83
+ end
@@ -13,7 +13,7 @@ module VagrantVbguest
13
13
  @options = options
14
14
  @iso_path = nil
15
15
  end
16
-
16
+
17
17
  def run!
18
18
  @options[:auto_update] = true
19
19
  run
@@ -25,49 +25,41 @@ module VagrantVbguest
25
25
  raise Vagrant::Errors::VMNotRunningError if @vm.state != :running
26
26
 
27
27
  if @options[:auto_update]
28
-
28
+
29
29
  @vm.ui.success(I18n.t("vagrant.plugins.vbguest.guest_ok", :version => guest_version)) unless needs_update?
30
30
  @vm.ui.warn(I18n.t("vagrant.plugins.vbguest.check_failed", :host => vb_version, :guest => guest_version)) if @options[:no_install]
31
-
31
+
32
32
  if @options[:force] || (!@options[:no_install] && needs_update?)
33
33
  @vm.ui.warn(I18n.t("vagrant.plugins.vbguest.installing#{@options[:force] ? '_forced' : ''}", :host => vb_version, :guest => guest_version))
34
-
35
- # :TODO:
34
+
35
+ # :TODO:
36
36
  # the whole installation process should be put into own classes
37
37
  # like the vagrant system loading
38
38
  if (i_script = installer_script)
39
39
  @vm.ui.info(I18n.t("vagrant.plugins.vbguest.start_copy_iso", :from => iso_path, :to => iso_destination))
40
40
  @vm.channel.upload(iso_path, iso_destination)
41
-
41
+
42
42
  @vm.ui.info(I18n.t("vagrant.plugins.vbguest.start_copy_script", :from => File.basename(i_script), :to => installer_destination))
43
43
  @vm.channel.upload(i_script, installer_destination)
44
-
44
+
45
45
  @vm.channel.sudo("sh #{installer_destination}") do |type, data|
46
- # Print the data directly to STDOUT, not doing any newlines
47
- # or any extra formatting of our own
48
- $stdout.print(data) if type != :exit_status
46
+ @vm.ui.info(data, :prefix => false, :new_line => false)
49
47
  end
50
48
 
51
- @vm.channel.execute("rm /tmp/install_vbguest.sh /tmp/VBoxGuestAdditions.iso") do |type, data|
52
- # Print the data directly to STDOUT, not doing any newlines
53
- # or any extra formatting of our own
54
- $stdout.print(data) if type != :exit_status
49
+ @vm.channel.execute("rm #{installer_destination} #{iso_destination}") do |type, data|
50
+ @vm.ui.error(data.chomp, :prefix => false)
55
51
  end
56
-
57
- # Puts out an ending newline just to make sure we end on a new
58
- # line.
59
- $stdout.puts
60
52
  end
61
53
  end
62
54
  end
63
55
  ensure
64
56
  cleanup
65
57
  end
66
-
58
+
67
59
  def needs_update?
68
60
  !(guest_version && vb_version == guest_version)
69
61
  end
70
-
62
+
71
63
  def guest_version
72
64
  guest_version = @vm.driver.read_guest_additions_version
73
65
  !guest_version ? nil : guest_version.gsub(/[-_]ose/i, '')
@@ -78,19 +70,19 @@ module VagrantVbguest
78
70
  end
79
71
 
80
72
  def installer_script
81
- plattform = @vm.guest.distro_dispatch
82
- case plattform
73
+ platform = @vm.guest.distro_dispatch
74
+ case platform
83
75
  when :debian, :ubuntu
84
76
  File.expand_path("../../../files/setup_debian.sh", __FILE__)
85
77
  when :gentoo, :redhat, :suse, :arch, :linux
86
- @vm.ui.warn(I18n.t("vagrant.plugins.vbguest.generic_install_script_for_plattform", :plattform => plattform.to_s))
78
+ @vm.ui.warn(I18n.t("vagrant.plugins.vbguest.generic_install_script_for_platform", :platform => platform.to_s))
87
79
  File.expand_path("../../../files/setup_linux.sh", __FILE__)
88
80
  else
89
- @vm.ui.error(I18n.t("vagrant.plugins.vbguest.no_install_script_for_plattform", :plattform => plattform.to_s))
81
+ @vm.ui.error(I18n.t("vagrant.plugins.vbguest.no_install_script_for_platform", :platform => platform.to_s))
90
82
  nil
91
83
  end
92
84
  end
93
-
85
+
94
86
  def installer_destination
95
87
  '/tmp/install_vbguest.sh'
96
88
  end
@@ -1,9 +1,9 @@
1
1
  module VagrantVbguest
2
-
2
+
3
3
  # A Vagrant middleware which checks the installed VirtualBox Guest
4
- # Additions to match the installed VirtualBox installation on the
4
+ # Additions to match the installed VirtualBox installation on the
5
5
  # host system.
6
-
6
+
7
7
  class Middleware
8
8
  def initialize(app, env, options = {})
9
9
  @app = app
@@ -19,4 +19,4 @@ module VagrantVbguest
19
19
  end
20
20
  end
21
21
 
22
- end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module VagrantVbguest
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/locales/en.yml CHANGED
@@ -8,8 +8,8 @@ en:
8
8
  installing_forced: "Forcing installation of Virtualbox Guest Additions %{host} - guest's version is %{guest}"
9
9
  start_copy_iso: "Copy iso file %{from} into the box %{to}"
10
10
  start_copy_script: "Copy installer file %{from} into the box %{to}"
11
- no_install_script_for_plattform: "Sorry, don't know how to install on a %{plattform} system. Stopping installation."
12
- generic_install_script_for_plattform: "%{plattform} is currently not supported, but i'll try generic linux way ... "
11
+ no_install_script_for_platform: "Sorry, don't know how to install on a %{platform} system. Stopping installation."
12
+ generic_install_script_for_platform: "%{platform} is currently not supported, will try generic Linux method..."
13
13
 
14
14
  validation_errors:
15
15
  missing_iso_path: |-
@@ -21,4 +21,4 @@ en:
21
21
  download:
22
22
  with: "Downloading VirtualBox Guest Additions ISO with %{class}..."
23
23
  cleaning: "Cleaning up downloaded VirtualBox Guest Additions ISO..."
24
- unknown_type: "Unknown or unsupported URI type given for VirtualBox Guest Additions ISO download."
24
+ unknown_type: "Unknown or unsupported URI type given for VirtualBox Guest Additions ISO download."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vbguest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-05 00:00:00.000000000Z
12
+ date: 2012-03-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: virtualbox
16
- requirement: &70295089810860 !ruby/object:Gem::Requirement
16
+ requirement: &70316106858200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70295089810860
24
+ version_requirements: *70316106858200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: vagrant
27
- requirement: &70295089810380 !ruby/object:Gem::Requirement
27
+ requirement: &70316106857700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70295089810380
35
+ version_requirements: *70316106857700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70295089809920 !ruby/object:Gem::Requirement
38
+ requirement: &70316106857220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70295089809920
46
+ version_requirements: *70316106857220
47
47
  description: A Vagrant plugin wich automatically installs the host's VirtualBox Guest
48
48
  Additions on the guest system.
49
49
  email: