nitro 0.25.0 → 0.26.0
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 +531 -1
- data/ProjectInfo +29 -5
- data/README +1 -1
- data/doc/AUTHORS +12 -6
- data/doc/RELEASES +114 -0
- data/lib/glue/sweeper.rb +71 -0
- data/lib/nitro.rb +19 -12
- data/lib/nitro/adapter/cgi.rb +4 -0
- data/lib/nitro/adapter/webrick.rb +4 -2
- data/lib/nitro/caching.rb +1 -0
- data/lib/nitro/caching/fragments.rb +7 -1
- data/lib/nitro/caching/output.rb +6 -1
- data/lib/nitro/caching/stores.rb +13 -1
- data/lib/nitro/cgi.rb +9 -1
- data/lib/nitro/cgi/request.rb +11 -3
- data/lib/nitro/cgi/utils.rb +24 -2
- data/lib/nitro/compiler.rb +89 -63
- data/lib/nitro/compiler/cleanup.rb +16 -0
- data/lib/nitro/compiler/elements.rb +117 -0
- data/lib/nitro/compiler/markup.rb +3 -1
- data/lib/nitro/compiler/morphing.rb +203 -73
- data/lib/nitro/compiler/script_generator.rb +14 -0
- data/lib/nitro/compiler/shaders.rb +1 -1
- data/lib/nitro/context.rb +5 -6
- data/lib/nitro/controller.rb +43 -21
- data/lib/nitro/dispatcher.rb +86 -37
- data/lib/nitro/element.rb +3 -105
- data/lib/nitro/helper/benchmark.rb +3 -0
- data/lib/nitro/helper/dojo.rb +0 -0
- data/lib/nitro/helper/form.rb +85 -255
- data/lib/nitro/helper/form/controls.rb +274 -0
- data/lib/nitro/helper/javascript.rb +86 -6
- data/lib/nitro/helper/pager.rb +5 -0
- data/lib/nitro/helper/prototype.rb +49 -0
- data/lib/nitro/helper/scriptaculous.rb +0 -0
- data/lib/nitro/helper/xhtml.rb +11 -8
- data/lib/nitro/helper/xml.rb +1 -1
- data/lib/nitro/routing.rb +8 -1
- data/lib/nitro/scaffolding.rb +344 -0
- data/lib/nitro/server.rb +5 -1
- data/lib/nitro/server/runner.rb +19 -15
- data/lib/nitro/session.rb +32 -56
- data/lib/nitro/session/drbserver.rb +1 -1
- data/lib/nitro/session/file.rb +34 -15
- data/lib/nitro/session/memory.rb +13 -4
- data/lib/nitro/session/og.rb +56 -0
- data/proto/public/js/controls.js +30 -1
- data/proto/public/js/dragdrop.js +211 -146
- data/proto/public/js/effects.js +261 -399
- data/proto/public/js/prototype.js +131 -72
- data/proto/public/scaffold/edit.xhtml +10 -3
- data/proto/public/scaffold/form.xhtml +1 -7
- data/proto/public/scaffold/index.xhtml +20 -0
- data/proto/public/scaffold/list.xhtml +15 -8
- data/proto/public/scaffold/new.xhtml +10 -3
- data/proto/public/scaffold/search.xhtml +28 -0
- data/proto/public/scaffold/view.xhtml +8 -0
- data/proto/run.rb +93 -1
- data/src/part/admin.rb +4 -2
- data/src/part/admin/controller.rb +62 -28
- data/src/part/admin/skin.rb +8 -8
- data/src/part/admin/system.css +135 -0
- data/src/part/admin/template/index.xhtml +8 -12
- data/test/nitro/caching/tc_stores.rb +17 -0
- data/test/nitro/tc_caching.rb +1 -4
- data/test/nitro/tc_dispatcher.rb +22 -10
- data/test/nitro/tc_element.rb +1 -1
- data/test/nitro/tc_session.rb +23 -11
- data/test/public/blog/another/very_litle/index.xhtml +1 -0
- metadata +29 -15
- data/lib/nitro/dispatcher/general.rb +0 -62
- data/lib/nitro/dispatcher/nice.rb +0 -57
- data/lib/nitro/scaffold.rb +0 -171
- data/proto/public/index.xhtml +0 -83
- data/proto/public/js/scaffold.js +0 -74
- data/proto/public/settings.xhtml +0 -66
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
<SystemPage
|
|
2
|
-
|
|
3
|
-
<
|
|
4
|
-
th {
|
|
5
|
-
border: 1px solid #ccc;
|
|
6
|
-
background: #eee;
|
|
7
|
-
text-align: left;
|
|
8
|
-
}
|
|
9
|
-
</style>
|
|
1
|
+
<SystemPage>
|
|
2
|
+
<?r base = "#{@base}/%base%" ?>
|
|
3
|
+
<h1><a href='/'>Home</a> > System</h1>
|
|
10
4
|
|
|
11
5
|
<h2>Og managed classes</h2>
|
|
12
6
|
|
|
@@ -14,12 +8,15 @@
|
|
|
14
8
|
<tr>
|
|
15
9
|
<th>Class</th>
|
|
16
10
|
<th>Count</th>
|
|
11
|
+
<th colspan="2">Cleanup</th>
|
|
17
12
|
<th>Properties</th>
|
|
18
13
|
</tr>
|
|
19
14
|
<?r for c in @classes ?>
|
|
20
15
|
<tr>
|
|
21
|
-
<td><a href="#@base/#{c.name.plural.underscore}">#{c.name}</a></td>
|
|
16
|
+
<td><a href="#@base/#{c.name.plural.underscore}/list">#{c.name}</a></td>
|
|
22
17
|
<td>#{c.count}</td>
|
|
18
|
+
<td><a href="delete_all/#{c.name}" onclick="return confirm('Delete all instances?')">delete</a></td>
|
|
19
|
+
<td><a href="destroy/#{c.name}" onclick="return confirm('Drop the schema?')">destroy</a></td>
|
|
23
20
|
<td width="100%">#{c.properties.values.join(', ')}</td>
|
|
24
21
|
</tr>
|
|
25
22
|
<?r end ?>
|
|
@@ -43,5 +40,4 @@
|
|
|
43
40
|
</tr>
|
|
44
41
|
<?r end ?>
|
|
45
42
|
</table>
|
|
46
|
-
|
|
47
|
-
</SystemPage>
|
|
43
|
+
</SystemPage>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'lib')
|
|
2
|
+
|
|
3
|
+
require 'test/unit'
|
|
4
|
+
|
|
5
|
+
require 'nitro/caching/stores'
|
|
6
|
+
|
|
7
|
+
class TC_CachingStores < Test::Unit::TestCase # :nodoc: all
|
|
8
|
+
|
|
9
|
+
def test_memory
|
|
10
|
+
s = Nitro::Caching::MemoryStore.new
|
|
11
|
+
s.write('test', 'hello', { :none => 1})
|
|
12
|
+
s.read('test')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# * George Moschovitis <gm@navel.gr>
|
data/test/nitro/tc_caching.rb
CHANGED
|
@@ -13,10 +13,7 @@ class TC_Caching < Test::Unit::TestCase # :nodoc: all
|
|
|
13
13
|
|
|
14
14
|
def test_all
|
|
15
15
|
# bug:
|
|
16
|
-
|
|
17
|
-
# FIXME: no module_options should be here!!
|
|
18
|
-
#++
|
|
19
|
-
assert_equal ['module_options'], Caching.public_instance_methods
|
|
16
|
+
assert_equal [], Caching.public_instance_methods
|
|
20
17
|
assert_equal [], DummyCa.public_instance_methods.grep(/caching/)
|
|
21
18
|
end
|
|
22
19
|
end
|
data/test/nitro/tc_dispatcher.rb
CHANGED
|
@@ -3,11 +3,20 @@ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
|
|
3
3
|
require 'test/unit'
|
|
4
4
|
|
|
5
5
|
require 'nitro'
|
|
6
|
-
require 'nitro/dispatcher/general'
|
|
7
6
|
|
|
8
7
|
class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
|
|
9
8
|
include Nitro
|
|
10
9
|
|
|
10
|
+
Template.root = File.expand_path(File.join('..', 'public'))
|
|
11
|
+
|
|
12
|
+
class MyContext
|
|
13
|
+
attr_accessor :headers
|
|
14
|
+
|
|
15
|
+
def initialize
|
|
16
|
+
@headers = {}
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
11
20
|
class MainController < Controller
|
|
12
21
|
end
|
|
13
22
|
|
|
@@ -26,10 +35,12 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
|
|
|
26
35
|
# FIXME: this is a hack!
|
|
27
36
|
'xml:blog' => BlogController
|
|
28
37
|
})
|
|
38
|
+
|
|
39
|
+
@ctx = MyContext.new
|
|
29
40
|
end
|
|
30
41
|
|
|
31
42
|
def teardown
|
|
32
|
-
@d = @dxml = nil
|
|
43
|
+
@d = @dxml = @ctx = nil
|
|
33
44
|
end
|
|
34
45
|
|
|
35
46
|
def test_initialize
|
|
@@ -38,29 +49,30 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
|
|
|
38
49
|
end
|
|
39
50
|
|
|
40
51
|
def test_dispatch
|
|
41
|
-
klass, action = @d.dispatch('/blog/list')
|
|
52
|
+
klass, action = @d.dispatch('/blog/list', @ctx)
|
|
42
53
|
assert_equal BlogController, klass
|
|
43
54
|
assert_equal 'list_action', action
|
|
44
55
|
|
|
45
|
-
klass, action = @d.dispatch('/blog/another/very_litle
|
|
56
|
+
klass, action = @d.dispatch('/blog/another/very_litle', @ctx)
|
|
46
57
|
assert_equal BlogController, klass
|
|
47
|
-
assert_equal '
|
|
48
|
-
|
|
49
|
-
klass, action = @d.dispatch('/another/litle/list')
|
|
58
|
+
assert_equal 'another__very_litle_action', action
|
|
59
|
+
=begin
|
|
60
|
+
klass, action = @d.dispatch('/another/litle/list', @ctx)
|
|
50
61
|
assert_equal MainController, klass
|
|
51
62
|
assert_equal 'another__litle__list_action', action
|
|
52
63
|
|
|
53
|
-
klass, action = @d.dispatch('/blog')
|
|
64
|
+
klass, action = @d.dispatch('/blog', @ctx)
|
|
54
65
|
assert_equal BlogController, klass
|
|
55
66
|
assert_equal 'index_action', action
|
|
56
67
|
|
|
57
|
-
klass, action, ctype = @d.dispatch('/login')
|
|
68
|
+
klass, action, ctype = @d.dispatch('/login', @ctx)
|
|
58
69
|
assert_equal MainController, klass
|
|
59
70
|
assert_equal 'login_action', action
|
|
60
71
|
|
|
61
|
-
klass, action = @d.dispatch('/')
|
|
72
|
+
klass, action = @d.dispatch('/', @ctx)
|
|
62
73
|
assert_equal MainController, klass
|
|
63
74
|
assert_equal 'index_action', action
|
|
75
|
+
=end
|
|
64
76
|
end
|
|
65
77
|
|
|
66
78
|
end
|
data/test/nitro/tc_element.rb
CHANGED
data/test/nitro/tc_session.rb
CHANGED
|
@@ -5,11 +5,14 @@ $NITRO_NO_ENVIRONMENT = true
|
|
|
5
5
|
require 'ostruct'
|
|
6
6
|
require 'test/unit'
|
|
7
7
|
|
|
8
|
+
require 'glue'
|
|
8
9
|
require 'nitro/session'
|
|
9
10
|
|
|
10
11
|
class TC_Session < Test::Unit::TestCase # :nodoc: all
|
|
11
12
|
include Nitro
|
|
12
13
|
|
|
14
|
+
STORES = [:memory, :file, :og]
|
|
15
|
+
|
|
13
16
|
def test_create_id
|
|
14
17
|
sid = Session.new.session_id
|
|
15
18
|
assert_not_equal sid, Session.new.session_id
|
|
@@ -20,17 +23,26 @@ class TC_Session < Test::Unit::TestCase # :nodoc: all
|
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
def test_gc
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
STORES.each do |store_type|
|
|
27
|
+
Session.store_type = store_type
|
|
28
|
+
|
|
29
|
+
if store_type == :og
|
|
30
|
+
Og.setup(:store => :sqlite, :name => "/tmp/test", :destroy => true)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Session.keepalive = 2
|
|
34
|
+
|
|
35
|
+
Session.store[1] = Session.new
|
|
36
|
+
Session.store[2] = Session.new
|
|
37
|
+
|
|
38
|
+
Session.store.gc!
|
|
39
|
+
assert_equal 2, Session.store.all.size
|
|
40
|
+
Session.store.gc!
|
|
41
|
+
assert_equal 2, Session.store.all.size
|
|
42
|
+
sleep(3)
|
|
43
|
+
Session.store.gc!
|
|
44
|
+
assert_equal 0, Session.store.all.size
|
|
45
|
+
end
|
|
34
46
|
end
|
|
35
47
|
|
|
36
48
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<html>hello</html>
|
metadata
CHANGED
|
@@ -3,9 +3,9 @@ rubygems_version: 0.8.10
|
|
|
3
3
|
specification_version: 1
|
|
4
4
|
name: nitro
|
|
5
5
|
version: !ruby/object:Gem::Version
|
|
6
|
-
version: 0.
|
|
7
|
-
date: 2005-
|
|
8
|
-
summary:
|
|
6
|
+
version: 0.26.0
|
|
7
|
+
date: 2005-12-21
|
|
8
|
+
summary: Everything you need to create Web 2.0 applications with Ruby and Javascript
|
|
9
9
|
require_paths:
|
|
10
10
|
- lib
|
|
11
11
|
email: gm@navel.gr
|
|
@@ -55,8 +55,10 @@ files:
|
|
|
55
55
|
- doc/MIGRATION
|
|
56
56
|
- doc/RELEASES
|
|
57
57
|
- doc/tutorial.txt
|
|
58
|
+
- lib/glue
|
|
58
59
|
- lib/nitro
|
|
59
60
|
- lib/nitro.rb
|
|
61
|
+
- lib/glue/sweeper.rb
|
|
60
62
|
- lib/nitro/adapter
|
|
61
63
|
- lib/nitro/caching
|
|
62
64
|
- lib/nitro/caching.rb
|
|
@@ -66,7 +68,6 @@ files:
|
|
|
66
68
|
- lib/nitro/compiler.rb
|
|
67
69
|
- lib/nitro/context.rb
|
|
68
70
|
- lib/nitro/controller.rb
|
|
69
|
-
- lib/nitro/dispatcher
|
|
70
71
|
- lib/nitro/dispatcher.rb
|
|
71
72
|
- lib/nitro/element
|
|
72
73
|
- lib/nitro/element.rb
|
|
@@ -76,7 +77,7 @@ files:
|
|
|
76
77
|
- lib/nitro/render.rb
|
|
77
78
|
- lib/nitro/routing.rb
|
|
78
79
|
- lib/nitro/scaffold
|
|
79
|
-
- lib/nitro/
|
|
80
|
+
- lib/nitro/scaffolding.rb
|
|
80
81
|
- lib/nitro/server
|
|
81
82
|
- lib/nitro/server.rb
|
|
82
83
|
- lib/nitro/service
|
|
@@ -101,6 +102,7 @@ files:
|
|
|
101
102
|
- lib/nitro/cgi/response.rb
|
|
102
103
|
- lib/nitro/cgi/stream.rb
|
|
103
104
|
- lib/nitro/cgi/utils.rb
|
|
105
|
+
- lib/nitro/compiler/cleanup.rb
|
|
104
106
|
- lib/nitro/compiler/css.rb
|
|
105
107
|
- lib/nitro/compiler/elements.rb
|
|
106
108
|
- lib/nitro/compiler/errors.rb
|
|
@@ -108,23 +110,27 @@ files:
|
|
|
108
110
|
- lib/nitro/compiler/localization.rb
|
|
109
111
|
- lib/nitro/compiler/markup.rb
|
|
110
112
|
- lib/nitro/compiler/morphing.rb
|
|
113
|
+
- lib/nitro/compiler/script_generator.rb
|
|
111
114
|
- lib/nitro/compiler/shaders.rb
|
|
112
115
|
- lib/nitro/compiler/squeeze.rb
|
|
113
116
|
- lib/nitro/compiler/xslt.rb
|
|
114
|
-
- lib/nitro/dispatcher/general.rb
|
|
115
|
-
- lib/nitro/dispatcher/nice.rb
|
|
116
117
|
- lib/nitro/element/java_script.rb
|
|
117
118
|
- lib/nitro/helper/benchmark.rb
|
|
118
119
|
- lib/nitro/helper/buffer.rb
|
|
119
120
|
- lib/nitro/helper/debug.rb
|
|
120
121
|
- lib/nitro/helper/default.rb
|
|
122
|
+
- lib/nitro/helper/dojo.rb
|
|
123
|
+
- lib/nitro/helper/form
|
|
121
124
|
- lib/nitro/helper/form.rb
|
|
122
125
|
- lib/nitro/helper/javascript.rb
|
|
123
126
|
- lib/nitro/helper/pager.rb
|
|
127
|
+
- lib/nitro/helper/prototype.rb
|
|
124
128
|
- lib/nitro/helper/rss.rb
|
|
129
|
+
- lib/nitro/helper/scriptaculous.rb
|
|
125
130
|
- lib/nitro/helper/table.rb
|
|
126
131
|
- lib/nitro/helper/xhtml.rb
|
|
127
132
|
- lib/nitro/helper/xml.rb
|
|
133
|
+
- lib/nitro/helper/form/controls.rb
|
|
128
134
|
- lib/nitro/scaffold/relations.rb
|
|
129
135
|
- lib/nitro/server/runner.rb
|
|
130
136
|
- lib/nitro/service/xmlrpc.rb
|
|
@@ -132,6 +138,7 @@ files:
|
|
|
132
138
|
- lib/nitro/session/drbserver.rb
|
|
133
139
|
- lib/nitro/session/file.rb
|
|
134
140
|
- lib/nitro/session/memory.rb
|
|
141
|
+
- lib/nitro/session/og.rb
|
|
135
142
|
- lib/nitro/test/assertions.rb
|
|
136
143
|
- lib/nitro/test/context.rb
|
|
137
144
|
- lib/nitro/test/testcase.rb
|
|
@@ -145,12 +152,10 @@ files:
|
|
|
145
152
|
- proto/public/cgi.rb
|
|
146
153
|
- proto/public/error.xhtml
|
|
147
154
|
- proto/public/fcgi.rb
|
|
148
|
-
- proto/public/index.xhtml
|
|
149
155
|
- proto/public/js
|
|
150
156
|
- proto/public/media
|
|
151
157
|
- proto/public/robots.txt
|
|
152
158
|
- proto/public/scaffold
|
|
153
|
-
- proto/public/settings.xhtml
|
|
154
159
|
- proto/public/js/behaviour.js
|
|
155
160
|
- proto/public/js/builder.js
|
|
156
161
|
- proto/public/js/controls.js
|
|
@@ -158,7 +163,6 @@ files:
|
|
|
158
163
|
- proto/public/js/dragdrop.js
|
|
159
164
|
- proto/public/js/effects.js
|
|
160
165
|
- proto/public/js/prototype.js
|
|
161
|
-
- proto/public/js/scaffold.js
|
|
162
166
|
- proto/public/js/scriptaculous.js
|
|
163
167
|
- proto/public/js/slider.js
|
|
164
168
|
- proto/public/js/unittest.js
|
|
@@ -166,8 +170,10 @@ files:
|
|
|
166
170
|
- proto/public/media/nitro.png
|
|
167
171
|
- proto/public/scaffold/edit.xhtml
|
|
168
172
|
- proto/public/scaffold/form.xhtml
|
|
173
|
+
- proto/public/scaffold/index.xhtml
|
|
169
174
|
- proto/public/scaffold/list.xhtml
|
|
170
175
|
- proto/public/scaffold/new.xhtml
|
|
176
|
+
- proto/public/scaffold/search.xhtml
|
|
171
177
|
- proto/public/scaffold/view.xhtml
|
|
172
178
|
- proto/script/benchmark
|
|
173
179
|
- proto/script/runner
|
|
@@ -179,13 +185,16 @@ files:
|
|
|
179
185
|
- src/part/admin.rb
|
|
180
186
|
- src/part/admin/controller.rb
|
|
181
187
|
- src/part/admin/skin.rb
|
|
188
|
+
- src/part/admin/system.css
|
|
182
189
|
- src/part/admin/template
|
|
183
190
|
- src/part/admin/template/denied.xhtml
|
|
184
191
|
- src/part/admin/template/index.xhtml
|
|
185
192
|
- test/nitro
|
|
186
193
|
- test/public
|
|
187
194
|
- test/nitro/adapter
|
|
195
|
+
- test/nitro/caching
|
|
188
196
|
- test/nitro/cgi
|
|
197
|
+
- test/nitro/compiler
|
|
189
198
|
- test/nitro/helper
|
|
190
199
|
- test/nitro/tc_caching.rb
|
|
191
200
|
- test/nitro/tc_cgi.rb
|
|
@@ -199,9 +208,9 @@ files:
|
|
|
199
208
|
- test/nitro/tc_render.rb
|
|
200
209
|
- test/nitro/tc_server.rb
|
|
201
210
|
- test/nitro/tc_session.rb
|
|
202
|
-
- test/nitro/ui
|
|
203
211
|
- test/nitro/adapter/raw_post1.bin
|
|
204
212
|
- test/nitro/adapter/tc_webrick.rb
|
|
213
|
+
- test/nitro/caching/tc_stores.rb
|
|
205
214
|
- test/nitro/cgi/tc_cookie.rb
|
|
206
215
|
- test/nitro/cgi/tc_request.rb
|
|
207
216
|
- test/nitro/helper/tc_pager.rb
|
|
@@ -210,14 +219,19 @@ files:
|
|
|
210
219
|
- test/nitro/helper/tc_xhtml.rb
|
|
211
220
|
- test/public/blog
|
|
212
221
|
- test/public/dummy_mailer
|
|
222
|
+
- test/public/blog/another
|
|
213
223
|
- test/public/blog/inc1.xhtml
|
|
214
224
|
- test/public/blog/inc2.xhtml
|
|
215
225
|
- test/public/blog/list.xhtml
|
|
226
|
+
- test/public/blog/another/very_litle
|
|
227
|
+
- test/public/blog/another/very_litle/index.xhtml
|
|
216
228
|
- test/public/dummy_mailer/registration.xhtml
|
|
217
229
|
test_files: []
|
|
218
230
|
rdoc_options: []
|
|
219
231
|
extra_rdoc_files: []
|
|
220
|
-
executables:
|
|
232
|
+
executables:
|
|
233
|
+
- nitro
|
|
234
|
+
- nitrogen
|
|
221
235
|
extensions: []
|
|
222
236
|
requirements: []
|
|
223
237
|
dependencies:
|
|
@@ -229,7 +243,7 @@ dependencies:
|
|
|
229
243
|
-
|
|
230
244
|
- "="
|
|
231
245
|
- !ruby/object:Gem::Version
|
|
232
|
-
version: 0.
|
|
246
|
+
version: 0.26.0
|
|
233
247
|
version:
|
|
234
248
|
- !ruby/object:Gem::Dependency
|
|
235
249
|
name: gen
|
|
@@ -239,7 +253,7 @@ dependencies:
|
|
|
239
253
|
-
|
|
240
254
|
- "="
|
|
241
255
|
- !ruby/object:Gem::Version
|
|
242
|
-
version: 0.
|
|
256
|
+
version: 0.26.0
|
|
243
257
|
version:
|
|
244
258
|
- !ruby/object:Gem::Dependency
|
|
245
259
|
name: glue
|
|
@@ -249,7 +263,7 @@ dependencies:
|
|
|
249
263
|
-
|
|
250
264
|
- "="
|
|
251
265
|
- !ruby/object:Gem::Version
|
|
252
|
-
version: 0.
|
|
266
|
+
version: 0.26.0
|
|
253
267
|
version:
|
|
254
268
|
- !ruby/object:Gem::Dependency
|
|
255
269
|
name: RedCloth
|
|
@@ -1,62 +0,0 @@
|
|
|
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>
|