rack 0.9.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack might be problematic. Click here for more details.

Files changed (79) hide show
  1. data/COPYING +1 -1
  2. data/RDOX +115 -16
  3. data/README +54 -7
  4. data/Rakefile +61 -85
  5. data/SPEC +50 -17
  6. data/bin/rackup +9 -5
  7. data/example/protectedlobster.ru +1 -1
  8. data/lib/rack.rb +7 -3
  9. data/lib/rack/auth/abstract/handler.rb +13 -4
  10. data/lib/rack/auth/digest/md5.rb +1 -1
  11. data/lib/rack/auth/digest/request.rb +2 -2
  12. data/lib/rack/auth/openid.rb +344 -302
  13. data/lib/rack/builder.rb +1 -5
  14. data/lib/rack/chunked.rb +49 -0
  15. data/lib/rack/conditionalget.rb +4 -0
  16. data/lib/rack/content_length.rb +7 -3
  17. data/lib/rack/content_type.rb +23 -0
  18. data/lib/rack/deflater.rb +83 -74
  19. data/lib/rack/directory.rb +5 -2
  20. data/lib/rack/file.rb +4 -1
  21. data/lib/rack/handler.rb +22 -1
  22. data/lib/rack/handler/cgi.rb +7 -3
  23. data/lib/rack/handler/fastcgi.rb +26 -24
  24. data/lib/rack/handler/lsws.rb +7 -4
  25. data/lib/rack/handler/mongrel.rb +5 -3
  26. data/lib/rack/handler/scgi.rb +5 -3
  27. data/lib/rack/handler/thin.rb +3 -0
  28. data/lib/rack/handler/webrick.rb +11 -5
  29. data/lib/rack/lint.rb +138 -66
  30. data/lib/rack/lock.rb +16 -0
  31. data/lib/rack/mime.rb +4 -4
  32. data/lib/rack/mock.rb +3 -3
  33. data/lib/rack/reloader.rb +88 -46
  34. data/lib/rack/request.rb +46 -10
  35. data/lib/rack/response.rb +15 -3
  36. data/lib/rack/rewindable_input.rb +98 -0
  37. data/lib/rack/session/abstract/id.rb +71 -82
  38. data/lib/rack/session/cookie.rb +2 -0
  39. data/lib/rack/session/memcache.rb +59 -47
  40. data/lib/rack/session/pool.rb +56 -29
  41. data/lib/rack/showexceptions.rb +2 -1
  42. data/lib/rack/showstatus.rb +1 -1
  43. data/lib/rack/urlmap.rb +12 -5
  44. data/lib/rack/utils.rb +115 -65
  45. data/rack.gemspec +54 -0
  46. data/test/multipart/binary +0 -0
  47. data/test/multipart/empty +10 -0
  48. data/test/multipart/ie +6 -0
  49. data/test/multipart/nested +10 -0
  50. data/test/multipart/none +9 -0
  51. data/test/multipart/text +10 -0
  52. data/test/spec_rack_auth_basic.rb +5 -1
  53. data/test/spec_rack_auth_digest.rb +93 -36
  54. data/test/spec_rack_auth_openid.rb +47 -100
  55. data/test/spec_rack_builder.rb +2 -2
  56. data/test/spec_rack_chunked.rb +62 -0
  57. data/test/spec_rack_conditionalget.rb +7 -7
  58. data/test/spec_rack_content_type.rb +30 -0
  59. data/test/spec_rack_deflater.rb +36 -14
  60. data/test/spec_rack_directory.rb +1 -1
  61. data/test/spec_rack_file.rb +11 -0
  62. data/test/spec_rack_handler.rb +21 -2
  63. data/test/spec_rack_lint.rb +163 -44
  64. data/test/spec_rack_lock.rb +38 -0
  65. data/test/spec_rack_mock.rb +6 -1
  66. data/test/spec_rack_request.rb +81 -12
  67. data/test/spec_rack_response.rb +46 -2
  68. data/test/spec_rack_rewindable_input.rb +118 -0
  69. data/test/spec_rack_session_memcache.rb +170 -62
  70. data/test/spec_rack_session_pool.rb +129 -41
  71. data/test/spec_rack_static.rb +2 -2
  72. data/test/spec_rack_thin.rb +3 -2
  73. data/test/spec_rack_urlmap.rb +10 -0
  74. data/test/spec_rack_utils.rb +214 -49
  75. data/test/spec_rack_webrick.rb +7 -0
  76. data/test/unregistered_handler/rack/handler/unregistered.rb +7 -0
  77. data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +7 -0
  78. metadata +95 -6
  79. data/AUTHORS +0 -8
