typhoeus 0.1.24 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,311 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ # some of these tests assume that you have some local services running.
4
+ # ruby spec/servers/app.rb -p 3000
5
+ # ruby spec/servers/app.rb -p 3001
6
+ # ruby spec/servers/app.rb -p 3002
7
+ describe Typhoeus::Hydra do
8
+ before(:all) do
9
+ cache_class = Class.new do
10
+ def initialize
11
+ @cache = {}
12
+ end
13
+ def get(key)
14
+ @cache[key]
15
+ end
16
+ def set(key, object, timeout = 0)
17
+ @cache[key] = object
18
+ end
19
+ end
20
+ @cache = cache_class.new
21
+ end
22
+
23
+ it "has a singleton" do
24
+ Typhoeus::Hydra.hydra.should be_a Typhoeus::Hydra
25
+ end
26
+
27
+ it "has a setter for the singleton" do
28
+ Typhoeus::Hydra.hydra = :foo
29
+ Typhoeus::Hydra.hydra.should == :foo
30
+ Typhoeus::Hydra.hydra = Typhoeus::Hydra.new
31
+ end
32
+
33
+ context "#stub" do
34
+ before do
35
+ @hydra = Typhoeus::Hydra.new
36
+ @on_complete_handler_called = nil
37
+ @request = Typhoeus::Request.new("http://localhost:3000/foo")
38
+ @request.on_complete do |response|
39
+ @on_complete_handler_called = true
40
+ response.code.should == 404
41
+ response.headers.should == "whatever"
42
+ end
43
+ @response = Typhoeus::Response.new(:code => 404, :headers => "whatever", :body => "not found", :time => 0.1)
44
+ end
45
+
46
+ it "stubs requests to a specific URI" do
47
+ @hydra.stub(:get, "http://localhost:3000/foo").and_return(@response)
48
+ @hydra.queue(@request)
49
+ @hydra.run
50
+ @on_complete_handler_called.should be_true
51
+ @response.request.should == @request
52
+ end
53
+
54
+ it "stubs requests to URIs matching a pattern" do
55
+ @hydra.stub(:get, /foo/).and_return(@response)
56
+ @hydra.queue(@request)
57
+ @hydra.run
58
+ @on_complete_handler_called.should be_true
59
+ @response.request.should == @request
60
+ end
61
+
62
+ it "can clear stubs" do
63
+ @hydra.clear_stubs
64
+ end
65
+
66
+ it "clears out previously queued requests once they are called" do
67
+ @hydra.stub(:get, "asdf").and_return(@response)
68
+
69
+ call_count = 0
70
+ request = Typhoeus::Request.new("asdf")
71
+ request.on_complete do |response|
72
+ call_count += 1
73
+ end
74
+ @hydra.queue(request)
75
+ @hydra.run
76
+ call_count.should == 1
77
+ @hydra.run
78
+ call_count.should == 1
79
+ end
80
+
81
+ it "calls stubs for requests that are queued up in the on_complete of a first stub" do
82
+ @hydra.stub(:get, "asdf").and_return(@response)
83
+ @hydra.stub(:get, "bar").and_return(@response)
84
+
85
+ second_handler_called = false
86
+ request = Typhoeus::Request.new("asdf")
87
+ request.on_complete do |response|
88
+ r = Typhoeus::Request.new("bar")
89
+ r.on_complete do |res|
90
+ second_handler_called = true
91
+ end
92
+ @hydra.queue(r)
93
+ end
94
+ @hydra.queue(request)
95
+ @hydra.run
96
+
97
+ second_handler_called.should be_true
98
+ end
99
+
100
+ it "matches a stub only when the HTTP method also matches"
101
+ end
102
+
103
+ it "queues a request" do
104
+ hydra = Typhoeus::Hydra.new
105
+ hydra.queue Typhoeus::Request.new("http://localhost:3000")
106
+ end
107
+
108
+ it "runs a batch of requests" do
109
+ hydra = Typhoeus::Hydra.new
110
+ first = Typhoeus::Request.new("http://localhost:3000/first")
111
+ second = Typhoeus::Request.new("http://localhost:3001/second")
112
+ hydra.queue first
113
+ hydra.queue second
114
+ hydra.run
115
+ first.response.body.should include("first")
116
+ second.response.body.should include("second")
117
+ end
118
+
119
+ it "has a cache_setter proc" do
120
+ hydra = Typhoeus::Hydra.new
121
+ hydra.cache_setter do |request|
122
+ # @cache.set(request.cache_key, request.response, request.cache_timeout)
123
+ end
124
+ end
125
+
126
+ it "has a cache_getter" do
127
+ hydra = Typhoeus::Hydra.new
128
+ hydra.cache_getter do |request|
129
+ # @cache.get(request.cache_key) rescue nil
130
+ end
131
+ end
132
+
133
+ it "memoizes GET reqeusts" do
134
+ hydra = Typhoeus::Hydra.new
135
+ first = Typhoeus::Request.new("http://localhost:3000/foo", :params => {:delay => 1})
136
+ second = Typhoeus::Request.new("http://localhost:3000/foo", :params => {:delay => 1})
137
+ hydra.queue first
138
+ hydra.queue second
139
+ start_time = Time.now
140
+ hydra.run
141
+ first.response.body.should include("foo")
142
+ first.handled_response.body.should include("foo")
143
+ first.response.should == second.response
144
+ first.handled_response.should == second.handled_response
145
+ (Time.now - start_time).should < 1.2 # if it had run twice it would be ~ 2 seconds
146
+ end
147
+
148
+ it "can turn off memoization for GET requests" do
149
+ hydra = Typhoeus::Hydra.new
150
+ hydra.disable_memoization
151
+ first = Typhoeus::Request.new("http://localhost:3000/foo")
152
+ second = Typhoeus::Request.new("http://localhost:3000/foo")
153
+ hydra.queue first
154
+ hydra.queue second
155
+ hydra.run
156
+ first.response.body.should include("foo")
157
+ first.response.object_id.should_not == second.response.object_id
158
+ end
159
+
160
+ it "pulls GETs from cache" do
161
+ hydra = Typhoeus::Hydra.new
162
+ start_time = Time.now
163
+ hydra.cache_getter do |request|
164
+ @cache.get(request.cache_key) rescue nil
165
+ end
166
+ hydra.cache_setter do |request|
167
+ @cache.set(request.cache_key, request.response, request.cache_timeout)
168
+ end
169
+
170
+ first = Typhoeus::Request.new("http://localhost:3000/foo", :params => {:delay => 1})
171
+ @cache.set(first.cache_key, :foo, 60)
172
+ hydra.queue first
173
+ hydra.run
174
+ (Time.now - start_time).should < 0.1
175
+ first.response.should == :foo
176
+ end
177
+
178
+ it "sets GET responses to cache when the request has a cache_timeout value" do
179
+ hydra = Typhoeus::Hydra.new
180
+ hydra.cache_getter do |request|
181
+ @cache.get(request.cache_key) rescue nil
182
+ end
183
+ hydra.cache_setter do |request|
184
+ @cache.set(request.cache_key, request.response, request.cache_timeout)
185
+ end
186
+
187
+ first = Typhoeus::Request.new("http://localhost:3000/first", :cache_timeout => 0)
188
+ second = Typhoeus::Request.new("http://localhost:3000/second")
189
+ hydra.queue first
190
+ hydra.queue second
191
+ hydra.run
192
+ first.response.body.should include("first")
193
+ @cache.get(first.cache_key).should == first.response
194
+ @cache.get(second.cache_key).should be_nil
195
+ end
196
+
197
+ it "has a global on_complete" do
198
+ foo = nil
199
+ hydra = Typhoeus::Hydra.new
200
+ hydra.on_complete do |response|
201
+ foo = :called
202
+ end
203
+
204
+ first = Typhoeus::Request.new("http://localhost:3000/first")
205
+ hydra.queue first
206
+ hydra.run
207
+ first.response.body.should include("first")
208
+ foo.should == :called
209
+ end
210
+
211
+ it "has a global on_complete setter" do
212
+ foo = nil
213
+ hydra = Typhoeus::Hydra.new
214
+ proc = Proc.new {|response| foo = :called}
215
+ hydra.on_complete = proc
216
+
217
+ first = Typhoeus::Request.new("http://localhost:3000/first")
218
+ hydra.queue first
219
+ hydra.run
220
+ first.response.body.should include("first")
221
+ foo.should == :called
222
+ end
223
+
224
+ it "should reuse connections from the pool for a host"
225
+
226
+ it "should queue up requests while others are running" do
227
+ hydra = Typhoeus::Hydra.new
228
+
229
+ start_time = Time.now
230
+ @responses = []
231
+
232
+ request = Typhoeus::Request.new("http://localhost:3000/first", :params => {:delay => 1})
233
+ request.on_complete do |response|
234
+ @responses << response
235
+ response.body.should include("first")
236
+ end
237
+
238
+ request.after_complete do |object|
239
+ second_request = Typhoeus::Request.new("http://localhost:3001/second", :params => {:delay => 2})
240
+ second_request.on_complete do |response|
241
+ @responses << response
242
+ response.body.should include("second")
243
+ end
244
+ hydra.queue second_request
245
+ end
246
+ hydra.queue request
247
+
248
+ third_request = Typhoeus::Request.new("http://localhost:3002/third", :params => {:delay => 3})
249
+ third_request.on_complete do |response|
250
+ @responses << response
251
+ response.body.should include("third")
252
+ end
253
+ hydra.queue third_request
254
+
255
+ hydra.run
256
+ @responses.size.should == 3
257
+ (Time.now - start_time).should < 3.3
258
+ end
259
+
260
+ it "should fire and forget" do
261
+ # this test is totally hacky. I have no clue how to make it verify. I just look at the test servers
262
+ # to verify that stuff is running
263
+ hydra = Typhoeus::Hydra.new
264
+ first = Typhoeus::Request.new("http://localhost:3000/first?delay=1")
265
+ second = Typhoeus::Request.new("http://localhost:3001/second?delay=2")
266
+ hydra.queue first
267
+ hydra.queue second
268
+ hydra.fire_and_forget
269
+ third = Typhoeus::Request.new("http://localhost:3002/third?delay=3")
270
+ hydra.queue third
271
+ hydra.fire_and_forget
272
+ sleep 3 # have to do this or future tests may break.
273
+ end
274
+
275
+ it "should take the maximum number of concurrent requests as an argument" do
276
+ hydra = Typhoeus::Hydra.new(:max_concurrency => 2)
277
+ first = Typhoeus::Request.new("http://localhost:3000/first?delay=1")
278
+ second = Typhoeus::Request.new("http://localhost:3001/second?delay=1")
279
+ third = Typhoeus::Request.new("http://localhost:3002/third?delay=1")
280
+ hydra.queue first
281
+ hydra.queue second
282
+ hydra.queue third
283
+
284
+ start_time = Time.now
285
+ hydra.run
286
+ finish_time = Time.now
287
+
288
+ first.response.code.should == 200
289
+ second.response.code.should == 200
290
+ third.response.code.should == 200
291
+ (finish_time - start_time).should > 2.0
292
+ end
293
+
294
+ it "should respect the follow_location option when set on a request" do
295
+ hydra = Typhoeus::Hydra.new
296
+ request = Typhoeus::Request.new("http://localhost:3000/redirect", :follow_location => true)
297
+ hydra.queue request
298
+ hydra.run
299
+
300
+ request.response.code.should == 200
301
+ end
302
+
303
+ it "should pass through the max_redirects option when set on a request" do
304
+ hydra = Typhoeus::Hydra.new
305
+ request = Typhoeus::Request.new("http://localhost:3000/bad_redirect", :max_redirects => 5)
306
+ hydra.queue request
307
+ hydra.run
308
+
309
+ request.response.code.should == 302
310
+ end
311
+ end
@@ -4,7 +4,7 @@ describe Typhoeus do
4
4
  it "should be deprecated" do
