mongrel 1.1.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data.tar.gz.sig +4 -0
  2. data/CHANGELOG +18 -0
  3. data/COPYING +55 -0
  4. data/LICENSE +55 -0
  5. data/Manifest +69 -0
  6. data/README +74 -0
  7. data/TODO +5 -0
  8. data/bin/mongrel_rails +283 -0
  9. data/examples/builder.rb +29 -0
  10. data/examples/camping/README +3 -0
  11. data/examples/camping/blog.rb +294 -0
  12. data/examples/camping/tepee.rb +149 -0
  13. data/examples/httpd.conf +474 -0
  14. data/examples/mime.yaml +3 -0
  15. data/examples/mongrel.conf +9 -0
  16. data/examples/mongrel_simple_ctrl.rb +92 -0
  17. data/examples/mongrel_simple_service.rb +116 -0
  18. data/examples/monitrc +57 -0
  19. data/examples/random_thrash.rb +19 -0
  20. data/examples/simpletest.rb +52 -0
  21. data/examples/webrick_compare.rb +20 -0
  22. data/ext/http11/ext_help.h +14 -0
  23. data/ext/http11/extconf.rb +6 -0
  24. data/ext/http11/http11.c +402 -0
  25. data/ext/http11/http11_parser.c +1221 -0
  26. data/ext/http11/http11_parser.h +49 -0
  27. data/ext/http11/http11_parser.java.rl +170 -0
  28. data/ext/http11/http11_parser.rl +152 -0
  29. data/ext/http11/http11_parser_common.rl +54 -0
  30. data/ext/http11_java/Http11Service.java +13 -0
  31. data/ext/http11_java/org/jruby/mongrel/Http11.java +266 -0
  32. data/ext/http11_java/org/jruby/mongrel/Http11Parser.java +572 -0
  33. data/lib/http11.so +0 -0
  34. data/lib/mongrel.rb +355 -0
  35. data/lib/mongrel/camping.rb +107 -0
  36. data/lib/mongrel/cgi.rb +181 -0
  37. data/lib/mongrel/command.rb +222 -0
  38. data/lib/mongrel/configurator.rb +388 -0
  39. data/lib/mongrel/const.rb +110 -0
  40. data/lib/mongrel/debug.rb +203 -0
  41. data/lib/mongrel/gems.rb +22 -0
  42. data/lib/mongrel/handlers.rb +468 -0
  43. data/lib/mongrel/header_out.rb +28 -0
  44. data/lib/mongrel/http_request.rb +155 -0
  45. data/lib/mongrel/http_response.rb +163 -0
  46. data/lib/mongrel/init.rb +10 -0
  47. data/lib/mongrel/mime_types.yml +616 -0
  48. data/lib/mongrel/rails.rb +185 -0
  49. data/lib/mongrel/stats.rb +89 -0
  50. data/lib/mongrel/tcphack.rb +18 -0
  51. data/lib/mongrel/uri_classifier.rb +76 -0
  52. data/mongrel-public_cert.pem +20 -0
  53. data/mongrel.gemspec +242 -0
  54. data/setup.rb +1585 -0
  55. data/test/mime.yaml +3 -0
  56. data/test/mongrel.conf +1 -0
  57. data/test/test_cgi_wrapper.rb +26 -0
  58. data/test/test_command.rb +86 -0
  59. data/test/test_conditional.rb +107 -0
  60. data/test/test_configurator.rb +88 -0
  61. data/test/test_debug.rb +25 -0
  62. data/test/test_handlers.rb +126 -0
  63. data/test/test_http11.rb +156 -0
  64. data/test/test_redirect_handler.rb +45 -0
  65. data/test/test_request_progress.rb +100 -0
  66. data/test/test_response.rb +127 -0
  67. data/test/test_stats.rb +35 -0
  68. data/test/test_uriclassifier.rb +261 -0
  69. data/test/test_ws.rb +115 -0
  70. data/test/testhelp.rb +79 -0
  71. data/tools/trickletest.rb +45 -0
  72. metadata +197 -0
  73. metadata.gz.sig +1 -0