data/COPYING CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007 Christian Neukirchen <purl.org/net/chneukirchen>
1
+ Copyright (c) 2007, 2008, 2009 Christian Neukirchen <purl.org/net/chneukirchen>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to
data/RDOX CHANGED
@@ -4,6 +4,7 @@
4
4
  * should rechallenge if incorrect credentials are specified
5
5
  * should return application output if correct credentials are specified
6
6
  * should return 400 Bad Request if different auth scheme used
7
+ * realm as optional constructor arg
7
8
 
8
9
  == Rack::Auth::Digest::MD5
9
10
  * should challenge when no credentials are specified
@@ -15,15 +16,19 @@
15
16
  * should return 400 Bad Request if incorrect qop given
16
17
  * should return 400 Bad Request if incorrect uri given
17
18
  * should return 400 Bad Request if different auth scheme used
19
+ * should not require credentials for unprotected path
20
+ * should challenge when no credentials are specified for protected path
21
+ * should return application output if correct credentials given for protected path
22
+ * should return application output if correct credentials given for POST
23
+ * should return application output if correct credentials given for PUT (using method override of POST)
24
+ * realm as optional constructor arg
18
25
 
19
26
  == Rack::Auth::OpenID
20
- * realm uri should be absolute and have a path
21
- * uri options should be absolute
22
- * return_to should be absolute and be under the realm
23
- * extensions should be a module
27
+ * realm uri should be valid
28
+ * should be able to check if a uri is within the realm (empty)
29
+ * return_to should be valid
24
30
  * extensions should have required constants defined
25
31
  * extensions should have Request and Response defined and inherit from OpenID::Extension
26
- * extensions should have NS_URI defined and be a string of an absolute http uri
27
32
 
28
33
  == Rack::Builder
29
34
  * chains apps by default
@@ -53,6 +58,16 @@
53
58
  * should set status
54
59
  * shutdown
55
60
 
61
+ == Rack::Chunked
62
+ * chunks responses with no Content-Length
63
+ * chunks empty bodies properly
64
+ * does not modify response when Content-Length header present
65
+ * does not modify response when client is HTTP/1.0
66
+ * does not modify response when Transfer-Encoding header already present
67
+ * does not modify response when status code is 100
68
+ * does not modify response when status code is 204
69
+ * does not modify response when status code is 304
70
+
56
71
  == Rack::CommonLogger
57
72
  * should log to rack.errors by default
58
73
  * should log to anything with <<
@@ -70,6 +85,12 @@
70
85
  * does not set Content-Length on 304 responses
71
86
  * does not set Content-Length when Transfer-Encoding is chunked
72
87
 
88
+ == Rack::ContentType
89
+ * sets Content-Type to default text/html if none is set
90
+ * sets Content-Type to chosen default if none is set
91
+ * does not change Content-Type if it is already set
92
+ * case insensitive detection of Content-Type
93
+
73
94
  == Rack::Deflater
74
95
  * should be able to deflate bodies that respond to each
75
96
  * should be able to deflate String bodies
@@ -106,11 +127,14 @@
106
127
  * does not allow directory traversal with encoded periods
107
128
  * 404s if it can't find the file
108
129
  * detects SystemCallErrors
130
+ * returns bodies that respond to #to_path
109
131
 
110
132
  == Rack::Handler
111
133
  * has registered default handlers
112
- * should get unregistered handler by name
134
+ * handler that doesn't exist should raise a NameError
135
+ * should get unregistered, but already required, handler by name
113
136
  * should register custom handler
137
+ * should not need registration for properly coded handlers even if not already required
114
138
 
115
139
  == Rack::Head
116
140
  * response (empty)
@@ -131,6 +155,7 @@
131
155
  * notices input handling errors
132
156
  * notices error handling errors
133
157
  * notices HEAD errors
158
+ * passes valid read calls
134
159
 
135
160
  == Rack::Lint::InputWrapper
136
161
  * delegates :size to underlying IO object
@@ -146,6 +171,11 @@
146
171
  * should be flippable
