virtualbox 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,6 +54,7 @@ module VirtualBox
54
54
 
55
55
  # 4.0.x interfaces
56
56
  if version == "4.0.x"
57
+ create_interface(:BandwidthControl, :NSISupports)
57
58
  create_interface(:VRDEServer, :NSISupports)
58
59
  end
59
60
  end
@@ -73,34 +73,48 @@ module VirtualBox
73
73
  end
74
74
  end.compact
75
75
 
76
- spec = spec.collect do |item|
77
- if item == T_BOOL
78
- args.shift ? 1 : 0
79
- elsif item.to_s[0,1] == item.to_s[0,1].upcase
80
- # Try to get the class from the interfaces
81
- interface = interface_klass(item.to_sym)
82
-
83
- if interface.superclass == COM::AbstractInterface
84
- # For interfaces, get the instance, then dig deep to get the pointer
85
- # to the VtblParent, which is what the API expects
86
- instance = args.shift
87
-
88
- if !instance.nil?
89
- # Get the actual MSCOM object, rather than the AbstractInterface
90
- instance.implementer.object
91
- else
92
- # If the argument was nil, just pass a nil pointer as the argument
93
- nil
94
- end
95
- elsif interface.superclass == COM::AbstractEnum
96
- # For enums, we need the value of the enum
97
- interface.index(args.shift.to_sym)
76
+ spec = spec.inject([]) do |results, item|
77
+ single_type_to_arg(args, item, results)
78
+ end
79
+ end
80
+
81
+ # Converts a single type and args list to the proper formal args list
82
+ def single_type_to_arg(args, item, results)
83
+ if item.is_a?(Array) && item.length == 1
84
+ # Array argument
85
+ data = args.shift
86
+
87
+ # If its a regular type (int, bool, etc.) then just make it an
88
+ # array of that
89
+ results << data.inject([]) do |converted_data, single|
90
+ single_type_to_arg([single], item[0], converted_data)
91
+ end
92
+ elsif item.to_s[0,1] == item.to_s[0,1].upcase
93
+ # Try to get the class from the interfaces
94
+ interface = interface_klass(item.to_sym)
95
+
96
+ if interface.superclass == COM::AbstractInterface
97
+ # For interfaces, get the instance, then dig deep to get the pointer
98
+ # to the VtblParent, which is what the API expects
99
+ instance = args.shift
100
+
101
+ results << if !instance.nil?
102
+ # Get the actual MSCOM object, rather than the AbstractInterface
103
+ instance.implementer.object
104
+ else
105
+ # If the argument was nil, just pass a nil pointer as the argument
106
+ nil
98
107
  end
99
- else
100
- # Simply replace spec item with next item in args
101
- # list
102
- args.shift
108
+ elsif interface.superclass == COM::AbstractEnum
109
+ # For enums, we need the value of the enum
110
+ results << interface.index(args.shift.to_sym)
103
111
  end
112
+ elsif item == T_BOOL
113
+ results << (args.shift ? 1 : 0)
114
+ else
115
+ # Simply replace spec item with next item in args
116
+ # list
117
+ results << args.shift
104
118
  end
105
119
  end
106
120
 
