nitro 0.21.0 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +48 -0
- data/README +2 -2
- data/doc/MIGRATION +10 -0
- data/doc/RELEASES +17 -1
- data/doc/config.txt +7 -1
- data/lib/nitro.rb +2 -2
- data/lib/nitro/adapter/scgi.rb +78 -0
- data/lib/nitro/compiler.rb +8 -10
- data/lib/nitro/controller.rb +17 -3
- data/lib/nitro/dispatcher.rb +4 -41
- data/lib/nitro/dispatcher/general.rb +62 -0
- data/lib/nitro/dispatcher/nice.rb +41 -0
- data/lib/nitro/mixin/markup.rb +28 -51
- data/lib/nitro/render.rb +2 -1
- data/lib/nitro/server.rb +5 -1
- data/lib/nitro/server/runner.rb +15 -2
- data/proto/public/error.xhtml +1 -1
- data/proto/public/robots.txt +0 -0
- data/test/nitro/tc_dispatcher.rb +1 -0
- metadata +9 -4
data/CHANGELOG
CHANGED
@@ -1,5 +1,53 @@
|
|
1
|
+
28-07-2005 George Moschovitis <gm@navel.gr>
|
2
|
+
|
3
|
+
* lib/nitro/dispatcher/nice.rb (#dispatch): fixed.
|
4
|
+
|
5
|
+
* doc/RELEASES: updated.
|
6
|
+
|
7
|
+
* doc/MIGRATION: updated.
|
8
|
+
|
9
|
+
27-07-2005 George Moschovitis <gm@navel.gr>
|
10
|
+
|
11
|
+
* lib/nitro/mixin/markup.rb: cleaned up,
|
12
|
+
added setup_xxx_transformation helpers.
|
13
|
+
|
14
|
+
* lib/nitro/server/runner.rb: added scgi support (--lhttpd-scgi)
|
15
|
+
|
16
|
+
* lib/nitro/adapter/scgi.rb: implemented.
|
17
|
+
|
18
|
+
* lib/nitro/controller.rb: added some cookie helpers.
|
19
|
+
|
20
|
+
* lib/nitro.rb: use nice dispatcher by default.
|
21
|
+
|
22
|
+
* lib/nitro/dispatcher.rb: mode setting.
|
23
|
+
|
24
|
+
* lib/nitro/dispatcher/general.rb: introduced.
|
25
|
+
|
26
|
+
* lib/nitro/dispatcher/nice.rb: introduced.
|
27
|
+
|
28
|
+
27-07-2005 Deborah Hooker <deb@ysabel.org>
|
29
|
+
|
30
|
+
* lib/nitro/server.rb: access_log attr_accessor.
|
31
|
+
|
32
|
+
26-07-2005 George Moschovitis <gm@navel.gr>
|
33
|
+
|
34
|
+
* lib/nitro/compiler.rb: more clever implicit nice urls.
|
35
|
+
|
36
|
+
* lib/nitro/controller.rb (#alias_action): made standalone.
|
37
|
+
|
38
|
+
* lib/nitro/dispatcher.rb (#dispatch): new algorithm,
|
39
|
+
more clever implicit nice urls.
|
40
|
+
|
1
41
|
25-07-2005 George Moschovitis <gm@navel.gr>
|
2
42
|
|
43
|
+
* lib/nitro/mixin/markup.rb (#escape/#unescape): added.
|
44
|
+
|
45
|
+
* proto/public/error.xhtml: temp fix, use ..markuper (ugh),
|
46
|
+
|
47
|
+
* proto/public/robots.txt added.
|
48
|
+
|
49
|
+
* --- VERSION 0.21.0 ---
|
50
|
+
|
3
51
|
* doc/MIGRATION: updated.
|
4
52
|
|
5
53
|
24-07-2005 George Moschovitis <gm@navel.gr>
|
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Nitro 0.21.
|
1
|
+
= Nitro 0.21.2 README
|
2
2
|
|
3
3
|
Nitro provides everything you need to develop professional Web
|
4
4
|
applications using Ruby and Javascript.
|
@@ -503,7 +503,7 @@ http://rubyforge.org/mailman/listinfo/nitro-general
|
|
503
503
|
|
504
504
|
== Licence
|
505
505
|
|
506
|
-
Copyright (c) 2004-2005, George '
|
506
|
+
Copyright (c) 2004-2005, George 'gmosx' Moschovitis (http://www.nitrohq.com)
|
507
507
|
Copyright (c) 2004-2005, Navel Ltd (http://www.navel.gr)
|
508
508
|
|
509
509
|
Nitro (http://www.nitrohq.com) is copyrighted free software
|
data/doc/MIGRATION
CHANGED
@@ -9,6 +9,16 @@ For more help, send your question to the mailing list:
|
|
9
9
|
|
10
10
|
http://rubyforge.org/mailman/listinfo/nitro-general
|
11
11
|
|
12
|
+
|
13
|
+
== 0.21.2 <- 0.21.0
|
14
|
+
|
15
|
+
1. The new 'nice' dispatching alogirthm is enabled by default. If
|
16
|
+
your app needs more general url dispatching you can enable the
|
17
|
+
old dispatcher with the following line:
|
18
|
+
|
19
|
+
require 'nitro/dispatcher/general'
|
20
|
+
|
21
|
+
|
12
22
|
== 0.21.0 <- 0.20.0
|
13
23
|
|
14
24
|
1. The helper methods for starting the application and defining
|
data/doc/RELEASES
CHANGED
@@ -1,4 +1,20 @@
|
|
1
|
-
== Version 0.21.
|
1
|
+
== Version 0.21.2
|
2
|
+
|
3
|
+
This is mainly a bug fix release. Some minor features are
|
4
|
+
implemented:
|
5
|
+
|
6
|
+
* Plugable dispatchers. A new dispatcher that implicitly handles
|
7
|
+
nice urls is enabled by default. You can easily change to the
|
8
|
+
old general dispatcher though.
|
9
|
+
|
10
|
+
* Better markup setup.
|
11
|
+
|
12
|
+
* Cookie Helpers.
|
13
|
+
|
14
|
+
* Important bug fixes in Og.
|
15
|
+
|
16
|
+
|
17
|
+
== Version 0.21.0 was released on 25-07-2005
|
2
18
|
|
3
19
|
Nitro goes from strength to strength as the community gets bigger.
|
4
20
|
Great new features were introduced and a lot of effort
|
data/doc/config.txt
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
= Configuration parameters
|
2
2
|
|
3
3
|
This file presents a complete list of Nitro Configuration
|
4
|
-
Parameters.
|
4
|
+
Parameters.
|
5
|
+
|
6
|
+
INFO: To browse a documented listing of an application's settings
|
7
|
+
point your browser to:
|
8
|
+
|
9
|
+
http://www.myapp.com/settings.
|
10
|
+
|
5
11
|
|
6
12
|
=== Session.store_type = :memory
|
7
13
|
|
data/lib/nitro.rb
CHANGED
@@ -25,7 +25,7 @@ module Nitro
|
|
25
25
|
|
26
26
|
# The version.
|
27
27
|
|
28
|
-
Version = '0.21.
|
28
|
+
Version = '0.21.2'
|
29
29
|
|
30
30
|
# Library path.
|
31
31
|
|
@@ -43,7 +43,7 @@ end
|
|
43
43
|
|
44
44
|
require 'nitro/context'
|
45
45
|
require 'nitro/controller'
|
46
|
-
require 'nitro/dispatcher'
|
46
|
+
require 'nitro/dispatcher/nice'
|
47
47
|
require 'nitro/render'
|
48
48
|
require 'nitro/server'
|
49
49
|
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# WARNING: Does not work yet!
|
2
|
+
|
3
|
+
require 'cgi'
|
4
|
+
require 'scgi'
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
require 'nitro/context'
|
8
|
+
require 'nitro/dispatcher'
|
9
|
+
require 'nitro/adapter/cgi'
|
10
|
+
|
11
|
+
# Speeds things up, more comaptible with OSX.
|
12
|
+
|
13
|
+
Socket.do_not_reverse_lookup = true
|
14
|
+
|
15
|
+
module Nitro
|
16
|
+
|
17
|
+
# SCGI Adaptor.
|
18
|
+
# No need for connection pooling, SCGI uses processes.
|
19
|
+
|
20
|
+
class Scgi
|
21
|
+
|
22
|
+
# A special modification so that we can make the socket and then pass it in.
|
23
|
+
# Should generalize this since it will be pretty common.
|
24
|
+
|
25
|
+
class Listener < Myriad::Listener
|
26
|
+
def initialize(socket, server_class, *params)
|
27
|
+
@socket = socket
|
28
|
+
@server_class = server_class
|
29
|
+
@params = params
|
30
|
+
@tick = [3,0] # this is just here until I can figure out the signals crap
|
31
|
+
Event::set(self, @socket.fileno, Event::READ | Event::TIMEOUT)
|
32
|
+
Event::add(self, @tick)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class SCGINitro < ::SCGI::SCGIServer
|
37
|
+
def process_request(data)
|
38
|
+
context = Context.new(Nitro::Server.new)
|
39
|
+
|
40
|
+
context.in = SCGIFixed.new(@request, data)
|
41
|
+
context.headers = cgi.env
|
42
|
+
|
43
|
+
CgiUtils.parse_params(context)
|
44
|
+
CgiUtils.parse_cookies(context)
|
45
|
+
|
46
|
+
context.render(context.path)
|
47
|
+
|
48
|
+
body = ''
|
49
|
+
body << CgiUtils.response_headers(context)
|
50
|
+
body << context.out
|
51
|
+
|
52
|
+
@trans.write(body)
|
53
|
+
|
54
|
+
super(data)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.start(server)
|
59
|
+
children = "5"
|
60
|
+
host = "127.0.0.0"
|
61
|
+
port = "8888"
|
62
|
+
|
63
|
+
socket = TCPServer.new(host, port)
|
64
|
+
socket.fcntl(Fcntl::F_SETFL, socket.fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)
|
65
|
+
|
66
|
+
children.to_i.times do
|
67
|
+
pid = fork do
|
68
|
+
Event::init(10)
|
69
|
+
server = Listener.new(socket, SCGINitro)
|
70
|
+
Event::dispatch
|
71
|
+
end
|
72
|
+
Process.detach(pid)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
data/lib/nitro/compiler.rb
CHANGED
@@ -126,21 +126,19 @@ class Compiler
|
|
126
126
|
code << "#{params.join(';')}"
|
127
127
|
end
|
128
128
|
|
129
|
-
# Try to resolve action parameters.
|
129
|
+
# Try to resolve action parameters. Returns negative
|
130
|
+
# numbers for arbitrary parameters.
|
130
131
|
|
131
132
|
param_count = klass.instance_method(action.intern).arity
|
132
133
|
|
133
|
-
|
134
|
-
|
135
|
-
if param_count > 0
|
134
|
+
if param_count != 0
|
136
135
|
code << %{
|
137
136
|
params = []
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
end
|
143
|
-
|
137
|
+
if context.query_string
|
138
|
+
context.query_string.split(/[&;]/).each do |qs|
|
139
|
+
params << qs.split(/=/).last
|
140
|
+
end
|
141
|
+
end
|
144
142
|
action_return_value = #{action}(*params)
|
145
143
|
}
|
146
144
|
else
|
data/lib/nitro/controller.rb
CHANGED
@@ -36,7 +36,7 @@ class ActionMeta < Hash
|
|
36
36
|
|
37
37
|
# Initialize the metadata.
|
38
38
|
|
39
|
-
def initialize(options)
|
39
|
+
def initialize(options = {})
|
40
40
|
@params = {}
|
41
41
|
update(options)
|
42
42
|
end
|
@@ -114,7 +114,7 @@ module Publishable
|
|
114
114
|
base.module_eval do
|
115
115
|
def self.alias_action(new, old)
|
116
116
|
alias_method new, old
|
117
|
-
md = action_metadata[old] ||
|
117
|
+
md = action_metadata[old] || ActionMeta.new
|
118
118
|
md[:view] = old
|
119
119
|
action_metadata[new] = md
|
120
120
|
end
|
@@ -166,8 +166,22 @@ module Publishable
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
169
|
-
|
169
|
+
|
170
|
+
# Cookie helpers.
|
171
|
+
|
172
|
+
base.module_eval do
|
173
|
+
private
|
174
|
+
|
175
|
+
def cookies
|
176
|
+
@context.cookies
|
177
|
+
end
|
178
|
+
|
179
|
+
def send_cookie(name, value = nil)
|
180
|
+
@context.add_cookie(name, value)
|
181
|
+
end
|
182
|
+
end
|
170
183
|
end
|
184
|
+
|
171
185
|
end
|
172
186
|
|
173
187
|
# The Controller part in the MVC paradigm. The controller's
|
data/lib/nitro/dispatcher.rb
CHANGED
@@ -12,9 +12,9 @@ class Dispatcher
|
|
12
12
|
|
13
13
|
include Router
|
14
14
|
|
15
|
-
# The
|
15
|
+
# The dispatcher specialization used.
|
16
16
|
|
17
|
-
setting :
|
17
|
+
setting :mode, :default => :nice, :doc => 'The dispatcher specialization used'
|
18
18
|
|
19
19
|
unless const_defined? :ROOT
|
20
20
|
ROOT = '/'
|
@@ -149,45 +149,8 @@ class Dispatcher
|
|
149
149
|
#++
|
150
150
|
|
151
151
|
def dispatch(path, context = nil)
|
152
|
-
|
153
|
-
|
154
|
-
parts = path.split('/')
|
155
|
-
parts.shift
|
156
|
-
|
157
|
-
case parts.size
|
158
|
-
when 0
|
159
|
-
# / -> root.index
|
160
|
-
base = '/'
|
161
|
-
klass = controller_class_for(base)
|
162
|
-
action = 'index'
|
163
|
-
|
164
|
-
when 1
|
165
|
-
base = "/#{parts[0]}"
|
166
|
-
if klass = controller_class_for(base)
|
167
|
-
# controller/ -> controller.index
|
168
|
-
action = 'index'
|
169
|
-
else
|
170
|
-
# action/ -> root.action
|
171
|
-
base = '/'
|
172
|
-
klass = controller_class_for(base)
|
173
|
-
action = parts[0]
|
174
|
-
end
|
175
|
-
|
176
|
-
else
|
177
|
-
base = "/#{parts[0]}"
|
178
|
-
if klass = controller_class_for(base)
|
179
|
-
# controller/action -> controller.action
|
180
|
-
parts.shift
|
181
|
-
action = parts.join('__')
|
182
|
-
else
|
183
|
-
# action/ -> root.action
|
184
|
-
base = '/'
|
185
|
-
klass = controller_class_for(base)
|
186
|
-
action = parts.join('__')
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
return klass, "#{action}_action", base
|
152
|
+
# Specialize in your application or use the default
|
153
|
+
# specializations in lib/nitro/dispatcher/*
|
191
154
|
end
|
192
155
|
alias_method :split_path, :dispatch
|
193
156
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'nitro/dispatcher'
|
2
|
+
|
3
|
+
module Nitro
|
4
|
+
|
5
|
+
# Specialize the Dispatcher to handle general urls. This is
|
6
|
+
# useful for PHP/ASP style programming.
|
7
|
+
|
8
|
+
class Dispatcher
|
9
|
+
|
10
|
+
# An alternative dispatching algorithm that handles
|
11
|
+
# general urls. Action containing '/' separators look for
|
12
|
+
# templates in subdirectories. The '/' char is converted
|
13
|
+
# to '__' to find the actual action.
|
14
|
+
|
15
|
+
def dispatch(path, context = nil)
|
16
|
+
path = route(path, context)
|
17
|
+
|
18
|
+
parts = path.split('/')
|
19
|
+
parts.shift
|
20
|
+
|
21
|
+
case parts.size
|
22
|
+
when 0
|
23
|
+
# / -> root.index
|
24
|
+
base = '/'
|
25
|
+
klass = controller_class_for(base)
|
26
|
+
action = 'index'
|
27
|
+
|
28
|
+
when 1
|
29
|
+
base = "/#{parts[0]}"
|
30
|
+
if klass = controller_class_for(base)
|
31
|
+
# controller/ -> controller.index
|
32
|
+
action = 'index'
|
33
|
+
else
|
34
|
+
# action/ -> root.action
|
35
|
+
base = '/'
|
36
|
+
klass = controller_class_for(base)
|
37
|
+
action = parts[0]
|
38
|
+
end
|
39
|
+
|
40
|
+
else
|
41
|
+
base = "/#{parts[0]}"
|
42
|
+
if klass = controller_class_for(base)
|
43
|
+
# controller/action -> controller.action
|
44
|
+
parts.shift
|
45
|
+
action = parts.join('__')
|
46
|
+
else
|
47
|
+
# action/ -> root.action
|
48
|
+
base = '/'
|
49
|
+
klass = controller_class_for(base)
|
50
|
+
action = parts.join('__')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
return klass, "#{action}_action", base
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Dispatcher.mode = :general
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# * George Moschovitis <gm@navel.gr>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'nitro/dispatcher'
|
2
|
+
|
3
|
+
module Nitro
|
4
|
+
|
5
|
+
# Specialize the Dispatcher to handle implicit 'nice' urls.
|
6
|
+
|
7
|
+
class Dispatcher
|
8
|
+
|
9
|
+
# An alternative dispatching algorithm that handles
|
10
|
+
# implicit nice urls. Subdirectories are not supported.
|
11
|
+
|
12
|
+
def dispatch(path, context)
|
13
|
+
path = route(path, context)
|
14
|
+
|
15
|
+
parts = path.split('/')
|
16
|
+
parts.shift # get rid of the leading '/'.
|
17
|
+
|
18
|
+
if klass = controller_class_for("/#{parts.first}")
|
19
|
+
base = "/#{parts.shift}"
|
20
|
+
else
|
21
|
+
base = ROOT
|
22
|
+
klass = controller_class_for(ROOT)
|
23
|
+
end
|
24
|
+
|
25
|
+
unless action = parts.shift
|
26
|
+
action = 'index'
|
27
|
+
end
|
28
|
+
|
29
|
+
unless parts.empty?
|
30
|
+
context.headers['QUERY_STRING'] = "#{parts.join(';')}#{context.headers['QUERY_STRING']}"
|
31
|
+
end
|
32
|
+
|
33
|
+
return klass, "#{action}_action", base
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Dispatcher.mode = :nice
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# * George Moschovitis <gm@navel.gr>
|
data/lib/nitro/mixin/markup.rb
CHANGED
@@ -1,58 +1,11 @@
|
|
1
1
|
require 'singleton'
|
2
2
|
require 'redcloth'
|
3
|
+
require 'cgi'
|
3
4
|
|
4
|
-
require 'glue/property'
|
5
5
|
require 'glue/sanitize'
|
6
6
|
|
7
7
|
module Nitro
|
8
8
|
|
9
|
-
#--
|
10
|
-
# Override the default PropertyUtils implementation to
|
11
|
-
# add markup support.
|
12
|
-
#++
|
13
|
-
=begin
|
14
|
-
module PropertyUtils
|
15
|
-
# Override to add markup code.
|
16
|
-
#
|
17
|
-
def self.prop_setter(prop)
|
18
|
-
s = prop.symbol
|
19
|
-
if markup = prop.meta[:markup]
|
20
|
-
# if true, set to default Markup
|
21
|
-
markup = Nitro::Markup if true == markup
|
22
|
-
|
23
|
-
code = %{
|
24
|
-
def #{s}=(val)
|
25
|
-
}
|
26
|
-
|
27
|
-
if Property.type_checking
|
28
|
-
code << %{
|
29
|
-
unless String == val.class
|
30
|
-
raise "Invalid type, expected '#{prop.klass}', is '\#\{val.class\}'."
|
31
|
-
end
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
code << %{
|
36
|
-
@#{s} = #{markup}.expand(val)
|
37
|
-
end
|
38
|
-
|
39
|
-
def compact_#{s}
|
40
|
-
#{markup}.compact(@#{s})
|
41
|
-
end
|
42
|
-
}
|
43
|
-
|
44
|
-
return code
|
45
|
-
else
|
46
|
-
return %{
|
47
|
-
def #{s}=(val)
|
48
|
-
@#{s} = val
|
49
|
-
end
|
50
|
-
}
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
=end
|
55
|
-
|
56
9
|
# Generalised Markup transformations.
|
57
10
|
#
|
58
11
|
# The expand methods evaluate (expand) the markup
|
@@ -68,7 +21,7 @@ end
|
|
68
21
|
#
|
69
22
|
# Define your custom markup methods like this:
|
70
23
|
#
|
71
|
-
# module
|
24
|
+
# module MarkupMixin
|
72
25
|
# def markup_simple
|
73
26
|
# ...
|
74
27
|
# end
|
@@ -130,12 +83,36 @@ private
|
|
130
83
|
|
131
84
|
def clear(str)
|
132
85
|
end
|
86
|
+
|
87
|
+
def escape(str)
|
88
|
+
CGI.escape(str.gsub(/ /, '_'))
|
89
|
+
end
|
90
|
+
|
91
|
+
def unescape(str)
|
92
|
+
CGI.unescape(str.gsub(/_/, ' '))
|
93
|
+
end
|
94
|
+
|
95
|
+
class << self
|
96
|
+
# Helper method for manipulating the sanitize transformation.
|
97
|
+
|
98
|
+
def setup_sanitize_transform(&block)
|
99
|
+
self.send :define_method, :sanitize, block
|
100
|
+
end
|
101
|
+
alias_method :setup_sanitize_transformation, :setup_sanitize_transform
|
102
|
+
|
103
|
+
# Helper method for manipulating the markup transformation.
|
104
|
+
|
105
|
+
def setup_markup_transform(&block)
|
106
|
+
self.send :define_method, :markup, block
|
107
|
+
end
|
108
|
+
alias_method :setup_markup_transformation, :setup_markup_transform
|
109
|
+
end
|
133
110
|
end
|
134
111
|
|
135
112
|
# An abstract Markup class.
|
136
113
|
|
137
|
-
class
|
138
|
-
|
114
|
+
class MarkupKit
|
115
|
+
extend Markup
|
139
116
|
include Markup
|
140
117
|
end
|
141
118
|
|
data/lib/nitro/render.rb
CHANGED
@@ -140,11 +140,12 @@ private
|
|
140
140
|
raise RenderExit
|
141
141
|
end
|
142
142
|
|
143
|
-
# Redirect to the referer
|
143
|
+
# Redirect to the referer.
|
144
144
|
|
145
145
|
def redirect_referer(postfix = nil, status = 303)
|
146
146
|
redirect("#{@context.referer}#{postfix}", status)
|
147
147
|
end
|
148
|
+
alias_method :redirect_to_referer, :redirect_referer
|
148
149
|
|
149
150
|
# Log a rendering error.
|
150
151
|
|
data/lib/nitro/server.rb
CHANGED
@@ -56,7 +56,11 @@ class Server
|
|
56
56
|
# Additional server options. Useful to pass options to
|
57
57
|
# Webrick for example.
|
58
58
|
|
59
|
-
attr_accessor :options
|
59
|
+
attr_accessor :options
|
60
|
+
|
61
|
+
# The access_log for this server, used by Webrick.
|
62
|
+
|
63
|
+
attr_accessor :access_log
|
60
64
|
|
61
65
|
def initialize(name = 'Nitro', options = {})
|
62
66
|
@name = name
|
data/lib/nitro/server/runner.rb
CHANGED
@@ -119,17 +119,22 @@ class Runner
|
|
119
119
|
@server = :webrick
|
120
120
|
end
|
121
121
|
|
122
|
-
opts.on('-l', '--lhttpd', 'Use a lighttpd server.') do
|
122
|
+
opts.on('-l', '--lhttpd', 'Use a lighttpd server (FastCGI).') do
|
123
123
|
@server = :lhttpd
|
124
124
|
Logger.set(Logger.new('log/app.log'))
|
125
125
|
end
|
126
126
|
|
127
|
+
opts.on('-l', '--lhttpd-scgi', 'Use the SCGI adapter (Lighttpd).') do
|
128
|
+
@server = :lhttpd_scgi
|
129
|
+
Logger.set(Logger.new('log/app.log'))
|
130
|
+
end
|
131
|
+
|
127
132
|
opts.on('-a', '--apache', 'Use an apache server.') do
|
128
133
|
@server = :apache
|
129
134
|
Logger.set(Logger.new('log/app.log'))
|
130
135
|
end
|
131
136
|
|
132
|
-
opts.on('--apache-cgi', '
|
137
|
+
opts.on('--apache-cgi', 'Use the CGI adapter (Apache)') do
|
133
138
|
@server = :cgi
|
134
139
|
Logger.set(Logger.new('log/app.log'))
|
135
140
|
end
|
@@ -225,6 +230,10 @@ class Runner
|
|
225
230
|
if 'fcgi_proc' == ENV['NITRO_INVOKE']
|
226
231
|
require 'nitro/adapter/fastcgi'
|
227
232
|
FastCGI.start(server)
|
233
|
+
|
234
|
+
elsif 'scgi_proc' == ENV['NITRO_INVOKE']
|
235
|
+
require 'nitro/adapter/scgi'
|
236
|
+
Scgi.start(server)
|
228
237
|
|
229
238
|
elsif 'cgi_proc' == ENV['NITRO_INVOKE']
|
230
239
|
require 'nitro/adapter/cgi'
|
@@ -272,6 +281,10 @@ class Runner
|
|
272
281
|
require 'nitro/adapter/fastcgi'
|
273
282
|
`lighttpd -f conf/lhttpd.conf`
|
274
283
|
|
284
|
+
when :lhttpd_scgi
|
285
|
+
require 'nitro/adapter/scgi'
|
286
|
+
`lighttpd -f conf/lhttpd_scgi.conf`
|
287
|
+
|
275
288
|
when :apache
|
276
289
|
require 'nitro/adapter/fastcgi'
|
277
290
|
`apachectl -d #{Dir.pwd} -f conf/apache.conf -k start`
|
data/proto/public/error.xhtml
CHANGED
File without changes
|
data/test/nitro/tc_dispatcher.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: nitro
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.21.
|
7
|
-
date: 2005-07-
|
6
|
+
version: 0.21.2
|
7
|
+
date: 2005-07-28 00:00:00 +03:00
|
8
8
|
summary: Nitro Web Engine
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- proto/public/cgi.rb
|
76
76
|
- proto/public/error.xhtml
|
77
77
|
- proto/public/fcgi.rb
|
78
|
+
- proto/public/robots.txt
|
78
79
|
- proto/public/media/nitro.png
|
79
80
|
- proto/public/js/prototype.js
|
80
81
|
- proto/public/js/dragdrop.js
|
@@ -94,6 +95,7 @@ files:
|
|
94
95
|
- lib/nitro/mail.rb
|
95
96
|
- lib/nitro/dispatcher.rb
|
96
97
|
- lib/nitro/context.rb
|
98
|
+
- lib/nitro/dispatcher
|
97
99
|
- lib/nitro/request.rb
|
98
100
|
- lib/nitro/mixin
|
99
101
|
- lib/nitro/caching.rb
|
@@ -122,12 +124,15 @@ files:
|
|
122
124
|
- lib/nitro/adapter/fastcgi.rb
|
123
125
|
- lib/nitro/adapter/cgi.rb
|
124
126
|
- lib/nitro/adapter/webrick.rb
|
127
|
+
- lib/nitro/adapter/scgi.rb
|
125
128
|
- lib/nitro/caching/invalidation.rb
|
126
129
|
- lib/nitro/caching/stores.rb
|
127
130
|
- lib/nitro/caching/actions.rb
|
128
131
|
- lib/nitro/caching/output.rb
|
129
132
|
- lib/nitro/caching/fragments.rb
|
130
133
|
- lib/nitro/element/java_script.rb
|
134
|
+
- lib/nitro/dispatcher/nice.rb
|
135
|
+
- lib/nitro/dispatcher/general.rb
|
131
136
|
- lib/nitro/mixin/debug.rb
|
132
137
|
- lib/nitro/mixin/pager.rb
|
133
138
|
- lib/nitro/mixin/markup.rb
|
@@ -203,7 +208,7 @@ dependencies:
|
|
203
208
|
-
|
204
209
|
- "="
|
205
210
|
- !ruby/object:Gem::Version
|
206
|
-
version: 0.21.
|
211
|
+
version: 0.21.2
|
207
212
|
version:
|
208
213
|
- !ruby/object:Gem::Dependency
|
209
214
|
name: og
|
@@ -213,7 +218,7 @@ dependencies:
|
|
213
218
|
-
|
214
219
|
- "="
|
215
220
|
- !ruby/object:Gem::Version
|
216
|
-
version: 0.21.
|
221
|
+
version: 0.21.2
|
217
222
|
version:
|
218
223
|
- !ruby/object:Gem::Dependency
|
219
224
|
name: ruby-breakpoint
|