147
172
  * should provide crashing for testing purposes
148
173
 
174
+ == Rack::Lock
175
+ * should call synchronize on lock
176
+ * should set multithread flag to false
177
+ * should reset original multithread flag when exiting lock
178
+
149
179
  == Rack::MethodOverride
150
180
  * should not affect GET requests
151
181
  * _method parameter should modify REQUEST_METHOD for POST requests
@@ -159,6 +189,7 @@
159
189
  * should be able to only return the environment
160
190
  * should provide sensible defaults
161
191
  * should allow GET/POST/PUT/DELETE
192
+ * should set content length
162
193
  * should allow posting
163
194
  * should use all parts of an URL
164
195
  * should behave valid according to the Rack spec
@@ -197,7 +228,7 @@
197
228
  * can parse POST data with explicit content type
198
229
  * does not parse POST data when media type is not form-data
199
230
  * rewinds input after parsing POST data
200
- * does not rewind unwindable CGI input
231
+ * cleans up Safari's ajax POST body
201
232
  * can get value by key from params with #[]
202
233
  * can set value to key on params with #[]=
203
234
  * values_at answers values by keys in order given
@@ -214,10 +245,14 @@
214
245
  * can parse multipart form data
215
246
  * can parse big multipart form data
216
247
  * can detect invalid multipart form data
248
+ * shouldn't try to interpret binary as utf8
217
249
  * should work around buggy 1.8.* Tempfile equality
218
250
  * does conform to the Rack spec
219
251
  * should parse Accept-Encoding correctly
220
252
  * should provide ip information
253
+ * memoizes itself to reduce the cost of repetitive initialization
254
+ * should allow subclass request to be instantiated after parent request
255
+ * should allow parent request to be instantiated after subclass request
221
256
 
222
257
  == Rack::Response
223
258
  * has sensible default values
@@ -226,13 +261,61 @@
226
261
  * can set cookies
227
262
  * formats the Cookie expiration date accordingly to RFC 2109
228
263
  * can set secure cookies
264
+ * can set http only cookies
229
265
  * can delete cookies
266
+ * can do redirects
230
267
  * has a useful constructor
231
268
  * has a constructor that can take a block
232
269
  * doesn't return invalid responses
233
270
  * knows if it's empty
234
271
  * should provide access to the HTTP status
235
272
  * should provide access to the HTTP headers
273
+ * does not add or change Content-Length when #finish()ing
274
+ * updates Content-Length when body appended to using #write
275
+
276
+ == Rack::RewindableInput
277
+ === given an IO object that is already rewindable
278
+ * should be able to handle to read()
279
+ * should be able to handle to read(nil)
280
+ * should be able to handle to read(length)
281
+ * should be able to handle to read(length, buffer)
282
+ * should be able to handle to read(nil, buffer)
283
+ * should rewind to the beginning when #rewind is called
284
+ * should be able to handle gets
285
+ * should be able to handle each
286
+ * should not buffer into a Tempfile if no data has been read yet
287
+ * should buffer into a Tempfile when data has been consumed for the first time
288
+ * should close the underlying tempfile upon calling #close
289
+ * should be possibel to call #close when no data has been buffered yet (empty)
290
+ * should be possible to call #close multiple times (empty)
291
+ === given an IO object that is not rewindable
292
+ * should be able to handle to read()
293
+ * should be able to handle to read(nil)
294
+ * should be able to handle to read(length)
295
+ * should be able to handle to read(length, buffer)
296
+ * should be able to handle to read(nil, buffer)
297
+ * should rewind to the beginning when #rewind is called
298
+ * should be able to handle gets
299
+ * should be able to handle each
300
+ * should not buffer into a Tempfile if no data has been read yet
301
+ * should buffer into a Tempfile when data has been consumed for the first time
302
+ * should close the underlying tempfile upon calling #close
303
+ * should be possibel to call #close when no data has been buffered yet (empty)
304
+ * should be possible to call #close multiple times (empty)
305
+ === given an IO object whose rewind method raises Errno::ESPIPE
306
+ * should be able to handle to read()
307
+ * should be able to handle to read(nil)
308
+ * should be able to handle to read(length)
309
+ * should be able to handle to read(length, buffer)
310
+ * should be able to handle to read(nil, buffer)
311
+ * should rewind to the beginning when #rewind is called
312
+ * should be able to handle gets
313
+ * should be able to handle each
314
+ * should not buffer into a Tempfile if no data has been read yet
315
+ * should buffer into a Tempfile when data has been consumed for the first time
316
+ * should close the underlying tempfile upon calling #close
317
+ * should be possibel to call #close when no data has been buffered yet (empty)
318
+ * should be possible to call #close multiple times (empty)
236
319
 
