nitro 0.9.5 → 0.10.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 +260 -0
- data/INSTALL +60 -0
- data/LICENSE +1 -0
- data/README +19 -20
- data/RELEASES +48 -0
- data/Rakefile +102 -92
- data/benchmark/og/bench.rb +74 -0
- data/benchmark/og/sqlite-no-prepare.1.txt +13 -0
- data/benchmark/og/sqlite-no-prepare.2.txt +13 -0
- data/benchmark/og/sqlite-prepare.1.txt +13 -0
- data/benchmark/og/sqlite-prepare.2.txt +13 -0
- data/bin/cluster +1 -1
- data/bin/nitro +3 -0
- data/bin/proto/conf/app.conf.rb +2 -10
- data/examples/README.windows +9 -0
- data/examples/blog/README +16 -4
- data/examples/blog/lib/blog.rb +3 -3
- data/examples/blog/lib/blog/controller.rb +7 -9
- data/examples/blog/root/fcgi.rb +2 -4
- data/examples/blog/root/style.xsl +4 -6
- data/examples/blog/run.rb +41 -0
- data/examples/flash/run.rb +9 -0
- data/examples/no_xsl_blog/README +0 -1
- data/examples/no_xsl_blog/conf/app.conf.rb +6 -13
- data/examples/no_xsl_blog/lib/blog.rb +2 -2
- data/examples/no_xsl_blog/lib/blog/controller.rb +6 -6
- data/examples/no_xsl_blog/root/fcgi.rb +2 -4
- data/examples/no_xsl_blog/run.rb +38 -0
- data/examples/og/mock_example.rb +0 -2
- data/examples/og/mysql_to_psql.rb +0 -2
- data/examples/og/run.rb +23 -22
- data/examples/tiny/root/fcgi.rb +2 -4
- data/examples/tiny/root/index.xhtml +21 -5
- data/examples/tiny/root/upload.xhtml +23 -0
- data/examples/tiny/run.rb +9 -0
- data/examples/wee_style/{wee.rb → run.rb} +13 -13
- data/install.rb +44 -0
- data/lib/glue/array.rb +6 -10
- data/lib/glue/attribute.rb +0 -3
- data/lib/glue/cache.rb +1 -1
- data/lib/glue/inflector.rb +5 -5
- data/lib/glue/mixins.rb +3 -12
- data/lib/glue/number.rb +1 -1
- data/lib/glue/object.rb +7 -1
- data/lib/glue/property.rb +32 -22
- data/lib/glue/string.rb +13 -75
- data/lib/glue/time.rb +2 -2
- data/lib/glue/validation.rb +7 -11
- data/lib/nitro.rb +16 -1
- data/lib/nitro/{adaptors → adapters}/cgi.rb +101 -20
- data/lib/nitro/{adaptors → adapters}/fastcgi.rb +3 -2
- data/lib/nitro/{adaptors → adapters}/webrick.rb +4 -4
- data/lib/nitro/builders/rss.rb +1 -1
- data/lib/nitro/builders/xml.rb +8 -10
- data/lib/nitro/cluster.rb +1 -1
- data/lib/nitro/conf.rb +34 -0
- data/lib/nitro/controller.rb +8 -9
- data/lib/nitro/dispatcher.rb +38 -11
- data/lib/nitro/filters.rb +1 -1
- data/lib/nitro/markup.rb +14 -1
- data/lib/nitro/render.rb +7 -10
- data/lib/nitro/runner.rb +232 -0
- data/lib/nitro/ui/pager.rb +2 -6
- data/lib/nitro/uri.rb +7 -11
- data/lib/og.rb +27 -261
- data/lib/og/adapter.rb +352 -0
- data/lib/og/adapters/mysql.rb +304 -0
- data/lib/og/adapters/psql.rb +286 -0
- data/lib/og/adapters/sqlite.rb +262 -0
- data/lib/og/backend.rb +1 -1
- data/lib/og/connection.rb +123 -87
- data/lib/og/database.rb +268 -0
- data/lib/og/meta.rb +23 -22
- data/lib/og/mock.rb +2 -3
- data/lib/xsl/base.xsl +1 -55
- data/test/glue/tc_property.rb +2 -0
- data/test/glue/tc_property_type_checking.rb +32 -0
- data/test/glue/tc_strings.rb +2 -2
- data/test/glue/tc_validation.rb +2 -0
- data/test/nitro/adapters/raw_post1.bin +0 -0
- data/test/nitro/{adaptors → adapters}/tc_cgi.rb +11 -2
- data/test/nitro/{adaptors → adapters}/tc_webrick.rb +3 -3
- data/test/nitro/builders/tc_xml.rb +14 -5
- data/test/nitro/tc_dispatcher.rb +3 -3
- data/test/nitro/tc_uri.rb +2 -4
- data/test/og/tc_lifecycle.rb +22 -25
- data/test/og/tc_sqlite.rb +87 -0
- data/test/tc_og.rb +61 -42
- metadata +67 -33
- data/examples/blog/conf/app.conf.rb +0 -52
- data/examples/blog/ctl +0 -4
- data/examples/flash/conf/app.conf.rb +0 -21
- data/examples/flash/ctl +0 -4
- data/examples/no_xsl_blog/conf/apache.conf +0 -0
- data/examples/no_xsl_blog/ctl +0 -4
- data/examples/tiny/conf/app.conf.rb +0 -17
- data/examples/tiny/ctl +0 -4
- data/lib/glue/macro.rb +0 -56
- data/lib/nitro/adaptors/runner.rb +0 -123
- data/lib/nitro/version.rb +0 -15
- data/lib/og/backends/mysql.rb +0 -370
- data/lib/og/backends/psql.rb +0 -386
- data/lib/og/backends/sqlite.rb +0 -383
- data/lib/og/version.rb +0 -9
metadata
CHANGED
|
@@ -3,17 +3,18 @@ rubygems_version: 0.8.4
|
|
|
3
3
|
specification_version: 1
|
|
4
4
|
name: nitro
|
|
5
5
|
version: !ruby/object:Gem::Version
|
|
6
|
-
version: 0.
|
|
7
|
-
date: 2005-02-
|
|
8
|
-
summary: Web Engine
|
|
6
|
+
version: 0.10.0
|
|
7
|
+
date: 2005-02-15
|
|
8
|
+
summary: Nitro Web Engine
|
|
9
9
|
require_paths:
|
|
10
10
|
- lib
|
|
11
11
|
email: gm@navel.gr
|
|
12
|
-
homepage: http://www.
|
|
12
|
+
homepage: http://www.rubyforge.com/projects/nitro
|
|
13
13
|
rubyforge_project: nitro
|
|
14
|
-
description: "An efficient,
|
|
14
|
+
description: "An efficient, multiparadigm and flexible platform for rapid web application
|
|
15
|
+
development. Implements a full development stack (Model, View, Controller)."
|
|
15
16
|
autorequire: nitro
|
|
16
|
-
default_executable:
|
|
17
|
+
default_executable: nitro
|
|
17
18
|
bindir: bin
|
|
18
19
|
has_rdoc: true
|
|
19
20
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
@@ -21,7 +22,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
|
21
22
|
-
|
|
22
23
|
- ">="
|
|
23
24
|
- !ruby/object:Gem::Version
|
|
24
|
-
version: 1.8.
|
|
25
|
+
version: 1.8.0
|
|
25
26
|
version:
|
|
26
27
|
platform: ruby
|
|
27
28
|
authors:
|
|
@@ -32,8 +33,11 @@ files:
|
|
|
32
33
|
- ChangeLog
|
|
33
34
|
- LICENSE
|
|
34
35
|
- AUTHORS
|
|
36
|
+
- INSTALL
|
|
35
37
|
- RELEASES
|
|
36
38
|
- README
|
|
39
|
+
- install.rb
|
|
40
|
+
- bin/nitro
|
|
37
41
|
- bin/new_app.rb
|
|
38
42
|
- bin/cluster
|
|
39
43
|
- bin/proto
|
|
@@ -64,20 +68,25 @@ files:
|
|
|
64
68
|
- benchmark/nitro/tiny-webrick-n-200-c-5.txt
|
|
65
69
|
- benchmark/nitro/tiny-webrick-n-200.txt
|
|
66
70
|
- benchmark/nitro/bench.rb
|
|
71
|
+
- benchmark/og/sqlite-prepare.2.txt
|
|
72
|
+
- benchmark/og/sqlite-no-prepare.2.txt
|
|
73
|
+
- benchmark/og/sqlite-no-prepare.1.txt
|
|
74
|
+
- benchmark/og/bench.rb
|
|
75
|
+
- benchmark/og/sqlite-prepare.1.txt
|
|
67
76
|
- examples/no_xsl_blog
|
|
68
77
|
- examples/flash
|
|
69
78
|
- examples/tiny
|
|
70
79
|
- examples/wee_style
|
|
71
80
|
- examples/blog
|
|
81
|
+
- examples/README.windows
|
|
72
82
|
- examples/og
|
|
73
|
-
- examples/no_xsl_blog/ctl
|
|
74
83
|
- examples/no_xsl_blog/log
|
|
75
84
|
- examples/no_xsl_blog/conf
|
|
76
85
|
- examples/no_xsl_blog/root
|
|
86
|
+
- examples/no_xsl_blog/run.rb
|
|
77
87
|
- examples/no_xsl_blog/lib
|
|
78
88
|
- examples/no_xsl_blog/README
|
|
79
89
|
- examples/no_xsl_blog/log/README
|
|
80
|
-
- examples/no_xsl_blog/conf/apache.conf
|
|
81
90
|
- examples/no_xsl_blog/conf/lhttpd.conf
|
|
82
91
|
- examples/no_xsl_blog/conf/app.conf.rb
|
|
83
92
|
- examples/no_xsl_blog/root/login.xhtml
|
|
@@ -110,39 +119,37 @@ files:
|
|
|
110
119
|
- examples/no_xsl_blog/lib/blog/template.rb
|
|
111
120
|
- examples/no_xsl_blog/lib/blog/model.rb
|
|
112
121
|
- examples/no_xsl_blog/lib/blog/controller.rb
|
|
113
|
-
- examples/flash/ctl
|
|
114
122
|
- examples/flash/log
|
|
115
123
|
- examples/flash/conf
|
|
116
124
|
- examples/flash/root
|
|
125
|
+
- examples/flash/run.rb
|
|
117
126
|
- examples/flash/log/README
|
|
118
|
-
- examples/flash/conf/app.conf.rb
|
|
119
127
|
- examples/flash/root/index.xhtml
|
|
120
128
|
- examples/flash/root/show_inline_text.xhtml
|
|
121
|
-
- examples/tiny/ctl
|
|
122
129
|
- examples/tiny/log
|
|
123
130
|
- examples/tiny/conf
|
|
124
131
|
- examples/tiny/root
|
|
132
|
+
- examples/tiny/run.rb
|
|
125
133
|
- examples/tiny/README
|
|
126
134
|
- examples/tiny/log/README
|
|
127
135
|
- examples/tiny/conf/apache.conf
|
|
128
136
|
- examples/tiny/conf/lhttpd.conf
|
|
129
|
-
- examples/tiny/conf/app.conf.rb
|
|
130
137
|
- examples/tiny/root/index.xhtml
|
|
131
138
|
- examples/tiny/root/nitro.png
|
|
139
|
+
- examples/tiny/root/upload.xhtml
|
|
132
140
|
- examples/tiny/root/fcgi.rb
|
|
133
141
|
- examples/tiny/root/include.xhtml
|
|
134
|
-
- examples/wee_style/
|
|
142
|
+
- examples/wee_style/run.rb
|
|
135
143
|
- examples/wee_style/README
|
|
136
|
-
- examples/blog/ctl
|
|
137
144
|
- examples/blog/log
|
|
138
145
|
- examples/blog/conf
|
|
139
146
|
- examples/blog/root
|
|
147
|
+
- examples/blog/run.rb
|
|
140
148
|
- examples/blog/lib
|
|
141
149
|
- examples/blog/README
|
|
142
150
|
- examples/blog/log/README
|
|
143
151
|
- examples/blog/conf/apache.conf
|
|
144
152
|
- examples/blog/conf/lhttpd.conf
|
|
145
|
-
- examples/blog/conf/app.conf.rb
|
|
146
153
|
- examples/blog/root/login.xhtml
|
|
147
154
|
- examples/blog/root/index.xhtml
|
|
148
155
|
- examples/blog/root/style.css
|
|
@@ -192,9 +199,9 @@ files:
|
|
|
192
199
|
- lib/nitro/cookie.rb
|
|
193
200
|
- lib/nitro/session.rb
|
|
194
201
|
- lib/nitro/uri.rb
|
|
195
|
-
- lib/nitro/
|
|
196
|
-
- lib/nitro/adaptors
|
|
202
|
+
- lib/nitro/runner.rb
|
|
197
203
|
- lib/nitro/scaffold.rb
|
|
204
|
+
- lib/nitro/adapters
|
|
198
205
|
- lib/nitro/context.rb
|
|
199
206
|
- lib/nitro/shaders.rb
|
|
200
207
|
- lib/nitro/buffering.rb
|
|
@@ -205,15 +212,15 @@ files:
|
|
|
205
212
|
- lib/nitro/cluster.rb
|
|
206
213
|
- lib/nitro/mail.rb
|
|
207
214
|
- lib/nitro/controller.rb
|
|
215
|
+
- lib/nitro/conf.rb
|
|
208
216
|
- lib/nitro/dispatcher.rb
|
|
209
217
|
- lib/nitro/request.rb
|
|
210
218
|
- lib/nitro/filters
|
|
211
219
|
- lib/nitro/markup.rb
|
|
212
220
|
- lib/nitro/filters.rb
|
|
213
|
-
- lib/nitro/
|
|
214
|
-
- lib/nitro/
|
|
215
|
-
- lib/nitro/
|
|
216
|
-
- lib/nitro/adaptors/webrick.rb
|
|
221
|
+
- lib/nitro/adapters/cgi.rb
|
|
222
|
+
- lib/nitro/adapters/fastcgi.rb
|
|
223
|
+
- lib/nitro/adapters/webrick.rb
|
|
217
224
|
- lib/nitro/builders/xhtml.rb
|
|
218
225
|
- lib/nitro/builders/form.rb
|
|
219
226
|
- lib/nitro/builders/rss.rb
|
|
@@ -238,7 +245,6 @@ files:
|
|
|
238
245
|
- lib/glue/time.rb
|
|
239
246
|
- lib/glue/property.rb
|
|
240
247
|
- lib/glue/misc.rb
|
|
241
|
-
- lib/glue/macro.rb
|
|
242
248
|
- lib/glue/flexob.rb
|
|
243
249
|
- lib/glue/cache.rb
|
|
244
250
|
- lib/glue/string.rb
|
|
@@ -246,16 +252,17 @@ files:
|
|
|
246
252
|
- lib/glue/array.rb
|
|
247
253
|
- lib/glue/validation.rb
|
|
248
254
|
- lib/glue/attribute.rb
|
|
249
|
-
- lib/og/
|
|
250
|
-
- lib/og/
|
|
255
|
+
- lib/og/adapter.rb
|
|
256
|
+
- lib/og/adapters
|
|
251
257
|
- lib/og/enchant.rb
|
|
252
258
|
- lib/og/connection.rb
|
|
259
|
+
- lib/og/database.rb
|
|
253
260
|
- lib/og/mock.rb
|
|
254
261
|
- lib/og/meta.rb
|
|
255
262
|
- lib/og/backend.rb
|
|
256
|
-
- lib/og/
|
|
257
|
-
- lib/og/
|
|
258
|
-
- lib/og/
|
|
263
|
+
- lib/og/adapters/mysql.rb
|
|
264
|
+
- lib/og/adapters/sqlite.rb
|
|
265
|
+
- lib/og/adapters/psql.rb
|
|
259
266
|
- test/nitro
|
|
260
267
|
- test/tc_og.rb
|
|
261
268
|
- test/root
|
|
@@ -263,14 +270,15 @@ files:
|
|
|
263
270
|
- test/og
|
|
264
271
|
- test/nitro/tc_uri.rb
|
|
265
272
|
- test/nitro/tc_controller.rb
|
|
266
|
-
- test/nitro/
|
|
273
|
+
- test/nitro/adapters
|
|
267
274
|
- test/nitro/tc_session.rb
|
|
268
275
|
- test/nitro/builders
|
|
269
276
|
- test/nitro/ui
|
|
270
277
|
- test/nitro/tc_context.rb
|
|
271
278
|
- test/nitro/tc_dispatcher.rb
|
|
272
|
-
- test/nitro/
|
|
273
|
-
- test/nitro/
|
|
279
|
+
- test/nitro/adapters/tc_webrick.rb
|
|
280
|
+
- test/nitro/adapters/tc_cgi.rb
|
|
281
|
+
- test/nitro/adapters/raw_post1.bin
|
|
274
282
|
- test/nitro/builders/tc_xhtml.rb
|
|
275
283
|
- test/nitro/builders/tc_xml.rb
|
|
276
284
|
- test/nitro/builders/tc_rss.rb
|
|
@@ -279,6 +287,7 @@ files:
|
|
|
279
287
|
- test/root/blog
|
|
280
288
|
- test/root/blog/list.xhtml
|
|
281
289
|
- test/glue/tc_strings.rb
|
|
290
|
+
- test/glue/tc_property_type_checking.rb
|
|
282
291
|
- test/glue/tc_logger.rb
|
|
283
292
|
- test/glue/tc_validation.rb
|
|
284
293
|
- test/glue/tc_property.rb
|
|
@@ -287,6 +296,7 @@ files:
|
|
|
287
296
|
- test/glue/tc_property_mixins.rb
|
|
288
297
|
- test/glue/tc_cache.rb
|
|
289
298
|
- test/glue/tc_numbers.rb
|
|
299
|
+
- test/og/tc_sqlite.rb
|
|
290
300
|
- test/og/tc_lifecycle.rb
|
|
291
301
|
- vendor/breakpoint_client.rb
|
|
292
302
|
- vendor/extensions
|
|
@@ -317,15 +327,39 @@ rdoc_options:
|
|
|
317
327
|
- README
|
|
318
328
|
- "--title"
|
|
319
329
|
- Nitro Documentation
|
|
330
|
+
- "--all"
|
|
331
|
+
- "--inline-source"
|
|
320
332
|
extra_rdoc_files:
|
|
321
333
|
- Rakefile
|
|
322
334
|
- ChangeLog.1
|
|
323
335
|
- ChangeLog
|
|
324
336
|
- LICENSE
|
|
325
337
|
- AUTHORS
|
|
338
|
+
- INSTALL
|
|
326
339
|
- RELEASES
|
|
327
340
|
- README
|
|
328
|
-
executables:
|
|
341
|
+
executables:
|
|
342
|
+
- nitro
|
|
329
343
|
extensions: []
|
|
330
344
|
requirements: []
|
|
331
|
-
dependencies:
|
|
345
|
+
dependencies:
|
|
346
|
+
- !ruby/object:Gem::Dependency
|
|
347
|
+
name: extensions
|
|
348
|
+
version_requirement:
|
|
349
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
|
350
|
+
requirements:
|
|
351
|
+
-
|
|
352
|
+
- ">="
|
|
353
|
+
- !ruby/object:Gem::Version
|
|
354
|
+
version: "0.5"
|
|
355
|
+
version:
|
|
356
|
+
- !ruby/object:Gem::Dependency
|
|
357
|
+
name: flexmock
|
|
358
|
+
version_requirement:
|
|
359
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
|
360
|
+
requirements:
|
|
361
|
+
-
|
|
362
|
+
- ">="
|
|
363
|
+
- !ruby/object:Gem::Version
|
|
364
|
+
version: 0.0.3
|
|
365
|
+
version:
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# * George Moschovitis <gm@navel.gr>
|
|
2
|
-
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id$
|
|
4
|
-
|
|
5
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
|
6
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
|
|
7
|
-
|
|
8
|
-
$DBG = true
|
|
9
|
-
|
|
10
|
-
require 'nitro'
|
|
11
|
-
require 'glue/validation'
|
|
12
|
-
require 'og'
|
|
13
|
-
|
|
14
|
-
require 'blog'
|
|
15
|
-
|
|
16
|
-
include N
|
|
17
|
-
|
|
18
|
-
og = Og::Database.new(
|
|
19
|
-
:address => 'localhost',
|
|
20
|
-
# :backend => 'mysql',
|
|
21
|
-
:backend => 'psql',
|
|
22
|
-
:database => 'blog',
|
|
23
|
-
:user => 'postgres',
|
|
24
|
-
:password => 'navelrulez',
|
|
25
|
-
:connection_count => 3
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
controllers = {
|
|
29
|
-
:index => BlogController
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
apis = {
|
|
33
|
-
:xml => 'text/xml'
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
dispatcher = Dispatcher.new(controllers, apis)
|
|
37
|
-
|
|
38
|
-
Rendering.shader = N::XSLTShader.new("#{dispatcher.root}/style.xsl",
|
|
39
|
-
N::RubyShader.new(
|
|
40
|
-
N::CompressShader.new
|
|
41
|
-
)
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
Rendering.reload = :partial
|
|
45
|
-
|
|
46
|
-
$conf = {
|
|
47
|
-
:name => 'Nitro Blog',
|
|
48
|
-
:host => 'localhost',
|
|
49
|
-
:port => 8069,
|
|
50
|
-
:dispatcher => dispatcher,
|
|
51
|
-
:og => og
|
|
52
|
-
}
|
data/examples/blog/ctl
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# * George Moschovitis <gm@navel.gr>
|
|
2
|
-
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id$
|
|
4
|
-
|
|
5
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
|
|
6
|
-
|
|
7
|
-
$DBG = true
|
|
8
|
-
|
|
9
|
-
require 'ostruct'
|
|
10
|
-
|
|
11
|
-
require 'nitro'
|
|
12
|
-
|
|
13
|
-
include N
|
|
14
|
-
|
|
15
|
-
dispatcher = Dispatcher.new
|
|
16
|
-
|
|
17
|
-
$conf = {
|
|
18
|
-
:host => 'localhost',
|
|
19
|
-
:port => 8069,
|
|
20
|
-
:dispatcher => dispatcher,
|
|
21
|
-
}
|
data/examples/flash/ctl
DELETED
|
File without changes
|
data/examples/no_xsl_blog/ctl
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# * George Moschovitis <gm@navel.gr>
|
|
2
|
-
# (c) 2004-2005 Navel, all rights reserved.
|
|
3
|
-
# $Id: app.rb 197 2004-12-21 13:50:17Z gmosx $
|
|
4
|
-
|
|
5
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
|
|
6
|
-
|
|
7
|
-
$DBG = true
|
|
8
|
-
|
|
9
|
-
require 'nitro'
|
|
10
|
-
|
|
11
|
-
# gmosx, FIXME: make this default!
|
|
12
|
-
|
|
13
|
-
$conf = {
|
|
14
|
-
:host => 'localhost',
|
|
15
|
-
:port => 8069,
|
|
16
|
-
:dispatcher => N::Dispatcher.new
|
|
17
|
-
}
|
data/examples/tiny/ctl
DELETED
data/lib/glue/macro.rb
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# = Macros
|
|
2
|
-
#
|
|
3
|
-
# A powerfull macro implementation for Ruby. Allows definition
|
|
4
|
-
# of new macro.
|
|
5
|
-
#
|
|
6
|
-
# EXPERIMENTAL, not fully working yet
|
|
7
|
-
#
|
|
8
|
-
# code:
|
|
9
|
-
# George Moschovitis <gm@navel.gr>
|
|
10
|
-
#
|
|
11
|
-
# (c) 2004 Navel, all rights reserved.
|
|
12
|
-
# $Id: macro.rb 165 2004-11-18 12:04:04Z gmosx $
|
|
13
|
-
|
|
14
|
-
$__macros__ = {}
|
|
15
|
-
$__required__ = {}
|
|
16
|
-
|
|
17
|
-
module Kernel
|
|
18
|
-
|
|
19
|
-
alias_method :old_require, :require
|
|
20
|
-
def require(path)
|
|
21
|
-
return if $__required__[path]
|
|
22
|
-
|
|
23
|
-
source = File.read(path)
|
|
24
|
-
|
|
25
|
-
# parse macro
|
|
26
|
-
source.gsub!(/defmacro\s*\/(.*?)\/\s(.*?)endmacro/m) {
|
|
27
|
-
$__macros__[Regexp.new($1)] = $2 ; ""
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# expand macros
|
|
31
|
-
$__macros__.each { |match, replace|
|
|
32
|
-
source.gsub!(match, replace)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
$__required__[path] = true
|
|
36
|
-
|
|
37
|
-
eval(source)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
require "nitro/test1.rb"
|
|
43
|
-
require "nitro/test2.rb"
|
|
44
|
-
|
|
45
|
-
__END__
|
|
46
|
-
|
|
47
|
-
Examples:
|
|
48
|
-
|
|
49
|
-
defmacro /my_macro\((.*)\)/
|
|
50
|
-
begin
|
|
51
|
-
my_function(\1)
|
|
52
|
-
rescue => ex
|
|
53
|
-
puts ex
|
|
54
|
-
end
|
|
55
|
-
endmacro
|
|
56
|
-
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
# * George Moschovitis <gm@navel.gr>
|
|
4
|
-
# (c) 2004-2005 Navel, all rights reserved.
|
|
5
|
-
# $Id$
|
|
6
|
-
|
|
7
|
-
require 'optparse'
|
|
8
|
-
|
|
9
|
-
module N
|
|
10
|
-
|
|
11
|
-
# The Runner is a helper class that encapsulates a web
|
|
12
|
-
# application and is responsible for launching the
|
|
13
|
-
# application using different adaptors. Default arguments
|
|
14
|
-
# parsing is also provided.
|
|
15
|
-
#
|
|
16
|
-
# You can implement your own, custom version of the Runner
|
|
17
|
-
# to run your custom web applications.
|
|
18
|
-
#
|
|
19
|
-
#--
|
|
20
|
-
# TODO: find a better name
|
|
21
|
-
#++
|
|
22
|
-
|
|
23
|
-
class Runner
|
|
24
|
-
|
|
25
|
-
# Parse the arguments and run the web application
|
|
26
|
-
# using the declared environment and adaptor
|
|
27
|
-
|
|
28
|
-
def self.run(argv)
|
|
29
|
-
|
|
30
|
-
# :start, :stop, :restart.
|
|
31
|
-
|
|
32
|
-
action = :start
|
|
33
|
-
|
|
34
|
-
# :webrick, :lhttp, :apache
|
|
35
|
-
|
|
36
|
-
server = :webrick
|
|
37
|
-
|
|
38
|
-
# daemonize? (in webrick only)
|
|
39
|
-
|
|
40
|
-
daemon = false
|
|
41
|
-
|
|
42
|
-
# log to file ?
|
|
43
|
-
|
|
44
|
-
log_to_file = false
|
|
45
|
-
|
|
46
|
-
# Parse the arguments.
|
|
47
|
-
|
|
48
|
-
parser = OptionParser.new do |opts|
|
|
49
|
-
|
|
50
|
-
opts.banner = 'Usage: ctl [options]'
|
|
51
|
-
opts.separator ''
|
|
52
|
-
opts.separator 'Specific options:'
|
|
53
|
-
|
|
54
|
-
opts.on("-s", "--start", "Start application.") do
|
|
55
|
-
action = :start
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
opts.on("-S", "--stop", "Stop application.") do
|
|
59
|
-
action = :stop
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
opts.on("-r", "--restart", "Restart application.") do
|
|
63
|
-
action = :restart
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
opts.on("-d", "--daemon", "Run application as a daemon.") do
|
|
67
|
-
daemon = true
|
|
68
|
-
log_to_file = true
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
opts.on("-D", "--debug", "Run application in debug mode.") do
|
|
72
|
-
$DBG = true
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
opts.on("-w", "--webrick", "Use a webrick server [default].") do
|
|
76
|
-
server = :webrick
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
opts.on("-l", "--lhttpd", "Use a webrick server [default].") do
|
|
80
|
-
server = :lhttpd
|
|
81
|
-
log_to_file = true
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
opts.on_tail("-v", "--version", "Show version.") do
|
|
85
|
-
require 'nitro/version'
|
|
86
|
-
puts "Nitro #{Nitro::Version}"
|
|
87
|
-
exit
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
opts.on_tail("-?", "--help", "Show this message.") do
|
|
91
|
-
puts opts
|
|
92
|
-
exit
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
parser.parse!(ARGV)
|
|
98
|
-
|
|
99
|
-
require 'conf/app.conf.rb'
|
|
100
|
-
|
|
101
|
-
if log_to_file
|
|
102
|
-
Logger.set(Logger.new('log/app.log'))
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
case server
|
|
106
|
-
|
|
107
|
-
when :webrick
|
|
108
|
-
require 'nitro/adaptors/webrick'
|
|
109
|
-
N::Webrick.start($conf)
|
|
110
|
-
|
|
111
|
-
when :lhttpd
|
|
112
|
-
require 'nitro/adaptors/fastcgi'
|
|
113
|
-
`lighttpd -f conf/lhttpd.conf`
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
# Run the app!
|
|
120
|
-
|
|
121
|
-
Runner.run(ARGV)
|
|
122
|
-
|
|
123
|
-
end
|