vagrant-vbguest 0.6.0.pre6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 0.6.0 (unreleased)
1
+ ## 0.6.0 (2012-01-13)
2
2
 
3
3
  - Debian installer now cope with missing `dkms` package [GH-30]
4
4
  - Fixed some issues when runnig on just creating boxes [GH-31]
@@ -7,7 +7,8 @@
7
7
  - Installers no longer are shell scripts, but ruby classes
8
8
  - Users may pass in their own installer classes
9
9
  (yes! plugins in plugins)
10
- - New `sprintf` style `%{version}` placeholder for iso download path
10
+ - New `sprintf` style `%{version}` placeholder for iso download path.
11
+ (old `$VBOX_VERSION` placeholder still working)
11
12
  - Revisited command arguments to not just mirror config values:
12
13
  - New `--do` argument: force-run one of those commands:
13
14
  * `start` : Try to start the GuestAdditions Service
@@ -1,7 +1,8 @@
1
1
  module VagrantVbguest
2
2
 
3
- # Handles the guest addins installation process
4
-
3
+ ##
4
+ # Dispatches the installation process to a rigistered
5
+ # Installer implementation.
5
6
  class Installer
6
7
 
7
8
  class NoInstallerFoundError < Vagrant::Errors::VagrantError
@@ -86,19 +87,19 @@ module VagrantVbguest
86
87
 
87
88
  def guest_version(reload=false)
88
89
  installer = guest_installer
89
- raise NoInstallerFoundError, :method => 'check installation of' if !installer
90
+ raise NoInstallerFoundError, :method => 'check guest version of' if !installer
90
91
  installer.guest_version(reload)
91
92
  end
92
93
 
93
94
  def host_version
94
95
  installer = guest_installer
95
- raise NoInstallerFoundError, :method => 'check installation of' if !installer
96
+ raise NoInstallerFoundError, :method => 'check host version of' if !installer
96
97
  installer.host_version
97
98
  end
98
99
 
99
100
  def running?
100
101
  installer = guest_installer
101
- raise NoInstallerFoundError, :method => 'check installation of' if !installer
102
+ raise NoInstallerFoundError, :method => 'check current state of' if !installer
102
103
  installer.running?
103
104
  end
104
105
 
@@ -108,7 +109,6 @@ module VagrantVbguest
108
109
  #
109
110
  # @return [Installers::Base]
110
111
  def guest_installer
111
-
112
112
  @guest_installer ||= if @options[:installer].is_a? Class
113
113
  @options[:installer].new(@vm)
114
114
  else
@@ -129,6 +129,9 @@ module VagrantVbguest
129
129
  vm.driver.version
130
130
  end
131
131
 
132
+ # Determinates the version of the GuestAdditions installer in use
133
+ #
134
+ # @return [String] The version code of the GuestAdditions installer
132
135
  def installer_version(path_to_installer)
133
136
  version = nil
134
137
  @vm.channel.sudo("#{path_to_installer} --info", :error_check => false) do |type, data|
@@ -139,18 +142,39 @@ module VagrantVbguest
139
142
  version
140
143
  end
141
144
 
145
+ # Helper to yield a warning message to the user, that the installation
146
+ # will start _now_.
147
+ # The message includes the host and installer version strings.
142
148
  def yield_installation_waring(path_to_installer)
143
149
  @vm.ui.warn I18n.t("vagrant.plugins.vbguest.installing#{@options[:force] ? '_forced' : ''}",
144
150
  :guest_version => guest_version,
145
- :installer_version => installer_version(path_to_installer) || "unknown")
151
+ :installer_version => installer_version(path_to_installer) || I18n.t("vagrant.plugins.vbguest.unknown"))
146
152
  end
147
153
 
154
+ # Helper to yield a warning message to the user, that the installation
155
+ # will be rebuild using the installed GuestAdditions.
156
+ # The message includes the host and installer version strings.
148
157
  def yield_rebuild_warning