237
320
  == Rack::Session::Cookie
238
321
  * creates a new cookie
@@ -244,21 +327,25 @@
244
327
  * ignores tampered with session cookies
245
328
 
246
329
  == Rack::Session::Memcache
247
- * startup (empty)
330
+ * MemCache can connect to existing server (empty)
248
331
  * faults on no connection
249
332
  * creates a new cookie
250
333
  * determines session from a cookie
251
- * survives broken cookies
334
+ * survives nonexistant cookies
252
335
  * maintains freshness
253
- * multithread: should cleanly merge sessions
254
- * shutdown
336
+ * deletes cookies with :drop option
337
+ * provides new session id with :renew option
338
+ * omits cookie with :defer option
339
+ * multithread: should cleanly merge sessions (empty)
255
340
 
256
341
  == Rack::Session::Pool
257
342
  * creates a new cookie
258
343
  * determines session from a cookie
259
- * survives broken cookies
260
- * maintains freshness
261
- * multithread: should merge sessions
344
+ * survives nonexistant cookies
345
+ * deletes cookies with :drop option
346
+ * provides new session id with :renew option
347
+ * omits cookie with :defer option
348
+ * multithread: should merge sessions (empty)
262
349
 
263
350
  == Rack::ShowExceptions
264
351
  * catches exceptions
@@ -294,8 +381,10 @@
294
381
  * should escape correctly
295
382
  * should unescape correctly
296
383
  * should parse query strings correctly
384
+ * should parse nested query strings correctly
297
385
  * should build query strings correctly
298
386
  * should figure out which encodings are acceptable
387
+ * should return the bytesize of String
299
388
 
300
389
  == Rack::Utils::HeaderHash
301
390
  * should retain header case
@@ -303,13 +392,23 @@
303
392
  * should merge case-insensitively
304
393
  * should overwrite case insensitively and assume the new key's case
305
394
  * should be converted to real Hash
395
+ * should convert Array values to Strings when converting to Hash
306
396
 
307
397
  == Rack::Utils::Context
308
- * should perform checks on both arguments
309
398
  * should set context correctly
310
399
  * should alter app on recontexting
311
400
  * should run different apps
312
401
 
402
+ == Rack::Utils::Multipart
403
+ * should return nil if content type is not multipart
404
+ * should parse multipart upload with text file
405
+ * should parse multipart upload with nested parameters
406
+ * should parse multipart upload with binary file
407
+ * should parse multipart upload with empty file
408
+ * should not include file params if no file was selected
409
+ * should parse IE multipart upload and clean up filename
410
+ * rewinds input after parsing upload
411
+
313
412
  == Rack::Handler::WEBrick
314
413
  * should respond
315
414
  * should be a WEBrick
@@ -321,4 +420,4 @@
321
420
  * should correctly set cookies
322
421
  * should provide a .run
323
422
 
324
- 244 specifications, 4 empty (1004 requirements), 0 failures
423
+ 330 specifications, 13 empty (1183 requirements), 0 failures
data/README CHANGED
@@ -9,6 +9,24 @@ middleware) into a single method call.
9
9
  The exact details of this are described in the Rack specification,
10
10
  which all Rack applications should conform to.
11
11
 
12
+ == Specification changes in this release
13
+
14
+ With Rack 1.0, the Rack specification (found in SPEC) changed in the
15
+ following backward-incompatible ways. This was done to properly
16
+ support Ruby 1.9 and to deprecate some problematic techniques:
17
+
18
+ * Rack::VERSION has been pushed to [1,0].
19
+ * Header values must be Strings now, split on "\n".
20
+ * rack.input must be rewindable and support reading into a buffer,
21
+ wrap with Rack::RewindableInput if it isn't.
22
+ * Content-Length can be missing, in this case chunked transfer
23
+ encoding is used.
24
+ * Bodies can now additionally respond to #to_path with a filename to
25
+ be served.
26
+ * String bodies are deprecated and will not work with Ruby 1.9, use an
27
+ Array with a single String instead.
28
+ * rack.session is now specified.
29
+
12
30
  == Supported web servers
