vagrant-vbguest 0.6.0.pre5 → 0.6.0.pre6
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/CHANGELOG.md +1 -0
- data/lib/vagrant-vbguest.rb +2 -0
- data/lib/vagrant-vbguest/core_ext/string/interpolate.rb +110 -0
- data/lib/vagrant-vbguest/installers/base.rb +7 -7
- data/lib/vagrant-vbguest/version.rb +1 -1
- data/locales/en.yml +1 -1
- metadata +20 -7
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,7 @@
|
|
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
11
|
- Revisited command arguments to not just mirror config values:
|
11
12
|
- New `--do` argument: force-run one of those commands:
|
12
13
|
* `start` : Try to start the GuestAdditions Service
|
data/lib/vagrant-vbguest.rb
CHANGED
@@ -0,0 +1,110 @@
|
|
1
|
+
# This backports the Ruby 1.9 String interpolation syntax to Ruby 1.8.
|
2
|
+
#
|
3
|
+
# This file is a copy from I18n
|
4
|
+
# https://github.com/mattetti/i18n/blob/master/lib/i18n/core_ext/string/interpolate.rb
|
5
|
+
# Copyright (c) 2008 The Ruby I18n team
|
6
|
+
# It's copied here for the resons given below:
|
7
|
+
#
|
8
|
+
# This backport has been shipped with I18n for a number of versions. Meanwhile
|
9
|
+
# Rails has started to rely on it and we are going to move it to ActiveSupport.
|
10
|
+
# See https://rails.lighthouseapp.com/projects/8994/tickets/6013-move-19-string-interpolation-syntax-backport-from-i18n-to-activesupport
|
11
|
+
#
|
12
|
+
# Once the above patch has been applied to Rails the following code will be
|
13
|
+
# removed from I18n.
|
14
|
+
|
15
|
+
=begin
|
16
|
+
heavily based on Masao Mutoh's gettext String interpolation extension
|
17
|
+
http://github.com/mutoh/gettext/blob/f6566738b981fe0952548c421042ad1e0cdfb31e/lib/gettext/core_ext/string.rb
|
18
|
+
Copyright (C) 2005-2009 Masao Mutoh
|
19
|
+
You may redistribute it and/or modify it under the same license terms as Ruby.
|
20
|
+
=end
|
21
|
+
|
22
|
+
begin
|
23
|
+
raise ArgumentError if ("a %{x}" % {:x=>'b'}) != 'a b'
|
24
|
+
rescue ArgumentError
|
25
|
+
# KeyError is raised by String#% when the string contains a named placeholder
|
26
|
+
# that is not contained in the given arguments hash. Ruby 1.9 includes and
|
27
|
+
# raises this exception natively. We define it to mimic Ruby 1.9's behaviour
|
28
|
+
# in Ruby 1.8.x
|
29
|
+
class KeyError < IndexError
|
30
|
+
def initialize(message = nil)
|
31
|
+
super(message || "key not found")
|
32
|
+
end
|
33
|
+
end unless defined?(KeyError)
|
34
|
+
|
35
|
+
# Extension for String class. This feature is included in Ruby 1.9 or later but not occur TypeError.
|
36
|
+
#
|
37
|
+
# String#% method which accept "named argument". The translator can know
|
38
|
+
# the meaning of the msgids using "named argument" instead of %s/%d style.
|
39
|
+
class String
|
40
|
+
# For older ruby versions, such as ruby-1.8.5
|
41
|
+
alias :bytesize :size unless instance_methods.find {|m| m.to_s == 'bytesize'}
|
42
|
+
alias :interpolate_without_ruby_19_syntax :% # :nodoc:
|
43
|
+
|
44
|
+
INTERPOLATION_PATTERN = Regexp.union(
|
45
|
+
/%\{(\w+)\}/, # matches placeholders like "%{foo}"
|
46
|
+
/%<(\w+)>(.*?\d*\.?\d*[bBdiouxXeEfgGcps])/ # matches placeholders like "%<foo>.d"
|
47
|
+
)
|
48
|
+
|
49
|
+
INTERPOLATION_PATTERN_WITH_ESCAPE = Regexp.union(
|
50
|
+
/%%/,
|
51
|
+
INTERPOLATION_PATTERN
|
52
|
+
)
|
53
|
+
|
54
|
+
# % uses self (i.e. the String) as a format specification and returns the
|
55
|
+
# result of applying it to the given arguments. In other words it interpolates
|
56
|
+
# the given arguments to the string according to the formats the string
|
57
|
+
# defines.
|
58
|
+
#
|
59
|
+
# There are three ways to use it:
|
60
|
+
#
|
61
|
+
# * Using a single argument or Array of arguments.
|
62
|
+
#
|
63
|
+
# This is the default behaviour of the String class. See Kernel#sprintf for
|
64
|
+
# more details about the format string.
|
65
|
+
#
|
66
|
+
# Example:
|
67
|
+
#
|
68
|
+
# "%d %s" % [1, "message"]
|
69
|
+
# # => "1 message"
|
70
|
+
#
|
71
|
+
# * Using a Hash as an argument and unformatted, named placeholders.
|
72
|
+
#
|
73
|
+
# When you pass a Hash as an argument and specify placeholders with %{foo}
|
74
|
+
# it will interpret the hash values as named arguments.
|
75
|
+
#
|
76
|
+
# Example:
|
77
|
+
#
|
78
|
+
# "%{firstname}, %{lastname}" % {:firstname => "Masao", :lastname => "Mutoh"}
|
79
|
+
# # => "Masao Mutoh"
|
80
|
+
#
|
81
|
+
# * Using a Hash as an argument and formatted, named placeholders.
|
82
|
+
#
|
83
|
+
# When you pass a Hash as an argument and specify placeholders with %<foo>d
|
84
|
+
# it will interpret the hash values as named arguments and format the value
|
85
|
+
# according to the formatting instruction appended to the closing >.
|
86
|
+
#
|
87
|
+
# Example:
|
88
|
+
#
|
89
|
+
# "%<integer>d, %<float>.1f" % { :integer => 10, :float => 43.4 }
|
90
|
+
# # => "10, 43.3"
|
91
|
+
def %(args)
|
92
|
+
if args.kind_of?(Hash)
|
93
|
+
dup.gsub(INTERPOLATION_PATTERN_WITH_ESCAPE) do |match|
|
94
|
+
if match == '%%'
|
95
|
+
'%'
|
96
|
+
else
|
97
|
+
key = ($1 || $2).to_sym
|
98
|
+
raise KeyError unless args.has_key?(key)
|
99
|
+
$3 ? sprintf("%#{$3}", args[key]) : args[key]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
elsif self =~ INTERPOLATION_PATTERN
|
103
|
+
raise ArgumentError.new('one hash required')
|
104
|
+
else
|
105
|
+
result = gsub(/%([{<])/, '%%\1')
|
106
|
+
result.send :'interpolate_without_ruby_19_syntax', args
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -153,10 +153,10 @@ module VagrantVbguest
|
|
153
153
|
|
154
154
|
def iso_file
|
155
155
|
@iso_file ||= begin
|
156
|
-
iso_path = options[:iso_path]
|
157
|
-
|
158
|
-
|
159
|
-
iso_path =
|
156
|
+
iso_path = options[:iso_path]
|
157
|
+
if !iso_path || iso_path.empty? || iso_path == :auto
|
158
|
+
iso_path = local_iso_path
|
159
|
+
iso_path = web_iso_path if !iso_path || iso_path.empty? && !options[:no_remote]
|
160
160
|
end
|
161
161
|
raise VagrantVbguest::IsoPathAutodetectionError if !iso_path || iso_path.empty?
|
162
162
|
|
@@ -166,13 +166,13 @@ module VagrantVbguest
|
|
166
166
|
iso_path
|
167
167
|
else
|
168
168
|
# :TODO: This will also raise, if the iso_url points to an invalid local path
|
169
|
-
raise VagrantVbguest::DownloadingDisabledError.new(:from =>
|
169
|
+
raise VagrantVbguest::DownloadingDisabledError.new(:from => iso_path) if options[:no_remote]
|
170
170
|
env = {
|
171
171
|
:ui => vm.ui,
|
172
172
|
:tmp_path => vm.env.tmp_path,
|
173
|
-
:iso_url =>
|
173
|
+
:iso_url => iso_path
|
174
174
|
}
|
175
|
-
@download = VagrantVbguest::Download.new(
|
175
|
+
@download = VagrantVbguest::Download.new(env)
|
176
176
|
@download.download
|
177
177
|
@download.temp_path
|
178
178
|
end
|
data/locales/en.yml
CHANGED
@@ -35,7 +35,7 @@ en:
|
|
35
35
|
|
36
36
|
downloading_disabled: |-
|
37
37
|
Could not locate a local Virtualbox Guest Additions iso file.
|
38
|
-
However, the no_remote option was set and thus I will downlownload it from
|
38
|
+
However, the no_remote option was set and thus I will not downlownload it from
|
39
39
|
%{from}
|
40
40
|
Please configure a local path to the iso using `config.vbguest.iso_path`
|
41
41
|
in your Vagrantfile or the `--iso` command line option.
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vbguest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: -4156320040
|
5
|
+
prerelease: 6
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 6
|
8
9
|
- 0
|
9
|
-
-
|
10
|
-
|
10
|
+
- pre
|
11
|
+
- 6
|
12
|
+
version: 0.6.0.pre6
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Robert Schulze
|
@@ -15,16 +17,17 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2013-01-
|
19
|
-
default_executable:
|
20
|
+
date: 2013-01-07 00:00:00 Z
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: micromachine
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ~>
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 31
|
28
31
|
segments:
|
29
32
|
- 1
|
30
33
|
- 0
|
@@ -36,9 +39,11 @@ dependencies:
|
|
36
39
|
name: i18n
|
37
40
|
prerelease: false
|
38
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
39
43
|
requirements:
|
40
44
|
- - ~>
|
41
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 7
|
42
47
|
segments:
|
43
48
|
- 0
|
44
49
|
- 6
|
@@ -50,9 +55,11 @@ dependencies:
|
|
50
55
|
name: log4r
|
51
56
|
prerelease: false
|
52
57
|
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
53
59
|
requirements:
|
54
60
|
- - ~>
|
55
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 1
|
56
63
|
segments:
|
57
64
|
- 1
|
58
65
|
- 1
|
@@ -64,9 +71,11 @@ dependencies:
|
|
64
71
|
name: bundler
|
65
72
|
prerelease: false
|
66
73
|
requirement: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
67
75
|
requirements:
|
68
76
|
- - ">="
|
69
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 31
|
70
79
|
segments:
|
71
80
|
- 1
|
72
81
|
- 2
|
@@ -93,6 +102,7 @@ files:
|
|
93
102
|
- lib/vagrant-vbguest.rb
|
94
103
|
- lib/vagrant-vbguest/command.rb
|
95
104
|
- lib/vagrant-vbguest/config.rb
|
105
|
+
- lib/vagrant-vbguest/core_ext/string/interpolate.rb
|
96
106
|
- lib/vagrant-vbguest/download.rb
|
97
107
|
- lib/vagrant-vbguest/errors.rb
|
98
108
|
- lib/vagrant-vbguest/helpers.rb
|
@@ -107,7 +117,6 @@ files:
|
|
107
117
|
- lib/vagrant_init.rb
|
108
118
|
- locales/en.yml
|
109
119
|
- vagrant-vbguest.gemspec
|
110
|
-
has_rdoc: true
|
111
120
|
homepage: https://github.com/dotless-de/vagrant-vbguest
|
112
121
|
licenses:
|
113
122
|
- MIT
|
@@ -117,16 +126,20 @@ rdoc_options: []
|
|
117
126
|
require_paths:
|
118
127
|
- lib
|
119
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
120
130
|
requirements:
|
121
131
|
- - ">="
|
122
132
|
- !ruby/object:Gem::Version
|
133
|
+
hash: 3
|
123
134
|
segments:
|
124
135
|
- 0
|
125
136
|
version: "0"
|
126
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
127
139
|
requirements:
|
128
140
|
- - ">="
|
129
141
|
- !ruby/object:Gem::Version
|
142
|
+
hash: 23
|
130
143
|
segments:
|
131
144
|
- 1
|
132
145
|
- 3
|
@@ -135,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
148
|
requirements: []
|
136
149
|
|
137
150
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.
|
151
|
+
rubygems_version: 1.8.24
|
139
152
|
signing_key:
|
140
153
|
specification_version: 3
|
141
154
|
summary: A Vagrant plugin to install the VirtualBoxAdditions into the guest VM
|