149
158
  @vm.ui.warn I18n.t("vagrant.plugins.vbguest.rebuild#{@options[:force] ? '_forced' : ''}",
150
159
  :guest_version => guest_version(true),
151
160
  :host_version => host_version)
152
161
  end
153
162
 
163
+ # GuestAdditions-iso-file-detection-magig.
164
+ #
165
+ # Detectio runs in those stages:
166
+ # 1. Uses the +iso_path+ config option, if present and not set to +:auto+
167
+ # 2. Look out for a local iso file
168
+ # 3. Use the default web URI
169
+ #
170
+ # If the detected or configured path is not a local file and remote downloads
171
+ # are allowed (the config option +:no_remote+ is NOT set) it will try to
172
+ # download that file into a temp file using Vagrants Downloaders.
173
+ # If remote downloads are prohibited (the config option +:no_remote+ IS set)
174
+ # a +VagrantVbguest::IsoPathAutodetectionError+ will be thrown
175
+ #
176
+ # @return [String] A absolute path to the GuestAdditions iso file.
177
+ # This might be a temp-file, e.g. when downloaded from web.
154
178
  def iso_file
155
179
  @iso_file ||= begin
156
180
  iso_path = options[:iso_path]
@@ -179,18 +203,35 @@ module VagrantVbguest
179
203
  end
180
204
  end
181
205
 
206
+ # Default web URI, where GuestAdditions iso file can be downloaded.
207
+ #
208
+ # @return [String] A URI template containing the versions placeholder.
182
209
  def web_iso_path
183
210
  "http://download.virtualbox.org/virtualbox/%{version}/VBoxGuestAdditions_%{version}.iso"
184
211
  end
185
212
 
213
+ # Finds GuestAdditions iso file on the host system.
214
+ # Returns +nil+ if none found.
215
+ #
216
+ # @return [String] Absolute path to the local GuestAdditions iso file, or +nil+ if not found.
186
217
  def local_iso_path
187
218
  media_manager_iso || guess_iso
188
219
  end
189
220
 
221
+ # Helper method which queries the VirtualBox media manager
222
+ # for a +VBoxGuestAdditions.iso+ file.
223
+ # Returns +nil+ if none found.
224
+ #
225
+ # @return [String] Absolute path to the local GuestAdditions iso file, or +nil+ if not found.
190
226
  def media_manager_iso
191
227
  (m = vm.driver.execute('list', 'dvds').match(/^.+:\s+(.*VBoxGuestAdditions.iso)$/i)) && m[1]
192
228
  end
193
229
 
230
+ # Makes an educated guess where the GuestAdditions iso file
231
+ # could be found on the host system depending on the OS.
232
+ # Returns +nil+ if no the file is not in it's place.
233
+ #
234
+ # @return [String] Absolute path to the local GuestAdditions iso file, or +nil+ if not found.
194
235
  def guess_iso
195
236
  path_platform = if Vagrant::Util::Platform.linux?
196
237
  "/usr/share/virtualbox/VBoxGuestAdditions.iso"
@@ -207,13 +248,20 @@ module VagrantVbguest
207
248
  end
208
249
 
209
250
  # A helper method to handle the GuestAdditions iso file upload
251
+ # into the guest box.
252
+ # The file will uploaded to the location given by the +tmp_path+ method.
253
+ #
254
+ # @example Default upload
255
+ # upload(iso_file)
256
+ #
257
+ # @param [String] Path of the file to upload to the +tmp_path*
210
258
  def upload(file)
211
259
  vm.ui.info(I18n.t("vagrant.plugins.vbguest.start_copy_iso", :from => file, :to => tmp_path))
212
260
  vm.channel.upload(file, tmp_path)
213
261
  end
214
262
 
215
263
  # A helper method to delete the uploaded GuestAdditions iso file
