nitro 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{ChangeLog → CHANGELOG} +137 -0
- data/INSTALL +1 -2
- data/README +1 -1
- data/Rakefile +10 -61
- data/benchmark/{nitro/bench.rb → bench.rb} +1 -1
- data/benchmark/{nitro/simple-webrick-n-200.txt → simple-webrick-n-200.txt} +0 -0
- data/benchmark/{nitro/static-webrick-n-200.txt → static-webrick-n-200.txt} +0 -0
- data/benchmark/{nitro/tiny-lhttpd-n-200-c-5.txt → tiny-lhttpd-n-200-c-5.txt} +0 -0
- data/benchmark/{nitro/tiny-webrick-n-200-c-5.txt → tiny-webrick-n-200-c-5.txt} +0 -0
- data/benchmark/{nitro/tiny-webrick-n-200.txt → tiny-webrick-n-200.txt} +0 -0
- data/benchmark/{nitro/tiny2-webrick-n-200.txt → tiny2-webrick-n-200.txt} +0 -0
- data/doc/{ChangeLog.1 → CHANGELOG.1} +0 -0
- data/{RELEASES → doc/RELEASES} +46 -0
- data/doc/faq.txt +7 -0
- data/examples/README.windows +1 -1
- data/examples/ajax/controller.rb +21 -0
- data/examples/ajax/public/index.xhtml +70 -0
- data/examples/ajax/public/js/ajax.js +64 -0
- data/examples/ajax/run.rb +16 -0
- data/examples/blog/README +6 -3
- data/examples/blog/conf/apache.conf +2 -2
- data/examples/blog/conf/lhttpd.conf +2 -2
- data/examples/blog/log/apache.error_log +777 -0
- data/examples/blog/{root → public}/base.xsl +0 -0
- data/examples/blog/{root → public}/fcgi.rb +0 -0
- data/examples/blog/{root → public}/m/bubbles.gif +0 -0
- data/examples/blog/{root → public}/m/comments_curve.gif +0 -0
- data/examples/blog/{root → public}/m/down.gif +0 -0
- data/examples/blog/{root → public}/m/footer_bg.gif +0 -0
- data/examples/blog/{root → public}/m/garrow.gif +0 -0
- data/examples/blog/{root → public}/m/gbull.gif +0 -0
- data/examples/blog/{root → public}/m/grbull.gif +0 -0
- data/examples/blog/{root → public}/m/h1_bg.gif +0 -0
- data/examples/blog/{root → public}/m/header_bg.gif +0 -0
- data/examples/blog/{root → public}/m/nitro.gif +0 -0
- data/examples/blog/{root → public}/m/obull.gif +0 -0
- data/examples/blog/{root → public}/m/page_bg.gif +0 -0
- data/examples/blog/{root → public}/m/rss.gif +0 -0
- data/examples/blog/{root → public}/m/side_title_bg.gif +0 -0
- data/examples/blog/{root → public}/m/sidebar_bg.gif +0 -0
- data/examples/{no_xsl_blog/root → blog/public}/style.css +6 -0
- data/examples/blog/run.rb +10 -12
- data/examples/blog/{lib → src}/blog.rb +3 -3
- data/examples/blog/{lib/blog → src}/controller.rb +13 -2
- data/examples/blog/src/mailer.rb +23 -0
- data/examples/blog/{lib/blog/model.rb → src/models/blog.rb} +4 -7
- data/examples/blog/src/models/content.rb +52 -0
- data/examples/blog/src/views/blog_entry_email.xhtml +16 -0
- data/examples/blog/{root → src/views}/comments.xhtml +0 -0
- data/examples/blog/{root → src/views}/entry_form.xhtml +0 -0
- data/examples/blog/{root → src/views}/error.xhtml +0 -0
- data/examples/blog/{root → src/views}/index.xhtml +0 -0
- data/examples/blog/{root → src/views}/login.xhtml +0 -0
- data/examples/blog/{root → src/views}/recent_posts.xhtml +0 -0
- data/examples/blog/{root → src/views}/view_entry.xhtml +8 -0
- data/examples/blog/{root → src/views}/view_entry.xml +0 -0
- data/examples/blog/src/xsl/base.xsl +153 -0
- data/examples/blog/{root → src/xsl}/style.xsl +2 -2
- data/examples/no_xsl_blog/README +5 -1
- data/examples/no_xsl_blog/conf/apache.conf +2 -2
- data/examples/no_xsl_blog/conf/lhttpd.conf +2 -2
- data/examples/no_xsl_blog/lib/blog/model.rb +1 -1
- data/{lib/parts → examples/no_xsl_blog/lib}/content.rb +1 -11
- data/examples/no_xsl_blog/log/apache.error_log +405 -0
- data/examples/no_xsl_blog/{root → public}/comments.xhtml +0 -0
- data/examples/no_xsl_blog/{root → public}/entry_form.xhtml +0 -0
- data/examples/no_xsl_blog/{root → public}/fcgi.rb +0 -0
- data/examples/no_xsl_blog/{root → public}/index.xhtml +0 -0
- data/examples/no_xsl_blog/{root → public}/login.xhtml +0 -0
- data/examples/no_xsl_blog/{root → public}/m/bubbles.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/comments_curve.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/down.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/footer_bg.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/garrow.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/gbull.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/grbull.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/h1_bg.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/header_bg.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/nitro.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/obull.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/page_bg.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/rss.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/side_title_bg.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/m/sidebar_bg.gif +0 -0
- data/examples/no_xsl_blog/{root → public}/recent_posts.xhtml +0 -0
- data/examples/{blog/root → no_xsl_blog/public}/style.css +0 -0
- data/examples/no_xsl_blog/{root → public}/view_entry.xhtml +0 -0
- data/examples/no_xsl_blog/{root → public}/view_entry.xml +0 -0
- data/examples/tiny/conf/apache.conf +2 -2
- data/examples/tiny/log/apache.error_log +100 -0
- data/examples/tiny/{root → public}/fcgi.rb +0 -0
- data/examples/tiny/{root → public}/include.xhtml +0 -0
- data/examples/tiny/{root → public}/index.xhtml +0 -0
- data/{bin/proto/root/m → examples/tiny/public}/nitro.png +0 -0
- data/examples/tiny/{root → public}/upload.xhtml +0 -0
- data/examples/tiny/run.rb +1 -2
- data/examples/why_wiki/wiki.yml +1 -0
- data/install.rb +5 -2
- data/lib/nitro.rb +2 -6
- data/lib/nitro/adapters/fastcgi.rb +2 -2
- data/lib/nitro/adapters/webrick.rb +4 -4
- data/lib/nitro/conf.rb +5 -2
- data/lib/nitro/controller.rb +2 -2
- data/lib/nitro/dispatcher.rb +19 -8
- data/lib/nitro/mail.rb +252 -8
- data/lib/nitro/render.rb +24 -21
- data/lib/nitro/runner.rb +1 -1
- data/lib/nitro/scaffold.rb +2 -5
- data/lib/nitro/simple.rb +2 -1
- data/lib/nitro/template.rb +42 -2
- data/test/nitro/tc_controller.rb +9 -4
- data/test/nitro/tc_dispatcher.rb +4 -6
- data/test/nitro/tc_mail.rb +95 -0
- data/test/{root → public}/blog/list.xhtml +0 -0
- data/test/public/dummy_mailer/registration.xhtml +5 -0
- data/vendor/README +0 -1
- metadata +136 -181
- data/benchmark/og/bench.rb +0 -75
- data/benchmark/og/sqlite-no-prepare.1.txt +0 -13
- data/benchmark/og/sqlite-no-prepare.2.txt +0 -13
- data/benchmark/og/sqlite-prepare.1.txt +0 -13
- data/benchmark/og/sqlite-prepare.2.txt +0 -13
- data/bin/proto/README +0 -34
- data/bin/proto/conf/apache.conf +0 -1
- data/bin/proto/conf/app.conf.rb +0 -14
- data/bin/proto/conf/lhttpd.conf +0 -236
- data/bin/proto/ctl +0 -4
- data/bin/proto/lib/README +0 -5
- data/bin/proto/log/README +0 -3
- data/bin/proto/root/fcgi.rb +0 -6
- data/bin/proto/root/index.xhtml +0 -69
- data/bin/proto/root/style.css +0 -152
- data/bin/proto/root/style.xsl +0 -99
- data/doc/og_config.txt +0 -35
- data/doc/og_tutorial.txt +0 -595
- data/examples/og/README +0 -11
- data/examples/og/mock_example.rb +0 -50
- data/examples/og/mysql_to_psql.rb +0 -96
- data/examples/og/run.rb +0 -286
- data/examples/tiny/root/nitro.png +0 -0
- data/lib/glue.rb +0 -55
- data/lib/glue/array.rb +0 -61
- data/lib/glue/attribute.rb +0 -83
- data/lib/glue/cache.rb +0 -138
- data/lib/glue/flexob.rb +0 -12
- data/lib/glue/hash.rb +0 -122
- data/lib/glue/inflector.rb +0 -91
- data/lib/glue/logger.rb +0 -147
- data/lib/glue/misc.rb +0 -14
- data/lib/glue/mixins.rb +0 -36
- data/lib/glue/number.rb +0 -24
- data/lib/glue/object.rb +0 -32
- data/lib/glue/pool.rb +0 -60
- data/lib/glue/property.rb +0 -408
- data/lib/glue/string.rb +0 -162
- data/lib/glue/time.rb +0 -85
- data/lib/glue/validation.rb +0 -394
- data/lib/og.rb +0 -185
- data/lib/og/adapter.rb +0 -513
- data/lib/og/adapters/filesys.rb +0 -121
- data/lib/og/adapters/mysql.rb +0 -347
- data/lib/og/adapters/oracle.rb +0 -375
- data/lib/og/adapters/psql.rb +0 -273
- data/lib/og/adapters/sqlite.rb +0 -262
- data/lib/og/backend.rb +0 -297
- data/lib/og/connection.rb +0 -304
- data/lib/og/database.rb +0 -282
- data/lib/og/enchant.rb +0 -125
- data/lib/og/meta.rb +0 -373
- data/lib/og/mock.rb +0 -165
- data/lib/og/observer.rb +0 -53
- data/lib/og/typemacros.rb +0 -23
- data/lib/parts/README +0 -9
- data/test/glue/tc_attribute.rb +0 -22
- data/test/glue/tc_cache.rb +0 -45
- data/test/glue/tc_hash.rb +0 -38
- data/test/glue/tc_logger.rb +0 -39
- data/test/glue/tc_numbers.rb +0 -20
- data/test/glue/tc_property.rb +0 -89
- data/test/glue/tc_property_mixins.rb +0 -93
- data/test/glue/tc_property_type_checking.rb +0 -35
- data/test/glue/tc_strings.rb +0 -103
- data/test/glue/tc_validation.rb +0 -188
- data/test/og/tc_filesys.rb +0 -83
- data/test/og/tc_lifecycle.rb +0 -104
- data/test/og/tc_many_to_many.rb +0 -62
- data/test/og/tc_meta.rb +0 -55
- data/test/og/tc_observer.rb +0 -85
- data/test/og/tc_sqlite.rb +0 -87
- data/test/tc_og.rb +0 -355
- data/vendor/composite_sexp_processor.rb +0 -43
- data/vendor/parse_tree.rb +0 -745
- data/vendor/sexp_processor.rb +0 -453
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -6,7 +6,7 @@ Listen 9999
|
|
6
6
|
|
7
7
|
PidFile /var/tmp/httpd.pid
|
8
8
|
TypesConfig /etc/mime.types
|
9
|
-
DocumentRoot /home/gmosx/navel/nitro/examples/tiny/
|
9
|
+
DocumentRoot /home/gmosx/navel/nitro/examples/tiny/public
|
10
10
|
|
11
11
|
# The error log.
|
12
12
|
ErrorLog log/apache.error_log
|
@@ -18,7 +18,7 @@ LoadModule fastcgi_module /usr/local/apache2/modules/mod_fastcgi.so
|
|
18
18
|
|
19
19
|
FastCgiIpcDir /var/tmp/fcgi
|
20
20
|
# gmosx: if you have installed the distribution the -I is not needed.
|
21
|
-
FastCgiConfig -initial-env 'RUBYOPT=-rubygems -I/home/gmosx/navel/nitro/lib'
|
21
|
+
FastCgiConfig -initial-env 'RUBYOPT=-rubygems -I/home/gmosx/navel/nitro/lib -I/home/gmosx/navel/og/lib -I/home/gmosx/navel/glue/lib'
|
22
22
|
AddHandler fastcgi-script fcgi rb
|
23
23
|
Options +FollowSymLinks +ExecCGI
|
24
24
|
|
@@ -28,3 +28,103 @@ DEBUG: Rendering '/include'.
|
|
28
28
|
DEBUG: Rendering '/'.
|
29
29
|
DEBUG: Rendering '/include'.
|
30
30
|
[Sun Feb 27 15:00:15 2005] [notice] caught SIGTERM, shutting down
|
31
|
+
[Thu Mar 17 12:31:03 2005] [notice] Digest: generating secret for digest authentication ...
|
32
|
+
[Thu Mar 17 12:31:03 2005] [notice] Digest: done
|
33
|
+
[Thu Mar 17 12:31:04 2005] [notice] FastCGI: process manager initialized (pid 4964)
|
34
|
+
[Thu Mar 17 12:31:04 2005] [notice] Apache/2.0.53 (Unix) DAV/2 mod_fastcgi/2.4.2 configured -- resuming normal operations
|
35
|
+
[Thu Mar 17 12:31:06 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/tiny/public/fcgi.rb" started (pid 4970)
|
36
|
+
DEBUG: Rendering '/view_entry/3'.
|
37
|
+
ERROR: Error while handling '/view_entry/3'.
|
38
|
+
ERROR: No controller for action
|
39
|
+
BACKTRACE:
|
40
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:231:in `render'
|
41
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:39:in `start'
|
42
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `each'
|
43
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `start'
|
44
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:217:in `invoke_fcgi_proc'
|
45
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:188:in `run'
|
46
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:276:in `run'
|
47
|
+
/home/gmosx/navel/nitro/examples/tiny/public/../run.rb:9
|
48
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__'
|
49
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'
|
50
|
+
/home/gmosx/navel/nitro/examples/tiny/public/fcgi.rb:4
|
51
|
+
LOGGED FROM:
|
52
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:281:in `log_error'
|
53
|
+
DEBUG: Rendering '/error'.
|
54
|
+
DEBUG: Compiling action 'public/error'
|
55
|
+
ERROR: Error while handling '/error'.
|
56
|
+
ERROR: undefined method `__xhtml__error' for #<SimpleController:0xf6d142a4>
|
57
|
+
BACKTRACE:
|
58
|
+
/home/gmosx/navel/nitro/lib/nitro/controller.rb:94:in `method_missing'
|
59
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:236:in `send'
|
60
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:236:in `render'
|
61
|
+
/home/gmosx/navel/nitro/lib/nitro/context.rb:67:in `out'
|
62
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:44:in `start'
|
63
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `each'
|
64
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `start'
|
65
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:217:in `invoke_fcgi_proc'
|
66
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:188:in `run'
|
67
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:276:in `run'
|
68
|
+
/home/gmosx/navel/nitro/examples/tiny/public/../run.rb:9
|
69
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__'
|
70
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'
|
71
|
+
/home/gmosx/navel/nitro/examples/tiny/public/fcgi.rb:4
|
72
|
+
LOGGED FROM:
|
73
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:281:in `log_error'
|
74
|
+
[Thu Mar 17 12:31:21 2005] [notice] caught SIGTERM, shutting down
|
75
|
+
[Thu Mar 17 12:31:34 2005] [notice] Digest: generating secret for digest authentication ...
|
76
|
+
[Thu Mar 17 12:31:34 2005] [notice] Digest: done
|
77
|
+
[Thu Mar 17 12:31:35 2005] [notice] FastCGI: process manager initialized (pid 4980)
|
78
|
+
[Thu Mar 17 12:31:35 2005] [notice] Apache/2.0.53 (Unix) DAV/2 mod_fastcgi/2.4.2 configured -- resuming normal operations
|
79
|
+
[Thu Mar 17 12:31:39 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/tiny/public/fcgi.rb" started (pid 4986)
|
80
|
+
DEBUG: Rendering '/view_entry/3'.
|
81
|
+
ERROR: Error while handling '/view_entry/3'.
|
82
|
+
ERROR: No controller for action
|
83
|
+
BACKTRACE:
|
84
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:231:in `render'
|
85
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:39:in `start'
|
86
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `each'
|
87
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `start'
|
88
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:217:in `invoke_fcgi_proc'
|
89
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:188:in `run'
|
90
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:276:in `run'
|
91
|
+
/home/gmosx/navel/nitro/examples/tiny/public/../run.rb:9
|
92
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__'
|
93
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'
|
94
|
+
/home/gmosx/navel/nitro/examples/tiny/public/fcgi.rb:4
|
95
|
+
LOGGED FROM:
|
96
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:281:in `log_error'
|
97
|
+
DEBUG: Rendering '/error'.
|
98
|
+
DEBUG: Compiling action 'public/error'
|
99
|
+
ERROR: Error while handling '/error'.
|
100
|
+
ERROR: undefined method `__xhtml__error' for #<SimpleController:0xf6d14268>
|
101
|
+
BACKTRACE:
|
102
|
+
/home/gmosx/navel/nitro/lib/nitro/controller.rb:94:in `method_missing'
|
103
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:236:in `send'
|
104
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:236:in `render'
|
105
|
+
/home/gmosx/navel/nitro/lib/nitro/context.rb:67:in `out'
|
106
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:44:in `start'
|
107
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `each'
|
108
|
+
/home/gmosx/navel/nitro/lib/nitro/adapters/fastcgi.rb:26:in `start'
|
109
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:217:in `invoke_fcgi_proc'
|
110
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:188:in `run'
|
111
|
+
/home/gmosx/navel/nitro/lib/nitro/runner.rb:276:in `run'
|
112
|
+
/home/gmosx/navel/nitro/examples/tiny/public/../run.rb:9
|
113
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__'
|
114
|
+
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'
|
115
|
+
/home/gmosx/navel/nitro/examples/tiny/public/fcgi.rb:4
|
116
|
+
LOGGED FROM:
|
117
|
+
/home/gmosx/navel/nitro/lib/nitro/render.rb:281:in `log_error'
|
118
|
+
DEBUG: Rendering '/'.
|
119
|
+
DEBUG: Compiling action 'public/index'
|
120
|
+
DEBUG: Transforming 'public/index.xhtml'
|
121
|
+
DEBUG: Rendering '/include'.
|
122
|
+
DEBUG: Compiling action 'public/include'
|
123
|
+
DEBUG: Transforming 'public/include.xhtml'
|
124
|
+
DEBUG: Rendering '/'.
|
125
|
+
DEBUG: Compiling action 'public/index'
|
126
|
+
DEBUG: Transforming 'public/index.xhtml'
|
127
|
+
DEBUG: Rendering '/include'.
|
128
|
+
DEBUG: Compiling action 'public/include'
|
129
|
+
DEBUG: Transforming 'public/include.xhtml'
|
130
|
+
[Thu Mar 17 12:34:48 2005] [notice] caught SIGTERM, shutting down
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/examples/tiny/run.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: run.rb
|
3
|
+
# $Id: run.rb 300 2005-03-16 13:23:10Z gmosx $
|
4
4
|
|
5
5
|
Dir.chdir File.dirname(__FILE__)
|
6
6
|
|
7
7
|
require 'nitro'
|
8
8
|
|
9
|
-
N::Rendering.reload = false
|
10
9
|
N::Runner.run(:host => '127.0.0.1', :port => 9999)
|
@@ -0,0 +1 @@
|
|
1
|
+
--- {}
|
data/install.rb
CHANGED
@@ -29,14 +29,17 @@ puts %{
|
|
29
29
|
|
30
30
|
|
31
31
|
---
|
32
|
-
Congratulations, you have successfully installed Nitro
|
32
|
+
Congratulations, you have successfully installed Nitro!
|
33
33
|
The libraries where installed in '#{dst_dir}'.
|
34
34
|
|
35
|
+
You probably need to install the Glue and Og libraries
|
36
|
+
as well. (http://nitro.rubyforge.org)
|
37
|
+
|
35
38
|
To verify that everything works correctly, try to run the tiny
|
36
39
|
example by issuing:
|
37
40
|
|
38
41
|
$ cd exampes/tiny
|
39
|
-
$ ruby
|
42
|
+
$ ruby run.rb
|
40
43
|
|
41
44
|
at the command line.
|
42
45
|
|
data/lib/nitro.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
#
|
13
13
|
# * George Moschovitis <gm@navel.gr>
|
14
14
|
# (c) 2004-2005 Navel, all rights reserved.
|
15
|
-
# $Id: nitro.rb
|
15
|
+
# $Id: nitro.rb 300 2005-03-16 13:23:10Z gmosx $
|
16
16
|
|
17
17
|
require 'glue'
|
18
18
|
require 'glue/logger'
|
@@ -21,13 +21,9 @@ require 'glue/logger'
|
|
21
21
|
|
22
22
|
module Nitro
|
23
23
|
|
24
|
-
# The name.
|
25
|
-
|
26
|
-
Name = 'Nitro'
|
27
|
-
|
28
24
|
# The version.
|
29
25
|
|
30
|
-
Version = '0.
|
26
|
+
Version = '0.13.0'
|
31
27
|
|
32
28
|
# Library path.
|
33
29
|
|
@@ -34,11 +34,11 @@ class FastCGI
|
|
34
34
|
CgiUtils.parse_cookies(context)
|
35
35
|
|
36
36
|
# gmosx, TODO: move this into a filter.
|
37
|
-
Og.db.get_connection if defined?(Og)
|
37
|
+
Og.db.get_connection if defined?(Og) and Og.db
|
38
38
|
|
39
39
|
context.render(context.path)
|
40
40
|
|
41
|
-
Og.db.put_connection if defined?(Og)
|
41
|
+
Og.db.put_connection if defined?(Og) and Og.db
|
42
42
|
|
43
43
|
cgi.out.print(CgiUtils.response_headers(context))
|
44
44
|
cgi.out.print(context.out)
|
@@ -57,7 +57,7 @@ class Webrick
|
|
57
57
|
@server = WEBrick::HTTPServer.new(
|
58
58
|
:BindAddress => conf.host,
|
59
59
|
:Port => conf.port,
|
60
|
-
:DocumentRoot => conf.dispatcher.
|
60
|
+
:DocumentRoot => conf.dispatcher.public_root,
|
61
61
|
:AccessLog => [
|
62
62
|
[accesslog, WEBrick::AccessLog::COMMON_LOG_FORMAT],
|
63
63
|
[refererlog, WEBrick::AccessLog::REFERER_LOG_FORMAT]
|
@@ -91,7 +91,7 @@ class WebrickAdapter < WEBrick::HTTPServlet::AbstractServlet
|
|
91
91
|
|
92
92
|
@file_handler = WEBrick::HTTPServlet::FileHandler.new(
|
93
93
|
server,
|
94
|
-
conf.dispatcher.
|
94
|
+
conf.dispatcher.public_root, conf.webrick_options || {})
|
95
95
|
end
|
96
96
|
|
97
97
|
def handle(req, res)
|
@@ -101,7 +101,7 @@ class WebrickAdapter < WEBrick::HTTPServlet::AbstractServlet
|
|
101
101
|
@file_handler.do_GET(req, res)
|
102
102
|
else
|
103
103
|
# gmosx, TODO: move this into a filter.
|
104
|
-
Og.db.get_connection if defined?(Og)
|
104
|
+
Og.db.get_connection if defined?(Og) and Og.db
|
105
105
|
|
106
106
|
# REQUEST_MUTEX.lock
|
107
107
|
|
@@ -137,7 +137,7 @@ class WebrickAdapter < WEBrick::HTTPServlet::AbstractServlet
|
|
137
137
|
end
|
138
138
|
ensure
|
139
139
|
# REQUEST_MUTEX.unlock if REQUEST_MUTEX.locked?
|
140
|
-
Og.db.put_connection if defined?(Og)
|
140
|
+
Og.db.put_connection if defined?(Og) and Og.db
|
141
141
|
end
|
142
142
|
|
143
143
|
alias do_GET handle
|
data/lib/nitro/conf.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: conf.rb
|
3
|
+
# $Id: conf.rb 302 2005-03-16 14:31:32Z gmosx $
|
4
4
|
|
5
5
|
require 'glue/flexob'
|
6
6
|
|
@@ -22,7 +22,10 @@ class Conf < Flexob
|
|
22
22
|
# this is accessible as localhost on windows
|
23
23
|
:host => '0.0.0.0',
|
24
24
|
:port => 9999,
|
25
|
-
:dispatcher => Dispatcher.new
|
25
|
+
:dispatcher => Dispatcher.new,
|
26
|
+
|
27
|
+
:template_root => 'templates',
|
28
|
+
:public_root => 'public'
|
26
29
|
}
|
27
30
|
|
28
31
|
hash.update(options)
|
data/lib/nitro/controller.rb
CHANGED
@@ -82,13 +82,13 @@ class Controller
|
|
82
82
|
# A hash containing metadata for the action
|
83
83
|
# methods.
|
84
84
|
|
85
|
-
cattr_accessor :action_metadata, {}
|
85
|
+
cattr_accessor :action_metadata, {}
|
86
86
|
|
87
87
|
# Use the method_missing hook to compile the actions
|
88
88
|
# for this controller.
|
89
89
|
|
90
90
|
def method_missing(action, *args)
|
91
|
-
if Rendering.compile_action(self.class, action, @
|
91
|
+
if Rendering.compile_action(self.class, action, @template_root)
|
92
92
|
send(action, *args)
|
93
93
|
else
|
94
94
|
super
|
data/lib/nitro/dispatcher.rb
CHANGED
@@ -13,9 +13,18 @@ require 'nitro/simple'
|
|
13
13
|
class Dispatcher
|
14
14
|
include Router
|
15
15
|
|
16
|
-
# The root directory.
|
16
|
+
# The public root directory. The files in this
|
17
|
+
# directory are published by the web server.
|
17
18
|
|
18
|
-
attr_accessor :
|
19
|
+
attr_accessor :public_root
|
20
|
+
|
21
|
+
# The template root directory. By default this
|
22
|
+
# points to the public root directory to allow
|
23
|
+
# for PHP/JSP/ASP style programming. But you should
|
24
|
+
# probably change this to another directory for
|
25
|
+
# extra security.
|
26
|
+
|
27
|
+
attr_accessor :template_root
|
19
28
|
|
20
29
|
# The controllers map.
|
21
30
|
|
@@ -37,7 +46,8 @@ class Dispatcher
|
|
37
46
|
# A hash of apis supported by the Dispatcher.
|
38
47
|
|
39
48
|
def initialize(controllers = nil, apis = nil, routes = nil)
|
40
|
-
@
|
49
|
+
@public_root = 'public'
|
50
|
+
@template_root = @public_root
|
41
51
|
|
42
52
|
if controllers and controllers.is_a?(Class) and controllers.ancestors.include?(Controller)
|
43
53
|
controllers = { :root => controllers }
|
@@ -127,32 +137,33 @@ class Dispatcher
|
|
127
137
|
case parts.size
|
128
138
|
when 0
|
129
139
|
# / -> root.index
|
130
|
-
base = @
|
140
|
+
# base = @template_root
|
131
141
|
klass = controller_class_for(:root, context)
|
132
142
|
action = 'index'
|
133
143
|
|
134
144
|
when 2
|
135
145
|
if klass = controller_class_for(parts[1], context)
|
136
146
|
# controller/ -> controller.index
|
137
|
-
base = "#{@
|
147
|
+
# base = "#{@template_root}/#{parts[1]}"
|
138
148
|
action = 'index'
|
139
149
|
else
|
140
150
|
# action/ -> root.action
|
141
|
-
base = @
|
151
|
+
# base = @template_root
|
142
152
|
klass = controller_class_for(:root, context)
|
143
153
|
action = parts[1]
|
144
154
|
end
|
145
155
|
|
146
156
|
when 3
|
147
157
|
# controller/action/ -> controller.action
|
148
|
-
base = "#{@
|
158
|
+
# base = "#{@template_root}/#{parts[1]}"
|
149
159
|
klass = controller_class_for(parts[1], context)
|
150
160
|
action = parts[2]
|
151
161
|
end
|
152
162
|
|
153
163
|
content_type = @apis[:api] || 'text/html'
|
154
164
|
|
155
|
-
return klass, "__#{api}__#{action}", base, content_type
|
165
|
+
# return klass, "__#{api}__#{action}", base, content_type
|
166
|
+
return klass, "__#{api}__#{action}", content_type
|
156
167
|
end
|
157
168
|
alias_method :split_path, :dispatch
|
158
169
|
|
data/lib/nitro/mail.rb
CHANGED
@@ -1,25 +1,269 @@
|
|
1
|
+
# Based on original code from the RubyOnRails project.
|
2
|
+
# http://www.rubyonrails.com
|
3
|
+
# Copyright (c) 2004 David Heinemeier Hansson
|
4
|
+
#
|
1
5
|
# * George Moschovitis <gm@navel.gr>
|
2
6
|
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: mail.rb
|
7
|
+
# $Id: mail.rb 300 2005-03-16 13:23:10Z gmosx $
|
4
8
|
|
5
9
|
require 'net/smtp'
|
6
10
|
|
11
|
+
require 'glue/attribute'
|
12
|
+
require 'nitro/template'
|
13
|
+
|
7
14
|
module N
|
8
15
|
|
9
|
-
#
|
16
|
+
# Encapsulates an email message.
|
17
|
+
|
18
|
+
class Mail
|
19
|
+
|
20
|
+
# Sender, can be an array.
|
21
|
+
|
22
|
+
attr_accessor :from
|
23
|
+
|
24
|
+
# The list of the recipients, can be arrays.
|
25
|
+
|
26
|
+
attr_accessor :to, :cc, :bcc
|
27
|
+
|
28
|
+
# The subject
|
29
|
+
|
30
|
+
attr_accessor :subject
|
31
|
+
|
32
|
+
# The body of the message.
|
33
|
+
|
34
|
+
attr_accessor :body
|
35
|
+
|
36
|
+
# Reply to.
|
37
|
+
|
38
|
+
attr_accessor :reply_to
|
39
|
+
|
40
|
+
# Sent on
|
41
|
+
|
42
|
+
attr_accessor :sent_on
|
43
|
+
|
44
|
+
# Encode the subject?
|
45
|
+
|
46
|
+
attr_accessor :encode_subject
|
47
|
+
|
48
|
+
# The charset used to encode the message.
|
49
|
+
|
50
|
+
attr_accessor :charset
|
51
|
+
|
52
|
+
# Additional headers
|
53
|
+
|
54
|
+
attr_accessor :headers
|
55
|
+
|
56
|
+
def initialize(from = nil, to = nil, subject = nil, body = nil)
|
57
|
+
@from, @to, @subject, @body = from, to, subject, body
|
58
|
+
@headers = {}
|
59
|
+
end
|
60
|
+
|
61
|
+
def [](key)
|
62
|
+
@headers[key]
|
63
|
+
end
|
10
64
|
|
11
|
-
|
65
|
+
def []=(key, value)
|
66
|
+
@headers[key] = value
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns the Mail message in encoded format.
|
12
70
|
|
13
|
-
|
71
|
+
def encoded
|
72
|
+
raise 'No body defined' unless @body
|
73
|
+
raise 'No sender defined' unless @from
|
74
|
+
raise 'No recipients defined' unless @to
|
14
75
|
|
15
|
-
|
76
|
+
# gmosx: From is typically NOT an array.
|
16
77
|
|
17
|
-
|
18
|
-
|
19
|
-
|
78
|
+
from = @from.is_a?(Array) ? @from.join(', ') : @from
|
79
|
+
buf = "From: #{from}\n"
|
80
|
+
|
81
|
+
to = @to.is_a?(Array) ? @to.join(', ') : @to
|
82
|
+
buf << "To: #{to}\n"
|
83
|
+
|
84
|
+
if @cc
|
85
|
+
cc = @cc.is_a?(Array) ? @cc.join(', ') : @cc
|
86
|
+
buf << "Cc: #{cc}\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
if @bcc
|
90
|
+
bcc = @bcc.is_a?(Array) ? @bcc.join(', ') : @bcc
|
91
|
+
buf << "Bcc: #{bcc}\n"
|
20
92
|
end
|
93
|
+
|
94
|
+
buf << "Subject: #@subject\n" if @subject
|
95
|
+
|
96
|
+
buf << "\n"
|
97
|
+
buf << @body
|
98
|
+
|
99
|
+
return buf
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
module MailerMixin
|
104
|
+
|
105
|
+
def self.append_features(base) # :nodoc:
|
106
|
+
super
|
107
|
+
base.extend(SingletonMethods)
|
21
108
|
end
|
109
|
+
|
110
|
+
module SingletonMethods
|
111
|
+
|
112
|
+
def mailer(klass)
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
# A flexible mailing service.
|
120
|
+
#--
|
121
|
+
# TODO: add callback/observers support.
|
122
|
+
#++
|
123
|
+
|
124
|
+
class Mailer < Mail
|
125
|
+
|
126
|
+
# The mail server configuration.
|
127
|
+
|
128
|
+
cattr_accessor :server; @@server = {
|
129
|
+
:address => 'localhost',
|
130
|
+
:port => 25,
|
131
|
+
:domain => 'localhost.localdomain',
|
132
|
+
:username => nil,
|
133
|
+
:password => nil,
|
134
|
+
:authentication => nil
|
135
|
+
}
|
136
|
+
|
137
|
+
# The delivery method. The following options are
|
138
|
+
# supported:
|
139
|
+
#
|
140
|
+
# * :smtp
|
141
|
+
# * :sendmail
|
142
|
+
# * :test
|
143
|
+
|
144
|
+
cattr_accessor :delivery_method; @@delivery_method = :smtp
|
145
|
+
|
146
|
+
# The encode subject.
|
147
|
+
|
148
|
+
cattr_accessor :encode_subject; @@encode_subject = false # true
|
22
149
|
|
150
|
+
# The default charset.
|
151
|
+
|
152
|
+
cattr_accessor :default_charset, 'utf-8'
|
153
|
+
|
154
|
+
# An array to store the delivered mails, useful
|
155
|
+
# for testing.
|
156
|
+
|
157
|
+
cattr_accessor :deliveries; @@deliveries = []
|
158
|
+
|
159
|
+
# Disable deliveries, useful for testing.
|
160
|
+
|
161
|
+
cattr_accessor :disable_deliveries, false
|
162
|
+
|
163
|
+
# The root directory where the templates reside
|
164
|
+
|
165
|
+
attr_accessor :template_root
|
166
|
+
|
167
|
+
def initialize(from = nil, to = nil, subject = nil, body = FileTemplate.new)
|
168
|
+
super
|
169
|
+
@charset = @@default_charset.dup
|
170
|
+
@encode_subject = @@encode_subject
|
171
|
+
@template_root = 'public'
|
172
|
+
end
|
173
|
+
|
174
|
+
class << self
|
175
|
+
|
176
|
+
def method_missing(method_symbol, *params) #:nodoc:
|
177
|
+
case method_symbol.id2name
|
178
|
+
when /^create_([_a-z]*)/
|
179
|
+
create_from_method($1, *params)
|
180
|
+
when /^deliver_([_a-z]*)/
|
181
|
+
begin
|
182
|
+
deliver(send("create_" + $1, *params))
|
183
|
+
rescue Object => e
|
184
|
+
raise e # FIXME
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def mail(from, to, subject, body, timestamp = nil, headers = {}, encode = @@encode_subject, charset = @@default_charset) #:nodoc:
|
190
|
+
deliver(create(from, to, subject, body, timestamp, headers, charset))
|
191
|
+
end
|
192
|
+
|
193
|
+
def create(from, to, subject, body, timestamp = nil, headers = {}, encode = @@encode_subject, charset = @@default_charset) #:nodoc:
|
194
|
+
m = Mail.new
|
195
|
+
m.to, m.subject, m.body, m.from = to, ( encode ? quoted_printable(subject, charset) : subject ), body, from
|
196
|
+
# m.date = timestamp.respond_to?("to_time") ? timestamp.to_time : (timestamp || Time.now)
|
197
|
+
# m.set_content_type "text", "plain", { "charset" => charset }
|
198
|
+
headers.each do |k, v|
|
199
|
+
m[k] = v
|
200
|
+
end
|
201
|
+
return m
|
202
|
+
end
|
203
|
+
|
204
|
+
def deliver(mail) #:nodoc:
|
205
|
+
send("perform_delivery_#{delivery_method}", mail) unless disable_deliveries
|
206
|
+
end
|
207
|
+
|
208
|
+
def quoted_printable(text, charset) #:nodoc:
|
209
|
+
text = text.gsub( /[^a-z ]/i ) { "=%02x" % $&[0] }.gsub( / /, "_" )
|
210
|
+
"=?#{charset}?Q?#{text}?="
|
211
|
+
end
|
212
|
+
|
213
|
+
private
|
214
|
+
|
215
|
+
def create_from_method(method_name, *params)
|
216
|
+
mailer = new
|
217
|
+
|
218
|
+
mailer.send(method_name, *params)
|
219
|
+
|
220
|
+
unless mailer.body.is_a?(String)
|
221
|
+
mailer.body = render_body(method_name, mailer)
|
222
|
+
end
|
223
|
+
|
224
|
+
mail = create(mailer.from, mailer.to, mailer.subject, mailer.body, mailer.sent_on,
|
225
|
+
mailer.headers, mailer.charset)
|
226
|
+
|
227
|
+
mail.cc = mailer.cc if mailer.cc
|
228
|
+
mail.bcc = mailer.bcc if mailer.bcc
|
229
|
+
|
230
|
+
return mail
|
231
|
+
end
|
232
|
+
|
233
|
+
# Render the body by expanfing the template
|
234
|
+
|
235
|
+
def render_body(method_name, mailer)
|
236
|
+
mailer.body.template_filename = "#{mailer.template_root}/#{method_name.to_s}.xhtml"
|
237
|
+
return mailer.body.process
|
238
|
+
end
|
239
|
+
|
240
|
+
# Deliver emails using SMTP.
|
241
|
+
|
242
|
+
def perform_delivery_smtp(mail) # :nodoc:
|
243
|
+
c = @@server
|
244
|
+
Net::SMTP.start(c[:address], c[:port], c[:domain], c[:username], c[:password], c[:authentication]) do |smtp|
|
245
|
+
smtp.send_message(mail.encoded, mail.from, mail.to)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
# Deliver emails using sendmail.
|
250
|
+
|
251
|
+
def perform_delivery_sendmail(mail) # :nodoc:
|
252
|
+
IO.popen('/usr/sbin/sendmail -i -t', 'w+') do |sm|
|
253
|
+
sm.print(mail.encoded)
|
254
|
+
sm.flush
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# Used for testing, does not actually send the
|
259
|
+
# mail.
|
260
|
+
|
261
|
+
def perform_delivery_test(mail) # :nodoc:
|
262
|
+
deliveries << mail
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
|
23
267
|
end
|
24
268
|
|
25
269
|
end
|