@@ -0,0 +1,18 @@
1
+ module VirtualBox
2
+ module COM
3
+ module Interface
4
+ module Version_4_0_X
5
+ class BandwidthControl < AbstractInterface
6
+ IID_STR = "D0A24DB0-F756-11DF-98CF-0800200C9A66"
7
+
8
+ property :num_groups, T_UINT32, :readonly => true
9
+
10
+ function :create_bandwidth_group, nil, [WSTRING, :BandwidthGroupType, T_UINT32]
11
+ function :delete_bandwidth_group, nil, [WSTRING]
12
+ function :get_bandwidth_group, :BandwidthGroup, [WSTRING]
13
+ function :get_all_bandwidth_groups, [:BandwidthGroup], []
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module VirtualBox
2
+ module COM
3
+ module Interface
4
+ module Version_4_0_X
5
+ class BandwidthGroup < AbstractInterface
6
+ IID_STR = "BADEA2D7-0261-4146-89F0-6A57CC34833D"
7
+
8
+ property :name, WSTRING, :readonly => true
9
+ property :type, :BandwidthGroupType, :readonly => true
10
+ property :reference, T_UINT32, :readonly => true
11
+ property :max_mb_per_sec, T_UINT32, :readonly => true
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ module VirtualBox
2
+ module COM
3
+ module Interface
4
+ module Version_4_0_X
5
+ class BandwidthGroupType < AbstractEnum
6
+ map [:null, :disk, :network]
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module VirtualBox
2
+ module COM
3
+ module Interface
4
+ module Version_4_0_X
5
+ class ChipsetType < AbstractEnum
6
+ map [:null, :piix3, :ich9]
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module VirtualBox
2
+ module COM
3
+ module Interface
4
+ module Version_4_0_X
5
+ class DataType < AbstractEnum
6
+ map [:int32, :int8, :string]
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ module VirtualBox
2
+ module COM
3
+ module Interface
4
+ module Version_4_0_X
5
+ class PciDeviceAttachment < AbstractInterface
6
+ IID_STR = "91F33D6F-E621-4F70-A77E-15F0E3C714D5"
7
+
8
+ property :name, WSTRING, :readonly => true
9
+ property :is_physical_device, T_BOOL, :readonly => true
10
+ property :host_address, T_UINT32, :readonly => true
11
+ property :guest_address, T_UINT32, :readonly => true
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -14,6 +14,7 @@ module VirtualBox
14
14
  property :bus, :StorageBus, :readonly => true
15
15
  property :controller_type, :StorageControllerType
16
16
  property :use_host_io_cache, T_BOOL
17
+ property :bootable, T_BOOL, :readonly => true
17
18
 
18
19
  function :get_ide_emulation_port, T_INT32, [T_INT32]
19
20
  function :set_ide_emulation_port, nil, [T_INT32, T_INT32]
@@ -19,6 +19,10 @@ module VirtualBox
19
19
  platform.include?("solaris")
20
20
  end
21
21
 
22
+ def jruby?
23
+ RbConfig::CONFIG["ruby_install_name"] == "jruby"
24
+ end
25
+
22
26
  def platform
23
27
  RbConfig::CONFIG["host_os"].downcase
24
28
  end
@@ -1,5 +1,5 @@
1
1
  module VirtualBox
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
 
4
4
  module Version
5
5
  # Returns a boolean denoting whether the current VirtualBox
@@ -1,3 +1,6 @@
1
+ require 'pathname'
2
+ require 'virtualbox/ext/platform'
3
+
1
4
  module VirtualBox
2
5
  # Represents a single VirtualBox virtual machine. All attributes which are
3
6
  # not read-only can be modified and saved.
@@ -556,12 +559,24 @@ module VirtualBox
556
559
  media = interface.unregister(:full)
557
560
 
558
561
  if !media.empty?
559
- interface.delete(media)
560
-
561
- # TODO: This sleep is silly. The progress object returned by the media
562
- # delete always fails to "wait" for some reason, so I do this. I hope
563
- # to solve this issue soon.
564
- sleep 1
562
+ if Platform.windows? && !Platform.jruby?
563
+ # The MSCOM interface in CRuby to delete media is broken,
564
+ # so we do this ghettoness.
565
+ path = interface.settings_file_path
566
+
567
+ # A simple sanity check to make sure we don't attempt to delete
568
+ # the root or something
569
+ if path.length > 10
570
+ Pathname.new(path).parent.rmtree
571
+ end
572
+ else
573
+ interface.delete(media)
574
+
575
+ # TODO: This sleep is silly. The progress object returned by the media
576
+ # delete always fails to "wait" for some reason, so I do this. I hope
577
+ # to solve this issue soon.
578
+ sleep 1
579
+ end
565
580
  end
566
581
  end
567
582
 
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.rubyforge_project = "virtualbox"
16
16
 
17
- s.add_dependency "ffi", "~> 0.6.3"
17
+ s.add_dependency "ffi", "~> 1.0"
18
18
  s.add_development_dependency "contest", "~> 0.1.2"
19
19
  s.add_development_dependency "mocha", "~> 0.9.8"
20
20
 
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtualbox
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 8
8
- - 3
9
- version: 0.8.3
4
+ prerelease:
5
+ version: 0.8.4
10
6
  platform: ruby