13
31
 
14
32
  The included *handlers* connect all kinds of web servers to Rack:
@@ -25,7 +43,8 @@ The included *handlers* connect all kinds of web servers to Rack:
25
43
  These web servers include Rack handlers in their distributions:
26
44
  * Ebb
27
45
  * Fuzed
28
- * Phusion Passenger (which is mod_rack for Apache)
46
+ * Phusion Passenger (which is mod_rack for Apache and for nginx)
47
+ * Unicorn
29
48
 
30
49
  Any valid Rack app will run the same on all these handlers, without
31
50
  changing anything.
@@ -36,6 +55,7 @@ The included *adapters* connect Rack with existing Ruby web frameworks:
36
55
  * Camping
37
56
 
38
57
  These frameworks include Rack adapters in their distributions:
58
+ * Camping
39
59
  * Coset
40
60
  * Halcyon
41
61
  * Mack
@@ -44,13 +64,15 @@ These frameworks include Rack adapters in their distributions:
44
64
  * Racktools::SimpleApplication
45
65
  * Ramaze
46
66
  * Ruby on Rails
67
+ * Rum
47
68
  * Sinatra
48
69
  * Sin
49
70
  * Vintage
50
71
  * Waves
72
+ * Wee
51
73
 
52
74
  Current links to these projects can be found at
53
- http://ramaze.net/#other-frameworks
75
+ http://wiki.ramaze.net/Home#other-frameworks
54
76
 
55
77
  == Available middleware
56
78
 
@@ -140,10 +162,11 @@ installation and test-spec.
140
162
  To run the test suite completely, you need:
141
163
 
142
164
  * camping
143
- * mongrel
144
165
  * fcgi
145
- * ruby-openid
146
166
  * memcache-client
167
+ * mongrel
168
+ * ruby-openid
169
+ * thin
147
170
 
148
171
  The full set of tests test FCGI access with lighttpd (on port
149
172
  9203) so you will need lighttpd installed as well as the FCGI
@@ -227,6 +250,28 @@ run on port 11211) and memcache-client installed.
227
250
  * January 9th, 2009: Sixth public release 0.9.1.
228
251
  * Fix directory traversal exploits in Rack::File and Rack::Directory.
229
252
 
253
+ * April 25th, 2009: Seventh public release 1.0.0.
254
+ * SPEC change: Rack::VERSION has been pushed to [1,0].
255
+ * SPEC change: header values must be Strings now, split on "\n".
256
+ * SPEC change: Content-Length can be missing, in this case chunked transfer
257
+ encoding is used.
258
+ * SPEC change: rack.input must be rewindable and support reading into
259
+ a buffer, wrap with Rack::RewindableInput if it isn't.
260
+ * SPEC change: rack.session is now specified.
261
+ * SPEC change: Bodies can now additionally respond to #to_path with
262
+ a filename to be served.
263
+ * NOTE: String bodies break in 1.9, use an Array consisting of a
264
+ single String instead.
265
+ * New middleware Rack::Lock.
266
+ * New middleware Rack::ContentType.
267
+ * Rack::Reloader has been rewritten.
268
+ * Major update to Rack::Auth::OpenID.
269
+ * Support for nested parameter parsing in Rack::Response.
270
+ * Support for redirects in Rack::Response.
271
+ * HttpOnly cookie support in Rack::Response.
272
+ * The Rakefile has been rewritten.
273
+ * Many bugfixes and small improvements.
274
+
230
275
  == Contact
231
276
 
232
277
  Please mail bugs, suggestions and patches to
@@ -237,7 +282,7 @@ Mailing list archives are available at
237
282
 
238
283
  There is a bug tracker at <http://rack.lighthouseapp.com/>.
239
284
 
240
- Git repository (patches rebased on master are most welcome):
285
+ Git repository (send Git patches to the mailing list):
241
286
  * http://github.com/rack/rack
242
287
  * http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack.git
243
288
 
@@ -262,8 +307,10 @@ would like to thank:
262
307
  * Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
263
308
  * Armin Ronacher, for the logo and racktools.
264
309
  * Aredridel, Ben Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd,
