streamly_ffi 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,4 +2,5 @@
2
2
  *.o
3
3
  Makefile
4
4
  *.tmproj
5
-
5
+ pkg
6
+ *.gem
@@ -5,12 +5,21 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
5
5
  require 'rubygems'
6
6
  require 'net/http'
7
7
  require 'rest_client'
8
+ require 'curb'
8
9
  require 'streamly'
10
+ require 'streamly_ffi'
9
11
  require 'benchmark'
10
12
 
11
13
  url = ARGV[0]
12
14
 
13
15
  Benchmark.bmbm do |x|
16
+ x.report do
17
+ puts "StreamlyFFI"
18
+ (ARGV[1] || 1).to_i.times do
19
+ StreamlyFFI.get(url)
20
+ end
21
+ end
22
+
14
23
  x.report do
15
24
  puts "Streamly"
16
25
  (ARGV[1] || 1).to_i.times do
@@ -19,7 +28,14 @@ Benchmark.bmbm do |x|
19
28
  end
20
29
 
21
30
  x.report do
22
- puts "Shell out to curl"
31
+ puts "Curb"
32
+ (ARGV[1] || 1).to_i.times do
33
+ Curl::Easy.perform(url)
34
+ end
35
+ end
36
+
37
+ x.report do
38
+ puts "`curl`"
23
39
  (ARGV[1] || 1).to_i.times do
24
40
  `curl -s --compressed #{url}`
25
41
  end
@@ -1,3 +1,3 @@
1
1
  module StreamlyFFI
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -10,21 +10,21 @@ describe StreamlyFFI::Request do
10
10
  describe "HEAD" do
11
11
  describe "basic" do
12
12
  it "should perform a basic request" do
13
- resp = Streamly.head('localhost:4567')
13
+ resp = StreamlyFFI.head('localhost:4567')
14
14
  resp.should_not be_nil
15
15
  end
16
16
  =begin
17
17
  if RUBY_VERSION =~ /^1.9/
18
18
  it "should default to utf-8 if Encoding.default_internal is nil" do
19
19
  Encoding.default_internal = nil
20
- Streamly.head('localhost:4567').encoding.should eql(Encoding.find('utf-8'))
20
+ StreamlyFFI.head('localhost:4567').encoding.should eql(Encoding.find('utf-8'))
21
21
  end
22
22
 
23
23
  it "should use Encoding.default_internal" do
24
24
  Encoding.default_internal = Encoding.find('utf-8')
25
- Streamly.head('localhost:4567').encoding.should eql(Encoding.default_internal)
25
+ StreamlyFFI.head('localhost:4567').encoding.should eql(Encoding.default_internal)
26
26
  Encoding.default_internal = Encoding.find('us-ascii')
27
- Streamly.head('localhost:4567').encoding.should eql(Encoding.default_internal)
27
+ StreamlyFFI.head('localhost:4567').encoding.should eql(Encoding.default_internal)
28
28
  end
29
29
  end
30
30
  =end
@@ -33,7 +33,7 @@ describe StreamlyFFI::Request do
33
33
  describe "streaming" do
34
34
  it "should perform a basic request and stream header chunks to the caller" do
35
35
  streamed_response = ""
36
- resp = Streamly.head('localhost:4567') do |chunk|
36
+ resp = StreamlyFFI.head('localhost:4567') do |chunk|
37
37
  chunk.should_not be_empty
38
38
  streamed_response << chunk
39
39
  end
@@ -44,18 +44,18 @@ describe StreamlyFFI::Request do
44
44
  if RUBY_VERSION =~ /^1.9/
45
45
  it "should default to utf-8 if Encoding.default_internal is nil" do
46
46
  Encoding.default_internal = nil
47
- Streamly.head('localhost:4567') do |chunk|
47
+ StreamlyFFI.head('localhost:4567') do |chunk|
48
48
  chunk.encoding.should eql(Encoding.find('utf-8'))
49
49
  end
50
50
  end
51
51
 
52
52
  it "should use Encoding.default_internal" do
53
53
  Encoding.default_internal = Encoding.find('utf-8')
54
- Streamly.head('localhost:4567') do |chunk|
54
+ StreamlyFFI.head('localhost:4567') do |chunk|
55
55
  chunk.encoding.should eql(Encoding.default_internal)
56
56
  end
