mongrel 1.1.2-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mongrel might be problematic. Click here for more details.
- data.tar.gz.sig +1 -0
- data/CHANGELOG +12 -0
- data/COPYING +55 -0
- data/LICENSE +55 -0
- data/Manifest +69 -0
- data/README +74 -0
- data/TODO +5 -0
- data/bin/mongrel_rails +283 -0
- data/examples/builder.rb +29 -0
- data/examples/camping/README +3 -0
- data/examples/camping/blog.rb +294 -0
- data/examples/camping/tepee.rb +149 -0
- data/examples/httpd.conf +474 -0
- data/examples/mime.yaml +3 -0
- data/examples/mongrel.conf +9 -0
- data/examples/mongrel_simple_ctrl.rb +92 -0
- data/examples/mongrel_simple_service.rb +116 -0
- data/examples/monitrc +57 -0
- data/examples/random_thrash.rb +19 -0
- data/examples/simpletest.rb +52 -0
- data/examples/webrick_compare.rb +20 -0
- data/ext/http11/ext_help.h +14 -0
- data/ext/http11/extconf.rb +6 -0
- data/ext/http11/http11.c +402 -0
- data/ext/http11/http11_parser.c +1221 -0
- data/ext/http11/http11_parser.h +49 -0
- data/ext/http11/http11_parser.java.rl +170 -0
- data/ext/http11/http11_parser.rl +152 -0
- data/ext/http11/http11_parser_common.rl +54 -0
- data/ext/http11_java/Http11Service.java +13 -0
- data/ext/http11_java/org/jruby/mongrel/Http11.java +266 -0
- data/ext/http11_java/org/jruby/mongrel/Http11Parser.java +572 -0
- data/lib/http11.jar +0 -0
- data/lib/mongrel.rb +355 -0
- data/lib/mongrel/camping.rb +107 -0
- data/lib/mongrel/cgi.rb +181 -0
- data/lib/mongrel/command.rb +222 -0
- data/lib/mongrel/configurator.rb +388 -0
- data/lib/mongrel/const.rb +110 -0
- data/lib/mongrel/debug.rb +203 -0
- data/lib/mongrel/gems.rb +22 -0
- data/lib/mongrel/handlers.rb +468 -0
- data/lib/mongrel/header_out.rb +28 -0
- data/lib/mongrel/http_request.rb +155 -0
- data/lib/mongrel/http_response.rb +163 -0
- data/lib/mongrel/init.rb +10 -0
- data/lib/mongrel/mime_types.yml +616 -0
- data/lib/mongrel/rails.rb +185 -0
- data/lib/mongrel/stats.rb +89 -0
- data/lib/mongrel/tcphack.rb +18 -0
- data/lib/mongrel/uri_classifier.rb +76 -0
- data/mongrel-public_cert.pem +20 -0
- data/mongrel.gemspec +263 -0
- data/setup.rb +1585 -0
- data/test/mime.yaml +3 -0
- data/test/mongrel.conf +1 -0
- data/test/test_cgi_wrapper.rb +26 -0
- data/test/test_command.rb +86 -0
- data/test/test_conditional.rb +107 -0
- data/test/test_configurator.rb +87 -0
- data/test/test_debug.rb +25 -0
- data/test/test_handlers.rb +103 -0
- data/test/test_http11.rb +156 -0
- data/test/test_redirect_handler.rb +44 -0
- data/test/test_request_progress.rb +99 -0
- data/test/test_response.rb +127 -0
- data/test/test_stats.rb +35 -0
- data/test/test_uriclassifier.rb +261 -0
- data/test/test_ws.rb +115 -0
- data/test/testhelp.rb +66 -0
- data/tools/trickletest.rb +45 -0
- metadata +186 -0
- metadata.gz.sig +4 -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/
|
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-----
|
data/mongrel.gemspec
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
|
2
|
+
# Gem::Specification for Mongrel-1.1.2
|
3
|
+
# Originally generated by Echoe
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = %q{mongrel}
|
7
|
+
s.version = "1.1.2"
|
8
|
+
s.platform = %q{java}
|
9
|
+
|
10
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
11
|
+
|
12
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
13
|
+
s.authors = ["Zed A. Shaw"]
|
14
|
+
s.date = %q{2007-12-22}
|
15
|
+
s.default_executable = %q{mongrel_rails}
|
16
|
+
s.description = %q{A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps.}
|
17
|
+
s.email = %q{}
|
18
|
+
s.executables = ["mongrel_rails"]
|
19
|
+
s.has_rdoc = true
|
20
|
+
s.homepage = %q{}
|
21
|
+
s.require_paths = ["lib", "ext"]
|
22
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.8.4")
|
23
|
+
s.rubyforge_project = %q{mongrel}
|
24
|
+
s.rubygems_version = %q{1.0.1}
|
25
|
+
s.summary = %q{A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps.}
|
26
|
+
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"]
|
27
|
+
|
28
|
+
s.add_dependency(%q<gem_plugin>, [">= 0.2.3"])
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# # Original Rakefile source (requires the Echoe gem):
|
33
|
+
#
|
34
|
+
#
|
35
|
+
# require 'rubygems'
|
36
|
+
# gem 'echoe', '>=2.7.5'
|
37
|
+
# require 'echoe'
|
38
|
+
#
|
39
|
+
# e = Echoe.new("mongrel") do |p|
|
40
|
+
# p.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps."
|
41
|
+
# p.author ="Zed A. Shaw"
|
42
|
+
# 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']
|
43
|
+
# p.rdoc_pattern = ['README', 'LICENSE', 'CHANGELOG', 'COPYING', 'lib/**/*.rb', 'doc/**/*.rdoc']
|
44
|
+
# p.ignore_pattern = /^(pkg|site|projects|doc|log)|CVS|\.log/
|
45
|
+
# p.ruby_version = '>= 1.8.4'
|
46
|
+
# p.dependencies = ['gem_plugin >=0.2.3']
|
47
|
+
# p.extension_pattern = nil
|
48
|
+
#
|
49
|
+
# p.need_tar_gz = false
|
50
|
+
# p.need_tgz = true
|
51
|
+
#
|
52
|
+
# case RUBY_PLATFORM
|
53
|
+
# when /mswin/
|
54
|
+
# when /java/
|
55
|
+
# else
|
56
|
+
# p.extension_pattern = ["ext/**/extconf.rb"]
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# p.eval = proc do
|
60
|
+
# case RUBY_PLATFORM
|
61
|
+
# when /mswin/
|
62
|
+
# self.files += ['lib/http11.so']
|
63
|
+
# self.platform = Gem::Platform::WIN32
|
64
|
+
# add_dependency('cgi_multipart_eof_fix', '>= 2.4')
|
65
|
+
# when /java/
|
66
|
+
# self.files += ['lib/http11.jar']
|
67
|
+
# self.platform = 'jruby'
|
68
|
+
# else
|
69
|
+
# add_dependency('daemons', '>= 1.0.3')
|
70
|
+
# add_dependency('fastthread', '>= 1.0.1')
|
71
|
+
# add_dependency('cgi_multipart_eof_fix', '>= 2.4')
|
72
|
+
# end
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
# end
|
76
|
+
#
|
77
|
+
# #### Ragel builder
|
78
|
+
#
|
79
|
+
# desc "Rebuild the Ragel sources"
|
80
|
+
# task :ragel do
|
81
|
+
# Dir.chdir "ext/http11" do
|
82
|
+
# target = "http11_parser.c"
|
83
|
+
# File.unlink target if File.exist? target
|
84
|
+
# sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}"
|
85
|
+
# raise "Failed to build C source" unless File.exist? target
|
86
|
+
# end
|
87
|
+
# Dir.chdir "ext/http11" do
|
88
|
+
# target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
|
89
|
+
# File.unlink target if File.exist? target
|
90
|
+
# sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}"
|
91
|
+
# raise "Failed to build Java source" unless File.exist? target
|
92
|
+
# end
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# #### Pre-compiled extensions for alternative platforms
|
96
|
+
#
|
97
|
+
# def move_extensions
|
98
|
+
# Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"].each { |file| mv file, "lib/" }
|
99
|
+
# end
|
100
|
+
#
|
101
|
+
# def java_classpath_arg
|
102
|
+
# # A myriad of ways to discover the JRuby classpath
|
103
|
+
# classpath = begin
|
104
|
+
# require 'java'
|
105
|
+
# # Already running in a JRuby JVM
|
106
|
+
# Java::java.lang.System.getProperty('java.class.path')
|
107
|
+
# rescue LoadError
|
108
|
+
# ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] && FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
|
109
|
+
# end
|
110
|
+
# classpath ? "-cp #{classpath}" : ""
|
111
|
+
# end
|
112
|
+
#
|
113
|
+
# case RUBY_PLATFORM
|
114
|
+
# when /mswin/
|
115
|
+
# filename = "lib/http11.so"
|
116
|
+
# file filename do
|
117
|
+
# Dir.chdir("ext/http11") do
|
118
|
+
# ruby "extconf.rb"
|
119
|
+
# system(PLATFORM =~ /mswin/ ? 'nmake' : 'make')
|
120
|
+
# end
|
121
|
+
# move_extensions
|
122
|
+
# end
|
123
|
+
# task :compile => [filename]
|
124
|
+
#
|
125
|
+
# when /java/
|
126
|
+
#
|
127
|
+
# # Avoid JRuby in-process launching problem
|
128
|
+
# begin
|
129
|
+
# require 'jruby'
|
130
|
+
# JRuby.runtime.instance_config.run_ruby_in_process = false
|
131
|
+
# rescue LoadError
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# filename = "lib/http11.jar"
|
135
|
+
# file filename do
|
136
|
+
# build_dir = "ext/http11_java/classes"
|
137
|
+
# mkdir_p build_dir
|
138
|
+
# sources = FileList['ext/http11_java/**/*.java'].join(' ')
|
139
|
+
# sh "javac -target 1.4 -source 1.4 -d #{build_dir} #{java_classpath_arg} #{sources}"
|
140
|
+
# sh "jar cf lib/http11.jar -C #{build_dir} ."
|
141
|
+
# move_extensions
|
142
|
+
# end
|
143
|
+
# task :compile => [filename]
|
144
|
+
#
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# #### Project-wide install and uninstall tasks
|
148
|
+
#
|
149
|
+
# def sub_project(project, *targets)
|
150
|
+
# targets.each do |target|
|
151
|
+
# Dir.chdir "projects/#{project}" do
|
152
|
+
# unless RUBY_PLATFORM =~ /mswin/
|
153
|
+
# sh("rake #{target.to_s}") # --trace
|
154
|
+
# end
|
155
|
+
# end
|
156
|
+
# end
|
157
|
+
# end
|
158
|
+
#
|
159
|
+
# desc "Package Mongrel and all subprojects"
|
160
|
+
# task :package_all => [:package] do
|
161
|
+
# sub_project("gem_plugin", :package)
|
162
|
+
# sub_project("cgi_multipart_eof_fix", :package)
|
163
|
+
# sub_project("fastthread", :package)
|
164
|
+
# sub_project("mongrel_status", :package)
|
165
|
+
# sub_project("mongrel_upload_progress", :package)
|
166
|
+
# sub_project("mongrel_console", :package)
|
167
|
+
# sub_project("mongrel_cluster", :package)
|
168
|
+
# sub_project("mongrel_experimental", :package)
|
169
|
+
#
|
170
|
+
# sh("rake java package") unless RUBY_PLATFORM =~ /java/
|
171
|
+
#
|
172
|
+
# # XXX Broken by RubyGems 0.9.5
|
173
|
+
# # sub_project("mongrel_service", :package) if RUBY_PLATFORM =~ /mswin/
|
174
|
+
# # sh("rake mswin package") unless RUBY_PLATFORM =~ /mswin/
|
175
|
+
# end
|
176
|
+
#
|
177
|
+
# task :install_requirements do
|
178
|
+
# # These run before Mongrel is installed
|
179
|
+
# sub_project("gem_plugin", :install)
|
180
|
+
# sub_project("cgi_multipart_eof_fix", :install)
|
181
|
+
# sub_project("fastthread", :install)
|
182
|
+
# end
|
183
|
+
#
|
184
|
+
# desc "for Mongrel and all subprojects"
|
185
|
+
# task :install => [:install_requirements] do
|
186
|
+
# # These run after Mongrel is installed
|
187
|
+
# sub_project("mongrel_status", :install)
|
188
|
+
# sub_project("mongrel_upload_progress", :install)
|
189
|
+
# sub_project("mongrel_console", :install)
|
190
|
+
# sub_project("mongrel_cluster", :install)
|
191
|
+
# # sub_project("mongrel_experimental", :install)
|
192
|
+
# sub_project("mongrel_service", :install) if RUBY_PLATFORM =~ /mswin/
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# desc "for Mongrel and all its subprojects"
|
196
|
+
# task :uninstall => [:clean] do
|
197
|
+
# sub_project("mongrel_status", :uninstall)
|
198
|
+
# sub_project("cgi_multipart_eof_fix", :uninstall)
|
199
|
+
# sub_project("mongrel_upload_progress", :uninstall)
|
200
|
+
# sub_project("mongrel_console", :uninstall)
|
201
|
+
# sub_project("gem_plugin", :uninstall)
|
202
|
+
# sub_project("fastthread", :uninstall)
|
203
|
+
# # sub_project("mongrel_experimental", :uninstall)
|
204
|
+
# sub_project("mongrel_service", :uninstall) if RUBY_PLATFORM =~ /mswin/
|
205
|
+
# end
|
206
|
+
#
|
207
|
+
# desc "for Mongrel and all its subprojects"
|
208
|
+
# task :clean do
|
209
|
+
# sub_project("gem_plugin", :clean)
|
210
|
+
# sub_project("cgi_multipart_eof_fix", :clean)
|
211
|
+
# sub_project("fastthread", :clean)
|
212
|
+
# sub_project("mongrel_status", :clean)
|
213
|
+
# sub_project("mongrel_upload_progress", :clean)
|
214
|
+
# sub_project("mongrel_console", :clean)
|
215
|
+
# sub_project("mongrel_cluster", :clean)
|
216
|
+
# sub_project("mongrel_experimental", :clean)
|
217
|
+
# sub_project("mongrel_service", :clean) if RUBY_PLATFORM =~ /mswin/
|
218
|
+
# end
|
219
|
+
#
|
220
|
+
# #### Site upload tasks
|
221
|
+
#
|
222
|
+
# namespace :site do
|
223
|
+
#
|
224
|
+
# desc "Package and upload .gem files and .tgz files for Mongrel and all subprojects to http://mongrel.rubyforge.org/releases/"
|
225
|
+
# task :source => [:package_all] do
|
226
|
+
# rm_rf "pkg/gems"
|
227
|
+
# rm_rf "pkg/tars"
|
228
|
+
# mkdir_p "pkg/gems"
|
229
|
+
# mkdir_p "pkg/tars"
|
230
|
+
#
|
231
|
+
# FileList["**/*.gem"].each { |gem| mv gem, "pkg/gems" }
|
232
|
+
# FileList["**/*.tgz"].each {|tgz| mv tgz, "pkg/tars" }
|
233
|
+
#
|
234
|
+
# sh "rm -rf pkg/mongrel*"
|
235
|
+
# sh "gem generate_index -d pkg"
|
236
|
+
# sh "scp -r CHANGELOG pkg/* rubyforge.org:/var/www/gforge-projects/mongrel/releases/"
|
237
|
+
# sh "svn log -v > SVN_LOG"
|
238
|
+
# sh "scp -r SVN_LOG pkg/* rubyforge.org:/var/www/gforge-projects/mongrel/releases/"
|
239
|
+
# rm "SVN_LOG"
|
240
|
+
# end
|
241
|
+
#
|
242
|
+
# desc "Upload the website"
|
243
|
+
# task :web do
|
244
|
+
# # Requires the 'webgem' gem
|
245
|
+
# sh "cd site; webgen; webgen; curl 'http://feed43.com/mongrel.xml' > output/rss.xml; rsync -azv --no-perms --no-times output/* rubyforge.org:/var/www/gforge-projects/mongrel/"
|
246
|
+
# puts "\nMake sure to re-run the site update 6 hours later if you updated the news. This delay is required for Feed43 to pick up the site changes."
|
247
|
+
# end
|
248
|
+
#
|
249
|
+
# desc "Upload the rdocs"
|
250
|
+
# task :rdoc => [:doc] do
|
251
|
+
# sh "rsync -azv --no-perms --no-times doc/* rubyforge.org:/var/www/gforge-projects/mongrel/rdoc/"
|
252
|
+
# sh "cd projects/gem_plugin; rake site:rdoc"
|
253
|
+
# end
|
254
|
+
#
|
255
|
+
# desc "Upload the coverage report"
|
256
|
+
# task :coverage => [:rcov] do
|
257
|
+
# sh "rsync -azv --no-perms --no-times test/coverage/* rubyforge.org:/var/www/gforge-projects/mongrel/coverage/" rescue nil
|
258
|
+
# end
|
259
|
+
#
|
260
|
+
# desc "Upload the website, the rdocs, and the coverage report"
|
261
|
+
# task :all => [:clean, :web, :rdoc, :coverage]
|
262
|
+
#
|
263
|
+
# end
|