curl_ffi 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +32 -0
- data/Rakefile +30 -0
- data/curl_ffi.gemspec +27 -17
- data/examples/evented_multi.rb +1 -1
- data/examples/perform_multi.rb +1 -1
- data/examples/select_multi.rb +1 -1
- data/lib/bindings.rb +985 -0
- data/lib/curl_ffi/version.rb +1 -1
- data/lib/curl_ffi.rb +2 -7
- data/spec/{curl → curl_ffi}/easy_spec.rb +14 -14
- data/spec/{curl → curl_ffi}/multi_spec.rb +17 -17
- data/spec/spec_helper.rb +5 -2
- metadata +10 -10
- data/lib/curl_ffi/curl_bindings.rb +0 -985
data/lib/curl_ffi/version.rb
CHANGED
data/lib/curl_ffi.rb
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
-
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
1
|
|
4
|
-
require
|
5
|
-
|
6
|
-
require "curl_ffi/ffi_bindings"
|
2
|
+
require "ffi"
|
3
|
+
require "bindings"
|
7
4
|
|
8
5
|
module CurlFFI
|
9
|
-
extend CurlFFI::CurlBindings
|
10
|
-
|
11
6
|
autoload :Easy, "curl_ffi/easy"
|
12
7
|
autoload :Multi, "curl_ffi/multi"
|
13
8
|
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require "spec_helper"
|
1
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
2
|
|
3
|
-
|
4
|
-
describe Easy
|
5
|
-
it "should return a new
|
6
|
-
Easy.new.should be_a(Easy)
|
3
|
+
describe CurlFFI::Easy do
|
4
|
+
describe "when calling Easy.new" do
|
5
|
+
it "should return a new CurlFFI::Easy object" do
|
6
|
+
CurlFFI::Easy.new.should be_a(CurlFFI::Easy)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
describe Easy do
|
10
|
+
describe "CurlFFI::Easy" do
|
11
11
|
before :each do
|
12
|
-
@easy = Easy.new
|
12
|
+
@easy = CurlFFI::Easy.new
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "#dup" do
|
16
|
-
it "should return a new
|
17
|
-
@easy.dup.should be_a(Easy)
|
16
|
+
it "should return a new CurlFFI::Easy object" do
|
17
|
+
@easy.dup.should be_a(CurlFFI::Easy)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should have a seperate libCurl handle" do
|
@@ -31,20 +31,20 @@ module Curl
|
|
31
31
|
|
32
32
|
describe "#setopt" do
|
33
33
|
it "should correctly set string options" do
|
34
|
-
@easy.setopt(OPTION[:URL], "http://google.de")
|
34
|
+
@easy.setopt(CurlFFI::OPTION[:URL], "http://google.de")
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should correctly set string options" do
|
38
|
-
@easy.setopt(OPTION[:PORT], 123)
|
38
|
+
@easy.setopt(CurlFFI::OPTION[:PORT], 123)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "#getinfo" do
|
43
43
|
it "should return internal information" do
|
44
|
-
@easy.getinfo(INFO[:EFFECTIVE_URL]).should == ""
|
44
|
+
@easy.getinfo(CurlFFI::INFO[:EFFECTIVE_URL]).should == ""
|
45
45
|
|
46
|
-
@easy.setopt(OPTION[:URL], "http://google.de")
|
47
|
-
@easy.getinfo(INFO[:EFFECTIVE_URL]).should == "http://google.de"
|
46
|
+
@easy.setopt(CurlFFI::OPTION[:URL], "http://google.de")
|
47
|
+
@easy.getinfo(CurlFFI::INFO[:EFFECTIVE_URL]).should == "http://google.de"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require "spec_helper"
|
1
|
+
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
2
|
|
3
|
-
|
4
|
-
describe Multi
|
5
|
-
it "should return a new
|
6
|
-
Multi.new.should be_a(Multi)
|
3
|
+
describe CurlFFI::Multi do
|
4
|
+
describe "CurlFFI::Multi.new" do
|
5
|
+
it "should return a new CurlFFI::Easy object" do
|
6
|
+
CurlFFI::Multi.new.should be_a(CurlFFI::Multi)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
describe Multi do
|
10
|
+
describe "Multi should work" do
|
11
11
|
before :each do
|
12
|
-
@multi = Multi.new
|
13
|
-
@easy = Easy.new
|
14
|
-
@easy.setopt(OPTION[:PROXY], "")
|
12
|
+
@multi = CurlFFI::Multi.new
|
13
|
+
@easy = CurlFFI::Easy.new
|
14
|
+
@easy.setopt(CurlFFI::OPTION[:PROXY], "")
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#add_handle" do
|
@@ -25,13 +25,13 @@ module Curl
|
|
25
25
|
@multi.info_read_next.should be_nil
|
26
26
|
end
|
27
27
|
|
28
|
-
it "should return
|
29
|
-
@easy.setopt(OPTION[:URL], "http://google.de")
|
28
|
+
it "should return CurlFFI::Message objects when messages are available" do
|
29
|
+
@easy.setopt(CurlFFI::OPTION[:URL], "http://google.de")
|
30
30
|
@multi.add_handle(@easy)
|
31
31
|
|
32
32
|
@multi.perform while @multi.running != 0
|
33
33
|
message = @multi.info_read_next
|
34
|
-
message.should be_a(
|
34
|
+
message.should be_a(CurlFFI::Message)
|
35
35
|
message[:msg].should == :DONE
|
36
36
|
end
|
37
37
|
end
|
@@ -41,15 +41,15 @@ module Curl
|
|
41
41
|
@multi.info_read_all.should == []
|
42
42
|
end
|
43
43
|
|
44
|
-
it "should return an array of
|
45
|
-
@easy.setopt(OPTION[:URL], "http://google.de")
|
44
|
+
it "should return an array of CurlFFI::Message objects when messages are available" do
|
45
|
+
@easy.setopt(CurlFFI::OPTION[:URL], "http://google.de")
|
46
46
|
@multi.add_handle(@easy)
|
47
47
|
|
48
48
|
@multi.perform while @multi.running != 0
|
49
49
|
messages = @multi.info_read_all
|
50
50
|
messages.size.should == 1
|
51
51
|
|
52
|
-
messages.first.should be_a(
|
52
|
+
messages.first.should be_a(CurlFFI::Message)
|
53
53
|
messages.first[:msg].should == :DONE
|
54
54
|
end
|
55
55
|
end
|
@@ -60,7 +60,7 @@ module Curl
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should return the timeout till the next call to #perform" do
|
63
|
-
@easy.setopt(OPTION[:URL], "http://google.de")
|
63
|
+
@easy.setopt(CurlFFI::OPTION[:URL], "http://google.de")
|
64
64
|
@multi.add_handle(@easy)
|
65
65
|
|
66
66
|
@multi.timeout.should == 1
|
@@ -71,7 +71,7 @@ module Curl
|
|
71
71
|
|
72
72
|
describe "#perform" do
|
73
73
|
before :each do
|
74
|
-
@easy.setopt(OPTION[:URL], "http://google.de")
|
74
|
+
@easy.setopt(CurlFFI::OPTION[:URL], "http://google.de")
|
75
75
|
@multi.add_handle(@easy)
|
76
76
|
end
|
77
77
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Arthur Schreiber
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-06 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -56,17 +56,19 @@ extra_rdoc_files: []
|
|
56
56
|
files:
|
57
57
|
- .gitignore
|
58
58
|
- Gemfile
|
59
|
+
- Gemfile.lock
|
60
|
+
- Rakefile
|
59
61
|
- curl_ffi.gemspec
|
60
62
|
- examples/evented_multi.rb
|
61
63
|
- examples/perform_multi.rb
|
62
64
|
- examples/select_multi.rb
|
65
|
+
- lib/bindings.rb
|
63
66
|
- lib/curl_ffi.rb
|
64
|
-
- lib/curl_ffi/curl_bindings.rb
|
65
67
|
- lib/curl_ffi/easy.rb
|
66
68
|
- lib/curl_ffi/multi.rb
|
67
69
|
- lib/curl_ffi/version.rb
|
68
|
-
- spec/
|
69
|
-
- spec/
|
70
|
+
- spec/curl_ffi/easy_spec.rb
|
71
|
+
- spec/curl_ffi/multi_spec.rb
|
70
72
|
- spec/spec_helper.rb
|
71
73
|
has_rdoc: true
|
72
74
|
homepage: http://github.com/nokarma/curl-ffi
|
@@ -102,7 +104,5 @@ rubygems_version: 1.3.7
|
|
102
104
|
signing_key:
|
103
105
|
specification_version: 3
|
104
106
|
summary: An FFI based libCurl interface
|
105
|
-
test_files:
|
106
|
-
|
107
|
-
- spec/curl/multi_spec.rb
|
108
|
-
- spec/spec_helper.rb
|
107
|
+
test_files: []
|
108
|
+
|