kastner-rack 0.3.171
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +8 -0
- data/COPYING +18 -0
- data/KNOWN-ISSUES +18 -0
- data/README +273 -0
- data/Rakefile +185 -0
- data/bin/rackup +172 -0
- data/contrib/rack_logo.svg +111 -0
- data/example/lobster.ru +4 -0
- data/example/protectedlobster.rb +14 -0
- data/example/protectedlobster.ru +8 -0
- data/lib/rack.rb +85 -0
- data/lib/rack/adapter/camping.rb +22 -0
- data/lib/rack/auth/abstract/handler.rb +28 -0
- data/lib/rack/auth/abstract/request.rb +37 -0
- data/lib/rack/auth/basic.rb +58 -0
- data/lib/rack/auth/digest/md5.rb +124 -0
- data/lib/rack/auth/digest/nonce.rb +51 -0
- data/lib/rack/auth/digest/params.rb +55 -0
- data/lib/rack/auth/digest/request.rb +40 -0
- data/lib/rack/auth/openid.rb +437 -0
- data/lib/rack/builder.rb +67 -0
- data/lib/rack/cascade.rb +36 -0
- data/lib/rack/commonlogger.rb +61 -0
- data/lib/rack/conditionalget.rb +42 -0
- data/lib/rack/deflater.rb +63 -0
- data/lib/rack/directory.rb +149 -0
- data/lib/rack/file.rb +84 -0
- data/lib/rack/handler.rb +46 -0
- data/lib/rack/handler/cgi.rb +57 -0
- data/lib/rack/handler/evented_mongrel.rb +8 -0
- data/lib/rack/handler/fastcgi.rb +86 -0
- data/lib/rack/handler/lsws.rb +52 -0
- data/lib/rack/handler/mongrel.rb +78 -0
- data/lib/rack/handler/scgi.rb +57 -0
- data/lib/rack/handler/swiftiplied_mongrel.rb +8 -0
- data/lib/rack/handler/webrick.rb +61 -0
- data/lib/rack/head.rb +19 -0
- data/lib/rack/lint.rb +463 -0
- data/lib/rack/lobster.rb +65 -0
- data/lib/rack/methodoverride.rb +21 -0
- data/lib/rack/mime.rb +204 -0
- data/lib/rack/mock.rb +160 -0
- data/lib/rack/recursive.rb +57 -0
- data/lib/rack/reloader.rb +64 -0
- data/lib/rack/request.rb +217 -0
- data/lib/rack/response.rb +171 -0
- data/lib/rack/session/abstract/id.rb +140 -0
- data/lib/rack/session/cookie.rb +89 -0
- data/lib/rack/session/memcache.rb +97 -0
- data/lib/rack/session/pool.rb +73 -0
- data/lib/rack/showexceptions.rb +348 -0
- data/lib/rack/showstatus.rb +105 -0
- data/lib/rack/static.rb +38 -0
- data/lib/rack/urlmap.rb +48 -0
- data/lib/rack/utils.rb +318 -0
- data/rack.gemspec +31 -0
- data/test/cgi/lighttpd.conf +20 -0
- data/test/cgi/test +9 -0
- data/test/cgi/test.fcgi +8 -0
- data/test/cgi/test.ru +7 -0
- data/test/spec_rack_auth_basic.rb +69 -0
- data/test/spec_rack_auth_digest.rb +169 -0
- data/test/spec_rack_auth_openid.rb +137 -0
- data/test/spec_rack_builder.rb +84 -0
- data/test/spec_rack_camping.rb +51 -0
- data/test/spec_rack_cascade.rb +50 -0
- data/test/spec_rack_cgi.rb +89 -0
- data/test/spec_rack_commonlogger.rb +32 -0
- data/test/spec_rack_conditionalget.rb +41 -0
- data/test/spec_rack_deflater.rb +70 -0
- data/test/spec_rack_directory.rb +56 -0
- data/test/spec_rack_fastcgi.rb +89 -0
- data/test/spec_rack_file.rb +57 -0
- data/test/spec_rack_handler.rb +24 -0
- data/test/spec_rack_head.rb +30 -0
- data/test/spec_rack_lint.rb +371 -0
- data/test/spec_rack_lobster.rb +45 -0
- data/test/spec_rack_methodoverride.rb +31 -0
- data/test/spec_rack_mock.rb +152 -0
- data/test/spec_rack_mongrel.rb +170 -0
- data/test/spec_rack_recursive.rb +77 -0
- data/test/spec_rack_request.rb +426 -0
- data/test/spec_rack_response.rb +173 -0
- data/test/spec_rack_session_cookie.rb +78 -0
- data/test/spec_rack_session_memcache.rb +132 -0
- data/test/spec_rack_session_pool.rb +84 -0
- data/test/spec_rack_showexceptions.rb +21 -0
- data/test/spec_rack_showstatus.rb +72 -0
- data/test/spec_rack_static.rb +37 -0
- data/test/spec_rack_urlmap.rb +175 -0
- data/test/spec_rack_utils.rb +174 -0
- data/test/spec_rack_webrick.rb +123 -0
- data/test/testrequest.rb +45 -0
- metadata +177 -0
data/AUTHORS
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
* Christian Neukirchen <chneukirchen@gmail.com>
|
2
|
+
* HTTP authentication: Tim Fletcher <twoggle@gmail.com>
|
3
|
+
* Cookie sessions, Static handler: Luc Heinrich <luc@honk-honk.com>
|
4
|
+
* Pool sessions, OpenID authentication: blink <blinketje@gmail.com>
|
5
|
+
* Rack::Deflater: Christoffer Sawicki <christoffer.sawicki@gmail.com>
|
6
|
+
* LiteSpeed handler: Adrian Madrid
|
7
|
+
* SCGI handler: Jeremy Evans
|
8
|
+
* Official Logo: Armin Ronacher
|
data/COPYING
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (c) 2007 Christian Neukirchen <purl.org/net/chneukirchen>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to
|
5
|
+
deal in the Software without restriction, including without limitation the
|
6
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/KNOWN-ISSUES
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
= Known issues with Rack and Web servers
|
2
|
+
|
3
|
+
* Lighttpd sets wrong SCRIPT_NAME and PATH_INFO if you mount your
|
4
|
+
FastCGI app at "/". This can be fixed by using this middleware:
|
5
|
+
|
6
|
+
class LighttpdScriptNameFix
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
env["PATH_INFO"] = env["SCRIPT_NAME"].to_s + env["PATH_INFO"].to_s
|
13
|
+
env["SCRIPT_NAME"] = ""
|
14
|
+
@app.call(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Of course, use this only when your app runs at "/".
|
data/README
ADDED
@@ -0,0 +1,273 @@
|
|
1
|
+
= Rack, a modular Ruby webserver interface
|
2
|
+
|
3
|
+
Rack provides a minimal, modular and adaptable interface for developing
|
4
|
+
web applications in Ruby. By wrapping HTTP requests and responses in
|
5
|
+
the simplest way possible, it unifies and distills the API for web
|
6
|
+
servers, web frameworks, and software in between (the so-called
|
7
|
+
middleware) into a single method call.
|
8
|
+
|
9
|
+
The exact details of this are described in the Rack specification,
|
10
|
+
which all Rack applications should conform to.
|
11
|
+
|
12
|
+
== Supported web servers
|
13
|
+
|
14
|
+
The included *handlers* connect all kinds of web servers to Rack:
|
15
|
+
* Mongrel
|
16
|
+
* EventedMongrel
|
17
|
+
* SwiftipliedMongrel
|
18
|
+
* WEBrick
|
19
|
+
* FCGI
|
20
|
+
* CGI
|
21
|
+
* SCGI
|
22
|
+
* LiteSpeed
|
23
|
+
|
24
|
+
These web servers include Rack handlers in their distributions:
|
25
|
+
* Ebb
|
26
|
+
* Fuzed
|
27
|
+
* Phusion Passenger (which is mod_rack for Apache)
|
28
|
+
* Thin
|
29
|
+
|
30
|
+
Any valid Rack app will run the same on all these handlers, without
|
31
|
+
changing anything.
|
32
|
+
|
33
|
+
== Supported web frameworks
|
34
|
+
|
35
|
+
The included *adapters* connect Rack with existing Ruby web frameworks:
|
36
|
+
* Camping
|
37
|
+
|
38
|
+
These frameworks include Rack adapters in their distributions:
|
39
|
+
* Coset
|
40
|
+
* Halcyon
|
41
|
+
* Mack
|
42
|
+
* Maveric
|
43
|
+
* Merb
|
44
|
+
* Racktools::SimpleApplication
|
45
|
+
* Ramaze
|
46
|
+
* Sinatra
|
47
|
+
* Vintage
|
48
|
+
* Waves
|
49
|
+
|
50
|
+
Ruby on Rails can be run with the adapter included with Thin, which
|
51
|
+
will be merged into a later Rack version.
|
52
|
+
|
53
|
+
Current links to these projects can be found at
|
54
|
+
http://ramaze.net/#other-frameworks
|
55
|
+
|
56
|
+
== Available middleware
|
57
|
+
|
58
|
+
Between the server and the framework, Rack can be customized to your
|
59
|
+
applications needs using middleware, for example:
|
60
|
+
* Rack::URLMap, to route to multiple applications inside the same process.
|
61
|
+
* Rack::CommonLogger, for creating Apache-style logfiles.
|
62
|
+
* Rack::ShowException, for catching unhandled exceptions and
|
63
|
+
presenting them in a nice and helpful way with clickable backtrace.
|
64
|
+
* Rack::File, for serving static files.
|
65
|
+
* ...many others!
|
66
|
+
|
67
|
+
All these components use the same interface, which is described in
|
68
|
+
detail in the Rack specification. These optional components can be
|
69
|
+
used in any way you wish.
|
70
|
+
|
71
|
+
== Convenience
|
72
|
+
|
73
|
+
If you want to develop outside of existing frameworks, implement your
|
74
|
+
own ones, or develop middleware, Rack provides many helpers to create
|
75
|
+
Rack applications quickly and without doing the same web stuff all
|
76
|
+
over:
|
77
|
+
* Rack::Request, which also provides query string parsing and
|
78
|
+
multipart handling.
|
79
|
+
* Rack::Response, for convenient generation of HTTP replies and
|
80
|
+
cookie handling.
|
81
|
+
* Rack::MockRequest and Rack::MockResponse for efficient and quick
|
82
|
+
testing of Rack application without real HTTP round-trips.
|
83
|
+
|
84
|
+
== rackup
|
85
|
+
|
86
|
+
rackup is a useful tool for running Rack applications, which uses the
|
87
|
+
Rack::Builder DSL to configure middleware and build up applications
|
88
|
+
easily.
|
89
|
+
|
90
|
+
rackup automatically figures out the environment it is run in, and
|
91
|
+
runs your application as FastCGI, CGI, or standalone with Mongrel or
|
92
|
+
WEBrick---all from the same configuration.
|
93
|
+
|
94
|
+
== Quick start
|
95
|
+
|
96
|
+
Try the lobster!
|
97
|
+
|
98
|
+
Either with the embedded WEBrick starter:
|
99
|
+
|
100
|
+
ruby -Ilib lib/rack/lobster.rb
|
101
|
+
|
102
|
+
Or with rackup:
|
103
|
+
|
104
|
+
bin/rackup -Ilib example/lobster.ru
|
105
|
+
|
106
|
+
By default, the lobster is found at http://localhost:9292.
|
107
|
+
|
108
|
+
== Installing with RubyGems
|
109
|
+
|
110
|
+
A Gem of Rack is available. You can install it with:
|
111
|
+
|
112
|
+
gem install rack
|
113
|
+
|
114
|
+
I also provide a local mirror of the gems (and development snapshots)
|
115
|
+
at my site:
|
116
|
+
|
117
|
+
gem install rack --source http://chneukirchen.org/releases/gems
|
118
|
+
|
119
|
+
== Running the tests
|
120
|
+
|
121
|
+
Testing Rack requires the test/spec testing framework:
|
122
|
+
|
123
|
+
gem install test-spec
|
124
|
+
|
125
|
+
There are two rake-based test tasks:
|
126
|
+
|
127
|
+
rake test tests all the fast tests (no Handlers or Adapters)
|
128
|
+
rake fulltest runs all the tests
|
129
|
+
|
130
|
+
The fast testsuite has no dependencies outside of the core Ruby
|
131
|
+
installation and test-spec.
|
132
|
+
|
133
|
+
To run the test suite completely, you need:
|
134
|
+
|
135
|
+
* camping
|
136
|
+
* mongrel
|
137
|
+
* fcgi
|
138
|
+
* ruby-openid
|
139
|
+
* memcache-client
|
140
|
+
|
141
|
+
The full set of tests test FCGI access with lighttpd (on port
|
142
|
+
9203) so you will need lighttpd installed as well as the FCGI
|
143
|
+
libraries and the fcgi gem:
|
144
|
+
|
145
|
+
Download and install lighttpd:
|
146
|
+
|
147
|
+
http://www.lighttpd.net/download
|
148
|
+
|
149
|
+
Installing the FCGI libraries:
|
150
|
+
|
151
|
+
curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
|
152
|
+
tar xzvf fcgi-2.4.0.tar.gz
|
153
|
+
cd fcgi-2.4.0
|
154
|
+
./configure --prefix=/usr/local
|
155
|
+
make
|
156
|
+
sudo make install
|
157
|
+
cd ..
|
158
|
+
|
159
|
+
Installing the Ruby fcgi gem:
|
160
|
+
|
161
|
+
gem install fcgi
|
162
|
+
|
163
|
+
Furthermore, to test Memcache sessions, you need memcached (will be
|
164
|
+
run on port 11211) and memcache-client installed.
|
165
|
+
|
166
|
+
|
167
|
+
== History
|
168
|
+
|
169
|
+
* March 3rd, 2007: First public release 0.1.
|
170
|
+
|
171
|
+
* May 16th, 2007: Second public release 0.2.
|
172
|
+
* HTTP Basic authentication.
|
173
|
+
* Cookie Sessions.
|
174
|
+
* Static file handler.
|
175
|
+
* Improved Rack::Request.
|
176
|
+
* Improved Rack::Response.
|
177
|
+
* Added Rack::ShowStatus, for better default error messages.
|
178
|
+
* Bug fixes in the Camping adapter.
|
179
|
+
* Removed Rails adapter, was too alpha.
|
180
|
+
|
181
|
+
* February 26th, 2008: Third public release 0.3.
|
182
|
+
* LiteSpeed handler, by Adrian Madrid.
|
183
|
+
* SCGI handler, by Jeremy Evans.
|
184
|
+
* Pool sessions, by blink.
|
185
|
+
* OpenID authentication, by blink.
|
186
|
+
* :Port and :File options for opening FastCGI sockets, by blink.
|
187
|
+
* Last-Modified HTTP header for Rack::File, by blink.
|
188
|
+
* Rack::Builder#use now accepts blocks, by Corey Jewett.
|
189
|
+
(See example/protectedlobster.ru)
|
190
|
+
* HTTP status 201 can contain a Content-Type and a body now.
|
191
|
+
* Many bugfixes, especially related to Cookie handling.
|
192
|
+
|
193
|
+
* August 21st, 2008: Fourth public release 0.4.
|
194
|
+
* New middleware, Rack::Deflater, by Christoffer Sawicki.
|
195
|
+
* OpenID authentication now needs ruby-openid 2.
|
196
|
+
* New Memcache sessions, by blink.
|
197
|
+
* Explicit EventedMongrel handler, by Joshua Peek <josh@joshpeek.com>
|
198
|
+
* Rack::Reloader is not loaded in rackup development mode.
|
199
|
+
* rackup can daemonize with -D.
|
200
|
+
* Many bugfixes, especially for pool sessions, URLMap, thread safety
|
201
|
+
and tempfile handling.
|
202
|
+
* Improved tests.
|
203
|
+
* Rack moved to Git.
|
204
|
+
|
205
|
+
== Contact
|
206
|
+
|
207
|
+
Please mail bugs, suggestions and patches to
|
208
|
+
<mailto:rack-devel@googlegroups.com>.
|
209
|
+
|
210
|
+
Mailing list archives are available at
|
211
|
+
<http://groups.google.com/group/rack-devel>.
|
212
|
+
|
213
|
+
Git repository (branches rebased on master are most welcome):
|
214
|
+
* http://github.com/chneukirchen/rack
|
215
|
+
* http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack.git
|
216
|
+
|
217
|
+
You are also welcome to join the #rack channel on irc.freenode.net.
|
218
|
+
|
219
|
+
== Thanks to
|
220
|
+
|
221
|
+
* blink for the Pool sessions, Memcache sessions, OpenID support, many
|
222
|
+
tweaks, patches and bugreports.
|
223
|
+
* Michael Fellinger, for the helpful discussion, bugfixes and a better
|
224
|
+
Rack::Request interface.
|
225
|
+
* Adrian Madrid, for the LiteSpeed handler.
|
226
|
+
* Christoffer Sawicki, for the first Rails adapter and Rack::Deflater.
|
227
|
+
* Tim Fletcher, for the HTTP authentication code.
|
228
|
+
* Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
|
229
|
+
* Armin Ronacher, for the logo and racktools.
|
230
|
+
* Aredridel, for bug fixing.
|
231
|
+
* Stephen Bannasch, for bug reports and documentation.
|
232
|
+
* Gary Wright, for proposing a better Rack::Response interface.
|
233
|
+
* Jonathan Buch, for improvements regarding Rack::Response.
|
234
|
+
* Armin Röhrl, for tracking down bugs in the Cookie generator.
|
235
|
+
* Alexander Kellett for testing the Gem and reviewing the announce.
|
236
|
+
* Marcus Rückert, for help with configuring and debugging lighttpd.
|
237
|
+
* The WSGI team for the well-done and documented work they've done and
|
238
|
+
Rack builds up on.
|
239
|
+
* All bug reporters and patch contributers not mentioned above.
|
240
|
+
|
241
|
+
== Copyright
|
242
|
+
|
243
|
+
Copyright (C) 2007, 2008 Christian Neukirchen <http://purl.org/net/chneukirchen>
|
244
|
+
|
245
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
246
|
+
of this software and associated documentation files (the "Software"), to
|
247
|
+
deal in the Software without restriction, including without limitation the
|
248
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
249
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
250
|
+
furnished to do so, subject to the following conditions:
|
251
|
+
|
252
|
+
The above copyright notice and this permission notice shall be included in
|
253
|
+
all copies or substantial portions of the Software.
|
254
|
+
|
255
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
256
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
257
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
258
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
259
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
260
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
261
|
+
|
262
|
+
== Links
|
263
|
+
|
264
|
+
Rack:: <http://rack.rubyforge.org/>
|
265
|
+
Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
|
266
|
+
rack-devel mailing list:: <http://groups.google.com/group/rack-devel>
|
267
|
+
|
268
|
+
Camping:: <http://camping.rubyforge.org/>
|
269
|
+
Ramaze:: <http://ramaze.rubyforge.org/>
|
270
|
+
Maveric:: <http://maveric.rubyforge.org/>
|
271
|
+
|
272
|
+
Christian Neukirchen:: <http://chneukirchen.org/>
|
273
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
# Rakefile for Rack. -*-ruby-*-
|
2
|
+
require 'rake/rdoctask'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
|
7
|
+
desc "Run all the tests"
|
8
|
+
task :default => [:test]
|
9
|
+
|
10
|
+
desc "Do predistribution stuff"
|
11
|
+
task :predist => [:chmod, :changelog, :rdoc, :gemspec]
|
12
|
+
|
13
|
+
|
14
|
+
desc "Make an archive as .tar.gz"
|
15
|
+
task :dist => [:fulltest, :predist] do
|
16
|
+
sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
|
17
|
+
sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX SPEC ChangeLog doc"
|
18
|
+
sh "gzip -f -9 #{release}.tar"
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Make the gemspec"
|
22
|
+
task :gemspec do
|
23
|
+
open("rack.gemspec", "w") {|f| f.print @spec.to_ruby }
|
24
|
+
end
|
25
|
+
|
26
|
+
# Helper to retrieve the "revision number" of the git tree.
|
27
|
+
def git_tree_version
|
28
|
+
if File.directory?(".git")
|
29
|
+
@tree_version ||= `git describe`.strip.sub('-', '.')
|
30
|
+
@tree_version << ".0" unless @tree_version.count('.') == 2
|
31
|
+
else
|
32
|
+
$: << "lib"
|
33
|
+
require 'rack'
|
34
|
+
@tree_version = Rack.release
|
35
|
+
end
|
36
|
+
@tree_version
|
37
|
+
end
|
38
|
+
|
39
|
+
def gem_version
|
40
|
+
git_tree_version.gsub(/-.*/, '')
|
41
|
+
end
|
42
|
+
|
43
|
+
def release
|
44
|
+
"rack-#{git_tree_version}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def manifest
|
48
|
+
`git ls-files`.split("\n")
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
desc "Make binaries executable"
|
53
|
+
task :chmod do
|
54
|
+
Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
|
55
|
+
Dir["test/cgi/test*"].each { |binary| File.chmod(0775, binary) }
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Generate a ChangeLog"
|
59
|
+
task :changelog do
|
60
|
+
File.open("ChangeLog", "w") { |out|
|
61
|
+
`git log -z`.split("\0").map { |chunk|
|
62
|
+
author = chunk[/Author: (.*)/, 1].strip
|
63
|
+
date = chunk[/Date: (.*)/, 1].strip
|
64
|
+
desc, detail = $'.strip.split("\n", 2)
|
65
|
+
detail ||= ""
|
66
|
+
detail = detail.gsub(/.*darcs-hash:.*/, '')
|
67
|
+
detail.rstrip!
|
68
|
+
out.puts "#{date} #{author}"
|
69
|
+
out.puts " * #{desc.strip}"
|
70
|
+
out.puts detail unless detail.empty?
|
71
|
+
out.puts
|
72
|
+
}
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
desc "Generate RDox"
|
78
|
+
task "RDOX" do
|
79
|
+
sh "specrb -Ilib:test -a --rdox >RDOX"
|
80
|
+
end
|
81
|
+
|
82
|
+
desc "Generate Rack Specification"
|
83
|
+
task "SPEC" do
|
84
|
+
File.open("SPEC", "wb") { |file|
|
85
|
+
IO.foreach("lib/rack/lint.rb") { |line|
|
86
|
+
if line =~ /## (.*)/
|
87
|
+
file.puts $1
|
88
|
+
end
|
89
|
+
}
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
desc "Run all the fast tests"
|
94
|
+
task :test do
|
95
|
+
sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS'] || '-t "^(?!Rack::Handler|Rack::Adapter|Rack::Session::Memcache|Rack::Auth::OpenID)"'}"
|
96
|
+
end
|
97
|
+
|
98
|
+
desc "Run all the tests"
|
99
|
+
task :fulltest => [:chmod] do
|
100
|
+
sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS']}"
|
101
|
+
end
|
102
|
+
|
103
|
+
begin
|
104
|
+
require 'rubygems'
|
105
|
+
|
106
|
+
require 'rake'
|
107
|
+
require 'rake/clean'
|
108
|
+
require 'rake/packagetask'
|
109
|
+
require 'rake/gempackagetask'
|
110
|
+
require 'fileutils'
|
111
|
+
rescue LoadError
|
112
|
+
# Too bad.
|
113
|
+
else
|
114
|
+
@spec = Gem::Specification.new do |s|
|
115
|
+
s.name = "rack"
|
116
|
+
s.version = gem_version
|
117
|
+
s.platform = Gem::Platform::RUBY
|
118
|
+
s.summary = "a modular Ruby webserver interface"
|
119
|
+
|
120
|
+
s.description = <<-EOF
|
121
|
+
Rack provides minimal, modular and adaptable interface for developing
|
122
|
+
web applications in Ruby. By wrapping HTTP requests and responses in
|
123
|
+
the simplest way possible, it unifies and distills the API for web
|
124
|
+
servers, web frameworks, and software in between (the so-called
|
125
|
+
middleware) into a single method call.
|
126
|
+
|
127
|
+
Also see http://rack.rubyforge.org.
|
128
|
+
EOF
|
129
|
+
|
130
|
+
s.files = manifest
|
131
|
+
s.bindir = 'bin'
|
132
|
+
s.executables << 'rackup'
|
133
|
+
s.require_path = 'lib'
|
134
|
+
s.has_rdoc = true
|
135
|
+
s.extra_rdoc_files = ['README', 'KNOWN-ISSUES']
|
136
|
+
s.test_files = Dir['test/{test,spec}_*.rb']
|
137
|
+
|
138
|
+
s.author = 'Christian Neukirchen'
|
139
|
+
s.email = 'chneukirchen@gmail.com'
|
140
|
+
s.homepage = 'http://rack.rubyforge.org'
|
141
|
+
s.rubyforge_project = 'rack'
|
142
|
+
end
|
143
|
+
|
144
|
+
Rake::GemPackageTask.new(@spec) do |p|
|
145
|
+
p.gem_spec = @spec
|
146
|
+
p.need_tar = false
|
147
|
+
p.need_zip = false
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
desc "Generate RDoc documentation"
|
152
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
153
|
+
rdoc.options << '--line-numbers' << '--inline-source' <<
|
154
|
+
'--main' << 'README' <<
|
155
|
+
'--title' << 'Rack Documentation' <<
|
156
|
+
'--charset' << 'utf-8'
|
157
|
+
rdoc.rdoc_dir = "doc"
|
158
|
+
rdoc.rdoc_files.include 'README'
|
159
|
+
rdoc.rdoc_files.include 'KNOWN-ISSUES'
|
160
|
+
rdoc.rdoc_files.include 'SPEC'
|
161
|
+
rdoc.rdoc_files.include 'RDOX'
|
162
|
+
rdoc.rdoc_files.include('lib/rack.rb')
|
163
|
+
rdoc.rdoc_files.include('lib/rack/*.rb')
|
164
|
+
rdoc.rdoc_files.include('lib/rack/*/*.rb')
|
165
|
+
end
|
166
|
+
task :rdoc => ["SPEC", "RDOX"]
|
167
|
+
|
168
|
+
task :pushsite => [:rdoc] do
|
169
|
+
sh "rsync -avz doc/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
|
170
|
+
sh "rsync -avz site/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/"
|
171
|
+
end
|
172
|
+
|
173
|
+
begin
|
174
|
+
require 'rcov/rcovtask'
|
175
|
+
|
176
|
+
Rcov::RcovTask.new do |t|
|
177
|
+
t.test_files = FileList['test/{spec,test}_*.rb']
|
178
|
+
t.verbose = true # uncomment to see the executed command
|
179
|
+
t.rcov_opts = ["--text-report",
|
180
|
+
"-Ilib:test",
|
181
|
+
"--include-file", "^lib,^test",
|
182
|
+
"--exclude-only", "^/usr,^/home/.*/src,active_"]
|
183
|
+
end
|
184
|
+
rescue LoadError
|
185
|
+
end
|