virtual_box 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.autotest +9 -0
  2. data/.document +5 -0
  3. data/.project +12 -0
  4. data/.rspec +1 -0
  5. data/Gemfile +14 -0
  6. data/Gemfile.lock +44 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.markdown +67 -0
  9. data/Rakefile +35 -22
  10. data/VERSION +1 -0
  11. data/lib/virtual_box/board.rb +287 -0
  12. data/lib/virtual_box/cli.rb +20 -0
  13. data/lib/virtual_box/dhcp.rb +149 -0
  14. data/lib/virtual_box/disk.rb +138 -0
  15. data/lib/virtual_box/io_bus.rb +261 -0
  16. data/lib/virtual_box/net.rb +144 -0
  17. data/lib/virtual_box/nic.rb +213 -0
  18. data/lib/virtual_box/version.rb +37 -24
  19. data/lib/virtual_box/vm.rb +289 -24
  20. data/lib/virtual_box.rb +14 -9
  21. data/test/helper.rb +24 -0
  22. data/test/tasks/tinycore.rake +378 -0
  23. data/test/virtual_box/board_test.rb +39 -0
  24. data/test/virtual_box/cli_test.rb +33 -0
  25. data/test/virtual_box/dhcp_test.rb +52 -0
  26. data/test/virtual_box/disk_test.rb +116 -0
  27. data/test/virtual_box/integration_test.rb +53 -0
  28. data/test/virtual_box/io_bus_test.rb +54 -0
  29. data/test/virtual_box/net_test.rb +80 -0
  30. data/test/virtual_box/nic_test.rb +50 -0
  31. data/test/virtual_box/version_test.rb +71 -0
  32. data/test/virtual_box/vm_test.rb +55 -0
  33. data/virtual_box.gemspec +81 -22
  34. metadata +208 -89
  35. data/CHANGELOG +0 -1
  36. data/LICENSE +0 -21
  37. data/Manifest +0 -17
  38. data/README.textile +0 -19
  39. data/lib/virtual_box/command_line.rb +0 -27
  40. data/lib/virtual_box/vm/general_settings.rb +0 -136
  41. data/lib/virtual_box/vm/identity.rb +0 -43
  42. data/lib/virtual_box/vm/lifecycle.rb +0 -42
  43. data/test/command_line_test.rb +0 -19
  44. data/test/general_settings_test.rb +0 -20
  45. data/test/lifecycle_test.rb +0 -64
  46. data/test/version_test.rb +0 -56
  47. data/testdata/golden_general_params.txt +0 -1
@@ -1,64 +0,0 @@
1
- # Author:: Victor Costan
2
- # Copyright:: Copyright (C) 2009 Zergling.Net
3
- # License:: MIT
4
-
5
- require 'virtual_box'
6
- require 'test/unit'
7
-
8
- require 'rubygems'
9
- require 'flexmock/test_unit'
10
-
11
-
12
- class LifecycleTest < Test::Unit::TestCase
13
- def setup
14
- super
15
-
16
- @uuid = 'test-uuid'
17
- @vm = VirtualBox::VM.new
18
- @vm.uuid = @uuid
19
- end
20
-
21
- def test_start
22
- flexmock(VirtualBox).should_receive(:ose?).and_return(false)
23
- flexmock(VirtualBox).should_receive(:shell_command).once.
24
- with("VBoxHeadless --startvm #{@uuid} --vrdp off").
25
- and_return({:status => 0, :output => ""})
26
-
27
- assert @vm.start
28
- end
29
-
30
- def test_start_rdp
31
- flexmock(VirtualBox).should_receive(:ose?).and_return(false)
32
- flexmock(VirtualBox).should_receive(:shell_command).once.
33
- with("VBoxHeadless --startvm #{@uuid} --vrdp on").
34
- and_return({:status => 0, :output => ""})
35
-
36
- assert @vm.start(:rdp => true)
37
- end
38
-
39
- def test_start_with_ose
40
- flexmock(VirtualBox).should_receive(:ose?).and_return(true)
41
- flexmock(VirtualBox).should_receive(:shell_command).once.
42
- with("VBoxHeadless --startvm #{@uuid}").
43
- and_return({:status => 0, :output => ""})
44
-
45
- assert @vm.start
46
- end
47
-
48
- def test_start_rdp_with_ose
49
- flexmock(VirtualBox).should_receive(:ose?).and_return(true)
50
-
51
- assert_raise RuntimeError do
52
- @vm.start :rdp => true
53
- end
54
- end
55
-
56
- def test_start_gui_with_error
57
- flexmock(VirtualBox).should_receive(:ose?).and_return(false)
58
- flexmock(VirtualBox).should_receive(:shell_command).once.
59
- with("VBoxManage startvm #{@uuid} --type gui --vrdp off").
60
- and_return({:status => 127, :output => ""})
61
-
62
- assert_equal false, @vm.start(:gui => true)
63
- end
64
- end
data/test/version_test.rb DELETED
@@ -1,56 +0,0 @@
1
- # Author:: Victor Costan
2
- # Copyright:: Copyright (C) 2009 Zergling.Net
3
- # License:: MIT
4
-
5
- require 'virtual_box'
6
- require 'test/unit'
7
-
8
- require 'rubygems'
9
- require 'flexmock/test_unit'
10
-
11
-
12
- class VersionTest < Test::Unit::TestCase
13
- def setup
14
- super
15
-
16
- # Hack to reset the cached version information.
17
- VirtualBox.instance_variable_set :@version_info, nil
18
- end
19
-
20
- def test_version_info_std
21
- flexmock(VirtualBox).should_receive(:shell_command).once.
22
- and_return({:status => 0, :output => "3.0.4r50677\n"})
23
-
24
- assert_equal '3.0.4', VirtualBox.version_info[:version]
25
- assert_equal nil, VirtualBox.version_info[:edition]
26
- assert_equal 50677, VirtualBox.version_info[:revision]
27
-
28
- assert_equal false, VirtualBox.ose?
29
- end
30
-
31
- def test_version_info_ose
32
- flexmock(VirtualBox).should_receive(:shell_command).once.
33
- and_return({:status => 0, :output => "3.0.2_OSEr49928\n"})
34
-
35
- assert_equal '3.0.2', VirtualBox.version_info[:version]
36
- assert_equal 'OSE', VirtualBox.version_info[:edition]
37
- assert_equal 49928, VirtualBox.version_info[:revision]
38
-
39
- assert_equal true, VirtualBox.ose?
40
- end
41
-
42
- def test_version_info_none
43
- flexmock(VirtualBox).should_receive(:shell_command).once.
44
- and_return({:status => 127, :output => "3.0.2_OSEr49928\n"})
45
-
46
- assert_equal false, VirtualBox.version_info
47
- assert_equal nil, VirtualBox.ose?
48
- end
49
-
50
- def test_live
51
- assert_equal Hash, VirtualBox.version_info.class,
52
- 'version_info result should be a hash'
53
- assert VirtualBox.version_info[:version],
54
- 'version_info should have a :version key'
55
- end
56
- end
@@ -1 +0,0 @@
1
- --memory 512 --vram 12 --pae off --acpi on --io_apic off --hwvirtex on --nestedpaging on --vtxvpid on --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --boot1 disk --boot2 net --boot3 dvd --boot4 none