libvirt-ruby-mapping 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/libvirt-ruby-mapping.rb +2 -2
- data/lib/libvirt-ruby-mapping/connect.rb +2 -2
- data/lib/libvirt-ruby-mapping/version.rb +1 -1
- data/spec/libvirt-ruby-mapping/connect/open_read_only_spec.rb +5 -1
- data/spec/libvirt-ruby-mapping/connect/open_spec.rb +5 -1
- data/spec/libvirt-ruby-mapping_spec.rb +10 -2
- metadata +7 -7
data/lib/libvirt-ruby-mapping.rb
CHANGED
@@ -5,12 +5,12 @@ module Libvirt
|
|
5
5
|
autoload :Connect, 'libvirt-ruby-mapping/connect'
|
6
6
|
|
7
7
|
def self.initialize
|
8
|
-
virInitialize(:int) unless
|
8
|
+
virInitialize(:int) unless respond_to?(:virInitialize)
|
9
9
|
virInitialize
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.version
|
13
|
-
virGetVersion(:pointer, :string, :pointer, :int) unless
|
13
|
+
virGetVersion(:pointer, :string, :pointer, :int) unless respond_to?(:virGetVersion)
|
14
14
|
p = FFI::MemoryPointer.new(:ulong)
|
15
15
|
virGetVersion(p, nil, nil)
|
16
16
|
version = p.get_ulong(0)
|
@@ -4,12 +4,12 @@ module Libvirt
|
|
4
4
|
extend Libvirt::Ruby
|
5
5
|
|
6
6
|
def self.open(uri)
|
7
|
-
virConnectOpen(:string, :pointer) unless
|
7
|
+
virConnectOpen(:string, :pointer) unless respond_to?(:virConnectOpen)
|
8
8
|
virConnectOpen(uri)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.open_read_only(uri)
|
12
|
-
virConnectOpenReadOnly(:string, :pointer) unless
|
12
|
+
virConnectOpenReadOnly(:string, :pointer) unless respond_to?(:virConnectOpenReadOnly)
|
13
13
|
virConnectOpenReadOnly(uri)
|
14
14
|
end
|
15
15
|
end
|
@@ -15,6 +15,10 @@ describe Libvirt::Ruby::Connect do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when virConnectOpenReadOnly is not attached yet" do
|
18
|
+
before :each do
|
19
|
+
connect.stub(:respond_to?).with(:virConnectOpenReadOnly).and_return(false)
|
20
|
+
end
|
21
|
+
|
18
22
|
it "should attach it" do
|
19
23
|
connect.should_receive(:virConnectOpenReadOnly).with(:string, :pointer)
|
20
24
|
end
|
@@ -22,7 +26,7 @@ describe Libvirt::Ruby::Connect do
|
|
22
26
|
|
23
27
|
context "when virConnectOpenReadOnly is already attached" do
|
24
28
|
before :each do
|
25
|
-
connect.stub(:
|
29
|
+
connect.stub(:respond_to?).with(:virConnectOpenReadOnly).and_return(true)
|
26
30
|
end
|
27
31
|
|
28
32
|
it "should not try to attach it again" do
|
@@ -15,6 +15,10 @@ describe Libvirt::Ruby::Connect do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when virConnectOpen is not attached yet" do
|
18
|
+
before :each do
|
19
|
+
connect.stub(:respond_to?).with(:virConnectOpen).and_return(false)
|
20
|
+
end
|
21
|
+
|
18
22
|
it "should attach it" do
|
19
23
|
connect.should_receive(:virConnectOpen).with(:string, :pointer)
|
20
24
|
end
|
@@ -22,7 +26,7 @@ describe Libvirt::Ruby::Connect do
|
|
22
26
|
|
23
27
|
context "when virConnectOpen is already attached" do
|
24
28
|
before :each do
|
25
|
-
connect.stub(:
|
29
|
+
connect.stub(:respond_to?).with(:virConnectOpen).and_return(true)
|
26
30
|
end
|
27
31
|
|
28
32
|
it "should not try to attach it again" do
|
@@ -15,6 +15,10 @@ describe Libvirt::Ruby do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when virInitialize is not attached yet" do
|
18
|
+
before :each do
|
19
|
+
libvirt.stub(:respond_to?).with(:virInitialize).and_return(false)
|
20
|
+
end
|
21
|
+
|
18
22
|
it "should attach it" do
|
19
23
|
libvirt.should_receive(:virInitialize).with(:int)
|
20
24
|
end
|
@@ -22,7 +26,7 @@ describe Libvirt::Ruby do
|
|
22
26
|
|
23
27
|
context "when virInitialize is already attached" do
|
24
28
|
before :each do
|
25
|
-
libvirt.stub(:
|
29
|
+
libvirt.stub(:respond_to?).with(:virInitialize).and_return(true)
|
26
30
|
end
|
27
31
|
|
28
32
|
it "should not try to attach it again" do
|
@@ -44,6 +48,10 @@ describe Libvirt::Ruby do
|
|
44
48
|
end
|
45
49
|
|
46
50
|
context "when virGetVersion is not attached yet" do
|
51
|
+
before :each do
|
52
|
+
libvirt.stub(:respond_to?).with(:virGetVersion).and_return(false)
|
53
|
+
end
|
54
|
+
|
47
55
|
it "should attach it" do
|
48
56
|
libvirt.should_receive(:virGetVersion).with(:pointer, :string, :pointer, :int)
|
49
57
|
libvirt.version
|
@@ -52,7 +60,7 @@ describe Libvirt::Ruby do
|
|
52
60
|
|
53
61
|
context "when virGetVersion is already attached" do
|
54
62
|
before :each do
|
55
|
-
libvirt.stub(:
|
63
|
+
libvirt.stub(:respond_to?).with(:virGetVersion).and_return(true)
|
56
64
|
end
|
57
65
|
|
58
66
|
it "should not try to attach it again" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libvirt-ruby-mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: libvirt-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &5626760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>'
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *5626760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &5626060 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *5626060
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &5625060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 2.5.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *5625060
|
47
47
|
description: Libvirt Mapping of C function to Ruby Class and methods
|
48
48
|
email: plribeiro3000@gmail.com
|
49
49
|
executables: []
|