mongrel 0.3.13.4 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -75
- data/Rakefile +14 -14
- data/bin/mongrel_rails +35 -23
- data/doc/rdoc/classes/IO.html +12 -12
- data/doc/rdoc/classes/IO.src/{M000001.html → M000003.html} +0 -0
- data/doc/rdoc/classes/IO.src/{M000002.html → M000004.html} +0 -0
- data/doc/rdoc/classes/Kernel.html +11 -11
- data/doc/rdoc/classes/Kernel.src/{M000010.html → M000012.html} +0 -0
- data/doc/rdoc/classes/Kernel.src/{M000011.html → M000013.html} +0 -0
- data/doc/rdoc/classes/Mongrel.html +3 -3
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +77 -69
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000115.html +12 -19
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000116.html +34 -12
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000117.html +21 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000118.html +19 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000119.html +12 -5
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000120.html +5 -6
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000121.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000122.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000123.html +19 -0
- data/doc/rdoc/classes/Mongrel/Camping.html +8 -8
- data/doc/rdoc/classes/Mongrel/Camping.src/M000041.html +22 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +31 -12
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000042.html +20 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000043.html +58 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.html +75 -73
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000018.html +11 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000019.html +29 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000020.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000021.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000022.html +5 -9
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000023.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000024.html +9 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000025.html +5 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000026.html +5 -11
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000027.html +5 -11
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000028.html +11 -5
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000029.html +24 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +20 -20
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000031.html +7 -45
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/{M000030.html → M000032.html} +0 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000033.html +58 -0
- data/doc/rdoc/classes/Mongrel/Configurator.html +163 -140
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000093.html +14 -8
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000094.html +18 -7
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000095.html +5 -10
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000096.html +8 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000097.html +7 -25
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000098.html +10 -6
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +5 -26
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000100.html +25 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000101.html +6 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000102.html +26 -11
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000103.html +20 -6
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000104.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000105.html +11 -9
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +6 -9
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +5 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +9 -21
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +9 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +5 -23
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +21 -5
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +36 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +18 -0
- data/doc/rdoc/classes/Mongrel/Const.html +8 -9
- data/doc/rdoc/classes/Mongrel/DeflateFilter.html +19 -12
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/{M000121.html → M000124.html} +5 -5
- data/doc/rdoc/classes/Mongrel/DeflateFilter.src/{M000122.html → M000125.html} +9 -14
- data/doc/rdoc/classes/Mongrel/DirHandler.html +43 -43
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000051.html +8 -25
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000052.html +29 -50
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000053.html +25 -26
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000054.html +52 -5
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000055.html +39 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000056.html +18 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +11 -11
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000123.html → M000126.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/{M000124.html → M000127.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +15 -10
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000066.html +21 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000067.html +21 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +25 -23
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000072.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/{M000071.html → M000073.html} +3 -3
- data/doc/rdoc/classes/Mongrel/{HttpHandlerPlugin.src/M000012.html → HttpHandler.src/M000074.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.html +22 -21
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000014.html +4 -6
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000015.html +4 -4
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000016.html +19 -0
- data/doc/rdoc/classes/Mongrel/{HttpHandler.src/M000070.html → HttpHandlerPlugin.src/M000017.html} +4 -4
- data/doc/rdoc/classes/Mongrel/HttpParser.html +44 -42
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000044.html +6 -7
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000045.html +7 -37
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000046.html +7 -5
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000047.html +37 -5
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000048.html +5 -6
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000042.html → M000049.html} +5 -6
- data/doc/rdoc/classes/Mongrel/HttpParser.src/{M000043.html → M000050.html} +6 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +37 -40
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000133.html +37 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000134.html +28 -7
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000135.html +16 -19
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000136.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000137.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000138.html +32 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +95 -85
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +12 -13
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +7 -9
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html +13 -9
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +9 -9
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +9 -18
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +9 -8
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +18 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +8 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +7 -7
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000084.html +7 -5
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000085.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000086.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.html +59 -63
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000057.html +12 -19
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000058.html +87 -8
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000059.html +19 -9
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000060.html +8 -49
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000061.html +16 -21
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000062.html +52 -5
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000063.html +21 -9
- data/doc/rdoc/classes/Mongrel/{HeaderOut.src → HttpServer.src}/M000064.html +5 -5
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +22 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.html +27 -25
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000034.html +24 -13
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/{M000033.html → M000035.html} +11 -11
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000036.html +26 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.html +24 -26
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000037.html +10 -8
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000038.html +43 -12
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000039.html +20 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000040.html +25 -0
- data/doc/rdoc/classes/Mongrel/RedirectHandler.html +10 -10
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/{M000128.html → M000131.html} +8 -8
- data/doc/rdoc/classes/Mongrel/RedirectHandler.src/{M000129.html → M000132.html} +13 -13
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.html +20 -20
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000125.html → M000128.html} +10 -10
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000126.html → M000129.html} +10 -10
- data/doc/rdoc/classes/Mongrel/StatisticsFilter.src/{M000127.html → M000130.html} +4 -4
- data/doc/rdoc/classes/Mongrel/Stats.html +43 -42
- data/doc/rdoc/classes/Mongrel/Stats.src/M000139.html +6 -5
- data/doc/rdoc/classes/Mongrel/Stats.src/M000140.html +10 -5
- data/doc/rdoc/classes/Mongrel/Stats.src/M000141.html +13 -5
- data/doc/rdoc/classes/Mongrel/Stats.src/M000142.html +5 -10
- data/doc/rdoc/classes/Mongrel/Stats.src/M000143.html +5 -7
- data/doc/rdoc/classes/Mongrel/Stats.src/{M000136.html → M000144.html} +5 -6
- data/doc/rdoc/classes/Mongrel/Stats.src/M000145.html +23 -0
- data/doc/rdoc/classes/Mongrel/Stats.src/M000146.html +20 -0
- data/doc/rdoc/classes/Mongrel/StatusHandler.html +21 -21
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000068.html +5 -29
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000069.html +11 -7
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000070.html +42 -0
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000071.html +20 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +58 -55
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000087.html +5 -26
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000088.html +5 -38
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000089.html +18 -15
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000090.html +25 -57
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000091.html +36 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000092.html +83 -0
- data/doc/rdoc/classes/MongrelDbg.html +25 -25
- data/doc/rdoc/classes/MongrelDbg.src/M000007.html +11 -9
- data/doc/rdoc/classes/MongrelDbg.src/M000008.html +7 -8
- data/doc/rdoc/classes/MongrelDbg.src/M000009.html +9 -5
- data/doc/rdoc/classes/MongrelDbg.src/M000010.html +21 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000011.html +18 -0
- data/doc/rdoc/classes/{Sync.html → Mutex.html} +50 -19
- data/doc/rdoc/classes/Mutex.src/M000001.html +24 -0
- data/doc/rdoc/classes/Mutex.src/M000002.html +32 -0
- data/doc/rdoc/classes/RequestLog/Access.html +5 -5
- data/doc/rdoc/classes/RequestLog/Access.src/{M000144.html → M000147.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Files.html +5 -5
- data/doc/rdoc/classes/RequestLog/Files.src/{M000145.html → M000148.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Objects.html +5 -5
- data/doc/rdoc/classes/RequestLog/Objects.src/{M000147.html → M000150.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Params.html +5 -5
- data/doc/rdoc/classes/RequestLog/Params.src/{M000148.html → M000151.html} +0 -0
- data/doc/rdoc/classes/RequestLog/Threads.html +5 -5
- data/doc/rdoc/classes/RequestLog/Threads.src/{M000146.html → M000149.html} +0 -0
- data/doc/rdoc/classes/TCPServer.html +10 -10
- data/doc/rdoc/classes/TCPServer.src/{M000003.html → M000005.html} +0 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/COPYING.html +1 -1
- data/doc/rdoc/files/LICENSE.html +1 -1
- data/doc/rdoc/files/README.html +11 -100
- data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/command_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/configurator_rb.html +1 -1
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +3 -2
- data/doc/rdoc/files/lib/mongrel/init_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +2 -3
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +2 -2
- data/doc/rdoc/files/lib/mongrel_rb.html +5 -3
- data/doc/rdoc/files/lib/mutex_fix_rb.html +108 -0
- data/doc/rdoc/fr_class_index.html +1 -1
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +151 -148
- data/ext/http11/http11.c +2 -2
- data/lib/mongrel.rb +85 -38
- data/lib/mongrel/camping.rb +17 -4
- data/lib/mongrel/configurator.rb +11 -7
- data/lib/mongrel/handlers.rb +30 -27
- data/lib/mongrel/mime_types.yml +615 -0
- data/lib/mongrel/rails.rb +21 -28
- data/lib/mutex_fix.rb +34 -0
- data/test/test_handlers.rb +16 -4
- data/test/test_http11.rb +8 -0
- data/test/test_request_progress.rb +45 -2
- data/test/test_response.rb +31 -0
- metadata +95 -71
- data/bin/mongrel_rails_service +0 -246
- data/bin/mongrel_rails_svc +0 -307
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000112.html +0 -25
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000113.html +0 -47
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000114.html +0 -34
- data/doc/rdoc/classes/Mongrel/Camping.src/M000039.html +0 -22
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000040.html +0 -18
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000041.html +0 -51
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000016.html +0 -24
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000017.html +0 -42
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000029.html +0 -20
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000091.html +0 -27
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000092.html +0 -31
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000049.html +0 -21
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000050.html +0 -43
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000065.html +0 -18
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000013.html +0 -17
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000130.html +0 -47
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000131.html +0 -37
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000132.html +0 -29
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000073.html +0 -25
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000074.html +0 -20
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000055.html +0 -25
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000056.html +0 -91
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000032.html +0 -37
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000035.html +0 -23
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000036.html +0 -54
- data/doc/rdoc/classes/Mongrel/Stats.src/M000137.html +0 -23
- data/doc/rdoc/classes/Mongrel/Stats.src/M000138.html +0 -26
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000066.html +0 -18
- data/doc/rdoc/classes/Mongrel/StatusHandler.src/M000067.html +0 -24
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000085.html +0 -18
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000086.html +0 -18
- data/doc/rdoc/classes/MongrelDbg.src/M000005.html +0 -24
- data/doc/rdoc/classes/MongrelDbg.src/M000006.html +0 -20
data/bin/mongrel_rails_service
DELETED
@@ -1,246 +0,0 @@
|
|
1
|
-
###############################################
|
2
|
-
# mongrel_rails_service
|
3
|
-
#
|
4
|
-
# Control script for Rails powered by Mongrel
|
5
|
-
#
|
6
|
-
# WARNING: stop command still doesn't work with rails!
|
7
|
-
###############################################
|
8
|
-
require 'rubygems'
|
9
|
-
require 'mongrel'
|
10
|
-
require 'win32/service'
|
11
|
-
include Win32
|
12
|
-
|
13
|
-
module GenericCommand
|
14
|
-
def configure
|
15
|
-
options [
|
16
|
-
['-n', '--name SVC_NAME', "Required name for the service to be registered/installed.", :@svc_name, nil],
|
17
|
-
]
|
18
|
-
end
|
19
|
-
|
20
|
-
def validate
|
21
|
-
valid? @svc_name != nil, "You must specify the service name to be uninstalled."
|
22
|
-
|
23
|
-
# Validate that the service exists
|
24
|
-
begin
|
25
|
-
valid? Service.exists?(@svc_name), "There is no service with that name, cannot proceed."
|
26
|
-
rescue
|
27
|
-
end
|
28
|
-
|
29
|
-
return @valid
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Install < GemPlugin::Plugin "/commands"
|
34
|
-
include Mongrel::Command::Base
|
35
|
-
|
36
|
-
# Default every option to nil so only the defined ones get passed to service
|
37
|
-
# (which will override ServiceCommand defaults).
|
38
|
-
def configure
|
39
|
-
options [
|
40
|
-
['-n', '--name SVC_NAME', "Required name for the service to be registered/installed.", :@svc_name, nil],
|
41
|
-
['-d', '--display SVC_DISPLAY', "Adjust the display name of the service.", :@svc_display, nil],
|
42
|
-
['-r', '--root PATH', "Set the root path where your rails app resides.", :@rails_root, Dir.pwd],
|
43
|
-
['-e', '--environment ENV', "Rails environment to run as. (default: production)", :@environment, 'production'],
|
44
|
-
['-b', '--binding ADDR', "Address to bind to", :@ip, nil],
|
45
|
-
['-p', '--port PORT', "Which port to bind to", :@port, 3000],
|
46
|
-
['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
|
47
|
-
['-P', '--num-procs INT', "Number of processor threads to use", :@num_procs, nil],
|
48
|
-
['-t', '--timeout SECONDS', "Timeout all requests after SECONDS time", :@timeout, nil],
|
49
|
-
['-c', '--cpu CPU', "Bind the process to specific cpu, starting from 1.", :@cpu, nil]
|
50
|
-
]
|
51
|
-
end
|
52
|
-
|
53
|
-
# When we validate the options, we need to make sure the --root is actually RAILS_ROOT
|
54
|
-
# of the rails application we wanted to serve, because later "as service" no error
|
55
|
-
# show to trace this.
|
56
|
-
def validate
|
57
|
-
@rails_root = File.expand_path(@rails_root)
|
58
|
-
|
59
|
-
# start with the premise of app really exist.
|
60
|
-
app_exist = true
|
61
|
-
paths = %w{app config db log public}
|
62
|
-
paths.each do |path|
|
63
|
-
if !File.directory?(@rails_root + '/' + path)
|
64
|
-
app_exist = false
|
65
|
-
break
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
valid? @svc_name != nil, "You must specify a valid service name to install."
|
70
|
-
valid? app_exist == true, "The root of rails app isn't valid, please verify."
|
71
|
-
valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map
|
72
|
-
|
73
|
-
# Validate the number of cpu to bind to.
|
74
|
-
valid? @cpu.to_i > 0, "You must specify a numeric value for cpu. (1..8)" if @cpu
|
75
|
-
|
76
|
-
# We should validate service existance here, right Zed?
|
77
|
-
begin
|
78
|
-
valid? !Service.exists?(@svc_name), "The service already exist, please uninstall it first."
|
79
|
-
rescue
|
80
|
-
end
|
81
|
-
|
82
|
-
# Expand to get full path for mime-types file
|
83
|
-
@mime_map = File.expand_path(@mime_map) if @mime_map
|
84
|
-
|
85
|
-
# default service display to service name
|
86
|
-
@svc_display = @svc_name if !@svc_display
|
87
|
-
|
88
|
-
return @valid
|
89
|
-
end
|
90
|
-
|
91
|
-
def build_params
|
92
|
-
# build the parameters that will be used when register/install the service
|
93
|
-
@params = ""
|
94
|
-
|
95
|
-
# add "service" command
|
96
|
-
@params << "service "
|
97
|
-
|
98
|
-
# rails_root, must be quoted to support long_names
|
99
|
-
@params << "-r \"#{@rails_root}\" "
|
100
|
-
|
101
|
-
# environment
|
102
|
-
@params << "-e #{@environment} " if @environment
|
103
|
-
|
104
|
-
# binding
|
105
|
-
@params << "-b #{@ip} " if @ip
|
106
|
-
|
107
|
-
# port
|
108
|
-
@params << "-p #{@port.to_i} " if @port
|
109
|
-
|
110
|
-
# mime
|
111
|
-
@params << "-m \"#{@mime_map}\" " if @mime_map
|
112
|
-
|
113
|
-
# num_procs
|
114
|
-
@params << "-P #{@num_procs.to_i} " if @num_procs
|
115
|
-
|
116
|
-
# timeout
|
117
|
-
@params << "-t #{@timeout.to_i} " if @timeout
|
118
|
-
|
119
|
-
# cpu
|
120
|
-
@params << "-c #{@cpu.to_i} " if @cpu
|
121
|
-
end
|
122
|
-
|
123
|
-
def install_service
|
124
|
-
# use rbconfig to get the path to bin ruby.exe
|
125
|
-
require 'rbconfig'
|
126
|
-
|
127
|
-
# ruby.exe instead of rubyw.exe due a exception raised when stoping the service!
|
128
|
-
binary_path = ""
|
129
|
-
binary_path << '"' << Config::CONFIG['bindir'] << '/ruby.exe' << '" '
|
130
|
-
|
131
|
-
# add service_script
|
132
|
-
service_script = File.expand_path(File.dirname(__FILE__) + '/mongrel_rails_svc')
|
133
|
-
binary_path << '"' << service_script << '" '
|
134
|
-
|
135
|
-
# now add the parameters to it.
|
136
|
-
binary_path << @params
|
137
|
-
|
138
|
-
puts "Installing service with these options:"
|
139
|
-
puts "service name: " << @svc_name
|
140
|
-
puts "service display: " << @svc_display
|
141
|
-
|
142
|
-
puts "RAILS_ROOT: " << @rails_root
|
143
|
-
puts "RAILS_ENV: " << @environment if @environment
|
144
|
-
puts "binding: " << @ip if @ip
|
145
|
-
puts "port: " << @port.to_s if @port
|
146
|
-
|
147
|
-
puts "mime_map: " << @mime_map if @mime_map
|
148
|
-
puts "num_procs: " << @num_procs.to_s if @num_procs
|
149
|
-
puts "timeout: " << @timeout.to_s if @timeout
|
150
|
-
|
151
|
-
puts "ruby.exe: " << Config::CONFIG['bindir'] << '/ruby.exe'
|
152
|
-
puts "service script: " << service_script
|
153
|
-
puts
|
154
|
-
|
155
|
-
svc = Service.new
|
156
|
-
begin
|
157
|
-
svc.create_service{ |s|
|
158
|
-
s.service_name = @svc_name
|
159
|
-
s.display_name = @svc_display
|
160
|
-
s.binary_path_name = binary_path
|
161
|
-
s.dependencies = []
|
162
|
-
}
|
163
|
-
puts "#{@svc_display} service installed."
|
164
|
-
rescue ServiceError => err
|
165
|
-
puts "There was a problem installing the service:"
|
166
|
-
puts err
|
167
|
-
end
|
168
|
-
svc.close
|
169
|
-
end
|
170
|
-
|
171
|
-
def run
|
172
|
-
build_params
|
173
|
-
install_service
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
class Delete < GemPlugin::Plugin "/commands"
|
178
|
-
include Mongrel::Command::Base
|
179
|
-
include GenericCommand
|
180
|
-
|
181
|
-
def run
|
182
|
-
display_name = Service.getdisplayname(@svc_name)
|
183
|
-
|
184
|
-
begin
|
185
|
-
Service.stop(@svc_name)
|
186
|
-
rescue
|
187
|
-
end
|
188
|
-
begin
|
189
|
-
Service.delete(@svc_name)
|
190
|
-
rescue
|
191
|
-
end
|
192
|
-
puts "#{display_name} service deleted."
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
class Start < GemPlugin::Plugin "/commands"
|
197
|
-
include Mongrel::Command::Base
|
198
|
-
include GenericCommand
|
199
|
-
|
200
|
-
def run
|
201
|
-
display_name = Service.getdisplayname(@svc_name)
|
202
|
-
|
203
|
-
begin
|
204
|
-
Service.start(@svc_name)
|
205
|
-
started = false
|
206
|
-
while started == false
|
207
|
-
s = Service.status(@svc_name)
|
208
|
-
started = true if s.current_state == "running"
|
209
|
-
break if started == true
|
210
|
-
puts "One moment, " + s.current_state
|
211
|
-
sleep 1
|
212
|
-
end
|
213
|
-
puts "#{display_name} service started"
|
214
|
-
rescue ServiceError => err
|
215
|
-
puts "There was a problem starting the service:"
|
216
|
-
puts err
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
class Stop < GemPlugin::Plugin "/commands"
|
222
|
-
include Mongrel::Command::Base
|
223
|
-
include GenericCommand
|
224
|
-
|
225
|
-
def run
|
226
|
-
display_name = Service.getdisplayname(@svc_name)
|
227
|
-
|
228
|
-
begin
|
229
|
-
Service.stop(@svc_name)
|
230
|
-
stopped = false
|
231
|
-
while stopped == false
|
232
|
-
s = Service.status(@svc_name)
|
233
|
-
stopped = true if s.current_state == "stopped"
|
234
|
-
break if stopped == true
|
235
|
-
puts "One moment, " + s.current_state
|
236
|
-
sleep 1
|
237
|
-
end
|
238
|
-
puts "#{display_name} service stopped"
|
239
|
-
rescue ServiceError => err
|
240
|
-
puts "There was a problem stopping the service:"
|
241
|
-
puts err
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
Mongrel::Command::Registry.instance.run ARGV
|
data/bin/mongrel_rails_svc
DELETED
@@ -1,307 +0,0 @@
|
|
1
|
-
###############################################
|
2
|
-
# mongrel_rails_svc
|
3
|
-
#
|
4
|
-
# This is where Win32::Daemon resides.
|
5
|
-
###############################################
|
6
|
-
require 'rubygems'
|
7
|
-
require 'mongrel'
|
8
|
-
require 'mongrel/rails'
|
9
|
-
require 'optparse'
|
10
|
-
require 'win32/service'
|
11
|
-
|
12
|
-
# We need to use OpenProcess and SetProcessAffinityMask on WinNT/2K/XP for
|
13
|
-
# binding the process to each cpu.
|
14
|
-
# Kernel32 Module Just for Win32 :D
|
15
|
-
require 'dl/win32'
|
16
|
-
|
17
|
-
module Kernel32
|
18
|
-
[
|
19
|
-
%w/OpenProcess LLL L/,
|
20
|
-
%w/SetProcessAffinityMask LL L/,
|
21
|
-
].each do |fn|
|
22
|
-
const_set fn[0].intern, Win32API.new('kernel32.dll', *fn)
|
23
|
-
end
|
24
|
-
|
25
|
-
PROCESS_ALL_ACCESS = 0x1f0fff
|
26
|
-
|
27
|
-
module_function
|
28
|
-
|
29
|
-
def set_affinity(pid, cpu)
|
30
|
-
handle = OpenProcess.call(PROCESS_ALL_ACCESS, 0, pid)
|
31
|
-
|
32
|
-
# CPU mask is a bit weird, hehehe :)
|
33
|
-
# default mask for CPU 1
|
34
|
-
mask = 1
|
35
|
-
mask = %w{1 2 4 8 16 32 64 128}[cpu.to_i - 1] if cpu.to_i.between?(1, 8)
|
36
|
-
|
37
|
-
SetProcessAffinityMask.call(handle, mask.to_i)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
# End Kernel32 Module
|
41
|
-
|
42
|
-
DEBUG_LOG_FILE = File.expand_path(File.dirname(__FILE__) + '/debug.log')
|
43
|
-
DEBUG_THREAD_LOG_FILE = File.expand_path(File.dirname(__FILE__) + '/debug_thread.log')
|
44
|
-
|
45
|
-
def dbg(msg)
|
46
|
-
File.open(DEBUG_LOG_FILE,"a+") { |f| f.puts("#{Time.now} - #{msg}") }
|
47
|
-
end
|
48
|
-
|
49
|
-
def dbg_th(msg)
|
50
|
-
File.open(DEBUG_THREAD_LOG_FILE,"a+") { |f| f.puts("#{Time.now} - #{msg}") }
|
51
|
-
end
|
52
|
-
|
53
|
-
# This class encapsulate the handler registering, http_server and working thread
|
54
|
-
# Is standalone, so using MongrelRails in your app get everything runnig
|
55
|
-
# (in case you don't want use mongrel_rails script)
|
56
|
-
class MongrelRails
|
57
|
-
def initialize(ip, port, rails_root, docroot, environment, mime_map, num_procs, timeout)
|
58
|
-
dbg "mongrelrails_initialize entered"
|
59
|
-
|
60
|
-
@ip = ip
|
61
|
-
@port = port
|
62
|
-
@rails_root = rails_root
|
63
|
-
@docroot = docroot
|
64
|
-
@environment = environment
|
65
|
-
@mime_map = mime_map
|
66
|
-
@num_procs = num_procs
|
67
|
-
@timeout = timeout
|
68
|
-
|
69
|
-
dbg "mongrelrails_initialize left"
|
70
|
-
end
|
71
|
-
|
72
|
-
def delayed_initialize
|
73
|
-
dbg "delayed_initialize entered"
|
74
|
-
|
75
|
-
@rails = configure_rails
|
76
|
-
|
77
|
-
# start up mongrel with the right configurations
|
78
|
-
@server = Mongrel::HttpServer.new(@ip, @port, @num_procs.to_i, @timeout.to_i)
|
79
|
-
@server.register("/", @rails)
|
80
|
-
|
81
|
-
dbg "delayed_initialize left"
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
def load_mime_map
|
86
|
-
dbg "load_mime_map entered"
|
87
|
-
|
88
|
-
mime = {}
|
89
|
-
|
90
|
-
# configure any requested mime map
|
91
|
-
if @mime_map
|
92
|
-
puts "Loading additional MIME types from #@mime_map"
|
93
|
-
mime.merge!(YAML.load_file(@mime_map))
|
94
|
-
|
95
|
-
# check all the mime types to make sure they are the right format
|
96
|
-
mime.each {|k,v| puts "WARNING: MIME type #{k} must start with '.'" if k.index(".") != 0 }
|
97
|
-
end
|
98
|
-
|
99
|
-
dbg "load_mime_map left"
|
100
|
-
|
101
|
-
return mime
|
102
|
-
end
|
103
|
-
|
104
|
-
def configure_rails
|
105
|
-
dbg "configure_rails entered"
|
106
|
-
|
107
|
-
Dir.chdir(@rails_root)
|
108
|
-
|
109
|
-
|
110
|
-
ENV['RAILS_ENV'] = @environment
|
111
|
-
require 'config/environment'
|
112
|
-
|
113
|
-
# configure the rails handler
|
114
|
-
rails = Mongrel::Rails::RailsHandler.new(@docroot, load_mime_map)
|
115
|
-
|
116
|
-
dbg "configure_rails left"
|
117
|
-
|
118
|
-
return rails
|
119
|
-
end
|
120
|
-
|
121
|
-
def start_serve
|
122
|
-
begin
|
123
|
-
dbg "start_serve entered"
|
124
|
-
|
125
|
-
@runner = Thread.new do
|
126
|
-
dbg_th "runner_thread suspended"
|
127
|
-
Thread.stop
|
128
|
-
|
129
|
-
dbg_th "runner_thread resumed"
|
130
|
-
dbg_th "runner_thread acceptor.join"
|
131
|
-
@server.acceptor.join
|
132
|
-
end
|
133
|
-
|
134
|
-
dbg "server.run"
|
135
|
-
@server.run
|
136
|
-
|
137
|
-
dbg "runner.run"
|
138
|
-
@runner.run
|
139
|
-
|
140
|
-
dbg "start_serve left"
|
141
|
-
rescue
|
142
|
-
dbg "ERROR: #$!\r\n"
|
143
|
-
dbg $!.backtrace.join("\r\n")
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def stop_serve
|
148
|
-
dbg "stop_serve entered"
|
149
|
-
|
150
|
-
if @runner.alive?
|
151
|
-
dbg "killing thread"
|
152
|
-
@runner.kill
|
153
|
-
end
|
154
|
-
|
155
|
-
@server.stop
|
156
|
-
|
157
|
-
dbg "stop_serve left"
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
class RailsDaemon < Win32::Daemon
|
162
|
-
def initialize(rails)
|
163
|
-
dbg "daemon_initialize entered"
|
164
|
-
|
165
|
-
@rails = rails
|
166
|
-
|
167
|
-
dbg "daemon_initialize left"
|
168
|
-
end
|
169
|
-
|
170
|
-
def service_init
|
171
|
-
dbg "service_init entered"
|
172
|
-
|
173
|
-
@rails.delayed_initialize
|
174
|
-
|
175
|
-
dbg "service_init left"
|
176
|
-
end
|
177
|
-
|
178
|
-
def service_main
|
179
|
-
dbg "service_main entered"
|
180
|
-
|
181
|
-
dbg "rails.start_serve"
|
182
|
-
@rails.start_serve
|
183
|
-
|
184
|
-
dbg "while RUNNING"
|
185
|
-
while state == RUNNING
|
186
|
-
sleep 1
|
187
|
-
end
|
188
|
-
dbg "state !RUNNING"
|
189
|
-
|
190
|
-
dbg "rails.stop_serve"
|
191
|
-
@rails.stop_serve
|
192
|
-
|
193
|
-
dbg "service_main left"
|
194
|
-
end
|
195
|
-
|
196
|
-
def service_stop
|
197
|
-
dbg "service_stop entered"
|
198
|
-
|
199
|
-
dbg "service_stop left"
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
|
204
|
-
begin
|
205
|
-
if ARGV[0] == 'service'
|
206
|
-
ARGV.shift
|
207
|
-
|
208
|
-
# default options
|
209
|
-
OPTIONS = {
|
210
|
-
:rails_root => Dir.pwd,
|
211
|
-
:environment => 'production',
|
212
|
-
:ip => '0.0.0.0',
|
213
|
-
:port => 3000,
|
214
|
-
:mime_map => nil,
|
215
|
-
:num_procs => 1024,
|
216
|
-
:timeout => 0,
|
217
|
-
:cpu => nil
|
218
|
-
}
|
219
|
-
|
220
|
-
ARGV.options do |opts|
|
221
|
-
opts.on('-r', '--root PATH', "Set the root path where your rails app resides.") { |OPTIONS[:rails_root]| }
|
222
|
-
opts.on('-e', '--environment ENV', "Rails environment to run as. (default: production)") { |OPTIONS[:environment]| }
|
223
|
-
opts.on('-b', '--binding ADDR', "Address to bind to") { |OPTIONS[:ip]| }
|
224
|
-
opts.on('-p', '--port PORT', "Which port to bind to") { |OPTIONS[:port]| }
|
225
|
-
opts.on('-m', '--mime PATH', "A YAML file that lists additional MIME types") { |OPTIONS[:mime_map]| }
|
226
|
-
opts.on('-P', '--num-procs INT', "Number of processor threads to use") { |OPTIONS[:num_procs]| }
|
227
|
-
opts.on('-t', '--timeout SECONDS', "Timeout all requests after SECONDS time") { |OPTIONS[:timeout]| }
|
228
|
-
opts.on('-c', '--cpu CPU', "Bind the process to specific cpu") { |OPTIONS[:cpu]| }
|
229
|
-
|
230
|
-
opts.parse!
|
231
|
-
end
|
232
|
-
|
233
|
-
#expand RAILS_ROOT
|
234
|
-
OPTIONS[:rails_root] = File.expand_path(OPTIONS[:rails_root])
|
235
|
-
|
236
|
-
OPTIONS[:docroot] = File.expand_path(OPTIONS[:rails_root] + '/public')
|
237
|
-
|
238
|
-
# We must bind to a specific cpu?
|
239
|
-
if OPTIONS[:cpu]
|
240
|
-
Kernel32.set_affinity(Process.pid, OPTIONS[:cpu])
|
241
|
-
end
|
242
|
-
|
243
|
-
rails = MongrelRails.new(OPTIONS[:ip], OPTIONS[:port], OPTIONS[:rails_root], OPTIONS[:docroot], OPTIONS[:environment], OPTIONS[:mime_map], OPTIONS[:num_procs].to_i, OPTIONS[:timeout].to_i)
|
244
|
-
rails_svc = RailsDaemon.new(rails)
|
245
|
-
rails_svc.mainloop
|
246
|
-
|
247
|
-
elsif ARGV[0] == 'debug'
|
248
|
-
ARGV.shift
|
249
|
-
|
250
|
-
# default options
|
251
|
-
OPTIONS = {
|
252
|
-
:rails_root => Dir.pwd,
|
253
|
-
:environment => 'production',
|
254
|
-
:ip => '0.0.0.0',
|
255
|
-
:port => 3000,
|
256
|
-
:mime_map => nil,
|
257
|
-
:num_procs => 20,
|
258
|
-
:timeout => 120,
|
259
|
-
:cpu => nil
|
260
|
-
}
|
261
|
-
|
262
|
-
ARGV.options do |opts|
|
263
|
-
opts.on('-r', '--root PATH', "Set the root path where your rails app resides.") { |OPTIONS[:rails_root]| }
|
264
|
-
opts.on('-e', '--environment ENV', "Rails environment to run as.") { |OPTIONS[:environment]| }
|
265
|
-
opts.on('-b', '--binding ADDR', "Address to bind to") { |OPTIONS[:ip]| }
|
266
|
-
opts.on('-p', '--port PORT', "Which port to bind to") { |OPTIONS[:port]| }
|
267
|
-
opts.on('-m', '--mime PATH', "A YAML file that lists additional MIME types") { |OPTIONS[:mime_map]| }
|
268
|
-
opts.on('-P', '--num-procs INT', "Number of processor threads to use") { |OPTIONS[:num_procs]| }
|
269
|
-
opts.on('-t', '--timeout SECONDS', "Timeout all requests after SECONDS time") { |OPTIONS[:timeout]| }
|
270
|
-
opts.on('-c', '--cpu CPU', "Bind the process to specific cpu") { |OPTIONS[:cpu]| }
|
271
|
-
|
272
|
-
opts.parse!
|
273
|
-
end
|
274
|
-
|
275
|
-
#expand RAILS_ROOT
|
276
|
-
OPTIONS[:rails_root] = File.expand_path(OPTIONS[:rails_root])
|
277
|
-
|
278
|
-
OPTIONS[:docroot] = File.expand_path(OPTIONS[:rails_root] + '/public')
|
279
|
-
|
280
|
-
# We must bind to a specific cpu?
|
281
|
-
if OPTIONS[:cpu]
|
282
|
-
Kernel32.set_affinity(Process.pid, OPTIONS[:cpu])
|
283
|
-
end
|
284
|
-
|
285
|
-
rails = MongrelRails.new(OPTIONS[:ip], OPTIONS[:port], OPTIONS[:rails_root], OPTIONS[:docroot], OPTIONS[:environment], OPTIONS[:mime_map], OPTIONS[:num_procs].to_i, OPTIONS[:timeout].to_i)
|
286
|
-
rails.delayed_initialize
|
287
|
-
rails.start_serve
|
288
|
-
|
289
|
-
begin
|
290
|
-
sleep
|
291
|
-
rescue Interrupt
|
292
|
-
dbg "ERROR: #$!\r\n"
|
293
|
-
dbg $!.backtrace.join("\r\n")
|
294
|
-
puts "graceful shutdown?"
|
295
|
-
end
|
296
|
-
|
297
|
-
begin
|
298
|
-
rails.stop_serve
|
299
|
-
rescue
|
300
|
-
dbg "ERROR: #$!\r\n"
|
301
|
-
dbg $!.backtrace.join("\r\n")
|
302
|
-
end
|
303
|
-
end
|
304
|
-
rescue
|
305
|
-
dbg "ERROR: #$!\r\n"
|
306
|
-
dbg $!.backtrace.join("\r\n")
|
307
|
-
end
|