5
5
  fail "This entire interface is deprecated!"
6
6
  end
7
-
7
+
8
8
  # before(:each) do
9
9
  # @klass = Class.new do
10
10
  # include Typhoeus
@@ -0,0 +1,195 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Typhoeus::Request do
4
+ describe "#params_string" do
5
+ it "should dump a sorted string" do
6
+ request = Typhoeus::Request.new(
7
+ "http://google.com",
8
+ :params => {
9
+ 'b' => 'fdsa',
10
+ 'a' => 'jlk',
11
+ 'c' => '789'
12
+ }
13
+ )
14
+
15
+ request.params_string.should == "a=jlk&b=fdsa&c=789"
16
+ end
17
+
18
+ it "should accept symboled keys" do
19
+ request = Typhoeus::Request.new('http://google.com',
20
+ :params => {
21
+ :b => 'fdsa',
22
+ :a => 'jlk',
23
+ :c => '789'
24
+ })
25
+ request.params_string.should == "a=jlk&b=fdsa&c=789"
26
+ end
27
+ end
28
+
29
+ describe "quick request methods" do
30
+ it "can run a GET synchronously" do
31
+ response = Typhoeus::Request.get("http://localhost:3000", :params => {:q => "hi"}, :headers => {:foo => "bar"})
32
+ response.code.should == 200
33
+ JSON.parse(response.body)["REQUEST_METHOD"].should == "GET"
34
+ end
35
+
36
+ it "can run a POST synchronously" do
37
+ response = Typhoeus::Request.post("http://localhost:3000", :params => {:q => "hi"}, :headers => {:foo => "bar"})
38
+ response.code.should == 200
39
+ json = JSON.parse(response.body)
40
+ json["REQUEST_METHOD"].should == "POST"
41
+ json["rack.request.query_hash"]["q"].should == "hi"
42
+ end
43
+
44
+ it "can run a PUT synchronously" do
45
+ response = Typhoeus::Request.put("http://localhost:3000", :params => {:q => "hi"}, :headers => {:foo => "bar"})
46
+ response.code.should == 200
47
+ JSON.parse(response.body)["REQUEST_METHOD"].should == "PUT"
48
+ end
49
+
50
+ it "can run a DELETE synchronously" do
51
+ response = Typhoeus::Request.delete("http://localhost:3000", :params => {:q => "hi"}, :headers => {:foo => "bar"})
52
+ response.code.should == 200
53
+ JSON.parse(response.body)["REQUEST_METHOD"].should == "DELETE"
54
+ end
55
+ end
56
+
57
+ it "takes url as the first argument" do
58
+ Typhoeus::Request.new("http://localhost:3000").url.should == "http://localhost:3000"
59
+ end
60
+
61
+ it "should parse the host from the url" do
62
+ Typhoeus::Request.new("http://localhost:3000/whatever?hi=foo").host.should == "http://localhost:3000"
63
+ Typhoeus::Request.new("http://localhost:3000?hi=foo").host.should == "http://localhost:3000"
64
+ Typhoeus::Request.new("http://localhost:3000").host.should == "http://localhost:3000"
65
+ end
66
+
67
+ it "takes method as an option" do
68
+ Typhoeus::Request.new("http://localhost:3000", :method => :get).method.should == :get
69
+ end
70
+
71
+ it "takes headers as an option" do
72
+ headers = {:foo => :bar}
73
+ request = Typhoeus::Request.new("http://localhost:3000", :headers => headers)
74
+ request.headers.should == headers
75
+ end
76
+
77
+ it "takes params as an option and adds them to the url" do
78
+ Typhoeus::Request.new("http://localhost:3000", :params => {:foo => "bar"}).url.should == "http://localhost:3000?foo=bar"
79
+ end
80
+
81
+ it "takes request body as an option" do
82
+ Typhoeus::Request.new("http://localhost:3000", :body => "whatever").body.should == "whatever"
83
+ end
84
+
85
+ it "takes timeout as an option" do
86
+ Typhoeus::Request.new("http://localhost:3000", :timeout => 10).timeout.should == 10
87
+ end
88
+
89
+ it "takes cache_timeout as an option" do
90
+ Typhoeus::Request.new("http://localhost:3000", :cache_timeout => 60).cache_timeout.should == 60
91
+ end
92
+
93
+ it "takes follow_location as an option" do
94
+ Typhoeus::Request.new("http://localhost:3000", :follow_location => true).follow_location.should == true
95
+ end
96
+
97
+ it "takes max_redirects as an option" do
98
+ Typhoeus::Request.new("http://localhost:3000", :max_redirects => 10).max_redirects.should == 10
99
+ end
100
+
101
+ it "has the associated response object" do
102
+ request = Typhoeus::Request.new("http://localhost:3000")
103
+ request.response = :foo
104
+ request.response.should == :foo
105
+ end
106
+
107
+ it "has an on_complete handler that is called when the request is completed" do
108
+ request = Typhoeus::Request.new("http://localhost:3000")
109
+ foo = nil
110
+ request.on_complete do |response|
111
+ foo = response
112
+ end
113
+ request.response = :bar
114
+ request.call_handlers
115
+ foo.should == :bar
116
+ end
117
+
118
+ it "has an on_complete setter" do
119
+ foo = nil
120
+ proc = Proc.new {|response| foo = response}
121
+ request = Typhoeus::Request.new("http://localhost:3000")
122
+ request.on_complete = proc
123
+ request.response = :bar
124
+ request.call_handlers
125
+ foo.should == :bar
126
+ end
127
+
128
+ it "stores the handled response that is the return value from the on_complete block" do
129
+ request = Typhoeus::Request.new("http://localhost:3000")
130
+ request.on_complete do |response|
131
+ "handled"
132
+ end
133
+ request.response = :bar
134
+ request.call_handlers
135
+ request.handled_response.should == "handled"
136
+ end
137
+
138
+ it "has an after_complete handler that recieves what on_complete returns" do
139
+ request = Typhoeus::Request.new("http://localhost:3000")
140
+ request.on_complete do |response|
141
+ "handled"
142
+ end
143
+ good = nil
144
+ request.after_complete do |object|
145
+ good = object == "handled"
146
+ end
147
+ request.call_handlers
148
+ good.should be_true
149
+ end
150
+
151
+ it "has an after_complete setter" do
152
+ request = Typhoeus::Request.new("http://localhost:3000")
153
+ request.on_complete do |response|
154
+ "handled"
155
+ end
156
+ good = nil
157
+ proc = Proc.new {|object| good = object == "handled"}
158
+ request.after_complete = proc
159
+
160
+ request.call_handlers
161
+ good.should be_true
162
+ end
163
+
164
+ describe "authentication" do
165
+
166
+ it "should allow to set username and password" do
167
+ auth = { :username => 'foo', :password => 'bar' }
168
+ e = Typhoeus::Request.get(
169
+ "http://localhost:3001/auth_basic/#{auth[:username]}/#{auth[:password]}",
170
+ auth
171
+ )
172
+ e.code.should == 200
173
+ end
174
+
175
+ it "should allow to set authentication method" do
176
+ auth = {
177
+ :username => 'username',
178
+ :password => 'password',
179
+ :auth_method => :ntlm
180
+ }
181
+ e = Typhoeus::Request.get(
182
+ "http://localhost:3001/auth_ntlm",
183
+ auth
184
+ )
185
+ e.code.should == 200
186
+ end
187
+
188
+ end
189
+
190
+ describe "retry" do
191
+ it "should take a retry option"
192
+ it "should count the number of times a request has failed"
193
+ end
194
+
195
+ end
data/typhoeus.gemspec ADDED
@@ -0,0 +1,113 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{typhoeus}
8
+ s.version = "0.1.31"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Paul Dix"]
12
+ s.date = %q{2010-07-16}
13
+ s.description = %q{Like a modern code version of the mythical beast with 100 serpent heads, Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.}
14
+ s.email = %q{paul@pauldix.net}
15
+ s.extensions = ["ext/typhoeus/extconf.rb"]
16
+ s.extra_rdoc_files = [
17
+ "README.textile"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "CHANGELOG.markdown",
22
+ "README.textile",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "benchmarks/profile.rb",
26
+ "benchmarks/vs_nethttp.rb",
27
+ "examples/twitter.rb",
28
+ "ext/typhoeus/.gitignore",
29
+ "ext/typhoeus/Makefile",
30
+ "ext/typhoeus/extconf.rb",
31
+ "ext/typhoeus/native.c",
32
+ "ext/typhoeus/native.h",
33
+ "ext/typhoeus/typhoeus_easy.c",
34
+ "ext/typhoeus/typhoeus_easy.h",
35
+ "ext/typhoeus/typhoeus_multi.c",
36
+ "ext/typhoeus/typhoeus_multi.h",
37
+ "lib/typhoeus.rb",
38
+ "lib/typhoeus/.gitignore",
39
+ "lib/typhoeus/easy.rb",
40
+ "lib/typhoeus/filter.rb",
41
+ "lib/typhoeus/hydra.rb",
42
+ "lib/typhoeus/multi.rb",
43
+ "lib/typhoeus/remote.rb",
44
+ "lib/typhoeus/remote_method.rb",
45
+ "lib/typhoeus/remote_proxy_object.rb",
46
+ "lib/typhoeus/request.rb",
47
+ "lib/typhoeus/response.rb",
48
+ "lib/typhoeus/service.rb",
49
+ "profilers/valgrind.rb",
50
+ "spec/fixtures/result_set.xml",
51
+ "spec/servers/app.rb",
52
+ "spec/spec.opts",
53
+ "spec/spec_helper.rb",
54
+ "spec/typhoeus/easy_spec.rb",
55
+ "spec/typhoeus/filter_spec.rb",
56
+ "spec/typhoeus/hydra_spec.rb",
57
+ "spec/typhoeus/multi_spec.rb",
58
+ "spec/typhoeus/remote_method_spec.rb",
59
+ "spec/typhoeus/remote_proxy_object_spec.rb",
60
+ "spec/typhoeus/remote_spec.rb",
61
+ "spec/typhoeus/request_spec.rb",
62
+ "spec/typhoeus/response_spec.rb",
63
+ "typhoeus.gemspec"
64
+ ]
65
+ s.homepage = %q{http://github.com/pauldix/typhoeus}
66
+ s.rdoc_options = ["--charset=UTF-8"]
67
+ s.require_paths = ["lib"]
68
+ s.rubygems_version = %q{1.3.6}
69
+ s.summary = %q{A library for interacting with web services (and building SOAs) at blinding speed.}
70
+ s.test_files = [
71
+ "spec/servers/app.rb",
72
+ "spec/spec_helper.rb",
73
+ "spec/typhoeus/easy_spec.rb",
74
+ "spec/typhoeus/filter_spec.rb",
75
+ "spec/typhoeus/hydra_spec.rb",
76
+ "spec/typhoeus/multi_spec.rb",
77
+ "spec/typhoeus/remote_method_spec.rb",
78
+ "spec/typhoeus/remote_proxy_object_spec.rb",
79
+ "spec/typhoeus/remote_spec.rb",
80
+ "spec/typhoeus/request_spec.rb",
81
+ "spec/typhoeus/response_spec.rb",
82
+ "examples/twitter.rb"
83
+ ]
84
+
85
+ if s.respond_to? :specification_version then
86
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
87
+ s.specification_version = 3
88
+
89
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
90
+ s.add_runtime_dependency(%q<rack>, [">= 0"])
91
+ s.add_development_dependency(%q<rspec>, [">= 0"])
92
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
93
+ s.add_development_dependency(%q<diff-lcs>, [">= 0"])
94
+ s.add_development_dependency(%q<sinatra>, [">= 0"])
95
+ s.add_development_dependency(%q<json>, [">= 0"])
96
+ else
97
+ s.add_dependency(%q<rack>, [">= 0"])
98
+ s.add_dependency(%q<rspec>, [">= 0"])
99
+ s.add_dependency(%q<jeweler>, [">= 0"])
100
+ s.add_dependency(%q<diff-lcs>, [">= 0"])
101
+ s.add_dependency(%q<sinatra>, [">= 0"])
102
+ s.add_dependency(%q<json>, [">= 0"])
103
+ end
104
+ else
105
+ s.add_dependency(%q<rack>, [">= 0"])
106
+ s.add_dependency(%q<rspec>, [">= 0"])
107
+ s.add_dependency(%q<jeweler>, [">= 0"])
108
+ s.add_dependency(%q<diff-lcs>, [">= 0"])
109
+ s.add_dependency(%q<sinatra>, [">= 0"])
110
+ s.add_dependency(%q<json>, [">= 0"])
111
+ end
112
+ end
113
+