57
57
  Encoding.default_internal = Encoding.find('us-ascii')
58
- Streamly.head('localhost:4567') do |chunk|
58
+ StreamlyFFI.head('localhost:4567') do |chunk|
59
59
  chunk.encoding.should eql(Encoding.default_internal)
60
60
  end
61
61
  end
@@ -67,21 +67,21 @@ describe StreamlyFFI::Request do
67
67
  describe "GET" do
68
68
  describe "basic" do
69
69
  it "should perform a basic request" do
70
- resp = Streamly.get('localhost:4567/?name=brian')
70
+ resp = StreamlyFFI.get('localhost:4567/?name=brian')
71
71
  resp.should eql(@response)
72
72
  end
73
73
  =begin
74
74
  if RUBY_VERSION =~ /^1.9/
75
75
  it "should default to utf-8 if Encoding.default_internal is nil" do
76
76
  Encoding.default_internal = nil
77
- Streamly.get('localhost:4567').encoding.should eql(Encoding.find('utf-8'))
77
+ StreamlyFFI.get('localhost:4567').encoding.should eql(Encoding.find('utf-8'))
78
78
  end
79
79
 
80
80
  it "should use Encoding.default_internal" do
81
81
  Encoding.default_internal = Encoding.find('utf-8')
82
- Streamly.get('localhost:4567').encoding.should eql(Encoding.default_internal)
82
+ StreamlyFFI.get('localhost:4567').encoding.should eql(Encoding.default_internal)
83
83
  Encoding.default_internal = Encoding.find('us-ascii')
84
- Streamly.get('localhost:4567').encoding.should eql(Encoding.default_internal)
84
+ StreamlyFFI.get('localhost:4567').encoding.should eql(Encoding.default_internal)
85
85
  end
86
86
  end
87
87
  =end
@@ -90,7 +90,7 @@ describe StreamlyFFI::Request do
90
90
  describe "streaming" do
91
91
  it "should perform a basic request and stream the response to the caller" do
92
92
  streamed_response = ''
93
- resp = Streamly.get('localhost:4567/?name=brian') do |chunk|
93
+ resp = StreamlyFFI.get('localhost:4567/?name=brian') do |chunk|
94
94
  chunk.should_not be_empty
95
95
  streamed_response << chunk
96
96
  end
@@ -101,18 +101,18 @@ describe StreamlyFFI::Request do
101
101
  if RUBY_VERSION =~ /^1.9/
102
102
  it "should default to utf-8 if Encoding.default_internal is nil" do
103
103
  Encoding.default_internal = nil
104
- Streamly.get('localhost:4567') do |chunk|
104
+ StreamlyFFI.get('localhost:4567') do |chunk|
105
105
  chunk.encoding.should eql(Encoding.find('utf-8'))
106
106
  end
107
107
  end
108
108
 
109
109
  it "should use Encoding.default_internal" do
110
110
  Encoding.default_internal = Encoding.find('utf-8')
111
- Streamly.get('localhost:4567') do |chunk|
111
+ StreamlyFFI.get('localhost:4567') do |chunk|
112
112
  chunk.encoding.should eql(Encoding.default_internal)
113
113
  end
114
114
  Encoding.default_internal = Encoding.find('us-ascii')
115
- Streamly.get('localhost:4567') do |chunk|
115
+ StreamlyFFI.get('localhost:4567') do |chunk|
116
116
  chunk.encoding.should eql(Encoding.default_internal)
117
117
  end
118
118
  end
@@ -124,21 +124,21 @@ describe StreamlyFFI::Request do
124
124
  describe "POST" do
125
125
  describe "basic" do
126
126
  it "should perform a basic request" do
127
- resp = Streamly.post('localhost:4567', 'name=brian')
127
+ resp = StreamlyFFI.post('localhost:4567', 'name=brian')
128
128
  resp.should eql(@response)
129
129
  end
130
130
  =begin
131
131
  if RUBY_VERSION =~ /^1.9/
132
132
  it "should default to utf-8 if Encoding.default_internal is nil" do
133
133
  Encoding.default_internal = nil
134
- Streamly.post('localhost:4567', 'name=brian').encoding.should eql(Encoding.find('utf-8'))
134
+ StreamlyFFI.post('localhost:4567', 'name=brian').encoding.should eql(Encoding.find('utf-8'))
135
135
  end