265
- Tom Robinson, and Phil Hagelberg for bug fixing and other
266
- improvements.
310
+ Tom Robinson, Phil Hagelberg, and S. Brent Faulkner for bug fixing
311
+ and other improvements.
312
+ * Brian Candler, for Rack::ContentType.
313
+ * Graham Batty, for improved handler loading.
267
314
  * Stephen Bannasch, for bug reports and documentation.
268
315
  * Gary Wright, for proposing a better Rack::Response interface.
269
316
  * Jonathan Buch, for improvements regarding Rack::Response.
data/Rakefile CHANGED
@@ -6,36 +6,36 @@ require 'rake/testtask'
6
6
  desc "Run all the tests"
7
7
  task :default => [:test]
8
8
 
9
- desc "Do predistribution stuff"
10
- task :predist => [:chmod, :changelog, :rdoc]
11
-
12
9
 
13
10
  desc "Make an archive as .tar.gz"
14
- task :dist => [:fulltest, :predist] do
11
+ task :dist => [:chmod, :changelog, :rdoc, "SPEC", "rack.gemspec"] do
12
+ FileUtils.touch("RDOX")
15
13
  sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
16
- sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX SPEC ChangeLog doc"
14
+ sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX SPEC ChangeLog doc rack.gemspec"
17
15
  sh "gzip -f -9 #{release}.tar"
18
16
  end
19
17
 
20
- # Helper to retrieve the "revision number" of the git tree.
21
- def git_tree_version
22
- if File.directory?(".git")
23
- @tree_version ||= `git describe`.strip.sub('-', '.')
24
- @tree_version << ".0" unless @tree_version.count('.') == 2
25
- else
26
- $: << "lib"
27
- require 'rack'
28
- @tree_version = Rack.release
29
- end
30
- @tree_version
18
+ desc "Make an official release"
19
+ task :officialrelease do
20
+ puts "Official build for #{release}..."
21
+ sh "rm -rf stage"
22
+ sh "git clone --shared . stage"
23
+ sh "cd stage && rake officialrelease_really"
24
+ sh "mv stage/#{release}.tar.gz stage/#{release}.gem ."
25
+ end
26
+
27
+ task :officialrelease_really => [:fulltest, "RDOX", "SPEC", :dist, :gem] do
28
+ sh "sha1sum #{release}.tar.gz #{release}.gem"
31
29
  end
32
30
 
33
- def gem_version
34
- git_tree_version.gsub(/-.*/, '')
31
+
32
+ def version
33
+ abort "You need to pass VERSION=... to build packages." unless ENV["VERSION"]
34
+ ENV["VERSION"]
35
35
  end
36
36
 
37
37
  def release
38
- "rack-#{git_tree_version}"
38
+ "rack-#{version}"
39
39
  end
40
40
 
41
41
  def manifest
@@ -96,22 +96,17 @@ end
96
96
 
97
97
  begin
98
98
  require 'rubygems'
99
-
100
- require 'rake'
101
- require 'rake/clean'
102
- require 'rake/packagetask'
103
- require 'rake/gempackagetask'
104
- require 'fileutils'
105
99
  rescue LoadError
106
100
  # Too bad.
107
101
  else
108
- spec = Gem::Specification.new do |s|
109
- s.name = "rack"
110
- s.version = gem_version
111
- s.platform = Gem::Platform::RUBY
112
- s.summary = "a modular Ruby webserver interface"
113
-
114
- s.description = <<-EOF
102
+ task "rack.gemspec" do
103
+ spec = Gem::Specification.new do |s|
104
+ s.name = "rack"
105
+ s.version = version
106
+ s.platform = Gem::Platform::RUBY
107
+ s.summary = "a modular Ruby webserver interface"
108
+
109
+ s.description = <<-EOF
115
110
  Rack provides minimal, modular and adaptable interface for developing
116
111
  web applications in Ruby. By wrapping HTTP requests and responses in
117
112
  the simplest way possible, it unifies and distills the API for web
@@ -121,68 +116,49 @@ middleware) into a single method call.
121
116
  Also see http://rack.rubyforge.org.
122
117
  EOF
123
118
 
