nitro 0.10.0 → 0.11.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/AUTHORS +4 -1
- data/ChangeLog +290 -7
- data/README +3 -3
- data/RELEASES +94 -0
- data/Rakefile +7 -7
- data/benchmark/og/bench.rb +11 -10
- data/{ChangeLog.1 → doc/ChangeLog.1} +0 -0
- data/doc/apache.txt +9 -0
- data/doc/architecture.txt +1 -27
- data/doc/bugs.txt +11 -4
- data/doc/config.txt +22 -0
- data/doc/og_config.txt +35 -0
- data/doc/og_tutorial.txt +595 -0
- data/doc/tutorial.txt +22 -0
- data/examples/blog/conf/apache.conf +30 -0
- data/examples/blog/conf/lhttpd.conf +2 -2
- data/examples/blog/lib/blog/controller.rb +11 -2
- data/examples/blog/log/apache.error_log +5528 -0
- data/examples/blog/root/fcgi.rb +1 -1
- data/examples/blog/run.rb +9 -3
- data/examples/flash/run.rb +2 -2
- data/examples/no_xsl_blog/conf/apache.conf +30 -0
- data/examples/no_xsl_blog/conf/lhttpd.conf +1 -1
- data/examples/no_xsl_blog/lib/blog/controller.rb +2 -2
- data/examples/no_xsl_blog/log/apache.error_log +68 -0
- data/examples/no_xsl_blog/root/fcgi.rb +2 -2
- data/examples/no_xsl_blog/run.rb +3 -3
- data/examples/og/run.rb +1 -1
- data/examples/tiny/conf/apache.conf +29 -4
- data/examples/tiny/conf/lhttpd.conf +1 -1
- data/examples/tiny/log/apache.error_log +30 -0
- data/examples/tiny/root/fcgi.rb +2 -2
- data/examples/tiny/root/index.xhtml +1 -1
- data/examples/tiny/run.rb +3 -2
- data/examples/wee_style/run.rb +7 -9
- data/examples/why_wiki/README +5 -0
- data/examples/why_wiki/run.rb +57 -0
- data/examples/why_wiki/wiki.yml +6 -0
- data/examples/wiki.yml +1 -0
- data/lib/glue/array.rb +14 -33
- data/lib/glue/hash.rb +32 -53
- data/lib/glue/pool.rb +9 -12
- data/lib/glue/property.rb +31 -9
- data/lib/nitro.rb +30 -8
- data/lib/nitro/adapters/cgi.rb +23 -3
- data/lib/nitro/adapters/webrick.rb +9 -3
- data/lib/nitro/builders/form.rb +21 -13
- data/lib/nitro/builders/rss.rb +20 -9
- data/lib/nitro/builders/table.rb +69 -10
- data/lib/nitro/builders/xhtml.rb +13 -4
- data/lib/nitro/component.rb +15 -0
- data/lib/nitro/conf.rb +4 -3
- data/lib/nitro/context.rb +22 -14
- data/lib/nitro/controller.rb +63 -5
- data/lib/nitro/dispatcher.rb +11 -6
- data/lib/nitro/output.rb +28 -0
- data/lib/nitro/render.rb +78 -59
- data/lib/nitro/request.rb +5 -1
- data/lib/nitro/runner.rb +20 -6
- data/lib/nitro/session.rb +89 -18
- data/lib/nitro/session/drb.rb +31 -0
- data/lib/nitro/session/drbserver.rb +71 -0
- data/lib/nitro/session/memory.rb +13 -0
- data/lib/nitro/simple.rb +7 -0
- data/lib/nitro/ui/date-select.rb +2 -5
- data/lib/nitro/ui/pager.rb +4 -4
- data/lib/nitro/ui/tabs.rb +2 -4
- data/lib/nitro/uri.rb +7 -4
- data/lib/og.rb +20 -12
- data/lib/og/adapter.rb +40 -13
- data/lib/og/adapters/filesys.rb +121 -0
- data/lib/og/adapters/mysql.rb +10 -5
- data/lib/og/adapters/oracle.rb +374 -0
- data/lib/og/adapters/psql.rb +10 -23
- data/lib/og/adapters/sqlite.rb +3 -3
- data/lib/og/backend.rb +2 -2
- data/lib/og/connection.rb +6 -6
- data/lib/og/database.rb +5 -5
- data/lib/og/enchant.rb +6 -2
- data/lib/og/meta.rb +56 -26
- data/lib/og/mock.rb +1 -1
- data/lib/og/typemacros.rb +23 -0
- data/lib/parts/content.rb +4 -10
- data/test/nitro/adapters/tc_cgi.rb +1 -1
- data/test/nitro/builders/tc_rss.rb +1 -1
- data/test/nitro/builders/tc_table.rb +30 -0
- data/test/nitro/tc_context.rb +4 -0
- data/test/nitro/tc_controller.rb +9 -2
- data/test/og/tc_filesys.rb +83 -0
- data/test/og/tc_meta.rb +55 -0
- data/test/tc_og.rb +115 -36
- data/vendor/README +11 -5
- data/vendor/breakpoint.rb +35 -38
- data/vendor/breakpoint_client.rb +119 -80
- data/vendor/composite_sexp_processor.rb +43 -0
- data/vendor/parse_tree.rb +745 -0
- data/vendor/sexp_processor.rb +453 -0
- metadata +34 -7
- data/examples/no_xsl_blog/conf/app.conf.rb +0 -47
data/examples/blog/root/fcgi.rb
CHANGED
data/examples/blog/run.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: run.rb
|
3
|
+
# $Id: run.rb 266 2005-02-28 14:50:48Z gmosx $
|
4
|
+
|
5
|
+
# $:.unshift '/home/gmosx/navel/nitro/lib'
|
4
6
|
|
5
7
|
Dir.chdir File.dirname(__FILE__)
|
6
8
|
|
@@ -9,6 +11,10 @@ require 'og'
|
|
9
11
|
|
10
12
|
require 'lib/blog'
|
11
13
|
|
14
|
+
# Nitro.resolve_action_arguments = true
|
15
|
+
# Og.create_schema = false
|
16
|
+
# Session.store_type = :drb
|
17
|
+
|
12
18
|
runner = Runner.new.setup
|
13
19
|
|
14
20
|
db = Og::Database.new(
|
@@ -32,8 +38,8 @@ Rendering.shader = XSLTShader.new("#{dispatcher.root}/style.xsl",
|
|
32
38
|
|
33
39
|
conf = Conf.new(
|
34
40
|
:name => 'Nitro Blog',
|
35
|
-
:host => '
|
36
|
-
:port =>
|
41
|
+
:host => '127.0.0.1',
|
42
|
+
:port => 9999,
|
37
43
|
:dispatcher => dispatcher,
|
38
44
|
:db => db
|
39
45
|
)
|
data/examples/flash/run.rb
CHANGED
@@ -1,9 +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 266 2005-02-28 14:50:48Z gmosx $
|
4
4
|
|
5
5
|
Dir.chdir File.dirname(__FILE__)
|
6
6
|
|
7
7
|
require 'nitro'
|
8
8
|
|
9
|
-
N::Runner.run(:host => '
|
9
|
+
N::Runner.run(:host => '127.0.0.1', :port => 9999)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Apache configuration file.
|
2
|
+
# Change as appropriate for your apache configuration.
|
3
|
+
# $Id$
|
4
|
+
|
5
|
+
Listen 9999
|
6
|
+
|
7
|
+
PidFile /var/tmp/httpd.pid
|
8
|
+
TypesConfig /etc/mime.types
|
9
|
+
DocumentRoot /home/gmosx/navel/nitro/examples/no_xsl_blog/root
|
10
|
+
|
11
|
+
# The error log.
|
12
|
+
ErrorLog log/apache.error_log
|
13
|
+
CustomLog log/access_log combined
|
14
|
+
|
15
|
+
# Load dynamic modules.
|
16
|
+
LoadModule fastcgi_module /usr/local/apache2/modules/mod_fastcgi.so
|
17
|
+
# LoadModule rewrite_module /usr/local/apache2/modules/mod_rewrite.so
|
18
|
+
|
19
|
+
FastCgiIpcDir /var/tmp/fcgi
|
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'
|
22
|
+
AddHandler fastcgi-script fcgi rb
|
23
|
+
Options +FollowSymLinks +ExecCGI
|
24
|
+
|
25
|
+
RewriteEngine On
|
26
|
+
RewriteRule ^/([\/\-_a-zA-Z0-9]+)?$ /fcgi.rb [QSA,L]
|
27
|
+
RewriteRule ^/([\/\-_a-zA-Z0-9]+)?\?([\-_a-zA-Z0-9=;&%]*)$ /fcgi.rb?$2 [QSA,L]
|
28
|
+
|
29
|
+
# You can also point these error messages to a controller/action
|
30
|
+
# ErrorDocument 500 /500.html
|
@@ -104,7 +104,7 @@ url.access-deny = ( "~", ".inc" )
|
|
104
104
|
######### Options that are good to be but not neccesary to be changed #######
|
105
105
|
|
106
106
|
## bind to port (default: 80)
|
107
|
-
server.port =
|
107
|
+
server.port = 9999
|
108
108
|
|
109
109
|
## bind to localhost (default: all interfaces)
|
110
110
|
#server.bind = "grisu.home.kneschke.de"
|
@@ -41,7 +41,7 @@ class BlogController < N::Controller
|
|
41
41
|
# example of generated view
|
42
42
|
|
43
43
|
def list_entry__xml
|
44
|
-
@out
|
44
|
+
@out.build_rss(@entries, :description => 'Blog entries', :link => context.host_url)
|
45
45
|
end
|
46
46
|
|
47
47
|
def new_comment
|
@@ -58,7 +58,7 @@ class BlogController < N::Controller
|
|
58
58
|
# example of generated view
|
59
59
|
|
60
60
|
def list_comment__xml
|
61
|
-
@out
|
61
|
+
@out.build_rss(@comments, :description => 'Blog comments', :link => context.host_url)
|
62
62
|
end
|
63
63
|
|
64
64
|
def login
|
@@ -0,0 +1,68 @@
|
|
1
|
+
[Sun Feb 27 14:41:24 2005] [notice] Digest: generating secret for digest authentication ...
|
2
|
+
[Sun Feb 27 14:41:24 2005] [notice] Digest: done
|
3
|
+
[Sun Feb 27 14:41:25 2005] [notice] FastCGI: process manager initialized (pid 4716)
|
4
|
+
[Sun Feb 27 14:41:25 2005] [notice] Apache/2.0.53 (Unix) DAV/2 mod_fastcgi/2.4.2 configured -- resuming normal operations
|
5
|
+
[Sun Feb 27 14:41:31 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" started (pid 4722)
|
6
|
+
/usr/bin/env: ruby: No such file or directory
|
7
|
+
[Sun Feb 27 14:41:32 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" (pid 4722) terminated by calling exit with status '127'
|
8
|
+
/usr/bin/env: ruby: No such file or directory
|
9
|
+
[Sun Feb 27 14:41:36 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" restarted (pid 4724)
|
10
|
+
[Sun Feb 27 14:41:36 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" (pid 4724) terminated by calling exit with status '127'
|
11
|
+
[Sun Feb 27 14:41:41 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" restarted (pid 4725)
|
12
|
+
/usr/bin/env: ruby: No such file or directory
|
13
|
+
[Sun Feb 27 14:41:41 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" (pid 4725) terminated by calling exit with status '127'
|
14
|
+
[Sun Feb 27 14:41:46 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" restarted (pid 4726)
|
15
|
+
/usr/bin/env: ruby: No such file or directory
|
16
|
+
[Sun Feb 27 14:41:46 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" (pid 4726) terminated by calling exit with status '127'
|
17
|
+
[Sun Feb 27 14:41:46 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
18
|
+
[Sun Feb 27 14:41:47 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
19
|
+
[Sun Feb 27 14:41:50 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
20
|
+
[Sun Feb 27 14:41:53 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
21
|
+
[Sun Feb 27 14:41:56 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
22
|
+
[Sun Feb 27 14:41:59 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
23
|
+
[Sun Feb 27 14:42:02 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
24
|
+
[Sun Feb 27 14:42:05 2005] [error] [client 127.0.0.1] FastCGI: comm with (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" aborted: (first read) idle timeout (30 sec), referer: http://0.0.0.0:9999/
|
25
|
+
[Sun Feb 27 14:42:05 2005] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb", referer: http://0.0.0.0:9999/
|
26
|
+
[Sun Feb 27 14:42:05 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
27
|
+
[Sun Feb 27 14:42:52 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
28
|
+
[Sun Feb 27 14:42:56 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
29
|
+
[Sun Feb 27 14:42:59 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
30
|
+
[Sun Feb 27 14:43:02 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
31
|
+
[Sun Feb 27 14:43:05 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
32
|
+
[Sun Feb 27 14:43:08 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
33
|
+
[Sun Feb 27 14:43:11 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
34
|
+
[Sun Feb 27 14:43:12 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
|
35
|
+
[Sun Feb 27 14:43:12 2005] [notice] caught SIGTERM, shutting down
|
36
|
+
[Sun Feb 27 14:43:21 2005] [notice] Digest: generating secret for digest authentication ...
|
37
|
+
[Sun Feb 27 14:43:21 2005] [notice] Digest: done
|
38
|
+
[Sun Feb 27 14:43:22 2005] [notice] FastCGI: process manager initialized (pid 4736)
|
39
|
+
[Sun Feb 27 14:43:22 2005] [notice] Apache/2.0.53 (Unix) DAV/2 mod_fastcgi/2.4.2 configured -- resuming normal operations
|
40
|
+
[Sun Feb 27 14:43:25 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/no_xsl_blog/root/fcgi.rb" started (pid 4742)
|
41
|
+
INFO: Connecting to database 'blog' using the 'mysql' adapter.
|
42
|
+
DEBUG: Og auto manages the following classes:
|
43
|
+
DEBUG: [BlogEntry, N::Category, Comment]
|
44
|
+
DEBUG: Rendering '/'.
|
45
|
+
DEBUG: Compiling action 'root/index'
|
46
|
+
DEBUG: Transforming 'root/index.xhtml'
|
47
|
+
DEBUG: SELECT * FROM og_blogentry ORDER BY oid DESC LIMIT 3
|
48
|
+
DEBUG: SELECT COUNT(*) FROM og_blogentry
|
49
|
+
DEBUG: Rendering '/'.
|
50
|
+
DEBUG: Compiling action 'root/index'
|
51
|
+
DEBUG: Transforming 'root/index.xhtml'
|
52
|
+
DEBUG: SELECT * FROM og_blogentry ORDER BY oid DESC LIMIT 3
|
53
|
+
DEBUG: SELECT COUNT(*) FROM og_blogentry
|
54
|
+
DEBUG: Rendering '/login'.
|
55
|
+
DEBUG: Compiling action 'root/login'
|
56
|
+
DEBUG: Transforming 'root/login.xhtml'
|
57
|
+
DEBUG: Rendering '/login'.
|
58
|
+
DEBUG: Compiling action 'root/login'
|
59
|
+
DEBUG: Transforming 'root/login.xhtml'
|
60
|
+
DEBUG: Rendering '/'.
|
61
|
+
DEBUG: Compiling action 'root/index'
|
62
|
+
DEBUG: Transforming 'root/index.xhtml'
|
63
|
+
DEBUG: SELECT * FROM og_blogentry ORDER BY oid DESC LIMIT 3
|
64
|
+
DEBUG: SELECT COUNT(*) FROM og_blogentry
|
65
|
+
DEBUG: Rendering '/entry_form'.
|
66
|
+
DEBUG: Compiling action 'root/entry_form'
|
67
|
+
DEBUG: Transforming 'root/entry_form.xhtml'
|
68
|
+
[Sun Feb 27 14:44:37 2005] [notice] caught SIGTERM, shutting down
|
data/examples/no_xsl_blog/run.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: run.rb
|
3
|
+
# $Id: run.rb 266 2005-02-28 14:50:48Z gmosx $
|
4
4
|
|
5
5
|
Dir.chdir File.dirname(__FILE__)
|
6
6
|
|
@@ -29,8 +29,8 @@ Rendering.shader = RubyShader.new(CompressShader.new)
|
|
29
29
|
|
30
30
|
conf = Conf.new(
|
31
31
|
:name => 'Blog sans XSLT',
|
32
|
-
:host => '
|
33
|
-
:port =>
|
32
|
+
:host => '127.0.0.1',
|
33
|
+
:port => 9999,
|
34
34
|
:dispatcher => dispatcher,
|
35
35
|
:db => db
|
36
36
|
)
|
data/examples/og/run.rb
CHANGED
@@ -1,5 +1,30 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# * George Moschovitis <gm@navel.gr>
|
4
|
-
# (c) 2005 Navel, all rights reserved.
|
1
|
+
# Apache configuration file.
|
2
|
+
# Change as appropriate for your apache configuration.
|
5
3
|
# $Id$
|
4
|
+
|
5
|
+
Listen 9999
|
6
|
+
|
7
|
+
PidFile /var/tmp/httpd.pid
|
8
|
+
TypesConfig /etc/mime.types
|
9
|
+
DocumentRoot /home/gmosx/navel/nitro/examples/tiny/root
|
10
|
+
|
11
|
+
# The error log.
|
12
|
+
ErrorLog log/apache.error_log
|
13
|
+
CustomLog log/access_log combined
|
14
|
+
|
15
|
+
# Load dynamic modules.
|
16
|
+
LoadModule fastcgi_module /usr/local/apache2/modules/mod_fastcgi.so
|
17
|
+
# LoadModule rewrite_module /usr/local/apache2/modules/mod_rewrite.so
|
18
|
+
|
19
|
+
FastCgiIpcDir /var/tmp/fcgi
|
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'
|
22
|
+
AddHandler fastcgi-script fcgi rb
|
23
|
+
Options +FollowSymLinks +ExecCGI
|
24
|
+
|
25
|
+
RewriteEngine On
|
26
|
+
RewriteRule ^/([\/\-_a-zA-Z0-9]+)?$ /fcgi.rb [QSA,L]
|
27
|
+
RewriteRule ^/([\/\-_a-zA-Z0-9]+)?\?([\-_a-zA-Z0-9=;&%]*)$ /fcgi.rb?$2 [QSA,L]
|
28
|
+
|
29
|
+
# You can also point these error messages to a controller/action
|
30
|
+
# ErrorDocument 500 /500.html
|
@@ -104,7 +104,7 @@ url.access-deny = ( "~", ".inc" )
|
|
104
104
|
######### Options that are good to be but not neccesary to be changed #######
|
105
105
|
|
106
106
|
## bind to port (default: 80)
|
107
|
-
server.port =
|
107
|
+
server.port = 9999
|
108
108
|
|
109
109
|
## bind to localhost (default: all interfaces)
|
110
110
|
#server.bind = "grisu.home.kneschke.de"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
[Sun Feb 27 14:59:50 2005] [notice] Digest: generating secret for digest authentication ...
|
2
|
+
[Sun Feb 27 14:59:50 2005] [notice] Digest: done
|
3
|
+
[Sun Feb 27 14:59:51 2005] [notice] FastCGI: process manager initialized (pid 4783)
|
4
|
+
[Sun Feb 27 14:59:51 2005] [notice] Apache/2.0.53 (Unix) DAV/2 mod_fastcgi/2.4.2 configured -- resuming normal operations
|
5
|
+
[Sun Feb 27 14:59:52 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/tiny/root/fcgi.rb" started (pid 4789)
|
6
|
+
DEBUG: Rendering '/'.
|
7
|
+
DEBUG: Compiling action 'root/index'
|
8
|
+
DEBUG: Transforming 'root/index.xhtml'
|
9
|
+
DEBUG: Rendering '/include'.
|
10
|
+
DEBUG: Compiling action 'root/include'
|
11
|
+
DEBUG: Transforming 'root/include.xhtml'
|
12
|
+
DEBUG: Rendering '/'.
|
13
|
+
DEBUG: Rendering '/include'.
|
14
|
+
DEBUG: Rendering '/'.
|
15
|
+
DEBUG: Rendering '/include'.
|
16
|
+
DEBUG: Rendering '/'.
|
17
|
+
DEBUG: Rendering '/include'.
|
18
|
+
DEBUG: Rendering '/'.
|
19
|
+
DEBUG: Rendering '/include'.
|
20
|
+
DEBUG: Rendering '/'.
|
21
|
+
DEBUG: Rendering '/include'.
|
22
|
+
DEBUG: Rendering '/'.
|
23
|
+
DEBUG: Rendering '/include'.
|
24
|
+
DEBUG: Rendering '/'.
|
25
|
+
DEBUG: Rendering '/include'.
|
26
|
+
DEBUG: Rendering '/'.
|
27
|
+
DEBUG: Rendering '/include'.
|
28
|
+
DEBUG: Rendering '/'.
|
29
|
+
DEBUG: Rendering '/include'.
|
30
|
+
[Sun Feb 27 15:00:15 2005] [notice] caught SIGTERM, shutting down
|
data/examples/tiny/root/fcgi.rb
CHANGED
data/examples/tiny/run.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: run.rb
|
3
|
+
# $Id: run.rb 266 2005-02-28 14:50:48Z gmosx $
|
4
4
|
|
5
5
|
Dir.chdir File.dirname(__FILE__)
|
6
6
|
|
7
7
|
require 'nitro'
|
8
8
|
|
9
|
-
N::
|
9
|
+
N::Rendering.reload = false
|
10
|
+
N::Runner.run(:host => '127.0.0.1', :port => 9999)
|
data/examples/wee_style/run.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
2
2
|
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: run.rb
|
3
|
+
# $Id: run.rb 266 2005-02-28 14:50:48Z gmosx $
|
4
4
|
|
5
|
-
require 'nitro'
|
5
|
+
require 'nitro'; include N
|
6
6
|
require 'nitro/adapters/webrick'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
class Wee < Controller
|
8
|
+
class Wee < Component
|
11
9
|
|
12
10
|
def index
|
13
11
|
counter = session[:counter] || 0
|
14
12
|
|
15
|
-
|
13
|
+
o.html {
|
16
14
|
o.comment 'This is a comment!'
|
17
15
|
o.h1 'Hello world'
|
18
16
|
o.text 'This is '
|
@@ -22,7 +20,7 @@ class Wee < Controller
|
|
22
20
|
o.br.br
|
23
21
|
o.p "Here is the counter: #{counter}"
|
24
22
|
o.p {
|
25
|
-
o.a('Increase', :href =>
|
23
|
+
o.a('Increase', :href => :inc_counter).text(' the counter.')
|
26
24
|
}
|
27
25
|
o.p '<a href="reset_counter">Reset</a> the counter.'
|
28
26
|
o.hr
|
@@ -42,8 +40,8 @@ class Wee < Controller
|
|
42
40
|
end
|
43
41
|
|
44
42
|
conf = {
|
45
|
-
:host => '
|
46
|
-
:port =>
|
43
|
+
:host => '127.0.0.1',
|
44
|
+
:port => 9999,
|
47
45
|
:dispatcher => Dispatcher.new(Wee)
|
48
46
|
}
|
49
47
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# * George Moschovitis <gm@navel.gr>
|
2
|
+
# $Id: run.rb 267 2005-02-28 14:52:41Z gmosx $
|
3
|
+
|
4
|
+
require 'cgi'
|
5
|
+
require 'redcloth'
|
6
|
+
require 'yaml/store'
|
7
|
+
|
8
|
+
require 'nitro'; include N
|
9
|
+
|
10
|
+
# A simple wiki. A straight conversion of the redhanded.hobix.com
|
11
|
+
# example. Original code by why the lucky stiff.
|
12
|
+
# This is just a cool example, not the preffered way to write
|
13
|
+
# Nitro applications.
|
14
|
+
|
15
|
+
class Wiki < Component
|
16
|
+
HP = 'HomePage'
|
17
|
+
WIKI = YAML::Store.new('wiki.yml')
|
18
|
+
|
19
|
+
def index
|
20
|
+
request['p'] = HP
|
21
|
+
show
|
22
|
+
end
|
23
|
+
|
24
|
+
def show
|
25
|
+
p = request['p'].to_s
|
26
|
+
o.h1(p)
|
27
|
+
o.a(HP, :href => '/') unless p == HP
|
28
|
+
WIKI.transaction do
|
29
|
+
if WIKI[p]
|
30
|
+
o << RedCloth.new(WIKI[p]).to_html.gsub(/([A-Z]\w+){2}/) { "<a href='show?p=#$&'>#$&</a>" }
|
31
|
+
o.a 'Edit', :href => "edit?p=#{p}"
|
32
|
+
else
|
33
|
+
o.p("No page #{p}. ").a('Create?', :href => "edit?p=#{p}")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def edit
|
39
|
+
p = request['p'].to_s
|
40
|
+
if c = request['c']
|
41
|
+
WIKI.transaction { WIKI[p] = c.to_s }
|
42
|
+
redirect "show?p=#{p}"
|
43
|
+
end
|
44
|
+
WIKI.transaction do
|
45
|
+
o.h1 "Editing #{p}"
|
46
|
+
o.a('Show', :href => "show?p=#{p}").br.br
|
47
|
+
o.form(:method => 'post') {
|
48
|
+
o.input :type => 'hidden', :name => 'p', :value => p
|
49
|
+
o.textarea WIKI[p].to_s, :name => 'c', :style => 'width: 90%; height: 200px'
|
50
|
+
o.br.br.submit
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
require 'nitro/adapters/webrick'
|
57
|
+
Webrick.start(:dispatcher => Dispatcher.new(Wiki))
|
data/examples/wiki.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--- {}
|
data/lib/glue/array.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# * George Moschovitis <gm@navel.gr>
|
2
2
|
# (c) 2002-2005 Navel, all rights reserved.
|
3
|
-
# $Id: array.rb
|
3
|
+
# $Id: array.rb 266 2005-02-28 14:50:48Z gmosx $
|
4
4
|
|
5
5
|
require 'sync'
|
6
6
|
|
7
7
|
module N
|
8
8
|
|
9
|
-
# A thread-safe array. We use a sync object instead of a
|
10
|
-
# because it is re-entrant.
|
11
|
-
#
|
12
|
-
# when reading
|
9
|
+
# A thread-safe array. We use a sync object instead of a
|
10
|
+
# mutex, because it is re-entrant. An exclusive lock is
|
11
|
+
# needed when writing, a shared lock IS NEEDED when reading.
|
13
12
|
|
14
13
|
class SafeArray < Array
|
15
14
|
|
@@ -18,61 +17,43 @@ class SafeArray < Array
|
|
18
17
|
# gmosx: delegator is not used.
|
19
18
|
|
20
19
|
def initialize(delegator = nil)
|
21
|
-
@sync =
|
20
|
+
@sync = Sync.new()
|
22
21
|
end
|
23
22
|
|
24
23
|
def << (value)
|
25
|
-
return @sync.synchronize(
|
26
|
-
super
|
27
|
-
}
|
24
|
+
return @sync.synchronize(Sync::SH) { super }
|
28
25
|
end
|
29
26
|
|
30
27
|
def delete_if(&block)
|
31
|
-
return @sync.synchronize(
|
32
|
-
super
|
33
|
-
}
|
28
|
+
return @sync.synchronize(Sync::SH) { super }
|
34
29
|
end
|
35
30
|
|
36
31
|
def [](key)
|
37
|
-
return @sync.synchronize(
|
38
|
-
super
|
39
|
-
}
|
32
|
+
return @sync.synchronize(Sync::SH) { super }
|
40
33
|
end
|
41
34
|
|
42
35
|
def []=(key, value)
|
43
|
-
return @sync.synchronize(
|
44
|
-
super
|
45
|
-
}
|
36
|
+
return @sync.synchronize(Sync::EX) { super }
|
46
37
|
end
|
47
38
|
|
48
39
|
def delete(key)
|
49
|
-
return @sync.synchronize(
|
50
|
-
super
|
51
|
-
}
|
40
|
+
return @sync.synchronize(Sync::EX) { super }
|
52
41
|
end
|
53
42
|
|
54
43
|
def clear
|
55
|
-
@sync.synchronize(
|
56
|
-
super
|
57
|
-
}
|
44
|
+
@sync.synchronize(Sync::EX) { super }
|
58
45
|
end
|
59
46
|
|
60
47
|
def size
|
61
|
-
return @sync.synchronize(
|
62
|
-
super
|
63
|
-
}
|
48
|
+
return @sync.synchronize(Sync::SH) { super }
|
64
49
|
end
|
65
50
|
|
66
51
|
def shift
|
67
|
-
return @sync.synchronize(::Sync::EX) {
|
68
|
-
super
|
69
|
-
}
|
52
|
+
return @sync.synchronize(::Sync::EX) { super }
|
70
53
|
end
|
71
54
|
|
72
55
|
def unshift(el)
|
73
|
-
return @sync.synchronize(::Sync::EX) {
|
74
|
-
super
|
75
|
-
}
|
56
|
+
return @sync.synchronize(::Sync::EX) { super }
|
76
57
|
end
|
77
58
|
|
78
59
|
end
|