136
136
 
137
137
  it "should use Encoding.default_internal" do
138
138
  Encoding.default_internal = Encoding.find('utf-8')
139
- Streamly.post('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
139
+ StreamlyFFI.post('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
140
140
  Encoding.default_internal = Encoding.find('us-ascii')
141
- Streamly.post('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
141
+ StreamlyFFI.post('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
142
142
  end
143
143
  end
144
144
  =end
@@ -147,7 +147,7 @@ describe StreamlyFFI::Request do
147
147
  describe "streaming" do
148
148
  it "should perform a basic request and stream the response to the caller" do
149
149
  streamed_response = ''
150
- resp = Streamly.post('localhost:4567', 'name=brian') do |chunk|
150
+ resp = StreamlyFFI.post('localhost:4567', 'name=brian') do |chunk|
151
151
  chunk.should_not be_empty
152
152
  streamed_response << chunk
153
153
  end
@@ -158,18 +158,18 @@ describe StreamlyFFI::Request do
158
158
  if RUBY_VERSION =~ /^1.9/
159
159
  it "should default to utf-8 if Encoding.default_internal is nil" do
160
160
  Encoding.default_internal = nil
161
- Streamly.post('localhost:4567', 'name=brian') do |chunk|
161
+ StreamlyFFI.post('localhost:4567', 'name=brian') do |chunk|
162
162
  chunk.encoding.should eql(Encoding.find('utf-8'))
163
163
  end
164
164
  end
165
165
 
166
166
  it "should use Encoding.default_internal" do
167
167
  Encoding.default_internal = Encoding.find('utf-8')
168
- Streamly.post('localhost:4567', 'name=brian') do |chunk|
168
+ StreamlyFFI.post('localhost:4567', 'name=brian') do |chunk|
169
169
  chunk.encoding.should eql(Encoding.default_internal)
170
170
  end
171
171
  Encoding.default_internal = Encoding.find('us-ascii')
172
- Streamly.post('localhost:4567', 'name=brian') do |chunk|
172
+ StreamlyFFI.post('localhost:4567', 'name=brian') do |chunk|
173
173
  chunk.encoding.should eql(Encoding.default_internal)
174
174
  end
175
175
  end
@@ -181,21 +181,21 @@ describe StreamlyFFI::Request do
181
181
  describe "PUT" do
182
182
  describe "basic" do
183
183
  it "should perform a basic request" do
184
- resp = Streamly.put('localhost:4567', 'name=brian')
184
+ resp = StreamlyFFI.put('localhost:4567', 'name=brian')
185
185
  resp.should eql(@response)
186
186
  end
187
187
  =begin
188
188
  if RUBY_VERSION =~ /^1.9/
189
189
  it "should default to utf-8 if Encoding.default_internal is nil" do
190
190
  Encoding.default_internal = nil
191
- Streamly.put('localhost:4567', 'name=brian').encoding.should eql(Encoding.find('utf-8'))
191
+ StreamlyFFI.put('localhost:4567', 'name=brian').encoding.should eql(Encoding.find('utf-8'))
192
192
  end
193
193
 
194
194
  it "should use Encoding.default_internal" do
195
195
  Encoding.default_internal = Encoding.find('utf-8')
196
- Streamly.put('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
196
+ StreamlyFFI.put('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
197
197
  Encoding.default_internal = Encoding.find('us-ascii')
198
- Streamly.put('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
198
+ StreamlyFFI.put('localhost:4567', 'name=brian').encoding.should eql(Encoding.default_internal)
199
199
  end
200
200
  end
201
201
  =end
@@ -204,7 +204,7 @@ describe StreamlyFFI::Request do
204
204
  describe "streaming" do
205
205
  it "should perform a basic request and stream the response to the caller" do
206
206
  streamed_response = ''
207
- resp = Streamly.put('localhost:4567', 'name=brian') do |chunk|
207
+ resp = StreamlyFFI.put('localhost:4567', 'name=brian') do |chunk|
208
208
  chunk.should_not be_empty
209
209
  streamed_response << chunk
210
210
  end
@@ -215,18 +215,18 @@ describe StreamlyFFI::Request do
215
215
  if RUBY_VERSION =~ /^1.9/
216
216
  it "should default to utf-8 if Encoding.default_internal is nil" do
217
217
  Encoding.default_internal = nil
218
- Streamly.put('localhost:4567', 'name=brian') do |chunk|
218
+ StreamlyFFI.put('localhost:4567', 'name=brian') do |chunk|
219
219
  chunk.encoding.should eql(Encoding.find('utf-8'))
220
220
  end
221
221
  end
222
222
 
223
223
  it "should use Encoding.default_internal" do
224
224
  Encoding.default_internal = Encoding.find('utf-8')
225
- Streamly.put('localhost:4567', 'name=brian') do |chunk|
225
+ StreamlyFFI.put('localhost:4567', 'name=brian') do |chunk|
226
226
  chunk.encoding.should eql(Encoding.default_internal)
227
227
  end
228
228
  Encoding.default_internal = Encoding.find('us-ascii')
229
- Streamly.put('localhost:4567', 'name=brian') do |chunk|
229
+ StreamlyFFI.put('localhost:4567', 'name=brian') do |chunk|
230
230
  chunk.encoding.should eql(Encoding.default_internal)
231
231
  end
232
232
  end
@@ -238,20 +238,20 @@ describe StreamlyFFI::Request do
238
238
  describe "DELETE" do
239
239
  describe "basic" do
240
240
  it "should perform a basic request" do
241
- resp = Streamly.delete('localhost:4567/?name=brian').should eql(@response)
241
+ resp = StreamlyFFI.delete('localhost:4567/?name=brian').should eql(@response)
242
242
  end
243
243
  =begin
244
244
  if RUBY_VERSION =~ /^1.9/
245
245
  it "should default to utf-8 if Encoding.default_internal is nil" do
246
246
  Encoding.default_internal = nil
247
- Streamly.delete('localhost:4567/?name=brian').encoding.should eql(Encoding.find('utf-8'))
247
+ StreamlyFFI.delete('localhost:4567/?name=brian').encoding.should eql(Encoding.find('utf-8'))
248
248
  end
249
249
 
250
250
  it "should use Encoding.default_internal" do
251
251
  Encoding.default_internal = Encoding.find('utf-8')
252
- Streamly.delete('localhost:4567/?name=brian').encoding.should eql(Encoding.default_internal)
252
+ StreamlyFFI.delete('localhost:4567/?name=brian').encoding.should eql(Encoding.default_internal)
253
253
  Encoding.default_internal = Encoding.find('us-ascii')
254
- Streamly.delete('localhost:4567/?name=brian').encoding.should eql(Encoding.default_internal)
254
+ StreamlyFFI.delete('localhost:4567/?name=brian').encoding.should eql(Encoding.default_internal)
255
255
  end
256
256
  end
257
257
  =end
@@ -260,7 +260,7 @@ describe StreamlyFFI::Request do
260
260
  describe "streaming" do
261
261
  it "should perform a basic request and stream the response to the caller" do
262
262
  streamed_response = ''
263
- resp = Streamly.delete('localhost:4567/?name=brian') do |chunk|
263
+ resp = StreamlyFFI.delete('localhost:4567/?name=brian') do |chunk|
264
264
  chunk.should_not be_empty
265
265
  streamed_response << chunk
266
266
  end
@@ -271,18 +271,18 @@ describe StreamlyFFI::Request do
271
271
  if RUBY_VERSION =~ /^1.9/
272
272
  it "should default to utf-8 if Encoding.default_internal is nil" do
273
273
  Encoding.default_internal = nil
274
- Streamly.delete('localhost:4567/?name=brian') do |chunk|
274
+ StreamlyFFI.delete('localhost:4567/?name=brian') do |chunk|
275
275
  chunk.encoding.should eql(Encoding.find('utf-8'))
276
276
  end
277
277
  end
278
278
 
279
279
  it "should use Encoding.default_internal" do
280
280
  Encoding.default_internal = Encoding.find('utf-8')
281
- Streamly.delete('localhost:4567/?name=brian') do |chunk|
281
+ StreamlyFFI.delete('localhost:4567/?name=brian') do |chunk|
282
282
  chunk.encoding.should eql(Encoding.default_internal)
283
283
  end
284
284
  Encoding.default_internal = Encoding.find('us-ascii')
285
- Streamly.delete('localhost:4567/?name=brian') do |chunk|
285
+ StreamlyFFI.delete('localhost:4567/?name=brian') do |chunk|
286
286
  chunk.encoding.should eql(Encoding.default_internal)
287
287
  end
288
288
  end
data/streamly_ffi.gemspec CHANGED
@@ -5,37 +5,25 @@
5
5
 
6
6
  $:.push File.expand_path("../lib", __FILE__)
7
7
 
8
+ require "date"
8
9
  require "streamly_ffi/version"
9
10
 
10
11
  Gem::Specification.new do |s|
11
- s.name = %q{streamly_ffi}
12
- s.version = StreamlyFFI::VERSION
13
- s.platform = Gem::Platform::RUBY
14
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
15
- s.authors = ["Brian Lopez", "Scott Gonyea"]
16
- s.date = %q{2010-09-02}
17
- s.email = %q{seniorlopez@gmail.com}
18
- s.extensions = ["ext/extconf.rb"]
19
- s.extra_rdoc_files = [
20
- "README.rdoc"
21
- ]
22
- s.files = `git ls-files`.split("\n")
23
- s.homepage = %q{http://github.com/aitrus/streamly_ffi}
24
- s.rdoc_options = ["--charset=UTF-8"]
25
- s.require_paths = ["lib", "ext"]
26
- s.rubyforge_project = %q{streamly_ffi}
27
- s.rubygems_version = %q{1.3.7}
28
- s.summary = %q{A streaming REST client for Ruby, in C.}
29
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
+ s.name = "streamly_ffi"
13
+ s.version = StreamlyFFI::VERSION
14
+ s.summary = %q{A streaming Curl/HTTP/REST client for Ruby, in cross-Ruby FFI.}
15
+ s.description = %q{A streaming Curl/HTTP/REST client for Ruby, in cross-Ruby FFI. Using the CurlFFI RubyGem.}
16
+ s.authors = ["Brian Lopez", "Scott Gonyea"]
17
+ s.date = Date.today.to_s
18
+ s.email = %q{seniorlopez@gmail.com}
19
+ s.homepage = %q{http://github.com/aitrus/streamly_ffi}
30
20
 
31
- if s.respond_to? :specification_version then
32
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
33
- s.specification_version = 3
21
+ s.platform = Gem::Platform::RUBY
22
+ s.add_dependency "curl_ffi"
23
+ s.add_development_dependency "rspec"
34
24
 
35
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
36
- else
37
- end
38
- else
39
- end
25
+ s.files = `git ls-files`.split("\n")
26
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
+ s.require_paths = ["lib"]
40
28
  end
41
29
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Lopez
@@ -15,18 +15,43 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-02 00:00:00 -07:00
18
+ date: 2010-11-09 00:00:00 -08:00
19
19
  default_executable:
20
- dependencies: []
21
-
22
- description:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: curl_ffi
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rspec
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :development
46
+ version_requirements: *id002
47
+ description: A streaming Curl/HTTP/REST client for Ruby, in cross-Ruby FFI. Using the CurlFFI RubyGem.
23
48
  email: seniorlopez@gmail.com
24
49
  executables: []
25
50
 
26
- extensions:
27
- - ext/extconf.rb
28
- extra_rdoc_files:
29
- - README.rdoc
51
+ extensions: []
52
+
53
+ extra_rdoc_files: []
54
+
30
55
  files:
31
56
  - .gitignore
32
57
  - .rspec
@@ -62,11 +87,10 @@ homepage: http://github.com/aitrus/streamly_ffi
62
87
  licenses: []
63
88
 
64
89
  post_install_message:
65
- rdoc_options:
66
- - --charset=UTF-8
90
+ rdoc_options: []
91
+
67
92
  require_paths:
68
93
  - lib
69
- - ext
70
94
  required_ruby_version: !ruby/object:Gem::Requirement
71
95
  none: false
72
96
  requirements:
@@ -85,11 +109,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
109
  version: "0"
86
110
  requirements: []
87
111
 
88
- rubyforge_project: streamly_ffi
112
+ rubyforge_project:
89
113
  rubygems_version: 1.3.7
90
114
  signing_key:
91
115
  specification_version: 3
92
- summary: A streaming REST client for Ruby, in C.
116
+ summary: A streaming Curl/HTTP/REST client for Ruby, in cross-Ruby FFI.
93
117
  test_files:
94
118
  - spec/server.rb
95
119
  - spec/spec_helper.rb