124
- s.files = manifest + %w(SPEC RDOX)
125
- s.bindir = 'bin'
126
- s.executables << 'rackup'
127
- s.require_path = 'lib'
128
- s.has_rdoc = true
129
- s.extra_rdoc_files = ['README', 'SPEC', 'RDOX', 'KNOWN-ISSUES']
130
- s.test_files = Dir['test/{test,spec}_*.rb']
131
-
132
- s.author = 'Christian Neukirchen'
133
- s.email = 'chneukirchen@gmail.com'
134
- s.homepage = 'http://rack.rubyforge.org'
135
- s.rubyforge_project = 'rack'
136
-
137
- #s.add_development_dependency 'test-spec'
138
-
139
- #s.add_development_dependency 'camping'
140
- #s.add_development_dependency 'fcgi'
141
- #s.add_development_dependency 'memcache-client'
142
- #s.add_development_dependency 'mongrel'
143
- #s.add_development_dependency 'ruby-openid', '~> 2.0.0'
144
- #s.add_development_dependency 'thin'
119
+ s.files = manifest + %w(SPEC RDOX rack.gemspec)
120
+ s.bindir = 'bin'
121
+ s.executables << 'rackup'
122
+ s.require_path = 'lib'
123
+ s.has_rdoc = true
124
+ s.extra_rdoc_files = ['README', 'SPEC', 'RDOX', 'KNOWN-ISSUES']
125
+ s.test_files = Dir['test/{test,spec}_*.rb']
126
+
127
+ s.author = 'Christian Neukirchen'
128
+ s.email = 'chneukirchen@gmail.com'
129
+ s.homepage = 'http://rack.rubyforge.org'
130
+ s.rubyforge_project = 'rack'
131
+
132
+ s.add_development_dependency 'test-spec'
133
+
134
+ s.add_development_dependency 'camping'
135
+ s.add_development_dependency 'fcgi'
136
+ s.add_development_dependency 'memcache-client'
137
+ s.add_development_dependency 'mongrel'
138
+ s.add_development_dependency 'ruby-openid', '~> 2.0.0'
139
+ s.add_development_dependency 'thin'
140
+ end
141
+
142
+ File.open("rack.gemspec", "w") { |f| f << spec.to_ruby }
145
143
  end
146
144
 
147
- Rake::GemPackageTask.new(spec) do |p|
148
- p.gem_spec = spec
149
- p.need_tar = false
150
- p.need_zip = false
145
+ task :gem => ["rack.gemspec", "SPEC"] do
146
+ FileUtils.touch("RDOX")
147
+ sh "gem build rack.gemspec"
151
148
  end
152
149
  end
153
150
 
154
151
  desc "Generate RDoc documentation"
155
- Rake::RDocTask.new(:rdoc) do |rdoc|
156
- rdoc.options << '--line-numbers' << '--inline-source' <<
157
- '--main' << 'README' <<
158
- '--title' << 'Rack Documentation' <<
159
- '--charset' << 'utf-8'
160
- rdoc.rdoc_dir = "doc"
161
- rdoc.rdoc_files.include 'README'
162
- rdoc.rdoc_files.include 'KNOWN-ISSUES'
163
- rdoc.rdoc_files.include 'SPEC'
164
- rdoc.rdoc_files.include 'RDOX'
165
- rdoc.rdoc_files.include('lib/rack.rb')
166
- rdoc.rdoc_files.include('lib/rack/*.rb')
167
- rdoc.rdoc_files.include('lib/rack/*/*.rb')
152
+ task :rdoc do
153
+ sh(*%w{rdoc --line-numbers --main README
154
+ --title 'Rack\ Documentation' --charset utf-8 -U -o doc} +
155
+ %w{README KNOWN-ISSUES SPEC RDOX} +
156
+ Dir["lib/**/*.rb"])
168
157
  end
169
- task :rdoc => ["SPEC", "RDOX"]
170
158
 
171
159
  task :pushsite => [:rdoc] do
160
+ sh "cd site && git gc"
172
161
  sh "rsync -avz doc/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
173
162
  sh "rsync -avz site/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/"
174
- end
175
-
176
- begin
177
- require 'rcov/rcovtask'
178
-
179
- Rcov::RcovTask.new do |t|
180
- t.test_files = FileList['test/{spec,test}_*.rb']
181
- t.verbose = true # uncomment to see the executed command
182
- t.rcov_opts = ["--text-report",
183
- "-Ilib:test",
184
- "--include-file", "^lib,^test",
185
- "--exclude-only", "^/usr,^/home/.*/src,active_"]
186
- end
187
- rescue LoadError
163
+ sh "cd site && git push"
188
164
  end