virtualbox 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.4
1
+ 0.7.5
@@ -18,7 +18,6 @@ module VirtualBox
18
18
 
19
19
  interface_dir = File.expand_path(File.join(File.dirname(__FILE__), "interface"))
20
20
  Dir[File.join(interface_dir, "*")].each do |f|
21
- p "Checking: #{f}"
22
21
  return if File.directory?(f) && initialize_for_version(File.basename(f))
23
22
  end
24
23
  end
@@ -34,7 +33,6 @@ module VirtualBox
34
33
  # Check if they match or not.
35
34
  return false if vb_version.length == version.length
36
35
  (0...(version.length)).each do |i|
37
- p "Checking: #{version[i,1]} to #{vb_version[i,1]}"
38
36
  next if version[i,1] == "x"
39
37
  return false if version[i,1] != vb_version[i,1]
40
38
  end
@@ -12,15 +12,23 @@ module VirtualBox
12
12
  end
13
13
 
14
14
  # Returns the version string of the VirtualBox installed, ex. "3.1.6"
15
- def version
16
- Lib.lib.virtualbox.version
15
+ # This string is cached since the version typically doesn't change
16
+ # during runtime. If you must refresh the version, send the boolean
17
+ # `true` as the first parameter.
18
+ def version(refresh=false)
19
+ @_version = Lib.lib.virtualbox.version if @_version.nil? || refresh
20
+ @_version
17
21
  rescue Exception
18
22
  nil
19
23
  end
20
24
 
21
25
  # Returns the revision string of the VirtualBox installed, ex. "51742"
22
- def revision
23
- Lib.lib.virtualbox.revision.to_s
26
+ # This string is cached since the revision doesn't typically change during
27
+ # runtime. If you must refresh the version, send the boolean `true` as the
28
+ # first parameter.
29
+ def revision(refresh=false)
30
+ @_revision = Lib.lib.virtualbox.revision.to_s if @_revision.nil? || refresh
31
+ @_revision
24
32
  end
25
33
  end
26
34
  end
@@ -30,16 +30,30 @@ class VersionTest < Test::Unit::TestCase
30
30
  should "return the version" do
31
31
  version = mock("version")
32
32
  @vbox.expects(:version).returns(version)
33
- assert_equal version, @module.version
33
+ assert_equal version, @module.version(true)
34
+ end
35
+
36
+ should "cache the version" do
37
+ @vbox.expects(:version).once.returns("v")
38
+ assert_equal "v", @module.version(true)
39
+ assert_equal "v", @module.version
40
+ assert_equal "v", @module.version
34
41
  end
35
42
 
36
43
  should "return nil if an error occurs" do
37
44
  @vbox.expects(:version).raises(LoadError)
38
- assert @module.version.nil?
45
+ assert @module.version(true).nil?
39
46
  end
40
47
 
41
48
  should "return the revision" do
42
49
  @vbox.expects(:revision).returns(7)
50
+ assert_equal "7", @module.revision(true)
51
+ end
52
+
53
+ should "cache the revision" do
54
+ @vbox.expects(:revision).once.returns(7)
55
+ assert_equal "7", @module.revision(true)
56
+ assert_equal "7", @module.revision
43
57
  assert_equal "7", @module.revision
44
58
  end
45
59
  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.7.4"
8
+ s.version = "0.7.5"
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-07-19}
12
+ s.date = %q{2010-07-20}
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 = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtualbox
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 4
10
- version: 0.7.4
9
+ - 5
10
+ version: 0.7.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mitchell Hashimoto
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-19 00:00:00 -07:00
18
+ date: 2010-07-20 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency