virtualbox-com 0.9.9 → 0.10.0
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/LICENSE +339 -19
- data/examples/simple.rb +2 -0
- data/ext/virtualbox-com/4.1/extconf.rb +4 -0
- data/ext/virtualbox-com/4.1/generated.inc +17345 -0
- data/ext/virtualbox-com/4.1/vbox.c +858 -0
- data/ext/virtualbox-com/4.2/extconf.rb +4 -0
- data/ext/virtualbox-com/4.2/generated.inc +19751 -0
- data/ext/virtualbox-com/4.2/vbox.c +858 -0
- data/ext/virtualbox-com/helpers.h +62 -0
- data/ext/virtualbox-com/loader/extconf.rb +3 -0
- data/ext/virtualbox-com/loader/vbox-loader.c +187 -0
- data/ext/virtualbox-com/types.h +34 -0
- data/ext/virtualbox-com/vbox.c +858 -0
- data/lib/virtualbox/com.rb +4 -26
- data/lib/virtualbox/com/{abstract_enum.rb → abstracts.rb} +22 -18
- data/lib/virtualbox/com/exceptions.rb +29 -3
- data/lib/virtualbox/com/model/4.1-generated.rb +2141 -0
- data/lib/virtualbox/com/model/4.2-generated.rb +141 -432
- data/lib/virtualbox/com/model/4.2.rb +4 -4
- data/lib/virtualbox/com/util.rb +2 -1
- data/lib/virtualbox/com/version.rb +1 -1
- data/lib/virtualbox/com/xpcomc-ffi.rb +5 -19
- data/lib/virtualbox/com/xpcomc-ffi/abstracts.rb +103 -0
- data/lib/virtualbox/com/{iid.rb → xpcomc-ffi/iid.rb} +18 -0
- data/lib/virtualbox/com/xpcomc-ffi/lib.rb +6 -0
- data/lib/virtualbox/com/xpcomc-ffi/model-types.rb +1 -0
- data/lib/virtualbox/com/xpcomc-native.rb +8 -0
- data/scripts/abstracts.rb +84 -0
- data/scripts/sig.rb +201 -0
- data/scripts/spec.rb +56 -0
- data/scripts/to_c.rb +157 -0
- data/scripts/xidl-conv.rb +110 -50
- data/virtualbox-com.gemspec +18 -11
- metadata +49 -47
- data/.gitignore +0 -9
- data/README.md +0 -89
- data/Rakefile +0 -8
- data/lib/virtualbox/com/abstract_interface.rb +0 -144
- data/lib/virtualbox/com/abstract_model.rb +0 -14
metadata
CHANGED
@@ -1,33 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virtualbox-com
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Stephane D'Alu
|
9
|
-
- Mitchell Hashimoto
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-07-12 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: ffi
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - '>='
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '0'
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - '>='
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '0'
|
31
14
|
- !ruby/object:Gem::Dependency
|
32
15
|
name: rake
|
33
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,43 +43,59 @@ dependencies:
|
|
60
43
|
- - '>='
|
61
44
|
- !ruby/object:Gem::Version
|
62
45
|
version: '0'
|
63
|
-
description: Low level VirtualBox
|
46
|
+
description: Low level VirtualBox binding using native code
|
64
47
|
email:
|
65
48
|
- stephane.dalu@gmail.com
|
66
|
-
- mitchell.hashimoto@gmail.com
|
67
49
|
executables: []
|
68
|
-
extensions:
|
50
|
+
extensions:
|
51
|
+
- ext/virtualbox-com/loader/extconf.rb
|
52
|
+
- ext/virtualbox-com/4.2/extconf.rb
|
53
|
+
- ext/virtualbox-com/4.1/extconf.rb
|
69
54
|
extra_rdoc_files: []
|
70
55
|
files:
|
71
|
-
- .gitignore
|
72
|
-
- Gemfile
|
73
56
|
- LICENSE
|
74
|
-
-
|
75
|
-
-
|
57
|
+
- Gemfile
|
58
|
+
- virtualbox-com.gemspec
|
59
|
+
- scripts/spec.rb
|
60
|
+
- scripts/sig.rb
|
61
|
+
- scripts/xidl-conv.rb
|
62
|
+
- scripts/to_c.rb
|
63
|
+
- scripts/abstracts.rb
|
76
64
|
- examples/simple.rb
|
65
|
+
- ext/virtualbox-com/4.1/vbox.c
|
66
|
+
- ext/virtualbox-com/loader/vbox-loader.c
|
67
|
+
- ext/virtualbox-com/vbox.c
|
68
|
+
- ext/virtualbox-com/4.2/vbox.c
|
69
|
+
- ext/virtualbox-com/types.h
|
70
|
+
- ext/virtualbox-com/helpers.h
|
71
|
+
- ext/virtualbox-com/4.1/extconf.rb
|
72
|
+
- ext/virtualbox-com/loader/extconf.rb
|
73
|
+
- ext/virtualbox-com/4.2/extconf.rb
|
74
|
+
- ext/virtualbox-com/4.1/generated.inc
|
75
|
+
- ext/virtualbox-com/4.2/generated.inc
|
77
76
|
- lib/virtualbox-com.rb
|
78
77
|
- lib/virtualbox/com.rb
|
79
|
-
- lib/virtualbox/com/
|
80
|
-
- lib/virtualbox/com/abstract_interface.rb
|
81
|
-
- lib/virtualbox/com/abstract_model.rb
|
82
|
-
- lib/virtualbox/com/exceptions.rb
|
83
|
-
- lib/virtualbox/com/iid.rb
|
84
|
-
- lib/virtualbox/com/model/4.2-generated.rb
|
85
|
-
- lib/virtualbox/com/model/4.2.rb
|
86
|
-
- lib/virtualbox/com/util.rb
|
78
|
+
- lib/virtualbox/com/abstracts.rb
|
87
79
|
- lib/virtualbox/com/version.rb
|
88
|
-
- lib/virtualbox/com/
|
89
|
-
- lib/virtualbox/com/xpcomc-ffi/
|
90
|
-
- lib/virtualbox/com/xpcomc-ffi/implementer.rb
|
80
|
+
- lib/virtualbox/com/util.rb
|
81
|
+
- lib/virtualbox/com/xpcomc-ffi/iid.rb
|
91
82
|
- lib/virtualbox/com/xpcomc-ffi/lib.rb
|
92
|
-
- lib/virtualbox/com/xpcomc-ffi/model-types.rb
|
93
|
-
- lib/virtualbox/com/xpcomc-ffi/sig.rb
|
94
|
-
- lib/virtualbox/com/xpcomc-ffi/spec.rb
|
95
83
|
- lib/virtualbox/com/xpcomc-ffi/xpcomc-vbox.rb
|
96
|
-
-
|
97
|
-
- virtualbox-
|
84
|
+
- lib/virtualbox/com/xpcomc-ffi/spec.rb
|
85
|
+
- lib/virtualbox/com/xpcomc-ffi/abstracts.rb
|
86
|
+
- lib/virtualbox/com/xpcomc-ffi/sig.rb
|
87
|
+
- lib/virtualbox/com/xpcomc-ffi/model-types.rb
|
88
|
+
- lib/virtualbox/com/xpcomc-ffi/binding.rb
|
89
|
+
- lib/virtualbox/com/xpcomc-ffi/implementer.rb
|
90
|
+
- lib/virtualbox/com/exceptions.rb
|
91
|
+
- lib/virtualbox/com/model/4.2.rb
|
92
|
+
- lib/virtualbox/com/model/4.1-generated.rb
|
93
|
+
- lib/virtualbox/com/model/4.2-generated.rb
|
94
|
+
- lib/virtualbox/com/xpcomc-native.rb
|
95
|
+
- lib/virtualbox/com/xpcomc-ffi.rb
|
98
96
|
homepage: http://github.com/sdalu/virtualbox-com
|
99
|
-
licenses:
|
97
|
+
licenses:
|
98
|
+
- GPL-2
|
100
99
|
post_install_message:
|
101
100
|
rdoc_options: []
|
102
101
|
require_paths:
|
@@ -109,17 +108,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
108
|
version: '0'
|
110
109
|
segments:
|
111
110
|
- 0
|
112
|
-
hash: -
|
111
|
+
hash: -3820670781565777041
|
113
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
113
|
none: false
|
115
114
|
requirements:
|
116
115
|
- - '>='
|
117
116
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
117
|
+
version: '0'
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
hash: -3820670781565777041
|
119
121
|
requirements: []
|
120
|
-
rubyforge_project:
|
122
|
+
rubyforge_project:
|
121
123
|
rubygems_version: 1.8.25
|
122
124
|
signing_key:
|
123
125
|
specification_version: 3
|
124
|
-
summary: Low level VirtualBox
|
126
|
+
summary: Low level VirtualBox binding
|
125
127
|
test_files: []
|
data/.gitignore
DELETED
data/README.md
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
# VirtualBox-Com Ruby Gem
|
2
|
-
|
3
|
-
The `virtualbox-COM` ruby gem is a library which focus on the
|
4
|
-
direct mapping of the VirtualBox API and allows anyone to control
|
5
|
-
VirtualBox from ruby code! Create, destroy, start, stop, suspend, and
|
6
|
-
resume virtual machines. Also list virtual machines, list hard
|
7
|
-
drives, network devices, etc.
|
8
|
-
|
9
|
-
This is a simplified version (focusing on the VirtualBox API) of the
|
10
|
-
unmaintained [virtualbox](https://github.com/mitchellh/virtualbox) gem
|
11
|
-
by [Mitchell Hashimoto](https://github.com/mitchellh) from which
|
12
|
-
part of this code belongs.
|
13
|
-
|
14
|
-
If you need a high level API take a look at
|
15
|
-
[ruby-virtualbox](https://github.com/sdalu/ruby-virtualbox) which
|
16
|
-
rely on this gem but provide a more rubyish interface.
|
17
|
-
|
18
|
-
|
19
|
-
## Installation and Requirements
|
20
|
-
|
21
|
-
First you need to install [VirtualBox](http://www.virtualbox.org/)
|
22
|
-
which is available for Windows, Linux, and OS X. After installation,
|
23
|
-
install the gem:
|
24
|
-
|
25
|
-
sudo gem install virtualbox-com
|
26
|
-
|
27
|
-
The gem uses the native COM interface which VirtualBox provides to
|
28
|
-
communicate with it. The gem uses Ruby-FFI to talk to the VirtualBox
|
29
|
-
dynamic library, and all the mapping as been generated from
|
30
|
-
the `VirtualBox.xidl`.
|
31
|
-
|
32
|
-
No configuration should be necessary to use this gem, but if
|
33
|
-
the dynamic library is not found, you can set the environment
|
34
|
-
variable `VBOX_APP_HOME` to the full library path.
|
35
|
-
|
36
|
-
|
37
|
-
## API Documentation
|
38
|
-
|
39
|
-
You can refer to the [VirtualBox SDK](https://www.virtualbox.org/sdkref/annotated.html)
|
40
|
-
knowning that in this gem
|
41
|
-
* classes are not prefixed with the `I` (`IMachine` => `Machine`)
|
42
|
-
* methods have been uncamelized (`canShowConsoleWindow` => `can_show_console_window`)
|
43
|
-
* when calling a method you only specify the in parameters, all the out (including the default return)
|
44
|
-
are being returned in an array if there is more than one, directly otherwise
|
45
|
-
|
46
|
-
|
47
|
-
## Basic Usage
|
48
|
-
require 'virtualbox-com'
|
49
|
-
|
50
|
-
lib = VirtualBox::COM
|
51
|
-
|
52
|
-
lib.virtualbox.machines.each {|vm|
|
53
|
-
puts "%s: %s" % [ vm.bame, vm.state ]
|
54
|
-
}
|
55
|
-
|
56
|
-
You can find more examples in the [`examples`](examples) directory
|
57
|
-
|
58
|
-
|
59
|
-
## Reporting Bugs or Feature Requests
|
60
|
-
|
61
|
-
Please use the [issue tracker](https://github.com/sdalu/virtualbox-com/issues).
|
62
|
-
|
63
|
-
|
64
|
-
## TODO
|
65
|
-
|
66
|
-
Improve documentation, re-implement a test-suite
|
67
|
-
|
68
|
-
|
69
|
-
## Contributing
|
70
|
-
|
71
|
-
If you'd like to contribute to VirtualBox, the first step to developing is to
|
72
|
-
clone this repo, get [bundler](http://github.com/carlhuda/bundler) if you
|
73
|
-
don't have it already, and do the following:
|
74
|
-
|
75
|
-
bundle install --relock
|
76
|
-
rake
|
77
|
-
|
78
|
-
This will run the test suite, which should come back all green! Then
|
79
|
-
you're good to go!
|
80
|
-
|
81
|
-
|
82
|
-
## Special Thanks
|
83
|
-
|
84
|
-
These folks went above and beyond with contributions to the virtualbox gem, and
|
85
|
-
for that, I have to say "thanks!"
|
86
|
-
|
87
|
-
* [Mitchell Hashimoto](https://github.com/mitchellh),
|
88
|
-
[Kieran Pilkington](https://github.com/KieranP),
|
89
|
-
[Aleksey Palazhchenko](https://github.com/AlekSi)
|
data/Rakefile
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
require_relative "abstract_model"
|
2
|
-
|
3
|
-
module VirtualBox
|
4
|
-
module COM
|
5
|
-
|
6
|
-
#
|
7
|
-
# # Defining an Interface
|
8
|
-
#
|
9
|
-
# Defining an interface is done by subclassing AbstractInterface and
|
10
|
-
# using the provided class methods to define the COM methods and
|
11
|
-
# properties. A small example class is shown below:
|
12
|
-
#
|
13
|
-
# class Time < AbstractInterface
|
14
|
-
# function :now, [[:out, :uint]]
|
15
|
-
# property :hour, :uint
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# # Accessing an Interface
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# # Assume `time` was retrieved already
|
22
|
-
# puts time.foo.to_s
|
23
|
-
# time.hour = 20
|
24
|
-
# x = time.now
|
25
|
-
#
|
26
|
-
# The above example shows how the properties and functions can be used
|
27
|
-
# with a given interface.
|
28
|
-
#
|
29
|
-
class AbstractInterface < AbstractModel
|
30
|
-
attr_reader :implementer
|
31
|
-
|
32
|
-
class << self
|
33
|
-
|
34
|
-
# Extends the current model with another one.
|
35
|
-
# Note that redefining functions or properties is not supported.
|
36
|
-
def extends(model)
|
37
|
-
Model.get(model).members.each do |spec|
|
38
|
-
if h.include?(spec.name)
|
39
|
-
raise "redefining of #{spec.name} is not supported"
|
40
|
-
end
|
41
|
-
h[spec.name] = spec
|
42
|
-
end
|
43
|
-
rescue ModelNotFoundException
|
44
|
-
raise "trying to extend an unknown model (#{model})"
|
45
|
-
end
|
46
|
-
|
47
|
-
# Adds a function to the interface
|
48
|
-
def function(name, type, args, opts={})
|
49
|
-
h[name] = Spec::Function.new(name, type, args, opts)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Adds a property to the interface
|
53
|
-
def property(name, type, opts={})
|
54
|
-
h[name] = Spec::Property.new(name, type, opts)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Perform final setup
|
58
|
-
def setup
|
59
|
-
members.each {|spec| name = spec.name
|
60
|
-
case spec
|
61
|
-
when Spec::Function
|
62
|
-
define_method(name) { |*args|
|
63
|
-
@implementer.call_function(spec, *args)
|
64
|
-
} unless spec.hide?
|
65
|
-
when Spec::Property
|
66
|
-
define_method(name) {
|
67
|
-
@implementer.read_property(spec)
|
68
|
-
} unless spec.hide?
|
69
|
-
define_method(:"#{name}=") { |value|
|
70
|
-
@implementer.write_property(spec, value)
|
71
|
-
} unless spec.hide? || spec.readonly?
|
72
|
-
end
|
73
|
-
}
|
74
|
-
end
|
75
|
-
|
76
|
-
# Get a member by name
|
77
|
-
def member(name)
|
78
|
-
h[name]
|
79
|
-
end
|
80
|
-
|
81
|
-
# List of members (Spec::*)
|
82
|
-
def members
|
83
|
-
h.values
|
84
|
-
end
|
85
|
-
|
86
|
-
# List of functions (Spec::Function)
|
87
|
-
def functions
|
88
|
-
members.select {|s| s.kind_of?(Spec::Function) }
|
89
|
-
end
|
90
|
-
|
91
|
-
# List if properties (Spec::Property)
|
92
|
-
def properties
|
93
|
-
members.select {|s| s.kind_of?(Spec::Property) }
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
private
|
98
|
-
def h ; @h ||= {} ; end
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
# Initializes the interface with the given implementer
|
103
|
-
def initialize(*args)
|
104
|
-
@args = args
|
105
|
-
@implementer = Implementer.new(self, *args)
|
106
|
-
end
|
107
|
-
|
108
|
-
|
109
|
-
# Cast to another model
|
110
|
-
def cast(name)
|
111
|
-
@implementer.cast(name, *@args)
|
112
|
-
end
|
113
|
-
|
114
|
-
# Reads a property with the given name
|
115
|
-
def read_property(name)
|
116
|
-
spec = self.class.member(name)
|
117
|
-
raise "#{name} is not a property" unless spec.kind_of?(Spec::Property)
|
118
|
-
@implementer.read_property(spec)
|
119
|
-
end
|
120
|
-
|
121
|
-
# Writes a property with the given name
|
122
|
-
def write_property(name, value)
|
123
|
-
spec = self.class.member(name)
|
124
|
-
raise "#{name} is not a property" unless spec.kind_of?(Spec::Property)
|
125
|
-
raise "property #{name} is readonly" if spec.readonly?
|
126
|
-
@implementer.write_property(spec, value)
|
127
|
-
end
|
128
|
-
|
129
|
-
# Calls a function with the given name
|
130
|
-
def call_function(name, *args)
|
131
|
-
spec = self.class.member(name)
|
132
|
-
raise "#{name} is not a function" unless spec.kind_of?(Spec::Function)
|
133
|
-
@implementer.call_function(spec, args)
|
134
|
-
end
|
135
|
-
|
136
|
-
|
137
|
-
# Concise inspect
|
138
|
-
def inspect
|
139
|
-
"#<#{self.class.name}>"
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
end
|