@@ -0,0 +1,185 @@
1
+ # Copyright (c) 2005 Zed A. Shaw
2
+ # You can redistribute it and/or modify it under the same terms as Ruby.
3
+ #
4
+ # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
5
+ # for more information.
6
+
7
+ require 'mongrel'
8
+ require 'cgi'
9
+
10
+
11
+ module Mongrel
12
+ module Rails
13
+ # Implements a handler that can run Rails and serve files out of the
14
+ # Rails application's public directory. This lets you run your Rails
15
+ # application with Mongrel during development and testing, then use it
16
+ # also in production behind a server that's better at serving the
17
+ # static files.
18
+ #
19
+ # The RailsHandler takes a mime_map parameter which is a simple suffix=mimetype
20
+ # mapping that it should add to the list of valid mime types.
21
+ #
22
+ # It also supports page caching directly and will try to resolve a request
23
+ # in the following order:
24
+ #
25
+ # * If the requested exact PATH_INFO exists as a file then serve it.
26
+ # * If it exists at PATH_INFO+".html" exists then serve that.
27
+ # * Finally, construct a Mongrel::CGIWrapper and run Dispatcher.dispatch to have Rails go.
28
+ #
29
+ # This means that if you are using page caching it will actually work with Mongrel
30
+ # and you should see a decent speed boost (but not as fast as if you use a static
31
+ # server like Apache or Litespeed).
32
+ class RailsHandler < Mongrel::HttpHandler
33
+ attr_reader :files
34
+ attr_reader :guard
35
+ @@file_only_methods = ["GET","HEAD"]
36
+
37
+ def initialize(dir, mime_map = {})
38
+ @files = Mongrel::DirHandler.new(dir,false)
39
+ @guard = Mutex.new
40
+
41
+ # Register the requested MIME types
42
+ mime_map.each {|k,v| Mongrel::DirHandler::add_mime_type(k,v) }
43
+ end
44
+
45
+ # Attempts to resolve the request as follows:
46
+ #
47
+ # * If the requested exact PATH_INFO exists as a file then serve it.
48
+ # * If it exists at PATH_INFO+".html" exists then serve that.
49
+ # * Finally, construct a Mongrel::CGIWrapper and run Dispatcher.dispatch to have Rails go.
50
+ def process(request, response)
51
+ return if response.socket.closed?
52
+
53
+ path_info = request.params[Mongrel::Const::PATH_INFO]
54
+ rest_operator = request.params[Mongrel::Const::REQUEST_URI][/^#{Regexp.escape path_info}(;[^\?]+)/, 1].to_s
55
+ path_info.chomp!("/")
56
+
57
+ page_cached = path_info + rest_operator + ActionController::Base.page_cache_extension
58
+ get_or_head = @@file_only_methods.include? request.params[Mongrel::Const::REQUEST_METHOD]
59
+
60
+ if get_or_head and @files.can_serve(path_info)
61
+ # File exists as-is so serve it up
62
+ @files.process(request,response)
63
+ elsif get_or_head and @files.can_serve(page_cached)
64
+ # Possible cached page, serve it up
65
+ request.params[Mongrel::Const::PATH_INFO] = page_cached
66
+ @files.process(request,response)
67
+ else
68
+ begin
69
+ cgi = Mongrel::CGIWrapper.new(request, response)
70
+ cgi.handler = self
71
+ # We don't want the output to be really final until we're out of the lock
72
+ cgi.default_really_final = false
73
+
74
+ @guard.synchronize {
75
+ @active_request_path = request.params[Mongrel::Const::PATH_INFO]
76
+ Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
77
+ @active_request_path = nil
78
+ }
79
+
80
+ # This finalizes the output using the proper HttpResponse way
81
+ cgi.out("text/html",true) {""}
82
+ rescue Errno::EPIPE
83
+ response.socket.close
84
+ rescue Object => rails_error
85
+ STDERR.puts "#{Time.now}: Error calling Dispatcher.dispatch #{rails_error.inspect}"
86
+ STDERR.puts rails_error.backtrace.join("\n")
87
+ end
88
+ end
89
+ end
90
+
91
+ # Does the internal reload for Rails. It might work for most cases, but
92
+ # sometimes you get exceptions. In that case just do a real restart.
93
+ def reload!
94
+ begin
95
+ @guard.synchronize {
96
+ $".replace $orig_dollar_quote
97
+ GC.start
98
+ Dispatcher.reset_application!
99
+ ActionController::Routing::Routes.reload
100
+ }
101
+ end
102
+ end
103
+ end
104
+
105
+ # Creates Rails specific configuration options for people to use
106
+ # instead of the base Configurator.
107
+ class RailsConfigurator < Mongrel::Configurator
108
+
109
+ # Creates a single rails handler and returns it so you
110
+ # can add it to a URI. You can actually attach it to
111
+ # as many URIs as you want, but this returns the
112
+ # same RailsHandler for each call.
113
+ #
114
+ # Requires the following options:
115
+ #
116
+ # * :docroot => The public dir to serve from.
117
+ # * :environment => Rails environment to use.
118
+ # * :cwd => The change to working directory
119
+ #
120
+ # And understands the following optional settings:
121
+ #
122
+ # * :mime => A map of mime types.
123
+ #
124
+ # Because of how Rails is designed you can only have
125
+ # one installed per Ruby interpreter (talk to them
126
+ # about thread safety). Because of this the first
127
+ # time you call this function it does all the config
128
+ # needed to get your Rails working. After that
129
+ # it returns the one handler you've configured.
130
+ # This lets you attach Rails to any URI(s) you want,
131
+ # but it still protects you from threads destroying
132
+ # your handler.
133
+ def rails(options={})
134
+
135
+ return @rails_handler if @rails_handler
136
+
137
+ ops = resolve_defaults(options)
138
+
139
+ # fix up some defaults
140
+ ops[:environment] ||= "development"
141
+ ops[:docroot] ||= "public"
142
+ ops[:mime] ||= {}
143
+
144
+ $orig_dollar_quote = $".clone
145
+ ENV['RAILS_ENV'] = ops[:environment]
146
+ env_location = "#{ops[:cwd]}/config/environment"
147
+ require env_location
148
+ require 'dispatcher'
149
+ require 'mongrel/rails'
150
+
151
+ ActionController::AbstractRequest.relative_url_root = ops[:prefix] if ops[:prefix]
152
+
153
+ @rails_handler = RailsHandler.new(ops[:docroot], ops[:mime])
154
+ end
155
+
156
+ # Reloads Rails. This isn't too reliable really, but it
157
+ # should work for most minimal reload purposes. The only reliable
158
+ # way to reload properly is to stop and then start the process.
159
+ def reload!
160
+ if not @rails_handler
161
+ raise "Rails was not configured. Read the docs for RailsConfigurator."
162
+ end
163
+
164
+ log "Reloading Rails..."
165
+ @rails_handler.reload!
166
+ log "Done reloading Rails."
167
+
168
+ end
169
+
170
+ # Takes the exact same configuration as Mongrel::Configurator (and actually calls that)
171
+ # but sets up the additional HUP handler to call reload!.
172
+ def setup_rails_signals(options={})
173
+ ops = resolve_defaults(options)
174
+ setup_signals(options)
175
+
176
+ if RUBY_PLATFORM !~ /mswin|mingw/
177
+ # rails reload
178
+ trap("HUP") { log "HUP signal received."; reload! }
179
+
180
+ log "Rails signals registered. HUP => reload (without restart). It might not work well."
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,89 @@
1
+ # Copyright (c) 2005 Zed A. Shaw
2
+ # You can redistribute it and/or modify it under the same terms as Ruby.
3
+ #
4
+ # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
5
+ # for more information.
6
+
7
+ # A very simple little class for doing some basic fast statistics sampling.
8
+ # You feed it either samples of numeric data you want measured or you call
9
+ # Stats.tick to get it to add a time delta between the last time you called it.
10
+ # When you're done either call sum, sumsq, n, min, max, mean or sd to get
11
+ # the information. The other option is to just call dump and see everything.
12
+ #
13
+ # It does all of this very fast and doesn't take up any memory since the samples
14
+ # are not stored but instead all the values are calculated on the fly.
15
+ module Mongrel
16
+ class Stats
17
+ attr_reader :sum, :sumsq, :n, :min, :max
18
+
19
+ def initialize(name)
20
+ @name = name
21
+ reset
22
+ end
23
+
24
+ # Resets the internal counters so you can start sampling again.
25
+ def reset
26
+ @sum = 0.0
27
+ @sumsq = 0.0
28
+ @last_time = Time.new
29
+ @n = 0.0
30
+ @min = 0.0
31
+ @max = 0.0
32
+ end
33
+
34
+ # Adds a sampling to the calculations.
35
+ def sample(s)
36
+ @sum += s
37
+ @sumsq += s * s
38
+ if @n == 0
39
+ @min = @max = s
40
+ else
41
+ @min = s if @min > s
42
+ @max = s if @max < s
43
+ end
44
+ @n+=1
45
+ end
46
+
47
+ # Dump this Stats object with an optional additional message.
48
+ def dump(msg = "", out=STDERR)
49
+ out.puts "#{msg}: #{self.to_s}"
50
+ end
51
+
52
+ # Returns a common display (used by dump)
53
+ def to_s
54
+ "[#{@name}]: SUM=%0.4f, SUMSQ=%0.4f, N=%0.4f, MEAN=%0.4f, SD=%0.4f, MIN=%0.4f, MAX=%0.4f" % [@sum, @sumsq, @n, mean, sd, @min, @max]
55
+ end
56
+
57
+
58
+ # Calculates and returns the mean for the data passed so far.
59
+ def mean
60
+ @sum / @n
61
+ end
62
+
63
+ # Calculates the standard deviation of the data so far.
64
+ def sd
65
+ # (sqrt( ((s).sumsq - ( (s).sum * (s).sum / (s).n)) / ((s).n-1) ))
66
+ begin
67
+ return Math.sqrt( (@sumsq - ( @sum * @sum / @n)) / (@n-1) )
68
+ rescue Errno::EDOM
69
+ return 0.0
70
+ end
71
+ end
72
+
73
+
74
+ # Adds a time delta between now and the last time you called this. This
75
+ # will give you the average time between two activities.
76
+ #
77
+ # An example is:
78
+ #
79
+ # t = Stats.new("do_stuff")
80
+ # 10000.times { do_stuff(); t.tick }
81
+ # t.dump("time")
82
+ #
83
+ def tick
84
+ now = Time.now
85
+ sample(now - @last_time)
86
+ @last_time = now
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,18 @@
1
+ # Copyright (c) 2005 Zed A. Shaw
2
+ # You can redistribute it and/or modify it under the same terms as Ruby.
3
+ #
4
+ # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
5
+ # for more information.
6
+
7
+
8
+ # A modification proposed by Sean Treadway that increases the default accept
9
+ # queue of TCPServer to 1024 so that it handles more concurrent requests.
10
+ class TCPServer
11
+ def initialize_with_backlog(*args)
12
+ initialize_without_backlog(*args)
13
+ listen(1024)
14
+ end
15
+
16
+ alias_method :initialize_without_backlog, :initialize
17
+ alias_method :initialize, :initialize_with_backlog
18
+ end
@@ -0,0 +1,76 @@
1
+
2
+ module Mongrel
3
+ class URIClassifier
4
+
5
+ class RegistrationError < RuntimeError
6
+ end
7
+ class UsageError < RuntimeError
8
+ end
9
+
10
+ attr_reader :handler_map
11
+
12
+ # Returns the URIs that have been registered with this classifier so far.
13
+ def uris
14
+ @handler_map.keys
15
+ end
16
+
17
+ def initialize
18
+ @handler_map = {}
19
+ @matcher = //
20
+ @root_handler = nil
21
+ end
22
+
23
+ # Register a handler object at a particular URI. The handler can be whatever
24
+ # you want, including an array. It's up to you what to do with it.
25
+ #
26
+ # Registering a handler is not necessarily threadsafe, so be careful if you go
27
+ # mucking around once the server is running.
28
+ def register(uri, handler)
29
+ raise RegistrationError, "#{uri.inspect} is already registered" if @handler_map[uri]
30
+ raise RegistrationError, "URI is empty" if !uri or uri.empty?
31
+ raise RegistrationError, "URI must begin with a \"#{Const::SLASH}\"" unless uri[0..0] == Const::SLASH
32
+ @handler_map[uri.dup] = handler
33
+ rebuild
34
+ end
35
+
36
+ # Unregister a particular URI and its handler.
37
+ def unregister(uri)
38
+ handler = @handler_map.delete(uri)
39
+ raise RegistrationError, "#{uri.inspect} was not registered" unless handler
40
+ rebuild
41
+ handler
42
+ end
43
+
44
+ # Resolve a request URI by finding the best partial match in the registered
45
+ # handler URIs.
46
+ def resolve(request_uri)
47
+ if @root_handler
48
+ # Optimization for the pathological case of only one handler on "/"; e.g. Rails
49
+ [Const::SLASH, request_uri, @root_handler]
50
+ elsif match = @matcher.match(request_uri)
51
+ uri = match.to_s
52
+ # A root mounted ("/") handler must resolve such that path info matches the original URI.
53
+ [uri, (uri == Const::SLASH ? request_uri : match.post_match), @handler_map[uri]]
54
+ else
55
+ [nil, nil, nil]
56
+ end
57
+ end
58
+
59
+ private
60
+
61
+ def rebuild
62
+ if @handler_map.size == 1 and @handler_map[Const::SLASH]
63
+ @root_handler = @handler_map.values.first
64
+ else
65
+ @root_handler = nil
66
+ routes = @handler_map.keys.sort.sort_by do |uri|
67
+ -uri.length
68
+ end
69
+ @matcher = Regexp.new(routes.map do |uri|
70
+ Regexp.new('^' + Regexp.escape(uri))
71
+ end.join('|'))
72
+ end
73
+ end
74
+
75
+ end
76
+ end
@@ -0,0 +1,20 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDUDCCAjigAwIBAgIBADANBgkqhkiG9w0BAQUFADBOMRwwGgYDVQQDDBNtb25n
3
+ cmVsLWRldmVsb3BtZW50MRkwFwYKCZImiZPyLGQBGRYJcnVieWZvcmdlMRMwEQYK
4
+ CZImiZPyLGQBGRYDb3JnMB4XDTA3MDkxNjEwMzI0OVoXDTA4MDkxNTEwMzI0OVow
5
+ TjEcMBoGA1UEAwwTbW9uZ3JlbC1kZXZlbG9wbWVudDEZMBcGCgmSJomT8ixkARkW
6
+ CXJ1Ynlmb3JnZTETMBEGCgmSJomT8ixkARkWA29yZzCCASIwDQYJKoZIhvcNAQEB
7
+ BQADggEPADCCAQoCggEBAMb9v3B01eOHk3FyypbQgKXzJplUE5P6dXoG+xpPm0Lv
8
+ P7BQmeMncOwqQ7zXpVQU+lTpXtQFTsOE3vL7KnhQFJKGvUAkbh24VFyopu1I0yqF
9
+ mGu4nRqNXGXVj8TvLSj4S1WpSRLAa0acLPNyKhGmoV9+crqQypSjM6XKjBeppifo
10
+ 4eBmWGjiJEYMIJBvJZPJ4rAVDDA8C6CM1m3gMBGNh8ELDhU8HI9AP3dMIkTI2Wx9
11
+ 9xkJwHdroAaS0IFFtYChrwee4FbCF1FHDgoTosMwa47DrLHg4hZ6ojaKwK5QVWEV
12
+ XGb6ju5UqpktnSWF2W+Lvl/K0tI42OH2CAhebT1gEVUCAwEAAaM5MDcwCQYDVR0T
13
+ BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFGHChyMSZ16u9WOzKhgJSQ9lqDc5
14
+ MA0GCSqGSIb3DQEBBQUAA4IBAQA/lfeN2WdB1xN+82tT7vNS4HOjRQw6MUh5yktu
15
+ GQjaGqm0UB+aX0Z9y0B0qpfv9rj7nmIvEGiwBmDepNWYCGuW15JyqpN7QVVnG2xS
16
+ Mrame7VqgjM7A+VGDD5In5LtWbM/CHAATvvFlQ5Ph13YE1EdnVbZ65c+KQv+5sFY
17
+ Q+zEop74d878uaC/SAHHXS46TiXneocaLSYw1CEZs/MAIy+9c4Q5ESbGpgnfg1Ad
18
+ 6lwl7k3hsNHO/+tZzx4HJtOXDI1yAl3+q6T9J0yI3z97EinwvAKhS1eyOI2Y5eeT
19
+ tbQaNYkU127B3l/VNpd8fQm3Jkl/PqCCmDBQjUszFrJEODug
20
+ -----END CERTIFICATE-----
@@ -0,0 +1,242 @@
1
+
2
+ # Gem::Specification for Mongrel-1.1.5
3
+ # Originally generated by Echoe
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{mongrel}
7
+ s.version = "1.1.5"
8
+ s.platform = %q{x86-mingw32}
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Zed A. Shaw"]
12
+ s.date = %q{2008-08-16}
13
+ s.default_executable = %q{mongrel_rails}
14
+ s.description = %q{A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps.}
15
+ s.email = %q{}
16
+ s.executables = ["mongrel_rails"]
17
+ s.has_rdoc = true
18
+ s.homepage = %q{http://mongrel.rubyforge.org}
19
+ s.require_paths = ["lib", "ext"]
20
+ s.required_ruby_version = Gem::Requirement.new(">= 1.8.4")
21
+ s.rubyforge_project = %q{mongrel}
22
+ s.rubygems_version = %q{1.2.0}
23
+ s.summary = %q{A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps.}
24
+ s.test_files = ["test/test_cgi_wrapper.rb", "test/test_command.rb", "test/test_conditional.rb", "test/test_configurator.rb", "test/test_debug.rb", "test/test_handlers.rb", "test/test_http11.rb", "test/test_redirect_handler.rb", "test/test_request_progress.rb", "test/test_response.rb", "test/test_stats.rb", "test/test_uriclassifier.rb", "test/test_ws.rb"]
25
+
26
+ if s.respond_to? :specification_version then
27
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
28
+ s.specification_version = 2
29
+
30
+ if current_version >= 3 then
31
+ s.add_runtime_dependency(%q<gem_plugin>, [">= 0.2.3"])
32
+ s.add_runtime_dependency(%q<cgi_multipart_eof_fix>, [">= 2.4"])
33
+ else
34
+ s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
35
+ s.add_dependency(%q<cgi_multipart_eof_fix>, [">= 2.4"])
36
+ end
37
+ else
38
+ s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
39
+ s.add_dependency(%q<cgi_multipart_eof_fix>, [">= 2.4"])
40
+ end
41
+ end
42
+
43
+
44
+ # # Original Rakefile source (requires the Echoe gem):
45
+ #
46
+ #
47
+ # require 'rubygems'
48
+ # gem 'echoe', '>=2.7.5'
49
+ # require 'echoe'
50
+ #
51
+ # e = Echoe.new("mongrel") do |p|
52
+ # p.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps."
53
+ # p.author ="Zed A. Shaw"
54
+ # p.clean_pattern = ['ext/http11/*.{bundle,so,o,obj,pdb,lib,def,exp}', 'lib/*.{bundle,so,o,obj,pdb,lib,def,exp}', 'ext/http11/Makefile', 'pkg', 'lib/*.bundle', '*.gem', 'site/output', '.config', 'lib/http11.jar', 'ext/http11_java/classes', 'coverage', 'doc']
55
+ # p.url = "http://mongrel.rubyforge.org"
56
+ # p.rdoc_pattern = ['README', 'LICENSE', 'CHANGELOG', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
57
+ # p.docs_host = 'mongrel.cloudbur.st:/home/eweaver/www/mongrel/htdocs/web'
58
+ # p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
59
+ # p.ruby_version = '>=1.8.4'
60
+ # p.dependencies = ['gem_plugin >=0.2.3']
61
+ # p.extension_pattern = nil
62
+ #
63
+ # when 'eweaver'
64
+ # when 'Luis', 'luislavena'
65
+ # end
66
+ #
67
+ # p.need_tar_gz = false
68
+ # p.need_tgz = true
69
+ #
70
+ # if RUBY_PLATFORM !~ /mswin|mingw|java/
71
+ # p.extension_pattern = ["ext/**/extconf.rb"]
72
+ # end
73
+ #
74
+ # p.eval = proc do
75
+ # case RUBY_PLATFORM
76
+ # when /mswin|mingw/
77
+ # self.files += ['lib/http11.so']
78
+ # self.platform = Gem::Platform::CURRENT
79
+ # add_dependency('cgi_multipart_eof_fix', '>= 2.4')
80
+ # when /java/
81
+ # self.files += ['lib/http11.jar']
82
+ # self.platform = 'jruby' # XXX Is this right?
83
+ # else
84
+ # add_dependency('daemons', '>= 1.0.3')
85
+ # add_dependency('fastthread', '>= 1.0.1')
86
+ # add_dependency('cgi_multipart_eof_fix', '>= 2.4')
87
+ # end
88
+ # end
89
+ #
90
+ # end
91
+ #
92
+ # #### Ragel builder
93
+ #
94
+ # desc "Rebuild the Ragel sources"
95
+ # task :ragel do
96
+ # Dir.chdir "ext/http11" do
97
+ # target = "http11_parser.c"
98
+ # File.unlink target if File.exist? target
99
+ # sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}"
100
+ # raise "Failed to build C source" unless File.exist? target
101
+ # end
102
+ # Dir.chdir "ext/http11" do
103
+ # target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
104
+ # File.unlink target if File.exist? target
105
+ # sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}"
106
+ # raise "Failed to build Java source" unless File.exist? target
107
+ # end
108
+ # end
109
+ #
110
+ # #### Pre-compiled extensions for alternative platforms
111
+ #
112
+ # def move_extensions
113
+ # Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"].each { |file| mv file, "lib/" }
114
+ # end
115
+ #
116
+ # def java_classpath_arg
117
+ # # A myriad of ways to discover the JRuby classpath
118
+ # classpath = begin
119
+ # require 'java'
120
+ # # Already running in a JRuby JVM
121
+ # Java::java.lang.System.getProperty('java.class.path')
122
+ # rescue LoadError
123
+ # ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
124
+ # end
125
+ # classpath ? "-cp #{classpath}" : ""
126
+ # end
127
+ #
128
+ # case RUBY_PLATFORM
129
+ # when /mswin|mingw/
130
+ # filename = "lib/http11.so"
131
+ # file filename do
132
+ # Dir.chdir("ext/http11") do
133
+ # ruby "extconf.rb"
134
+ # system(PLATFORM =~ /mswin/ ? 'nmake' : 'make')
135
+ # end
136
+ # move_extensions
137
+ # end
138
+ # task :compile => [filename]
139
+ #
140
+ # when /java/
141
+ #
142
+ # # Avoid JRuby in-process launching problem
143
+ # begin
144
+ # require 'jruby'
145
+ # JRuby.runtime.instance_config.run_ruby_in_process = false
146
+ # rescue LoadError
147
+ # end
148
+ #
149
+ # filename = "lib/http11.jar"
150
+ # file filename do
151
+ # build_dir = "ext/http11_java/classes"
152
+ # mkdir_p build_dir
153
+ # sources = FileList['ext/http11_java/**/*.java'].join(' ')
154
+ # sh "javac -target 1.4 -source 1.4 -d #{build_dir} #{java_classpath_arg} #{sources}"
155
+ # sh "jar cf lib/http11.jar -C #{build_dir} ."
156
+ # move_extensions
157
+ # end
158
+ # task :compile => [filename]
159
+ #
160
+ # end
161
+ #
162
+ # #### Project-wide install and uninstall tasks
163
+ #
164
+ # def sub_project(project, *targets)
165
+ # targets.each do |target|
166
+ # Dir.chdir "projects/#{project}" do
167
+ # unless RUBY_PLATFORM =~ /mswin/
168
+ # sh("rake #{target.to_s}") # --trace
169
+ # end
170
+ # end
171
+ # end
172
+ # end
173
+ #
174
+ # desc "Package Mongrel and all subprojects"
175
+ # task :package_all => [:package] do
176
+ # sub_project("gem_plugin", :package)
177
+ # sub_project("cgi_multipart_eof_fix", :package)
178
+ # sub_project("fastthread", :package)
179
+ # sub_project("mongrel_status", :package)
180
+ # sub_project("mongrel_upload_progress", :package)
181
+ # sub_project("mongrel_console", :package)
182
+ # sub_project("mongrel_cluster", :package)
183
+ # sub_project("mongrel_experimental", :package)
184
+ #
185
+ # sh("rake java package") unless RUBY_PLATFORM =~ /java/
186
+ #
187
+ # # XXX Broken by RubyGems 0.9.5
188
+ # # sub_project("mongrel_service", :package) if RUBY_PLATFORM =~ /mswin/
189
+ # # sh("rake mswin package") unless RUBY_PLATFORM =~ /mswin/
190
+ # end
191
+ #
192
+ # task :install_requirements do
193
+ # # These run before Mongrel is installed
194
+ # sub_project("gem_plugin", :install)
195
+ # sub_project("cgi_multipart_eof_fix", :install)
196
+ # sub_project("fastthread", :install)
197
+ # end
198
+ #
199
+ # desc "for Mongrel and all subprojects"
200
+ # task :install => [:install_requirements] do
201
+ # # These run after Mongrel is installed
202
+ # sub_project("mongrel_status", :install)
203
+ # sub_project("mongrel_upload_progress", :install)
204
+ # sub_project("mongrel_console", :install)
205
+ # sub_project("mongrel_cluster", :install)
206
+ # # sub_project("mongrel_experimental", :install)
207
+ # sub_project("mongrel_service", :install) if RUBY_PLATFORM =~ /mswin|mingw/
208
+ # end
209
+ #
210
+ # desc "for Mongrel and all its subprojects"
211
+ # task :uninstall => [:clean] do
212
+ # sub_project("mongrel_status", :uninstall)
213
+ # sub_project("cgi_multipart_eof_fix", :uninstall)
214
+ # sub_project("mongrel_upload_progress", :uninstall)
215
+ # sub_project("mongrel_console", :uninstall)
216
+ # sub_project("gem_plugin", :uninstall)
217
+ # sub_project("fastthread", :uninstall)
218
+ # # sub_project("mongrel_experimental", :uninstall)
219
+ # sub_project("mongrel_service", :uninstall) if RUBY_PLATFORM =~ /mswin|mingw/
220
+ # end
221
+ #
222
+ # desc "for Mongrel and all its subprojects"
223
+ # task :clean do
224
+ # sub_project("gem_plugin", :clean)
225
+ # sub_project("cgi_multipart_eof_fix", :clean)
226
+ # sub_project("fastthread", :clean)
227
+ # sub_project("mongrel_status", :clean)
228
+ # sub_project("mongrel_upload_progress", :clean)
229
+ # sub_project("mongrel_console", :clean)
230
+ # sub_project("mongrel_cluster", :clean)
231
+ # sub_project("mongrel_experimental", :clean)
232
+ # sub_project("mongrel_service", :clean) if RUBY_PLATFORM =~ /mswin|mingw/
233
+ # end
234
+ #
235
+ # #### Site upload tasks
236
+ #
237
+ # namespace :site do
238
+ # desc "Upload the coverage report"
239
+ # task :coverage => [:rcov] do
240
+ # sh "rsync -azv --no-perms --no-times test/coverage/* mongrel.cloudbur.st:/home/eweaver/www/mongrel/htdocs/web/coverage" rescue nil
241
+ # end
242
+ # end