11
7
  authors:
12
8
  - Mitchell Hashimoto
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-28 00:00:00 -08:00
13
+ date: 2011-05-12 00:00:00 -07:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -24,11 +20,7 @@ dependencies:
24
20
  requirements:
25
21
  - - ~>
26
22
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 6
30
- - 3
31
- version: 0.6.3
23
+ version: "1.0"
32
24
  type: :runtime
33
25
  prerelease: false
34
26
  version_requirements: *id001
@@ -39,10 +31,6 @@ dependencies:
39
31
  requirements:
40
32
  - - ~>
41
33
  - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
- - 1
45
- - 2
46
34
  version: 0.1.2
47
35
  type: :development
48
36
  prerelease: false
@@ -54,10 +42,6 @@ dependencies:
54
42
  requirements:
55
43
  - - ~>
56
44
  - !ruby/object:Gem::Version
57
- segments:
58
- - 0
59
- - 9
60
- - 8
61
45
  version: 0.9.8
62
46
  type: :development
63
47
  prerelease: false
@@ -266,12 +250,17 @@ files:
266
250
  - lib/virtualbox/com/interface/4.0.x/audio_controller_type.rb
267
251
  - lib/virtualbox/com/interface/4.0.x/audio_driver_type.rb
268
252
  - lib/virtualbox/com/interface/4.0.x/auth_type.rb
253
+ - lib/virtualbox/com/interface/4.0.x/bandwidth_control.rb
254
+ - lib/virtualbox/com/interface/4.0.x/bandwidth_group.rb
255
+ - lib/virtualbox/com/interface/4.0.x/bandwidth_group_type.rb
269
256
  - lib/virtualbox/com/interface/4.0.x/bios_boot_menu_mode.rb
270
257
  - lib/virtualbox/com/interface/4.0.x/bios_settings.rb
258
+ - lib/virtualbox/com/interface/4.0.x/chipset_type.rb
271
259
  - lib/virtualbox/com/interface/4.0.x/cleanup_mode.rb
272
260
  - lib/virtualbox/com/interface/4.0.x/clipboard_mode.rb
273
261
  - lib/virtualbox/com/interface/4.0.x/console.rb
274
262
  - lib/virtualbox/com/interface/4.0.x/cpu_property_type.rb
263
+ - lib/virtualbox/com/interface/4.0.x/data_type.rb
275
264
  - lib/virtualbox/com/interface/4.0.x/device_type.rb
276
265
  - lib/virtualbox/com/interface/4.0.x/dhcp_server.rb
277
266
  - lib/virtualbox/com/interface/4.0.x/event_source.rb
@@ -306,6 +295,7 @@ files:
306
295
  - lib/virtualbox/com/interface/4.0.x/nsiexception.rb
307
296
  - lib/virtualbox/com/interface/4.0.x/nsisupports.rb
308
297
  - lib/virtualbox/com/interface/4.0.x/parallel_port.rb
298
+ - lib/virtualbox/com/interface/4.0.x/pci_device_attachment.rb
309
299
  - lib/virtualbox/com/interface/4.0.x/pointing_hid_type.rb
310
300
  - lib/virtualbox/com/interface/4.0.x/port_mode.rb
311
301
  - lib/virtualbox/com/interface/4.0.x/progress.rb
@@ -435,7 +425,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
435
425
  requirements:
436
426
  - - ">="
437
427
  - !ruby/object:Gem::Version
438
- hash: 3085819186325211373
428
+ hash: -3965605946174079114
439
429
  segments:
440
430
  - 0
441
431
  version: "0"
@@ -444,15 +434,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
444
434
  requirements:
445
435
  - - ">="
446
436
  - !ruby/object:Gem::Version
447
- segments:
448
- - 1
449
- - 3
450
- - 6
451
437
  version: 1.3.6
452
438
  requirements: []
453
439
 
454
440
  rubyforge_project: virtualbox
455
- rubygems_version: 1.3.7
441
+ rubygems_version: 1.5.0
456
442
  signing_key:
457
443
  specification_version: 3
458
444
  summary: Create and modify virtual machines in VirtualBox using pure ruby