216
- # from the guest
264
+ # from the guest box
217
265
  def cleanup
218
266
  @download.cleanup if @download
219
267
  vm.channel.execute("test -f #{tmp_path} && rm #{tmp_path}", :error_check => false) do |type, data|
@@ -15,15 +15,7 @@ module VagrantVbguest
15
15
  vm.channel.sudo('apt-get update', opts, &block)
16
16
  vm.channel.sudo(install_dependencies_cmd, opts, &block)
17
17
  end
18
- upload(iso_file)
19
- vm.channel.sudo("mount #{tmp_path} -o loop #{mount_point}", opts, &block)
20
-
21
- installer = File.join(mount_point, 'VBoxLinuxAdditions.run')
22
- yield_installation_waring(installer)
23
-
24
- vm.channel.sudo("#{installer} --nox11", opts, &block)
25
-
26
- vm.channel.sudo("umount #{mount_point}", opts, &block)
18
+ super
27
19
  end
28
20
 
29
21
  protected
@@ -39,12 +39,12 @@ module VagrantVbguest
39
39
 
40
40
  # a generic way of installing GuestAdditions assuming all
41
41
  # dependencies on the guest are installed
42
- def install(iso_file = nil, opts=nil, &block)
43
- vm.ui.warn I18n.t("vagrant.plugins.vbguest.installer.generic_linux_installer")
42
+ def install(opts=nil, &block)
43
+ vm.ui.warn I18n.t("vagrant.plugins.vbguest.installer.generic_linux_installer") if self.class == Linux
44
44
  upload(iso_file)
45
- vm.channel.sudo("mount #{tmp_path} -o loop #{mount_point}", opts, &block)
46
- vm.channel.sudo("#{mount_point}/VBoxLinuxAdditions.run --nox11", opts, &block)
47
- vm.channel.sudo("umount #{mount_point}", opts, &block)
45
+ mount_iso
46
+ execute_installer
47
+ unmount_iso
48
48
  end
49
49
 
50
50
  def running?(opts=nil, &block)
@@ -69,7 +69,6 @@ module VagrantVbguest
69
69
  @guest_version
70
70
  end
71
71
 
72
-
73
72
  def rebuild(opts=nil, &block)
74
73
  vm.channel.sudo('/etc/init.d/vboxadd setup', opts, &block)
75
74
  end
@@ -79,6 +78,29 @@ module VagrantVbguest
79
78
  vm.channel.sudo('/etc/init.d/vboxadd start', opts, &block)
80
79
  end
81
80
 
81
+
82
+ # A generic helper method to execute the installer. The iso file
83
+ # has to be mounted on +mount_point+.
84
+ # This also yields a installation warning to the user.
85
+ def execute_installer(opts=nil, &block)
86
+ installer = File.join(mount_point, 'VBoxLinuxAdditions.run')
87
+ yield_installation_waring(installer)
88
+ vm.channel.sudo("#{installer} --nox11", opts, &block)
89
+ end
90
+
91
+ # A generic helper method for mounting the GuestAdditions iso file
92
+ # on most linux system.
93
+ # Mounts the given uploaded file from +tmp_path+ on +mount_point+.
94
+ def mount_iso(opts=nil, &block)
95
+ vm.channel.sudo("mount #{tmp_path} -o loop #{mount_point}", opts, &block)
96
+ end
97
+
98
+ # A generic helper method for un-mounting the GuestAdditions iso file
99
+ # on most linux system
100
+ # Unmounts the +mount_point+.
101
+ def unmount_iso(opts=nil, &block)
102
+ vm.channel.sudo("umount #{mount_point}", opts, &block)
103
+ end
82
104
  end
83
105
  end
84
106
  end
@@ -1,3 +1,3 @@
1
1
  module VagrantVbguest
2
- VERSION = "0.6.0.pre6"
2
+ VERSION = "0.6.0"
3
3
  end
