sinatra 0.2.2 → 0.3.0

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

Potentially problematic release.


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

Files changed (109) hide show
  1. data/ChangeLog +64 -0
  2. data/LICENSE +1 -1
  3. data/README.rdoc +244 -141
  4. data/Rakefile +111 -0
  5. data/lib/sinatra.rb +942 -627
  6. data/{vendor/rack/lib → lib/sinatra}/rack/handler/mongrel.rb +10 -3
  7. data/lib/sinatra/test/methods.rb +56 -36
  8. data/lib/sinatra/test/rspec.rb +10 -0
  9. data/lib/sinatra/test/spec.rb +2 -2
  10. data/lib/sinatra/test/unit.rb +1 -1
  11. data/sinatra.gemspec +71 -43
  12. data/test/app_test.rb +181 -32
  13. data/test/application_test.rb +179 -36
  14. data/test/custom_error_test.rb +17 -22
  15. data/test/erb_test.rb +42 -22
  16. data/test/event_context_test.rb +3 -3
  17. data/test/events_test.rb +8 -11
  18. data/test/filter_test.rb +30 -0
  19. data/test/haml_test.rb +83 -31
  20. data/test/helper.rb +6 -3
  21. data/test/mapped_error_test.rb +32 -21
  22. data/test/pipeline_test.rb +66 -0
  23. data/test/sass_test.rb +7 -7
  24. data/test/sessions_test.rb +8 -9
  25. data/test/streaming_test.rb +10 -4
  26. data/test/sym_params_test.rb +1 -1
  27. data/test/template_test.rb +11 -11
  28. data/test/use_in_file_templates_test.rb +9 -10
  29. metadata +22 -101
  30. data/CHANGELOG +0 -3
  31. data/Manifest +0 -122
  32. data/index.html +0 -9
  33. data/test/diddy_test.rb +0 -41
  34. data/test/rest_test.rb +0 -16
  35. data/vendor/rack/AUTHORS +0 -7
  36. data/vendor/rack/COPYING +0 -18
  37. data/vendor/rack/KNOWN-ISSUES +0 -18
  38. data/vendor/rack/README +0 -242
  39. data/vendor/rack/Rakefile +0 -174
  40. data/vendor/rack/bin/rackup +0 -153
  41. data/vendor/rack/contrib/rack_logo.svg +0 -111
  42. data/vendor/rack/example/lobster.ru +0 -4
  43. data/vendor/rack/example/protectedlobster.rb +0 -14
  44. data/vendor/rack/example/protectedlobster.ru +0 -8
  45. data/vendor/rack/lib/rack.rb +0 -92
  46. data/vendor/rack/lib/rack/adapter/camping.rb +0 -22
  47. data/vendor/rack/lib/rack/auth/abstract/handler.rb +0 -28
  48. data/vendor/rack/lib/rack/auth/abstract/request.rb +0 -37
  49. data/vendor/rack/lib/rack/auth/basic.rb +0 -58
  50. data/vendor/rack/lib/rack/auth/digest/md5.rb +0 -124
  51. data/vendor/rack/lib/rack/auth/digest/nonce.rb +0 -51
  52. data/vendor/rack/lib/rack/auth/digest/params.rb +0 -55
  53. data/vendor/rack/lib/rack/auth/digest/request.rb +0 -40
  54. data/vendor/rack/lib/rack/auth/openid.rb +0 -116
  55. data/vendor/rack/lib/rack/builder.rb +0 -56
  56. data/vendor/rack/lib/rack/cascade.rb +0 -36
  57. data/vendor/rack/lib/rack/commonlogger.rb +0 -56
  58. data/vendor/rack/lib/rack/file.rb +0 -112
  59. data/vendor/rack/lib/rack/handler/cgi.rb +0 -57
  60. data/vendor/rack/lib/rack/handler/fastcgi.rb +0 -83
  61. data/vendor/rack/lib/rack/handler/lsws.rb +0 -52
  62. data/vendor/rack/lib/rack/handler/scgi.rb +0 -57
  63. data/vendor/rack/lib/rack/handler/webrick.rb +0 -57
  64. data/vendor/rack/lib/rack/lint.rb +0 -394
  65. data/vendor/rack/lib/rack/lobster.rb +0 -65
  66. data/vendor/rack/lib/rack/mock.rb +0 -160
  67. data/vendor/rack/lib/rack/recursive.rb +0 -57
  68. data/vendor/rack/lib/rack/reloader.rb +0 -64
  69. data/vendor/rack/lib/rack/request.rb +0 -197
  70. data/vendor/rack/lib/rack/response.rb +0 -166
  71. data/vendor/rack/lib/rack/session/abstract/id.rb +0 -126
  72. data/vendor/rack/lib/rack/session/cookie.rb +0 -71
  73. data/vendor/rack/lib/rack/session/memcache.rb +0 -83
  74. data/vendor/rack/lib/rack/session/pool.rb +0 -67
  75. data/vendor/rack/lib/rack/showexceptions.rb +0 -344
  76. data/vendor/rack/lib/rack/showstatus.rb +0 -103
  77. data/vendor/rack/lib/rack/static.rb +0 -38
  78. data/vendor/rack/lib/rack/urlmap.rb +0 -48
  79. data/vendor/rack/lib/rack/utils.rb +0 -240
  80. data/vendor/rack/test/cgi/lighttpd.conf +0 -20
  81. data/vendor/rack/test/cgi/test +0 -9
  82. data/vendor/rack/test/cgi/test.fcgi +0 -7
  83. data/vendor/rack/test/cgi/test.ru +0 -7
  84. data/vendor/rack/test/spec_rack_auth_basic.rb +0 -69
  85. data/vendor/rack/test/spec_rack_auth_digest.rb +0 -169
  86. data/vendor/rack/test/spec_rack_builder.rb +0 -50
  87. data/vendor/rack/test/spec_rack_camping.rb +0 -47
  88. data/vendor/rack/test/spec_rack_cascade.rb +0 -50
  89. data/vendor/rack/test/spec_rack_cgi.rb +0 -91
  90. data/vendor/rack/test/spec_rack_commonlogger.rb +0 -32
  91. data/vendor/rack/test/spec_rack_fastcgi.rb +0 -91
  92. data/vendor/rack/test/spec_rack_file.rb +0 -40
  93. data/vendor/rack/test/spec_rack_lint.rb +0 -317
  94. data/vendor/rack/test/spec_rack_lobster.rb +0 -45
  95. data/vendor/rack/test/spec_rack_mock.rb +0 -152
  96. data/vendor/rack/test/spec_rack_mongrel.rb +0 -165
  97. data/vendor/rack/test/spec_rack_recursive.rb +0 -77
  98. data/vendor/rack/test/spec_rack_request.rb +0 -384
  99. data/vendor/rack/test/spec_rack_response.rb +0 -167
  100. data/vendor/rack/test/spec_rack_session_cookie.rb +0 -49
  101. data/vendor/rack/test/spec_rack_session_memcache.rb +0 -100
  102. data/vendor/rack/test/spec_rack_session_pool.rb +0 -84
  103. data/vendor/rack/test/spec_rack_showexceptions.rb +0 -21
  104. data/vendor/rack/test/spec_rack_showstatus.rb +0 -71
  105. data/vendor/rack/test/spec_rack_static.rb +0 -37
  106. data/vendor/rack/test/spec_rack_urlmap.rb +0 -175
  107. data/vendor/rack/test/spec_rack_utils.rb +0 -57
  108. data/vendor/rack/test/spec_rack_webrick.rb +0 -106
  109. data/vendor/rack/test/testrequest.rb +0 -43
