virtualbox 0.6.0 → 0.6.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/VERSION +1 -1
- data/lib/virtualbox.rb +1 -1
- data/lib/virtualbox/abstract_model/attributable.rb +15 -1
- data/lib/virtualbox/abstract_model/interface_attributes.rb +3 -3
- data/lib/virtualbox/com/implementer/base.rb +7 -0
- data/lib/virtualbox/com/implementer/mscom.rb +14 -2
- data/lib/virtualbox/com/interface/progress.rb +3 -3
- data/lib/virtualbox/exceptions.rb +0 -3
- data/lib/virtualbox/ext/byte_normalizer.rb +17 -0
- data/lib/virtualbox/hard_drive.rb +7 -0
- data/lib/virtualbox/hw_virtualization.rb +57 -0
- data/lib/virtualbox/vm.rb +1 -0
- data/test/virtualbox/abstract_model/attributable_test.rb +34 -0
- data/test/virtualbox/abstract_model/interface_attributes_test.rb +2 -2
- data/test/virtualbox/com/implementer/mscom_test.rb +58 -14
- data/test/virtualbox/ext/byte_normalizer_test.rb +34 -0
- data/test/virtualbox/hard_drive_test.rb +9 -0
- data/test/virtualbox/hw_virtualization_test.rb +103 -0
- data/virtualbox.gemspec +8 -2
- metadata +9 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
data/lib/virtualbox.rb
CHANGED
@@ -3,7 +3,7 @@ libdir = File.join(File.dirname(__FILE__), "virtualbox")
|
|
3
3
|
require File.expand_path("ext/glob_loader", libdir)
|
4
4
|
|
5
5
|
# Load them up
|
6
|
-
VirtualBox::GlobLoader.glob_require(libdir, %w{ext/logger ext/platform ext/subclass_listing com abstract_model medium})
|
6
|
+
VirtualBox::GlobLoader.glob_require(libdir, %w{ext/logger ext/platform ext/subclass_listing ext/byte_normalizer com abstract_model medium})
|
7
7
|
|
8
8
|
# Setup the top-level module methods
|
9
9
|
module VirtualBox
|
@@ -137,7 +137,8 @@ module VirtualBox
|
|
137
137
|
# a custom populate key to use for {Attributable#populate_attributes}
|
138
138
|
def attribute(name, options = {})
|
139
139
|
name = name.to_sym
|
140
|
-
attributes[name] =
|
140
|
+
attributes[name] = @__attribute_scope || {}
|
141
|
+
attributes[name].merge!(options)
|
141
142
|
|
142
143
|
# Create the method for reading this attribute
|
143
144
|
define_method(name) { read_attribute(name) }
|
@@ -153,6 +154,19 @@ module VirtualBox
|
|
153
154
|
end
|
154
155
|
end
|
155
156
|
|
157
|
+
# Defines the specified scope for all attributes within the block.
|
158
|
+
# The scope is reset to the previous value once the block ends. Multiple
|
159
|
+
# scopes can be nested and they'll inherit from each other.
|
160
|
+
def attribute_scope(options, &block)
|
161
|
+
@__attribute_scope ||= {}
|
162
|
+
old_value = @__attribute_scope
|
163
|
+
@__attribute_scope = old_value.merge(options)
|
164
|
+
|
165
|
+
instance_eval(&block)
|
166
|
+
|
167
|
+
@__attribute_scope = old_value
|
168
|
+
end
|
169
|
+
|
156
170
|
# Returns the hash of attributes and their associated options.
|
157
171
|
def attributes
|
158
172
|
@attributes ||= {}
|
@@ -28,7 +28,7 @@ module VirtualBox
|
|
28
28
|
|
29
29
|
# Convert the getter to a proc and call it
|
30
30
|
getter = spec_to_proc(getter)
|
31
|
-
write_attribute(key, getter.call(interface))
|
31
|
+
write_attribute(key, getter.call(self, interface, key))
|
32
32
|
end
|
33
33
|
|
34
34
|
# Saves all the attributes which have an interface setter.
|
@@ -55,7 +55,7 @@ module VirtualBox
|
|
55
55
|
|
56
56
|
# Convert the setter to a proc and call it
|
57
57
|
setter = spec_to_proc(setter)
|
58
|
-
setter.call(interface, read_attribute(key))
|
58
|
+
setter.call(self, interface, key, read_attribute(key))
|
59
59
|
end
|
60
60
|
|
61
61
|
# Converts a getter/setter specification to a Proc which can be called
|
@@ -88,7 +88,7 @@ module VirtualBox
|
|
88
88
|
if spec.is_a?(Symbol)
|
89
89
|
# For symbols, wrap up a method send in a Proc and return
|
90
90
|
# that
|
91
|
-
return Proc.new { |m, *args| m.send(spec, *args) }
|
91
|
+
return Proc.new { |this, m, key, *args| m.send(spec, *args) }
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
@@ -4,6 +4,13 @@ module VirtualBox
|
|
4
4
|
class Base < AbstractImplementer
|
5
5
|
include Logger
|
6
6
|
|
7
|
+
# Returns the Ruby version as a float
|
8
|
+
#
|
9
|
+
# @return [Float]
|
10
|
+
def ruby_version
|
11
|
+
RUBY_VERSION.to_f
|
12
|
+
end
|
13
|
+
|
7
14
|
# Finds and returns the `COM::Interface` class associated with the type.
|
8
15
|
# If the class does not exist, a `NameError` will be raised.
|
9
16
|
#
|
@@ -19,7 +19,12 @@ module VirtualBox
|
|
19
19
|
# Reads a property from the interface with the given name.
|
20
20
|
def read_property(name, opts)
|
21
21
|
# First get the basic value from the COM object
|
22
|
-
|
22
|
+
method = COM::FFI::Util.camelize(name.to_s)
|
23
|
+
value = if ruby_version >= 1.9
|
24
|
+
@object.send(method)
|
25
|
+
else
|
26
|
+
@object[method]
|
27
|
+
end
|
23
28
|
|
24
29
|
# Then depending on the value type, we either return as-is or
|
25
30
|
# must wrap it up in another interface class
|
@@ -30,7 +35,14 @@ module VirtualBox
|
|
30
35
|
# value.
|
31
36
|
def write_property(name, value, opts)
|
32
37
|
# Set the property with a prepared value
|
33
|
-
|
38
|
+
method = COM::FFI::Util.camelize(name.to_s)
|
39
|
+
value = spec_to_args([opts[:value_type]], [value]).first
|
40
|
+
|
41
|
+
if ruby_version >= 1.9
|
42
|
+
@object.send("#{method}=", value)
|
43
|
+
else
|
44
|
+
@object[method] = value
|
45
|
+
end
|
34
46
|
end
|
35
47
|
|
36
48
|
# Calls a function from the interface with the given name
|
@@ -41,15 +41,15 @@ module VirtualBox
|
|
41
41
|
last_reported = -100
|
42
42
|
|
43
43
|
while true
|
44
|
-
break if completed || canceled
|
45
|
-
|
46
44
|
delta = percent - last_reported
|
47
45
|
last_reported += delta
|
48
|
-
yield
|
46
|
+
yield self if delta >= interval_percent
|
49
47
|
|
50
48
|
# This either sleeps for half a second or returns on
|
51
49
|
# completion
|
52
50
|
wait_for_completion(500)
|
51
|
+
|
52
|
+
break if completed || canceled
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -4,9 +4,6 @@ module VirtualBox
|
|
4
4
|
module Exceptions
|
5
5
|
class Exception < ::Exception; end
|
6
6
|
|
7
|
-
class CommandFailedException < Exception; end
|
8
|
-
class ConfigurationException < Exception; end
|
9
|
-
class InvalidRelationshipObjectException < Exception; end
|
10
7
|
class NonSettableRelationshipException < Exception; end
|
11
8
|
class ValidationFailedException < Exception; end
|
12
9
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VirtualBox::ByteNormalizer
|
2
|
+
# So that this is only defined once (suppress warnings)
|
3
|
+
if !defined?(THOUSAND)
|
4
|
+
THOUSAND = 1024.0
|
5
|
+
BYTE = 1.0
|
6
|
+
KILOBYTE = BYTE * THOUSAND
|
7
|
+
MEGABYTE = KILOBYTE * THOUSAND
|
8
|
+
end
|
9
|
+
|
10
|
+
def bytes_to_megabytes(b)
|
11
|
+
b / MEGABYTE
|
12
|
+
end
|
13
|
+
|
14
|
+
def megabytes_to_bytes(mb)
|
15
|
+
mb * MEGABYTE
|
16
|
+
end
|
17
|
+
end
|
@@ -77,6 +77,8 @@ module VirtualBox
|
|
77
77
|
# There are more attributes on the {Medium} model, which {HardDrive} inherits
|
78
78
|
# from.
|
79
79
|
class HardDrive < Medium
|
80
|
+
include ByteNormalizer
|
81
|
+
|
80
82
|
attribute :format, :default => "VDI", :property => :format
|
81
83
|
attribute :logical_size, :property => :logical_size
|
82
84
|
attribute :physical_size, :readonly => true, :property => :size
|
@@ -105,6 +107,11 @@ module VirtualBox
|
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
110
|
+
# Custom getter to convert the physical size from bytes to megabytes.
|
111
|
+
def physical_size
|
112
|
+
bytes_to_megabytes(read_attribute(:physical_size))
|
113
|
+
end
|
114
|
+
|
108
115
|
# Clone hard drive, possibly also converting formats. All formats
|
109
116
|
# supported by your local VirtualBox installation are supported
|
110
117
|
# here. If no format is specified, the format of the source drive
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module VirtualBox
|
2
|
+
# Represents the HW virtualization properties on a VM.
|
3
|
+
class HWVirtualization < AbstractModel
|
4
|
+
attribute :parent, :readonly => true, :property => false
|
5
|
+
attribute_scope(:property_getter => Proc.new { |instance, *args| instance.get_property(*args) },
|
6
|
+
:property_setter => Proc.new { |instance, *args| instance.set_property(*args) }) do
|
7
|
+
attribute :enabled
|
8
|
+
attribute :exclusive
|
9
|
+
attribute :vpid
|
10
|
+
attribute :nested_paging
|
11
|
+
end
|
12
|
+
|
13
|
+
class <<self
|
14
|
+
# Populates a relationship with another model.
|
15
|
+
#
|
16
|
+
# **This method typically won't be used except internally.**
|
17
|
+
#
|
18
|
+
# @return [HWVirtualization]
|
19
|
+
def populate_relationship(caller, imachine)
|
20
|
+
data = new(caller, imachine)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Saves the relationship.
|
24
|
+
#
|
25
|
+
# **This method typically won't be used except internally.**
|
26
|
+
def save_relationship(caller, instance)
|
27
|
+
instance.save
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(parent, imachine)
|
32
|
+
write_attribute(:parent, parent)
|
33
|
+
|
34
|
+
# Load the attributes and mark the whole thing as existing
|
35
|
+
load_interface_attributes(imachine)
|
36
|
+
clear_dirty!
|
37
|
+
existing_record!
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_property(interface, key)
|
41
|
+
interface.get_hw_virt_ex_property(key)
|
42
|
+
end
|
43
|
+
|
44
|
+
def set_property(interface, key, value)
|
45
|
+
interface.set_hw_virt_ex_property(key, value)
|
46
|
+
end
|
47
|
+
|
48
|
+
def save
|
49
|
+
parent.with_open_session do |session|
|
50
|
+
machine = session.machine
|
51
|
+
|
52
|
+
# Save them
|
53
|
+
save_changed_interface_attributes(machine)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/virtualbox/vm.rb
CHANGED
@@ -121,6 +121,7 @@ module VirtualBox
|
|
121
121
|
attribute :interface, :readonly => true, :property => false
|
122
122
|
relationship :audio_adapter, :AudioAdapter
|
123
123
|
relationship :bios, :BIOS
|
124
|
+
relationship :hw_virt, :HWVirtualization
|
124
125
|
relationship :storage_controllers, :StorageController, :dependent => :destroy
|
125
126
|
relationship :medium_attachments, :MediumAttachment
|
126
127
|
relationship :shared_folders, :SharedFolder
|
@@ -27,6 +27,40 @@ class AttributableTest < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
context "attribute scopes" do
|
31
|
+
class AttributeScopeA < EmptyAttributeModel
|
32
|
+
attribute :foo
|
33
|
+
attribute_scope(:bar => 7) do
|
34
|
+
attribute :foo2
|
35
|
+
|
36
|
+
attribute_scope(:baz => 3) do
|
37
|
+
attribute :bazzed
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attribute :foo3, :bar => 10
|
42
|
+
end
|
43
|
+
|
44
|
+
setup do
|
45
|
+
@klass = AttributeScopeA
|
46
|
+
end
|
47
|
+
|
48
|
+
should "use attribute scope" do
|
49
|
+
assert_equal 7, @klass.attributes[:foo2][:bar]
|
50
|
+
end
|
51
|
+
|
52
|
+
should "not use attribute scope outside of the block" do
|
53
|
+
assert !@klass.attributes[:foo].has_key?(:bar)
|
54
|
+
assert_equal 10, @klass.attributes[:foo3][:bar]
|
55
|
+
end
|
56
|
+
|
57
|
+
should "properly nest" do
|
58
|
+
bazzed = @klass.attributes[:bazzed]
|
59
|
+
assert_equal 3, bazzed[:baz]
|
60
|
+
assert_equal 7, bazzed[:bar]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
30
64
|
context "attribute options" do
|
31
65
|
context "custom populate keys" do
|
32
66
|
class CustomPopulateModel < AttributeModel
|
@@ -25,14 +25,14 @@ class InterfaceAttributesTest < Test::Unit::TestCase
|
|
25
25
|
result = mock("result")
|
26
26
|
proc = @instance.spec_to_proc(:foo)
|
27
27
|
@interface.expects(:foo).once.returns(result)
|
28
|
-
assert_equal result, proc.call(@interface)
|
28
|
+
assert_equal result, proc.call(nil, @interface)
|
29
29
|
end
|
30
30
|
|
31
31
|
should "forward all parameters" do
|
32
32
|
result = mock("result")
|
33
33
|
proc = @instance.spec_to_proc(:foo)
|
34
34
|
@interface.expects(:foo).with(1, 2, 3).once.returns(result)
|
35
|
-
assert_equal result, proc.call(@interface, 1, 2, 3)
|
35
|
+
assert_equal result, proc.call(nil, @interface, :key, 1, 2, 3)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -59,26 +59,70 @@ class COMImplementerMSCOMTest < Test::Unit::TestCase
|
|
59
59
|
end
|
60
60
|
|
61
61
|
context "reading a property" do
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
context "with ruby 1.8" do
|
63
|
+
setup do
|
64
|
+
@instance.stubs(:ruby_version).returns(1.8)
|
65
|
+
end
|
66
|
+
|
67
|
+
should "read the property on the object and return it" do
|
68
|
+
name = :foo_bar
|
69
|
+
value = mock("value")
|
70
|
+
result = mock("result")
|
71
|
+
opts = { :value_type => :foo }
|
72
|
+
@object.expects(:[]).with('FooBar').once.returns(value)
|
73
|
+
@instance.expects(:returnable_value).with(value, opts[:value_type]).returns(result)
|
69
74
|
|
70
|
-
|
75
|
+
assert_equal result, @instance.read_property(name, opts)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "with ruby 1.9" do
|
80
|
+
setup do
|
81
|
+
@instance.stubs(:ruby_version).returns(1.9)
|
82
|
+
end
|
83
|
+
|
84
|
+
should "read the property on the object and return it" do
|
85
|
+
name = :foo_bar
|
86
|
+
value = mock("value")
|
87
|
+
result = mock("result")
|
88
|
+
opts = { :value_type => :foo }
|
89
|
+
@object.expects(:FooBar).once.returns(value)
|
90
|
+
@instance.expects(:returnable_value).with(value, opts[:value_type]).returns(result)
|
91
|
+
|
92
|
+
assert_equal result, @instance.read_property(name, opts)
|
93
|
+
end
|
71
94
|
end
|
72
95
|
end
|
73
96
|
|
74
97
|
context "writing a property" do
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
@object.expects(:[]=).with('FooBar', :modified).once
|
98
|
+
context "on ruby 1.8" do
|
99
|
+
setup do
|
100
|
+
@instance.stubs(:ruby_version).returns(1.8)
|
101
|
+
end
|
80
102
|
|
81
|
-
|
103
|
+
should "convert the args and set it on the object" do
|
104
|
+
name = :foo_bar
|
105
|
+
opts = { :value_type => :foo }
|
106
|
+
@instance.expects(:spec_to_args).with([:foo], [:value]).returns([:modified])
|
107
|
+
@object.expects(:[]=).with('FooBar', :modified).once
|
108
|
+
|
109
|
+
@instance.write_property(name, :value, opts)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "on ruby 1.9" do
|
114
|
+
setup do
|
115
|
+
@instance.stubs(:ruby_version).returns(1.9)
|
116
|
+
end
|
117
|
+
|
118
|
+
should "convert the args and set it on the object" do
|
119
|
+
name = :foo_bar
|
120
|
+
opts = { :value_type => :foo }
|
121
|
+
@instance.expects(:spec_to_args).with([:foo], [:value]).returns([:modified])
|
122
|
+
@object.expects(:FooBar=).with(:modified).once
|
123
|
+
|
124
|
+
@instance.write_property(name, :value, opts)
|
125
|
+
end
|
82
126
|
end
|
83
127
|
end
|
84
128
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
2
|
+
require 'virtualbox/ext/byte_normalizer'
|
3
|
+
|
4
|
+
class ByteNormalizerTest < Test::Unit::TestCase
|
5
|
+
class A
|
6
|
+
include VirtualBox::ByteNormalizer
|
7
|
+
end
|
8
|
+
|
9
|
+
setup do
|
10
|
+
@instance = A.new
|
11
|
+
end
|
12
|
+
|
13
|
+
should "convert megabytes to bytes" do
|
14
|
+
expected = {
|
15
|
+
1 => 1_048_576,
|
16
|
+
345.4 => 362_178_150.4
|
17
|
+
}
|
18
|
+
|
19
|
+
expected.each do |input, out|
|
20
|
+
assert_equal out, @instance.megabytes_to_bytes(input)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
should "convert bytes to megabytes" do
|
25
|
+
expected = {
|
26
|
+
1_048_576 => 1,
|
27
|
+
362_178_150.4 => 345.4
|
28
|
+
}
|
29
|
+
|
30
|
+
expected.each do |input, out|
|
31
|
+
assert_equal out, @instance.bytes_to_megabytes(input)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -54,6 +54,15 @@ class HardDriveTest < Test::Unit::TestCase
|
|
54
54
|
@instance = @klass.new(@interface)
|
55
55
|
end
|
56
56
|
|
57
|
+
context "physical size" do
|
58
|
+
should "convert bytes to megabytes" do
|
59
|
+
nonnormalized = 37548181
|
60
|
+
normalized = @instance.bytes_to_megabytes(nonnormalized)
|
61
|
+
@instance.expects(:read_attribute).with(:physical_size).returns(nonnormalized)
|
62
|
+
assert_equal normalized, @instance.physical_size
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
57
66
|
context "cloning" do
|
58
67
|
setup do
|
59
68
|
@system_properties = mock("system_properties")
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
|
+
|
3
|
+
class HWVirtualizationTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::HWVirtualization
|
6
|
+
@interface = mock("interface")
|
7
|
+
@parent = mock("parent")
|
8
|
+
end
|
9
|
+
|
10
|
+
context "class methods" do
|
11
|
+
context "populating relationship" do
|
12
|
+
setup do
|
13
|
+
@instance = mock("instance")
|
14
|
+
@klass.stubs(:new).returns(@instance)
|
15
|
+
end
|
16
|
+
|
17
|
+
should "call new for the interface" do
|
18
|
+
@klass.expects(:new).with(nil, @interface).once.returns(@instance)
|
19
|
+
assert_equal @instance, @klass.populate_relationship(nil, @interface)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "saving relationship" do
|
24
|
+
should "call save with the interface on the instance" do
|
25
|
+
instance = mock("instance")
|
26
|
+
instance.expects(:save).once
|
27
|
+
|
28
|
+
@klass.save_relationship(nil, instance)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "initializing" do
|
34
|
+
setup do
|
35
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
36
|
+
end
|
37
|
+
|
38
|
+
should "load interface attribtues" do
|
39
|
+
@klass.any_instance.expects(:load_interface_attributes).with(@interface).once
|
40
|
+
@klass.new(@parent, @interface)
|
41
|
+
end
|
42
|
+
|
43
|
+
should "not be dirty" do
|
44
|
+
@instance = @klass.new(@parent, @interface)
|
45
|
+
assert !@instance.changed?
|
46
|
+
end
|
47
|
+
|
48
|
+
should "be existing record" do
|
49
|
+
@instance = @klass.new(@parent, @interface)
|
50
|
+
assert !@instance.new_record?
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "instance methods" do
|
55
|
+
setup do
|
56
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
57
|
+
|
58
|
+
@parent = mock("parent")
|
59
|
+
@interface = mock("interface")
|
60
|
+
@instance = @klass.new(@parent, @interface)
|
61
|
+
end
|
62
|
+
|
63
|
+
context "getting a property" do
|
64
|
+
setup do
|
65
|
+
@key = :foo
|
66
|
+
end
|
67
|
+
|
68
|
+
should "call proper function on interface" do
|
69
|
+
result = mock("result")
|
70
|
+
@interface.expects(:get_hw_virt_ex_property).with(@key).returns(result)
|
71
|
+
assert_equal result, @instance.get_property(@interface, @key)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "setting a property" do
|
76
|
+
setup do
|
77
|
+
@key = :foo
|
78
|
+
@value = :bar
|
79
|
+
end
|
80
|
+
|
81
|
+
should "call proper function on interface" do
|
82
|
+
@interface.expects(:set_hw_virt_ex_property).with(@key, @value).once
|
83
|
+
@instance.set_property(@interface, @key, @value)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "saving" do
|
88
|
+
setup do
|
89
|
+
@bios_settings = mock("bios_settings")
|
90
|
+
@session = mock("session")
|
91
|
+
@machine = mock("machine")
|
92
|
+
@session.stubs(:machine).returns(@machine)
|
93
|
+
@parent.stubs(:with_open_session).yields(@session)
|
94
|
+
end
|
95
|
+
|
96
|
+
should "save the interface settings with the new bios settings" do
|
97
|
+
save_seq = sequence("save_seq")
|
98
|
+
@instance.expects(:save_changed_interface_attributes).with(@machine).once.in_sequence(save_seq)
|
99
|
+
@instance.save
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
data/virtualbox.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{virtualbox}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mitchell Hashimoto"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-24}
|
13
13
|
s.description = %q{Create and modify virtual machines in VirtualBox using pure ruby.}
|
14
14
|
s.email = %q{mitchell.hashimoto@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -113,6 +113,7 @@ Gem::Specification.new do |s|
|
|
113
113
|
"lib/virtualbox/com/util.rb",
|
114
114
|
"lib/virtualbox/dvd.rb",
|
115
115
|
"lib/virtualbox/exceptions.rb",
|
116
|
+
"lib/virtualbox/ext/byte_normalizer.rb",
|
116
117
|
"lib/virtualbox/ext/glob_loader.rb",
|
117
118
|
"lib/virtualbox/ext/logger.rb",
|
118
119
|
"lib/virtualbox/ext/platform.rb",
|
@@ -121,6 +122,7 @@ Gem::Specification.new do |s|
|
|
121
122
|
"lib/virtualbox/forwarded_port.rb",
|
122
123
|
"lib/virtualbox/global.rb",
|
123
124
|
"lib/virtualbox/hard_drive.rb",
|
125
|
+
"lib/virtualbox/hw_virtualization.rb",
|
124
126
|
"lib/virtualbox/lib.rb",
|
125
127
|
"lib/virtualbox/media.rb",
|
126
128
|
"lib/virtualbox/medium.rb",
|
@@ -156,12 +158,14 @@ Gem::Specification.new do |s|
|
|
156
158
|
"test/virtualbox/com/mscom_interface_test.rb",
|
157
159
|
"test/virtualbox/com/util_test.rb",
|
158
160
|
"test/virtualbox/dvd_test.rb",
|
161
|
+
"test/virtualbox/ext/byte_normalizer_test.rb",
|
159
162
|
"test/virtualbox/ext/platform_test.rb",
|
160
163
|
"test/virtualbox/ext/subclass_listing_test.rb",
|
161
164
|
"test/virtualbox/extra_data_test.rb",
|
162
165
|
"test/virtualbox/forwarded_port_test.rb",
|
163
166
|
"test/virtualbox/global_test.rb",
|
164
167
|
"test/virtualbox/hard_drive_test.rb",
|
168
|
+
"test/virtualbox/hw_virtualization_test.rb",
|
165
169
|
"test/virtualbox/lib_test.rb",
|
166
170
|
"test/virtualbox/medium_attachment_test.rb",
|
167
171
|
"test/virtualbox/medium_test.rb",
|
@@ -205,12 +209,14 @@ Gem::Specification.new do |s|
|
|
205
209
|
"test/virtualbox/com/mscom_interface_test.rb",
|
206
210
|
"test/virtualbox/com/util_test.rb",
|
207
211
|
"test/virtualbox/dvd_test.rb",
|
212
|
+
"test/virtualbox/ext/byte_normalizer_test.rb",
|
208
213
|
"test/virtualbox/ext/platform_test.rb",
|
209
214
|
"test/virtualbox/ext/subclass_listing_test.rb",
|
210
215
|
"test/virtualbox/extra_data_test.rb",
|
211
216
|
"test/virtualbox/forwarded_port_test.rb",
|
212
217
|
"test/virtualbox/global_test.rb",
|
213
218
|
"test/virtualbox/hard_drive_test.rb",
|
219
|
+
"test/virtualbox/hw_virtualization_test.rb",
|
214
220
|
"test/virtualbox/lib_test.rb",
|
215
221
|
"test/virtualbox/medium_attachment_test.rb",
|
216
222
|
"test/virtualbox/medium_test.rb",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 1
|
9
|
+
version: 0.6.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mitchell Hashimoto
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-24 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/virtualbox/com/util.rb
|
138
138
|
- lib/virtualbox/dvd.rb
|
139
139
|
- lib/virtualbox/exceptions.rb
|
140
|
+
- lib/virtualbox/ext/byte_normalizer.rb
|
140
141
|
- lib/virtualbox/ext/glob_loader.rb
|
141
142
|
- lib/virtualbox/ext/logger.rb
|
142
143
|
- lib/virtualbox/ext/platform.rb
|
@@ -145,6 +146,7 @@ files:
|
|
145
146
|
- lib/virtualbox/forwarded_port.rb
|
146
147
|
- lib/virtualbox/global.rb
|
147
148
|
- lib/virtualbox/hard_drive.rb
|
149
|
+
- lib/virtualbox/hw_virtualization.rb
|
148
150
|
- lib/virtualbox/lib.rb
|
149
151
|
- lib/virtualbox/media.rb
|
150
152
|
- lib/virtualbox/medium.rb
|
@@ -180,12 +182,14 @@ files:
|
|
180
182
|
- test/virtualbox/com/mscom_interface_test.rb
|
181
183
|
- test/virtualbox/com/util_test.rb
|
182
184
|
- test/virtualbox/dvd_test.rb
|
185
|
+
- test/virtualbox/ext/byte_normalizer_test.rb
|
183
186
|
- test/virtualbox/ext/platform_test.rb
|
184
187
|
- test/virtualbox/ext/subclass_listing_test.rb
|
185
188
|
- test/virtualbox/extra_data_test.rb
|
186
189
|
- test/virtualbox/forwarded_port_test.rb
|
187
190
|
- test/virtualbox/global_test.rb
|
188
191
|
- test/virtualbox/hard_drive_test.rb
|
192
|
+
- test/virtualbox/hw_virtualization_test.rb
|
189
193
|
- test/virtualbox/lib_test.rb
|
190
194
|
- test/virtualbox/medium_attachment_test.rb
|
191
195
|
- test/virtualbox/medium_test.rb
|
@@ -253,12 +257,14 @@ test_files:
|
|
253
257
|
- test/virtualbox/com/mscom_interface_test.rb
|
254
258
|
- test/virtualbox/com/util_test.rb
|
255
259
|
- test/virtualbox/dvd_test.rb
|
260
|
+
- test/virtualbox/ext/byte_normalizer_test.rb
|
256
261
|
- test/virtualbox/ext/platform_test.rb
|
257
262
|
- test/virtualbox/ext/subclass_listing_test.rb
|
258
263
|
- test/virtualbox/extra_data_test.rb
|
259
264
|
- test/virtualbox/forwarded_port_test.rb
|
260
265
|
- test/virtualbox/global_test.rb
|
261
266
|
- test/virtualbox/hard_drive_test.rb
|
267
|
+
- test/virtualbox/hw_virtualization_test.rb
|
262
268
|
- test/virtualbox/lib_test.rb
|
263
269
|
- test/virtualbox/medium_attachment_test.rb
|
264
270
|
- test/virtualbox/medium_test.rb
|