bbrowning-virtualbox 0.7.6.dev
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/.gitignore +8 -0
- data/.yardopts +3 -0
- data/Gemfile +16 -0
- data/LICENSE +19 -0
- data/Rakefile +33 -0
- data/Readme.md +70 -0
- data/docs/GettingStarted.md +196 -0
- data/docs/WhatsNew.md +12 -0
- data/features/README.md +33 -0
- data/features/global.feature +19 -0
- data/features/global_extra_data.feature +27 -0
- data/features/step_definitions/abstract_model_steps.rb +39 -0
- data/features/step_definitions/extra_data_steps.rb +36 -0
- data/features/step_definitions/global_steps.rb +29 -0
- data/features/step_definitions/nat_engine_steps.rb +76 -0
- data/features/step_definitions/network_adapter_steps.rb +38 -0
- data/features/step_definitions/shared_folder_steps.rb +76 -0
- data/features/step_definitions/snapshot_steps.rb +74 -0
- data/features/step_definitions/storage_controller_steps.rb +16 -0
- data/features/step_definitions/virtualbox_steps.rb +17 -0
- data/features/step_definitions/vm_steps.rb +50 -0
- data/features/support/env.rb +61 -0
- data/features/support/helpers.rb +38 -0
- data/features/support/hooks.rb +30 -0
- data/features/support/ordered_hash.rb +49 -0
- data/features/support/vboxmanage.rb +191 -0
- data/features/version.feature +16 -0
- data/features/vm.feature +13 -0
- data/features/vm_bios.feature +29 -0
- data/features/vm_cpu.feature +29 -0
- data/features/vm_extra_data.feature +35 -0
- data/features/vm_hw_virt.feature +29 -0
- data/features/vm_nat_engine.feature +57 -0
- data/features/vm_network_adapters.feature +27 -0
- data/features/vm_shared_folders.feature +42 -0
- data/features/vm_snapshots.feature +29 -0
- data/features/vm_storage_controllers.feature +11 -0
- data/lib/virtualbox.rb +11 -0
- data/lib/virtualbox/abstract_model.rb +281 -0
- data/lib/virtualbox/abstract_model/attributable.rb +290 -0
- data/lib/virtualbox/abstract_model/dirty.rb +177 -0
- data/lib/virtualbox/abstract_model/interface_attributes.rb +98 -0
- data/lib/virtualbox/abstract_model/relatable.rb +332 -0
- data/lib/virtualbox/abstract_model/validatable.rb +167 -0
- data/lib/virtualbox/abstract_model/version_matcher.rb +35 -0
- data/lib/virtualbox/appliance.rb +62 -0
- data/lib/virtualbox/audio_adapter.rb +52 -0
- data/lib/virtualbox/bios.rb +50 -0
- data/lib/virtualbox/com.rb +23 -0
- data/lib/virtualbox/com/abstract_enum.rb +43 -0
- data/lib/virtualbox/com/abstract_implementer.rb +45 -0
- data/lib/virtualbox/com/abstract_interface.rb +167 -0
- data/lib/virtualbox/com/base_interface.rb +38 -0
- data/lib/virtualbox/com/ffi/interface.rb +150 -0
- data/lib/virtualbox/com/ffi/interfaces.rb +54 -0
- data/lib/virtualbox/com/ffi/util.rb +119 -0
- data/lib/virtualbox/com/ffi/vboxxpcomc.rb +31 -0
- data/lib/virtualbox/com/ffi_interface.rb +96 -0
- data/lib/virtualbox/com/implementer/base.rb +59 -0
- data/lib/virtualbox/com/implementer/ffi.rb +361 -0
- data/lib/virtualbox/com/implementer/mscom.rb +175 -0
- data/lib/virtualbox/com/implementer/nil.rb +10 -0
- data/lib/virtualbox/com/interface/3.1.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.1.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/guest_os_type.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/host.rb +42 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/machine.rb +105 -0
- data/lib/virtualbox/com/interface/3.1.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/medium.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.1.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/system_properties.rb +37 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_controller.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_server.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.2.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/guest.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/guest_os_type.rb +33 -0
- data/lib/virtualbox/com/interface/3.2.x/host.rb +43 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/keyboard_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/machine.rb +118 -0
- data/lib/virtualbox/com/interface/3.2.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/medium.rb +51 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_alias_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_engine.rb +27 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_protocol.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter.rb +34 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/pointing_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.2.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/system_properties.rb +42 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_controller.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_server.rb +21 -0
- data/lib/virtualbox/com/mscom_interface.rb +44 -0
- data/lib/virtualbox/com/nil_interface.rb +7 -0
- data/lib/virtualbox/com/util.rb +32 -0
- data/lib/virtualbox/cpu.rb +61 -0
- data/lib/virtualbox/dhcp_server.rb +89 -0
- data/lib/virtualbox/dvd.rb +27 -0
- data/lib/virtualbox/exceptions.rb +39 -0
- data/lib/virtualbox/ext/byte_normalizer.rb +17 -0
- data/lib/virtualbox/ext/glob_loader.rb +22 -0
- data/lib/virtualbox/ext/logger.rb +38 -0
- data/lib/virtualbox/ext/platform.rb +27 -0
- data/lib/virtualbox/ext/subclass_listing.rb +24 -0
- data/lib/virtualbox/extra_data.rb +127 -0
- data/lib/virtualbox/forwarded_port.rb +222 -0
- data/lib/virtualbox/global.rb +102 -0
- data/lib/virtualbox/guest_property.rb +116 -0
- data/lib/virtualbox/hard_drive.rb +246 -0
- data/lib/virtualbox/host.rb +71 -0
- data/lib/virtualbox/host_network_interface.rb +137 -0
- data/lib/virtualbox/hw_virtualization.rb +63 -0
- data/lib/virtualbox/lib.rb +84 -0
- data/lib/virtualbox/media.rb +20 -0
- data/lib/virtualbox/medium.rb +145 -0
- data/lib/virtualbox/medium_attachment.rb +61 -0
- data/lib/virtualbox/nat_engine.rb +71 -0
- data/lib/virtualbox/nat_forwarded_port.rb +171 -0
- data/lib/virtualbox/network_adapter.rb +166 -0
- data/lib/virtualbox/proxies/collection.rb +57 -0
- data/lib/virtualbox/shared_folder.rb +220 -0
- data/lib/virtualbox/snapshot.rb +185 -0
- data/lib/virtualbox/storage_controller.rb +160 -0
- data/lib/virtualbox/system_properties.rb +74 -0
- data/lib/virtualbox/usb_controller.rb +59 -0
- data/lib/virtualbox/usb_device_filter.rb +74 -0
- data/lib/virtualbox/version.rb +36 -0
- data/lib/virtualbox/virtual_system_description.rb +47 -0
- data/lib/virtualbox/vm.rb +684 -0
- data/lib/virtualbox/vrdp_server.rb +59 -0
- data/test/test_helper.rb +18 -0
- data/test/virtualbox/abstract_model/attributable_test.rb +269 -0
- data/test/virtualbox/abstract_model/dirty_test.rb +83 -0
- data/test/virtualbox/abstract_model/interface_attributes_test.rb +194 -0
- data/test/virtualbox/abstract_model/relatable_test.rb +348 -0
- data/test/virtualbox/abstract_model/validatable_test.rb +308 -0
- data/test/virtualbox/abstract_model/version_matcher_test.rb +41 -0
- data/test/virtualbox/abstract_model_test.rb +462 -0
- data/test/virtualbox/appliance_test.rb +159 -0
- data/test/virtualbox/audio_adapter_test.rb +83 -0
- data/test/virtualbox/bios_test.rb +83 -0
- data/test/virtualbox/com/abstract_enum_test.rb +49 -0
- data/test/virtualbox/com/abstract_implementer_test.rb +40 -0
- data/test/virtualbox/com/abstract_interface_test.rb +140 -0
- data/test/virtualbox/com/ffi/interface_test.rb +249 -0
- data/test/virtualbox/com/ffi/util_test.rb +108 -0
- data/test/virtualbox/com/ffi_interface_test.rb +42 -0
- data/test/virtualbox/com/implementer/base_test.rb +38 -0
- data/test/virtualbox/com/implementer/ffi_test.rb +527 -0
- data/test/virtualbox/com/implementer/mscom_test.rb +247 -0
- data/test/virtualbox/com/mscom_interface_test.rb +17 -0
- data/test/virtualbox/com/util_test.rb +17 -0
- data/test/virtualbox/cpu_test.rb +103 -0
- data/test/virtualbox/dhcp_server_test.rb +165 -0
- data/test/virtualbox/dvd_test.rb +28 -0
- data/test/virtualbox/ext/byte_normalizer_test.rb +34 -0
- data/test/virtualbox/ext/platform_test.rb +50 -0
- data/test/virtualbox/ext/subclass_listing_test.rb +25 -0
- data/test/virtualbox/extra_data_test.rb +155 -0
- data/test/virtualbox/forwarded_port_test.rb +286 -0
- data/test/virtualbox/global_test.rb +46 -0
- data/test/virtualbox/hard_drive_test.rb +141 -0
- data/test/virtualbox/host_network_interface_test.rb +254 -0
- data/test/virtualbox/host_test.rb +94 -0
- data/test/virtualbox/hw_virtualization_test.rb +103 -0
- data/test/virtualbox/lib_test.rb +93 -0
- data/test/virtualbox/medium_attachment_test.rb +147 -0
- data/test/virtualbox/medium_test.rb +192 -0
- data/test/virtualbox/nat_engine_test.rb +106 -0
- data/test/virtualbox/nat_forwarded_port_test.rb +222 -0
- data/test/virtualbox/network_adapter_test.rb +191 -0
- data/test/virtualbox/proxies/collection_test.rb +102 -0
- data/test/virtualbox/shared_folder_test.rb +219 -0
- data/test/virtualbox/snapshot_test.rb +231 -0
- data/test/virtualbox/storage_controller_test.rb +197 -0
- data/test/virtualbox/system_properties_test.rb +87 -0
- data/test/virtualbox/usb_controller_test.rb +112 -0
- data/test/virtualbox/usb_device_filter_test.rb +93 -0
- data/test/virtualbox/version_test.rb +59 -0
- data/test/virtualbox/virtual_system_description_test.rb +61 -0
- data/test/virtualbox/vm_test.rb +637 -0
- data/test/virtualbox/vrdp_server_test.rb +83 -0
- data/test/virtualbox_test.rb +11 -0
- data/virtualbox.gemspec +25 -0
- metadata +397 -0
data/.gitignore
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2010 Mitchell Hashimoto.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require "rubygems"
|
|
2
|
+
require "bundler/setup"
|
|
3
|
+
require "rake/testtask"
|
|
4
|
+
require "rcov/rcovtask"
|
|
5
|
+
require "cucumber"
|
|
6
|
+
require "cucumber/rake/task"
|
|
7
|
+
require "yard"
|
|
8
|
+
Bundler::GemHelper.install_tasks
|
|
9
|
+
|
|
10
|
+
task :default => "test:units"
|
|
11
|
+
|
|
12
|
+
namespace :test do
|
|
13
|
+
Rake::TestTask.new(:units) do |t|
|
|
14
|
+
t.libs << "test"
|
|
15
|
+
t.pattern = 'test/**/*_test.rb'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Cucumber::Rake::Task.new(:integration) do |t|
|
|
19
|
+
t.cucumber_opts = "features --format pretty"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
Rcov::RcovTask.new do |t|
|
|
23
|
+
t.libs << "test"
|
|
24
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
|
25
|
+
t.output_dir = "test/coverage"
|
|
26
|
+
t.verbose = true
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
YARD::Rake::YardocTask.new do |t|
|
|
31
|
+
t.options = ['--main', 'Readme.md', '--markup', 'markdown']
|
|
32
|
+
t.options += ['--title', 'VirtualBox Ruby Library Documentation']
|
|
33
|
+
end
|
data/Readme.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# VirtualBox Ruby Gem
|
|
2
|
+
|
|
3
|
+
The VirtualBox ruby gem is a library which allows anyone to control VirtualBox
|
|
4
|
+
from ruby code! Create, destroy, start, stop, suspend, and resume virtual machines.
|
|
5
|
+
Also list virtual machines, list hard drives, network devices, etc.
|
|
6
|
+
|
|
7
|
+
## Installation and Requirements
|
|
8
|
+
|
|
9
|
+
First you need to install [VirtualBox](http://www.virtualbox.org/) which is available for
|
|
10
|
+
Windows, Linux, and OS X. After installation, install the gem:
|
|
11
|
+
|
|
12
|
+
sudo gem install virtualbox
|
|
13
|
+
|
|
14
|
+
The gem uses the native COM interface with VirtualBox provides to communicate with
|
|
15
|
+
VirtualBox. On Windows, this is globally available. On Linux-based machines, the gem
|
|
16
|
+
uses Ruby-FFI to talk to a dynamic library. No configuration should be necessary.
|
|
17
|
+
|
|
18
|
+
## Basic Usage
|
|
19
|
+
|
|
20
|
+
The virtualbox gem is modeled after ActiveRecord. If you've used ActiveRecord, you'll
|
|
21
|
+
feel very comfortable using the virtualbox gem.
|
|
22
|
+
|
|
23
|
+
There is a [quick getting started guide](http://mitchellh.github.com/virtualbox/file.GettingStarted.html) to
|
|
24
|
+
get you acquainted with the conventions of the virtualbox gem.
|
|
25
|
+
|
|
26
|
+
Complete documentation can be found at [http://mitchellh.github.com/virtualbox](http://mitchellh.github.com/virtualbox).
|
|
27
|
+
|
|
28
|
+
Below are some examples:
|
|
29
|
+
|
|
30
|
+
require 'virtualbox'
|
|
31
|
+
|
|
32
|
+
vm = VirtualBox::VM.find("my-vm")
|
|
33
|
+
|
|
34
|
+
# Let's first print out some basic info about the VM
|
|
35
|
+
puts "Memory: #{vm.memory_size}"
|
|
36
|
+
|
|
37
|
+
# Let's modify the memory and name...
|
|
38
|
+
vm.memory_size = 360
|
|
39
|
+
vm.name = "my-renamed-vm"
|
|
40
|
+
|
|
41
|
+
# Save it!
|
|
42
|
+
vm.save
|
|
43
|
+
|
|
44
|
+
## Known Issues or Uncompleted Features
|
|
45
|
+
|
|
46
|
+
VirtualBox has a _ton_ of features! As such, this gem is still not totally complete.
|
|
47
|
+
You can see the features that are still left to do in the TODO file.
|
|
48
|
+
|
|
49
|
+
## Reporting Bugs or Feature Requests
|
|
50
|
+
|
|
51
|
+
Please use the [issue tracker](https://github.com/mitchellh/virtualbox/issues).
|
|
52
|
+
|
|
53
|
+
## Contributing
|
|
54
|
+
|
|
55
|
+
If you'd like to contribute to VirtualBox, the first step to developing is to
|
|
56
|
+
clone this repo, get [bundler](http://github.com/carlhuda/bundler) if you
|
|
57
|
+
don't have it already, and do the following:
|
|
58
|
+
|
|
59
|
+
bundle install --relock
|
|
60
|
+
rake
|
|
61
|
+
|
|
62
|
+
This will run the test suite, which should come back all green! Then you're good to go!
|
|
63
|
+
|
|
64
|
+
## Special Thanks
|
|
65
|
+
|
|
66
|
+
These folks went above and beyond with contributions to the virtualbox gem, and
|
|
67
|
+
for that, I have to say "thanks!"
|
|
68
|
+
|
|
69
|
+
* [Kieran Pilkington](http://github.com/KieranP)
|
|
70
|
+
* [Aleksey Palazhchenko](http://github.com/AlekSi)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Getting Started with the VirtualBox Gem
|
|
2
|
+
|
|
3
|
+
* [Basic Conventions](#basic-conventions)
|
|
4
|
+
* [Finding Models](#bc-finding-models)
|
|
5
|
+
* [Accessing Models](#bc-accessing-models)
|
|
6
|
+
* [Modifying Models](#bc-modifying-models)
|
|
7
|
+
* [Saving Models](#bc-saving-models)
|
|
8
|
+
|
|
9
|
+
<a name="basic-conventions"></a>
|
|
10
|
+
# Basic Conventions
|
|
11
|
+
|
|
12
|
+
The entire virtualbox library follows a few conventions to make sure
|
|
13
|
+
things work uniformly across the entire codebase, and so that nothing
|
|
14
|
+
should surprise any developers once they understand these conventions.
|
|
15
|
+
|
|
16
|
+
When browsing the documentation, you'll probably notice that a lot of the
|
|
17
|
+
classes inherit from {VirtualBox::AbstractModel}. This just means that all
|
|
18
|
+
these classes act the same way! Every {VirtualBox::AbstractModel AbstractModel}
|
|
19
|
+
shares the following behaviors:
|
|
20
|
+
|
|
21
|
+
* Finding
|
|
22
|
+
* Accessing
|
|
23
|
+
* Modifying
|
|
24
|
+
* Saving
|
|
25
|
+
|
|
26
|
+
These behaviors should be similar if not the exact same across all
|
|
27
|
+
virtualbox models. Each of these behaviors is covered below.
|
|
28
|
+
|
|
29
|
+
<a name="bc-finding-models"></a>
|
|
30
|
+
## Finding Models
|
|
31
|
+
|
|
32
|
+
All data models have a `find` or `all` method (or sometimes both!) These
|
|
33
|
+
methods do what you expect them to: `all` will return an array of all instances
|
|
34
|
+
of that model which is typically unordered. `find` will allow you to find a
|
|
35
|
+
specific instance of that model, typically by name or UUID. Below are a couple
|
|
36
|
+
examples of this.
|
|
37
|
+
|
|
38
|
+
### All
|
|
39
|
+
|
|
40
|
+
This example uses {VirtualBox::HardDrive}. As you can see, its just an
|
|
41
|
+
unmodified ruby `Array` which is returned by `all`. This can be used find,
|
|
42
|
+
sort, enumerate, etc.
|
|
43
|
+
|
|
44
|
+
drives = VirtualBox::HardDrive.all
|
|
45
|
+
puts "You have #{drives.length} hard drives!"
|
|
46
|
+
|
|
47
|
+
drives.each do |drive|
|
|
48
|
+
puts "Drive: #{drive.uuid}"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
In the case that `all` returns an empty array, this simply means that none
|
|
52
|
+
of that model exist.
|
|
53
|
+
|
|
54
|
+
### Find
|
|
55
|
+
|
|
56
|
+
This example uses {VirtualBox::VM}, which will probably be the most common
|
|
57
|
+
model you search for.
|
|
58
|
+
|
|
59
|
+
vm = VirtualBox::VM.find("MyVM")
|
|
60
|
+
puts "This VM has #{vm.memory} MB of RAM allocated to it."
|
|
61
|
+
|
|
62
|
+
Find can also be used with UUIDs:
|
|
63
|
+
|
|
64
|
+
vm = VirtualBox::VM.find("3d0f87b4-50f7-4fc5-ad89-93375b1b32a3")
|
|
65
|
+
puts "This VM's name is: #{vm.name}"
|
|
66
|
+
|
|
67
|
+
When a find fails, it will return `nil`.
|
|
68
|
+
|
|
69
|
+
<a name="bc-accessing-models"></a>
|
|
70
|
+
## Accessing Models
|
|
71
|
+
|
|
72
|
+
Every model has an _attribute list_ associated with it. These attributes are
|
|
73
|
+
what can be accessed on the model via the typical ruby attribute accessing
|
|
74
|
+
syntax with the `.` (dot) operator. Because these methods are generated
|
|
75
|
+
dynamically, they don't show up as methods in the documentation. Because of this,
|
|
76
|
+
attributes are listed for every model in their overviews. For examples, see the
|
|
77
|
+
overviews of {VirtualBox::VM}, {VirtualBox::HardDrive}, etc.
|
|
78
|
+
|
|
79
|
+
In addition to an attribute list, many models also have _relationships_.
|
|
80
|
+
Relationships are, for our purposes, similar enough to attributes that they
|
|
81
|
+
can be treated the same. Relationship accessing methods are also dynamically
|
|
82
|
+
generated, so they are listed within the overviews of the models as well (if they
|
|
83
|
+
have any). Relationships allow two models to show that they are connected in some
|
|
84
|
+
way, and can therefore be accessed through each other.
|
|
85
|
+
|
|
86
|
+
### Attributes
|
|
87
|
+
|
|
88
|
+
Reading attributes is simple. Let's use a {VirtualBox::VM} as an example:
|
|
89
|
+
|
|
90
|
+
vm = VirtualBox::VM.find("FooVM")
|
|
91
|
+
|
|
92
|
+
# Accessing attributes:
|
|
93
|
+
vm.memory
|
|
94
|
+
vm.name
|
|
95
|
+
vm.boot1
|
|
96
|
+
vm.ioapic
|
|
97
|
+
|
|
98
|
+
### Relationships
|
|
99
|
+
|
|
100
|
+
Relationships are read the exact same way as attributes. Again using a
|
|
101
|
+
{VirtualBox::VM} as an example:
|
|
102
|
+
|
|
103
|
+
vm = VirtualBox::VM.find("FooVM")
|
|
104
|
+
|
|
105
|
+
# storage_controllers is a relationship containing an array of all the
|
|
106
|
+
# storage controllers on this VM
|
|
107
|
+
vm.storage_controllers.each do |sc|
|
|
108
|
+
puts "Storage Controller: #{sc.uuid}"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
The difference from an attribute is that while attributes are typically ruby
|
|
112
|
+
primitives such as `String` or `Boolean`, relationship objects are always other
|
|
113
|
+
virtualbox models such as {VirtualBox::StorageController}.
|
|
114
|
+
|
|
115
|
+
<a name="bc-modifying-models"></a>
|
|
116
|
+
## Modifying Models
|
|
117
|
+
|
|
118
|
+
In addition to simply reading attributes and relationships, most can be modified
|
|
119
|
+
as well. I say "most" because some attributes are `readonly` and some relationships
|
|
120
|
+
simply don't support being directly modified (though their objects may, I'll get to
|
|
121
|
+
this in a moment). By looking at the attribute list it is easy to spot a readonly
|
|
122
|
+
attribute, which will have the `:readonly` option set to `true`. Below is an example
|
|
123
|
+
of what you might see in the overview of some model:
|
|
124
|
+
|
|
125
|
+
attribute :uuid, :readonly => true
|
|
126
|
+
|
|
127
|
+
In the above case, you could read the `uuid` attribute as normal, but it wouldn't support
|
|
128
|
+
modification (and you'll simply get a `NoMethodError` if you try to set it).
|
|
129
|
+
|
|
130
|
+
Relationships are a little bit trickier, since when discussing modifying a relationship,
|
|
131
|
+
it could either be taken to mean the items _in_ the relationship, or the relationship
|
|
132
|
+
itself. A good rule of thumb, assuming there exists a relationship `foos`,is if you ever
|
|
133
|
+
want to do `object.foos =` something, then you're _modifying the relationship_ and _not_
|
|
134
|
+
the objects. But if you ever do `object.foos[0].destroy`, then you're _modifying the
|
|
135
|
+
relationship objects_ and _not_ the relationship itself.
|
|
136
|
+
|
|
137
|
+
### Attributes
|
|
138
|
+
|
|
139
|
+
Attributes which support modification are modified like standard ruby attributes. The
|
|
140
|
+
following example uses {VirtualBox::HardDrive}:
|
|
141
|
+
|
|
142
|
+
hd = VirtualBox::HardDrive.new
|
|
143
|
+
hd.size = 2000 # megabytes
|
|
144
|
+
hd.format = "VMDK"
|
|
145
|
+
|
|
146
|
+
As you can see, there is nothing sneaky going on here, and does what you expect.
|
|
147
|
+
|
|
148
|
+
### Relationships
|
|
149
|
+
|
|
150
|
+
Modifying relationships, on the other hand, is a little different. If the model supports
|
|
151
|
+
modifying the relationship (which it'll note in its respective documentation), then
|
|
152
|
+
you can set it just like an attribute. Below, we use {VirtualBox::AttachedDevice} as
|
|
153
|
+
an example:
|
|
154
|
+
|
|
155
|
+
ad = VirtualBox::AttachedDevice.new
|
|
156
|
+
|
|
157
|
+
# Attached devices have an image relationship
|
|
158
|
+
ad.image = VirtualBox::DVD.empty_drive
|
|
159
|
+
|
|
160
|
+
If a relationship doesn't support setting it, it will raise a {VirtualBox::Exceptions::NonSettableRelationshipException}.
|
|
161
|
+
|
|
162
|
+
**Note**: Below is an example of modifying a relationship object, rather than a
|
|
163
|
+
relationship itself. The example below uses {VirtualBox::VM}.
|
|
164
|
+
|
|
165
|
+
vm = VirtualBox::VM.find("FooVM")
|
|
166
|
+
vm.storage_controllers[0].name = "Foo Controller"
|
|
167
|
+
|
|
168
|
+
<a name="bc-saving-models"></a>
|
|
169
|
+
## Saving Models
|
|
170
|
+
|
|
171
|
+
Saving models is _really_ easy: you simply call `save`. That's all! Well, there are
|
|
172
|
+
some subtleties, but that's the basic idea. `save` will typically **also save relationships**
|
|
173
|
+
so if you modify a relationship object or relationship itself, calling `save` on the
|
|
174
|
+
parent object will typically save the relationships as well. `save` always returns
|
|
175
|
+
`true` or `false` depending on whether the operation was a success or not. If you'd like
|
|
176
|
+
instead to know why a `save` failed, you can call the method with a `true` parameter
|
|
177
|
+
which sets `raise_errors` to `true` and will raise a {VirtualBox::Exceptions::CommandFailedException}
|
|
178
|
+
if there is a failure. The message on this object contains the reason.
|
|
179
|
+
|
|
180
|
+
Below is an example of saving a simple {VirtualBox::VM} object:
|
|
181
|
+
|
|
182
|
+
vm = VirtualBox::VM.find("FooVM")
|
|
183
|
+
|
|
184
|
+
# Double the memory
|
|
185
|
+
vm.memory = vm.memory.to_i * 2
|
|
186
|
+
|
|
187
|
+
# This will return true/false depending on success
|
|
188
|
+
vm.save
|
|
189
|
+
|
|
190
|
+
Below is an example where an exception will be raised if an error occurs:
|
|
191
|
+
|
|
192
|
+
vm = VirtualBox::VM.find("FooVM")
|
|
193
|
+
vm.memory = "INVALID"
|
|
194
|
+
|
|
195
|
+
# This will raise an exception, since the memory is invalid
|
|
196
|
+
vm.save(true)
|
data/docs/WhatsNew.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# What's New in 0.6.x?
|
|
2
|
+
|
|
3
|
+
## Native Interface
|
|
4
|
+
|
|
5
|
+
The VirtualBox gem no longer piggy-backs on top of `VBoxManage` or XML configuration files.
|
|
6
|
+
The gem now uses the native interface provided by VirtualBox to communicate. The result of
|
|
7
|
+
this is a _huge_ speed increase which simply would not have been possible otherwise, and
|
|
8
|
+
stability across versions. In addition to that, the entire VirtualBox API is now at your
|
|
9
|
+
disposal. While the gem itself doesn't yet support creating VMs and so on, the API is available
|
|
10
|
+
for you to do it manually (if you really wanted to!).
|
|
11
|
+
|
|
12
|
+
Future versions will support more and more of the API.
|
data/features/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# VirtualBox Gem Feature Tests
|
|
2
|
+
|
|
3
|
+
**Warning: These tests actually hit the real VirtualBox software!**
|
|
4
|
+
|
|
5
|
+
The tests in this directory are _not_ meant as a replacement
|
|
6
|
+
for the unit tests in the `test/` directory. Instead, these
|
|
7
|
+
features are meant to test the actual integration of the
|
|
8
|
+
virtualbox gem with an actual VirtualBox installation.
|
|
9
|
+
|
|
10
|
+
Whereas the unit tests try to test every branch of the code in a
|
|
11
|
+
very prescribed, isolated environment, the feature tests do not
|
|
12
|
+
test specific branches of code, but test behavior of the gem.
|
|
13
|
+
The reasoning for both tests is that the unit tests test proper
|
|
14
|
+
behavior _within the library itself_ whereas these feature tests
|
|
15
|
+
test proper behavior _with the outside world_.
|
|
16
|
+
|
|
17
|
+
## Running Feature Tests
|
|
18
|
+
|
|
19
|
+
The easiest way to run these feature tests is via `rake` or the
|
|
20
|
+
`cucumber` binary. `rake` shown below:
|
|
21
|
+
|
|
22
|
+
rake test:integration
|
|
23
|
+
|
|
24
|
+
## Feature Coverage
|
|
25
|
+
|
|
26
|
+
The test coverage of the features are purposefully not trying to
|
|
27
|
+
reach 100% branch coverage. They test the basic functionality (and
|
|
28
|
+
as much as the functionality as possible) to verify the library is
|
|
29
|
+
functional. If a bug is found, then a feature should be added to
|
|
30
|
+
reproduce and verify the bug no longer exists, but I'm not concerned
|
|
31
|
+
with getting 100% branch coverage right away.
|
|
32
|
+
|
|
33
|
+
For 100% branch coverage, see the unit tests, which do this.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Feature: Global Data
|
|
2
|
+
As a virtualbox library user
|
|
3
|
+
I want to access information about the global state of VirtualBox
|
|
4
|
+
In order to get information about my environment
|
|
5
|
+
|
|
6
|
+
Scenario: Reading the VMs
|
|
7
|
+
Given the global object
|
|
8
|
+
When I read the "vms"
|
|
9
|
+
Then I should get a matching length for "vms"
|
|
10
|
+
|
|
11
|
+
Scenario: Reading the hard drives
|
|
12
|
+
Given the global object
|
|
13
|
+
When I read the media "hard drives"
|
|
14
|
+
Then I should get a matching length of media items
|
|
15
|
+
|
|
16
|
+
Scenario: Reading the dvds
|
|
17
|
+
Given the global object
|
|
18
|
+
When I read the media "dvds"
|
|
19
|
+
Then I should get a matching length of media items
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Feature: Global Extra Data
|
|
2
|
+
As a virtualbox library user
|
|
3
|
+
I want to access and update global extra data
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
Given the global object
|
|
7
|
+
And I delete the "global" extra data "VirtualBoxGemTest/Key"
|
|
8
|
+
And the "extra_data" relationship
|
|
9
|
+
|
|
10
|
+
Scenario: Reading extra data
|
|
11
|
+
When I get the extra data of "global"
|
|
12
|
+
Then all the extra data should match
|
|
13
|
+
|
|
14
|
+
@unsafe
|
|
15
|
+
Scenario: Writing extra data
|
|
16
|
+
When I set the extra data "VirtualBoxGemTest/Key" to "Value"
|
|
17
|
+
And I save the relationship
|
|
18
|
+
And I get the extra data of "global"
|
|
19
|
+
Then the extra data should include "VirtualBoxGemTest/Key" as "Value"
|
|
20
|
+
|
|
21
|
+
@unsafe
|
|
22
|
+
Scenario: Deleting extra data
|
|
23
|
+
When I set the extra data "VirtualBoxGemTest/Key" to "Value"
|
|
24
|
+
And I save the relationship
|
|
25
|
+
And I delete the extra data "VirtualBoxGemTest/Key"
|
|
26
|
+
And I get the extra data of "global"
|
|
27
|
+
Then the extra data should not include "VirtualBoxGemTest/Key"
|