data/index.html DELETED
@@ -1,9 +0,0 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
- <html>
3
- <head>
4
- <title>Your Page Title</title>
5
- <meta http-equiv="REFRESH" content="0;url=http://sinatrarb.com"></HEAD>
6
- <BODY>
7
- This site has <a href="http:://sinatrarb.com">moved</a>.
8
- </BODY>
9
- </HTML>
@@ -1,41 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- context "Diddy" do
4
-
5
- setup do
6
- Sinatra.application = nil
7
- end
8
-
9
- specify "should map urls to different apps" do
10
-
11
- get '/' do
12
- 'asdf'
13
- end
14
-
15
- get_it '/'
16
- assert ok?
17
- assert_equal('asdf', body)
18
-
19
- get '/foo', :host => 'foo.sinatrarb.com' do
20
- 'in foo!'
21
- end
22
-
23
- get '/foo', :host => 'bar.sinatrarb.com' do
24
- 'in bar!'
25
- end
26
-
27
- get_it '/foo', {}, 'HTTP_HOST' => 'foo.sinatrarb.com'
28
- assert ok?
29
- assert_equal 'in foo!', body
30
-
31
- get_it '/foo', {}, 'HTTP_HOST' => 'bar.sinatrarb.com'
32
- assert ok?
33
- assert_equal 'in bar!', body
34
-
35
- get_it '/foo'
36
- assert not_found?
37
-
38
- end
39
-
40
- end
41
-
@@ -1,16 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- context "RESTful tests" do
4
-
5
- specify "should take xml" do
6
- post '/foo.xml' do
7
- request.body.string
8
- end
9
-
10
- post_it '/foo.xml', '<myxml></myxml>'
11
- assert ok?
12
- assert_equal('<myxml></myxml>', body)
13
- end
14
-
15
- end
16
-
@@ -1,7 +0,0 @@
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
- * LiteSpeed handler: Adrian Madrid
6
- * SCGI handler: Jeremy Evans
7
- * Official Logo: Armin Ronacher
@@ -1,18 +0,0 @@
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.
@@ -1,18 +0,0 @@
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 "/".
@@ -1,242 +0,0 @@
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
- * Mongrel/Swiftcore (require it before requiring rack)
17
- * WEBrick
18
- * FCGI
19
- * CGI
20
- * SCGI
21
- * LiteSpeed
22
-
23
- These web servers include Rack handlers in their distributions:
24
- * Ebb
25
- * Fuzed
26
- * Thin
27
-
28
- Any valid Rack app will run the same on all these handlers, without
29
- changing anything.
30
-
31
- == Supported web frameworks
32
-
33
- The included *adapters* connect Rack with existing Ruby web frameworks:
34
- * Camping
35
-
36
- These frameworks include Rack adapters in their distributions:
37
- * Coset
38
- * Halcyon
39
- * Maveric
40
- * Merb
41
- * Racktools::SimpleApplication
42
- * Ramaze
43
- * Sinatra
44
- * Vintage
45
-
46
- Ruby on Rails can be run with the adapter included with Thin, which
47
- will be merged into a later Rack version.
48
-
49
- Current links to these projects can be found at
50
- http://ramaze.net/#other-frameworks
51
-
52
- == Available middleware
53
-
54
- Between the server and the framework, Rack can be customized to your
55
- applications needs using middleware, for example:
56
- * Rack::URLMap, to route to multiple applications inside the same process.
57
- * Rack::CommonLogger, for creating Apache-style logfiles.
58
- * Rack::ShowException, for catching unhandled exceptions and
59
- presenting them in a nice and helpful way with clickable backtrace.
60
- * Rack::File, for serving static files.
61
- * ...many others!
62
-
63
- All these components use the same interface, which is described in
64
- detail in the Rack specification. You can choose to use them exactly
65
- in the way you want.
66
-
67
- == Convenience
68
-
69
- If you want to develop outside of existing frameworks, implement your
70
- own ones, or develop middleware, Rack provides many helpers to create
71
- Rack applications quickly and without doing the same web stuff all
72
- over:
73
- * Rack::Request, which also provides query string parsing and
74
- multipart handling.
75
- * Rack::Response, for convenient generation of HTTP replies and
76
- cookie handling.
77
- * Rack::MockRequest and Rack::MockResponse for efficient and quick
78
- testing of Rack application without real HTTP round-trips.
79
-
80
- == rackup
81
-
82
- rackup is a useful tool for running Rack applications, which uses the
83
- Rack::Builder DSL to configure middleware and build up applications
84
- easily.
85
-
86
- rackup automatically figures out the environment it is run in, and
87
- runs your application as FastCGI, CGI, or standalone with Mongrel or
88
- WEBrick---all from the same configuration.
89
-
90
- == Quick start
91
-
92
- Try the lobster!
93
-
94
- Either with the embedded WEBrick starter:
95
-
96
- ruby -Ilib lib/rack/lobster.rb
97
-
98
- Or with rackup:
99
-
100
- bin/rackup -Ilib example/lobster.ru
101
-
102
- By default, the lobster is found at http://localhost:9292.
103
-
104
- == Installing with RubyGems
105
-
106
- A Gem of Rack is available. You can install it with:
107
-
108
- gem install rack
109
-
110
- I also provide a local mirror of the gems (and development snapshots)
111
- at my site:
112
-
113
- gem install rack --source http://chneukirchen.org/releases/gems
114
-
115
- == Running the tests
116
-
117
- Testing Rack requires the test/spec testing framework:
118
-
119
- gem install test-spec
120
-
121
- The full set of tests also test FCGI access with lighttpd so you will
122
- need lighttpd installed as well as the FCGI libraries and the fcgi gem
123
- installed:
124
-
125
- Download and install lighttpd:
126
-
127
- http://www.lighttpd.net/download
128
-
129
- Installing the FCGI libraries:
130
-
131
- curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
132
- tar xzvf fcgi-2.4.0.tar.gz
133
- cd fcgi-2.4.0
134
- ./configure --prefix=/usr/local
135
- make
136
- sudo make install
137
- cd ..
138
-
139
- Installing the Ruby fcgi gem:
140
-
141
- gem install fcgi
142
-
143
- There are two rake-based test tasks:
144
-
145
- rake test tests all the fast tests (no Handlers or Adapters)
146
- rake fulltest runs all the tests
147
-
148
- == History
149
-
150
- * March 3rd, 2007: First public release 0.1.
151
-
152
- * May 16th, 2007: Second public release 0.2.
153
- * HTTP Basic authentication.
154
- * Cookie Sessions.
155
- * Static file handler.
156
- * Improved Rack::Request.
157
- * Improved Rack::Response.
158
- * Added Rack::ShowStatus, for better default error messages.
159
- * Bug fixes in the Camping adapter.
160
- * Removed Rails adapter, was too alpha.
161
-
162
- * February 26th, 2008: Third public release 0.3.
163
- * LiteSpeed handler, by Adrian Madrid.
164
- * SCGI handler, by Jeremy Evans.
165
- * Pool sessions, by blink.
166
- * OpenID authentication, by blink.
167
- * :Port and :File options for opening FastCGI sockets, by blink.
168
- * Last-Modified HTTP header for Rack::File, by blink.
169
- * Rack::Builder#use now accepts blocks, by Corey Jewett.
170
- (See example/protectedlobster.ru)
171
- * HTTP status 201 can contain a Content-Type and a body now.
172
- * Many bugfixes, especially related to Cookie handling.
173
-
174
- * XXX, 2008: Fourth public release 0.4.
175
- * New Memcache sessions, by blink.
176
- * Rack::Reloader is not loaded in rackup development mode.
177
- * Many bugfixes, especially for pool sessions and URLMap.
178
-
179
- == Contact
180
-
181
- Please mail bugs, suggestions and patches to
182
- <mailto:chneukirchen@gmail.com>.
183
-
184
- Darcs repository ("darcs send" is welcome for patches):
185
- http://chneukirchen.org/repos/rack
186
-
187
- You are also welcome to join the #rack channel on irc.freenode.net.
188
-
189
- == Thanks to
190
-
191
- * blink for the Pool sessions, OpenID support, many tweaks, patches
192
- and bugreports.
193
- * Michael Fellinger, for the helpful discussion, bugfixes and a better
194
- Rack::Request interface.
195
- * Adrian Madrid, for the LiteSpeed handler.
196
- * Christoffer Sawicki, for the Rails adapter.
197
- * Tim Fletcher, for the HTTP authentication code.
198
- * Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
199
- * Armin Ronacher, for the logo and racktools.
200
- * Aredridel, for bug fixing.
201
- * Stephen Bannasch, for bug reports and documentation.
202
- * Gary Wright, for proposing a better Rack::Response interface.
203
- * Jonathan Buch, for improvements regarding Rack::Response.
204
- * Armin Röhrl, for tracking down bugs in the Cookie generator.
205
- * Alexander Kellett for testing the Gem and reviewing the announce.
206
- * Marcus Rückert, for help with configuring and debugging lighttpd.
207
- * The WSGI team for the well-done and documented work they've done and
208
- Rack builds up on.
209
-
210
- == Copyright
211
-
212
- Copyright (C) 2007, 2008 Christian Neukirchen <http://purl.org/net/chneukirchen>
213
-
214
- Permission is hereby granted, free of charge, to any person obtaining a copy
215
- of this software and associated documentation files (the "Software"), to
216
- deal in the Software without restriction, including without limitation the
217
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
218
- sell copies of the Software, and to permit persons to whom the Software is
219
- furnished to do so, subject to the following conditions:
220
-
221
- The above copyright notice and this permission notice shall be included in
222
- all copies or substantial portions of the Software.
223
-
224
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
225
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
226
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
227
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
228
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
229
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
230
-
231
- == Links
232
-
233
- Rack:: <http://rack.rubyforge.org/>
234
- Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
235
-
236
- Camping:: <http://camping.rubyforge.org/>
237
- Ramaze:: <http://ramaze.rubyforge.org/>
238
- Maveric:: <http://maveric.rubyforge.org/>
239
- racktools:: <http://lucumr.pocoo.org/trac/repos/racktools/>
240
-
241
- Christian Neukirchen:: <http://chneukirchen.org/>
242
-
@@ -1,174 +0,0 @@
1
- # Rakefile for Rack. -*-ruby-*-
2
- require 'rake/rdoctask'
3
- require 'rake/testtask'
4
-
5
-
6
- desc "Run all the tests"
7
- task :default => [:test]
8
-
9
- desc "Do predistribution stuff"
10
- task :predist => [:chmod, :changelog, :rdoc]
11
-
12
-
13
- desc "Make an archive as .tar.gz"
14
- task :dist => :fulltest do
15
- sh "export DARCS_REPO=#{File.expand_path "."}; " +
16
- "darcs dist -d rack-#{get_darcs_tree_version}"
17
- end
18
-
19
- # Helper to retrieve the "revision number" of the darcs tree.
20
- def get_darcs_tree_version
21
- unless File.directory? "_darcs"
22
- $: << "lib"
23
- require 'rack'
24
- return Rack.version
25
- end
26
-
27
- changes = `darcs changes`
28
- count = 0
29
- tag = "0.0"
30
-
31
- changes.split("\n\n").each { |change|
32
- head, title, desc = change.split("\n", 3)
33
-
34
- if title =~ /^ \*/
35
- # Normal change.
36
- count += 1
37
- elsif title =~ /tagged (.*)/
38
- # Tag. We look for these.
39
- tag = $1
40
- break
41
- else
42
- warn "Unparsable change: #{change}"
43
- end
44
- }
45
-
46
- tag + "." + count.to_s
47
- end
48
-
49
- def manifest
50
- `darcs query manifest`.split("\n").map { |f| f.gsub(/\A\.\//, '') }
51
- end
52
-
53
-
54
- desc "Make binaries executable"
55
- task :chmod do
56
- Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
57
- Dir["test/cgi/test*"].each { |binary| File.chmod(0775, binary) }
58
- end
59
-
60
- desc "Generate a ChangeLog"
61
- task :changelog do
62
- sh "darcs changes --repo=#{ENV["DARCS_REPO"] || "."} >ChangeLog"
63
- end
64
-
65
-
66
- desc "Generate RDox"
67
- task "RDOX" do
68
- sh "specrb -Ilib:test -a --rdox >RDOX"
69
- end
70
-
71
- desc "Generate Rack Specification"
72
- task "SPEC" do
73
- File.open("SPEC", "wb") { |file|
74
- IO.foreach("lib/rack/lint.rb") { |line|
75
- if line =~ /## (.*)/
76
- file.puts $1
77
- end
78
- }
79
- }
80
- end
81
-
82
- desc "Run all the fast tests"
83
- task :test do
84
- sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS'] || '-t "^(?!Rack::Handler|Rack::Adapter|Rack::Session::Memcache)"'}"
85
- end
86
-
87
- desc "Run all the tests"
88
- task :fulltest => [:chmod] do
89
- sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS']}"
90
- end
91
-
92
- begin
93
- require 'rubygems'
94
-
95
- require 'rake'
96
- require 'rake/clean'
97
- require 'rake/packagetask'
98
- require 'rake/gempackagetask'
99
- require 'fileutils'
100
- rescue LoadError
101
- # Too bad.
102
- else
103
- spec = Gem::Specification.new do |s|
104
- s.name = "rack"
105
- s.version = get_darcs_tree_version
106
- s.platform = Gem::Platform::RUBY
107
- s.summary = "a modular Ruby webserver interface"
108
-
109
- s.description = <<-EOF
110
- Rack provides minimal, modular and adaptable interface for developing
111
- web applications in Ruby. By wrapping HTTP requests and responses in
112
- the simplest way possible, it unifies and distills the API for web
113
- servers, web frameworks, and software in between (the so-called
114
- middleware) into a single method call.
115
-
116
- Also see http://rack.rubyforge.org.
117
- EOF
118
-
119
- s.files = manifest + %w(SPEC RDOX)
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
- end
132
-
133
- Rake::GemPackageTask.new(spec) do |p|
134
- p.gem_spec = spec
135
- p.need_tar = false
136
- p.need_zip = false
137
- end
138
- end
139
-
140
- desc "Generate RDoc documentation"
141
- Rake::RDocTask.new(:rdoc) do |rdoc|
142
- rdoc.options << '--line-numbers' << '--inline-source' <<
143
- '--main' << 'README' <<
144
- '--title' << 'Rack Documentation' <<
145
- '--charset' << 'utf-8'
146
- rdoc.rdoc_dir = "doc"
147
- rdoc.rdoc_files.include 'README'
148
- rdoc.rdoc_files.include 'KNOWN-ISSUES'
149
- rdoc.rdoc_files.include 'SPEC'
150
- rdoc.rdoc_files.include 'RDOX'
151
- rdoc.rdoc_files.include('lib/rack.rb')
152
- rdoc.rdoc_files.include('lib/rack/*.rb')
153
- rdoc.rdoc_files.include('lib/rack/*/*.rb')
154
- end
155
- task :rdoc => ["SPEC", "RDOX"]
156
-
157
- task :pushsite => [:rdoc] do
158
- sh "rsync -avz doc/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
159
- sh "rsync -avz site/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/"
160
- end
161
-
162
- begin
163
- require 'rcov/rcovtask'
164
-
165
- Rcov::RcovTask.new do |t|
166
- t.test_files = FileList['test/{spec,test}_*.rb']
167
- t.verbose = true # uncomment to see the executed command
168
- t.rcov_opts = ["--text-report",
169
- "-Ilib:test",
170
- "--include-file", "^lib,^test",
171
- "--exclude-only", "^/usr,^/home/.*/src,active_"]
172
- end
173
- rescue LoadError
174
- end