data/locales/en.yml CHANGED
@@ -18,6 +18,7 @@ en:
18
18
  Virtualbox on your host claims: %{driver}
19
19
  VBoxService inside the vm claims: %{service}
20
20
  Going on, assuming VBoxService is correct...
21
+ unknown: unknown
21
22
 
22
23
  status:
23
24
  clean: "No installation found."
metadata CHANGED
@@ -1,98 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vbguest
3
- version: !ruby/object:Gem::Version
4
- hash: -4156320040
5
- prerelease: 6
6
- segments:
7
- - 0
8
- - 6
9
- - 0
10
- - pre
11
- - 6
12
- version: 0.6.0.pre6
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ prerelease:
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Robert Schulze
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2013-01-07 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2013-01-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: micromachine
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
18
+ requirements:
28
19
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 31
31
- segments:
32
- - 1
33
- - 0
34
- - 4
20
+ - !ruby/object:Gem::Version
35
21
  version: 1.0.4
36
22
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: i18n
40
23
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.4
30
+ - !ruby/object:Gem::Dependency
31
+ name: i18n
32
+ requirement: !ruby/object:Gem::Requirement
42
33
  none: false
43
- requirements:
34
+ requirements:
44
35
  - - ~>
45
- - !ruby/object:Gem::Version
46
- hash: 7
47
- segments:
48
- - 0
49
- - 6
50
- - 0
36
+ - !ruby/object:Gem::Version
51
37
  version: 0.6.0
52
38
  type: :runtime
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: log4r
56
39
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
58
41
  none: false
59
- requirements:
42
+ requirements:
60
43
  - - ~>
61
- - !ruby/object:Gem::Version
62
- hash: 1
63
- segments:
64
- - 1
65
- - 1
66
- - 9
44
+ - !ruby/object:Gem::Version
45
+ version: 0.6.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: log4r
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
67
53
  version: 1.1.9
68
54
  type: :runtime
69
- version_requirements: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: bundler
72
55
  prerelease: false
73
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
74
57
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 31
79
- segments:
80
- - 1
81
- - 2
82
- - 0
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.9
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
83
69
  version: 1.2.0
84
70
  type: :development
85
- version_requirements: *id004
86
- description: A Vagrant plugin which automatically installs the host's VirtualBox Guest Additions on the guest system.
87
- email:
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.2.0
78
+ description: A Vagrant plugin which automatically installs the host's VirtualBox Guest
79
+ Additions on the guest system.
80
+ email:
88
81
  - robert@dotless.de
89
82
  executables: []
90
-
91
83
  extensions: []
92
-
93
84
  extra_rdoc_files: []
94
-
95
- files:
85
+ files:
96
86
  - .gitignore
97
87
  - CHANGELOG.md
98
88
  - Gemfile
@@ -118,39 +108,28 @@ files:
118
108
  - locales/en.yml
119
109
  - vagrant-vbguest.gemspec
120
110
  homepage: https://github.com/dotless-de/vagrant-vbguest
121
- licenses:
111
+ licenses:
122
112
  - MIT
123
113
  post_install_message:
124
114
  rdoc_options: []
125
-
126
- require_paths:
115
+ require_paths:
127
116
  - lib
128
- required_ruby_version: !ruby/object:Gem::Requirement
117
+ required_ruby_version: !ruby/object:Gem::Requirement
129
118
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 3
134
- segments:
135
- - 0
136
- version: "0"
137
- required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
124
  none: false
139
- requirements:
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- hash: 23
143
- segments:
144
- - 1
145
- - 3
146
- - 6
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
147
128
  version: 1.3.6
148
129
  requirements: []
149
-
150
130
  rubyforge_project:
151
131
  rubygems_version: 1.8.24
152
132
  signing_key:
153
133
  specification_version: 3
154
134
  summary: A Vagrant plugin to install the VirtualBoxAdditions into the guest VM
155
135
  test_files: []
156
-