nitro 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. data/AUTHORS +8 -0
  2. data/ChangeLog +1546 -0
  3. data/LICENCE +32 -0
  4. data/README +278 -0
  5. data/RELEASES +7 -0
  6. data/Rakefile +79 -0
  7. data/bin/cluster.rb +219 -0
  8. data/doc/architecture.txt +28 -0
  9. data/doc/bugs.txt +7 -0
  10. data/doc/css.txt +20 -0
  11. data/doc/ideas.txt +120 -0
  12. data/doc/pg.txt +47 -0
  13. data/doc/svn.txt +82 -0
  14. data/doc/todo.txt +30 -0
  15. data/etc/new-project.rb +18 -0
  16. data/examples/simple/README +15 -0
  17. data/examples/simple/app.rb +31 -0
  18. data/examples/simple/conf/apache.conf +100 -0
  19. data/examples/simple/conf/config.rb +89 -0
  20. data/examples/simple/conf/debug-config.rb +53 -0
  21. data/examples/simple/conf/live-config.rb +48 -0
  22. data/examples/simple/conf/overrides.rb +9 -0
  23. data/examples/simple/conf/requires.rb +51 -0
  24. data/examples/simple/ctl +32 -0
  25. data/examples/simple/env.rb +33 -0
  26. data/examples/simple/install.rb +12 -0
  27. data/examples/simple/lib/articles/entities.rb +35 -0
  28. data/examples/simple/lib/articles/lc-en.rb +36 -0
  29. data/examples/simple/lib/articles/methods.rb +55 -0
  30. data/examples/simple/lib/articles/part.rb +58 -0
  31. data/examples/simple/logs/access_log +2 -0
  32. data/examples/simple/logs/apache.log +3 -0
  33. data/examples/simple/logs/app.log +1 -0
  34. data/examples/simple/logs/events.log +1 -0
  35. data/examples/simple/root/add-article.sx +15 -0
  36. data/examples/simple/root/article-form.ss +20 -0
  37. data/examples/simple/root/comments-form.ss +16 -0
  38. data/examples/simple/root/comments.si +30 -0
  39. data/examples/simple/root/index.sx +44 -0
  40. data/examples/simple/root/shader/shader.xsl +100 -0
  41. data/examples/simple/root/shader/style.css +9 -0
  42. data/examples/simple/root/view-article.sx +30 -0
  43. data/examples/tiny/app.rb +30 -0
  44. data/examples/tiny/conf/apache.conf +100 -0
  45. data/examples/tiny/conf/config.rb +67 -0
  46. data/examples/tiny/conf/requires.rb +40 -0
  47. data/examples/tiny/ctl +31 -0
  48. data/examples/tiny/logs/access_log +9 -0
  49. data/examples/tiny/logs/apache.log +9 -0
  50. data/examples/tiny/root/index.sx +35 -0
  51. data/lib/n/app/cluster.rb +219 -0
  52. data/lib/n/app/cookie.rb +86 -0
  53. data/lib/n/app/filters/autologin.rb +50 -0
  54. data/lib/n/app/fragment.rb +67 -0
  55. data/lib/n/app/handlers.rb +120 -0
  56. data/lib/n/app/handlers/code-handler.rb +184 -0
  57. data/lib/n/app/handlers/page-handler.rb +612 -0
  58. data/lib/n/app/request-part.rb +59 -0
  59. data/lib/n/app/request.rb +653 -0
  60. data/lib/n/app/script.rb +398 -0
  61. data/lib/n/app/server.rb +53 -0
  62. data/lib/n/app/session.rb +224 -0
  63. data/lib/n/app/user.rb +47 -0
  64. data/lib/n/app/webrick-servlet.rb +213 -0
  65. data/lib/n/app/webrick.rb +70 -0
  66. data/lib/n/application.rb +187 -0
  67. data/lib/n/config.rb +31 -0
  68. data/lib/n/db.rb +217 -0
  69. data/lib/n/db/README +232 -0
  70. data/lib/n/db/connection.rb +369 -0
  71. data/lib/n/db/make-release.sh +26 -0
  72. data/lib/n/db/managed.rb +235 -0
  73. data/lib/n/db/mixins.rb +282 -0
  74. data/lib/n/db/mysql.rb +342 -0
  75. data/lib/n/db/psql.rb +378 -0
  76. data/lib/n/db/tools.rb +110 -0
  77. data/lib/n/db/utils.rb +99 -0
  78. data/lib/n/events.rb +118 -0
  79. data/lib/n/l10n.rb +22 -0
  80. data/lib/n/logger.rb +33 -0
  81. data/lib/n/macros.rb +53 -0
  82. data/lib/n/mixins.rb +46 -0
  83. data/lib/n/parts.rb +154 -0
  84. data/lib/n/properties.rb +194 -0
  85. data/lib/n/server.rb +61 -0
  86. data/lib/n/server/PLAYBACK.txt +8 -0
  87. data/lib/n/server/RESEARCH.txt +13 -0
  88. data/lib/n/server/filter.rb +77 -0
  89. data/lib/n/shaders.rb +167 -0
  90. data/lib/n/sitemap.rb +188 -0
  91. data/lib/n/std.rb +69 -0
  92. data/lib/n/sync/clc.rb +108 -0
  93. data/lib/n/sync/handler.rb +221 -0
  94. data/lib/n/sync/server.rb +170 -0
  95. data/lib/n/tools/README +11 -0
  96. data/lib/n/ui/date-select.rb +74 -0
  97. data/lib/n/ui/pager.rb +187 -0
  98. data/lib/n/ui/popup.rb +45 -0
  99. data/lib/n/ui/select.rb +41 -0
  100. data/lib/n/ui/tabs.rb +34 -0
  101. data/lib/n/utils/array.rb +92 -0
  102. data/lib/n/utils/cache.rb +144 -0
  103. data/lib/n/utils/gfx.rb +108 -0
  104. data/lib/n/utils/hash.rb +148 -0
  105. data/lib/n/utils/html.rb +147 -0
  106. data/lib/n/utils/http.rb +98 -0
  107. data/lib/n/utils/mail.rb +28 -0
  108. data/lib/n/utils/number.rb +31 -0
  109. data/lib/n/utils/pool.rb +66 -0
  110. data/lib/n/utils/string.rb +297 -0
  111. data/lib/n/utils/template.rb +38 -0
  112. data/lib/n/utils/time.rb +91 -0
  113. data/lib/n/utils/uri.rb +193 -0
  114. data/lib/xsl/base.xsl +205 -0
  115. data/lib/xsl/ce.xsl +30 -0
  116. data/lib/xsl/localization.xsl +23 -0
  117. data/lib/xsl/xforms.xsl +26 -0
  118. data/test/run.rb +95 -0
  119. metadata +187 -0
@@ -0,0 +1,28 @@
1
+
2
+
3
+
4
+ Client:
5
+ Web Browsers, Mobile Phones, PDA, TV
6
+
7
+ HttpServer:
8
+ handles .html, .gif/.jpg/.png, .css, .js, .swf, .ssi
9
+ no loging, tuned for maximum performance, clustered
10
+
11
+ AppServer:
12
+ handles dynamic pages, controller / actions (.sx, .si, .ss, .sc)
13
+ loging, clustered
14
+
15
+ Cluster:
16
+ make distributed by hash! (all servers have access to all stateservers)
17
+ and multiplex access.
18
+
19
+ SyncServer:
20
+ multiple servers for multiple services
21
+
22
+ DBServer:
23
+ Database
24
+ Clustered (rdbms)
25
+
26
+ DNSServer:
27
+ Provides dns services, initial clustering support.
28
+ (inherently clustered)
@@ -0,0 +1,7 @@
1
+
2
+ IMPORTANT:
3
+
4
+ SMALL:
5
+
6
+ - the script filenames contain '//' path should not contain
7
+ leading '/' ??
@@ -0,0 +1,20 @@
1
+ Center a page:
2
+ --------------
3
+
4
+ 1>
5
+ .parent {
6
+ text-align: center;
7
+ }
8
+
9
+ .child {
10
+ width: 800px;
11
+ margin: auto;
12
+ }
13
+
14
+ 2>
15
+ .child {
16
+ width: 800px;
17
+ position: relative;
18
+ left: 50%;
19
+ margin-left: -(800/2)px;
20
+ }
@@ -0,0 +1,120 @@
1
+ Names:
2
+ ------
3
+
4
+ Nitro
5
+ Cell
6
+ Plasma
7
+ Root
8
+ Surrender
9
+
10
+ Services
11
+ --------
12
+
13
+ + api / rpc
14
+ + feeds
15
+
16
+ Pickaxe
17
+ -------
18
+
19
+ #-- : stops RDoc comment.
20
+ :include: file
21
+ gem install -r rake
22
+
23
+ General
24
+ -------
25
+
26
+ + use hashes/yaml for configuration (so they can be editable from a
27
+ web interface). Or even marshal dump them to the db.
28
+ + use P prefix for part classes. (infamous File problem).
29
+ + enable cache should be default.
30
+ + dependencies in parts.
31
+ + env.rb -> .irbrc
32
+ + add a check for nested db invocations.
33
+ + geoloc part.
34
+ + xpath->sql translator.
35
+ + keep old values in form when updating (transaction checks).
36
+ + use xsltproc x:include
37
+ + use ruby/extensions.
38
+ + MEGA: use ostruct for db non serialized access.
39
+ + auto-box .ss/.si files.
40
+ + something like phpinfo.
41
+ + have banned user names.
42
+ + somehow use templates for .ss stuff to avoid the .sx
43
+ + convert to greeklish when searching has an interesting side effect.
44
+ + remove non-hash/utility methods from request (to simplify the code
45
+ and make more compatible with irb).
46
+ + use closures to implement filters.
47
+ + mute.
48
+ + irb.login returns request (and session).
49
+ + request[:USER]
50
+ + change log format.
51
+ + run the app from a special user inherit the root directory.
52
+ + index.sx like ruby require !!!
53
+ + use Ruby/DL for libxml/libxslt and if it is as efficient for psql.
54
+ + dont use $vars due to nasty ruby handling!
55
+ + use one cookie for nsid/nauth
56
+ + _ prefix for sql tables to be more safe.
57
+ + __ -> _
58
+ + Trash with marshaled objects.
59
+ + use those cool tooltips from the js library.
60
+ + __pre_render ? or rename __init?
61
+ + expires needed as well as lm ?
62
+ + try to NOT create sessions when calculating etag.
63
+ + do NOT use threads, very risky! -> NO, i AM risky :)
64
+
65
+ Messages
66
+ --------
67
+
68
+ yahoo:
69
+
70
+ + send audibles/avatars (flash based).
71
+
72
+ Fora
73
+ ----
74
+
75
+ + css export (generalized should parse categories)
76
+ + show related threads (how calc? --> tags?)
77
+
78
+ mad:
79
+
80
+ + see recent messages 24, 48, 7 h
81
+
82
+ from yahoo:
83
+
84
+ + report abuse.
85
+ + ignore filter / profanity.
86
+ + threaded titles.
87
+ + go to message id.
88
+
89
+
90
+ Polls
91
+ -----
92
+
93
+ + sort poll results by votes !! (da)
94
+
95
+
96
+ Ad Management
97
+ --------------
98
+ + ad management should be centralized, not per page, just overrides.
99
+
100
+
101
+ App Server
102
+ ----------
103
+
104
+ + sitemap should autocalculate which part a given page belongs
105
+ (context sensitive search).
106
+ + use one object (io ??) instead of request/response.
107
+ + pre-compress css files.
108
+
109
+
110
+
111
+
112
+
113
+ DONE:
114
+ =====
115
+
116
+ + [rails] Enviroroments, allows scripts and debugging with irb.
117
+ + .tc-xxxx.rb for unit tests!
118
+ + dont allow special chars in user names (esp ':')
119
+ + push model for DRB synchronization to avoid excessive drb calls.
120
+
@@ -0,0 +1,47 @@
1
+
2
+ PostgreSQL Tips
3
+ ===============
4
+
5
+
6
+ * Quicky connect to a database 'foo' using
7
+ the interactive shell:
8
+
9
+ [elathan@velka elathan]$ psql foo -U postgres
10
+
11
+ Use '\d' to show the tables after the connection.
12
+
13
+
14
+ * Execute an SQL command via psql:
15
+
16
+ joy=# SELECT * FROM r_forum;
17
+
18
+ Keep in mind that you have to use uppercase for SQL commands
19
+ and don't forget the trailing ';'.
20
+
21
+
22
+ * Create a new database called 'foo':
23
+
24
+ [elathan@velka elathan]$ createdb foo -U postgres
25
+ CREATE DATABASE
26
+
27
+
28
+ * Dump 'foo' database to 'dump.out':
29
+
30
+ [elathan@velka elathan]$ pg_dump -U postgres -db foo -Fc > dump.out
31
+
32
+ '-Fc' is the output format. From the docs:
33
+
34
+ 'The most flexible output file format is the "custom" format (-Fc).
35
+ It allows for selection and reordering of all archived items, and is
36
+ compressed by default.'
37
+
38
+ * Drop database called foo:
39
+
40
+ [elathan@velka elathan]$ dropdb joy -U postgres
41
+
42
+
43
+ * Restore foo using dump.out
44
+
45
+ [elathan@velka elathan]$ pg_restore foo.out -d joy -U postgres
46
+
47
+
@@ -0,0 +1,82 @@
1
+ elathan:
2
+
3
+ Navel SVN Server: http://morfeas.navel.gr/
4
+ Central Repository: navel
5
+
6
+ FOR COMMITS: Don't forget to set up SVN_EDITOR:
7
+ export SVN_EDITOR=vim
8
+
9
+ Some Tips for the SubVersion System
10
+
11
+ 1. Install a server
12
+
13
+ [elathan@velka elathan]$ cat /etc/services | grep svn
14
+ svn 3690/tcp # Subversion
15
+ svn 3690/udp # Subversion
16
+
17
+ For xinetd-based systems:
18
+
19
+ [elathan@velka elathan]$ cat /etc/xinetd.d/svn
20
+
21
+ service svn
22
+ {
23
+ disable = no
24
+ socket_type = stream
25
+ wait = no
26
+ port = 3690
27
+ protocol = tcp
28
+ user = svn
29
+ server = /usr/local/bin/svnserve
30
+ server_args = -i -r /home/svn/
31
+ }
32
+
33
+ For inetd-based systems:
34
+
35
+ elathan@morfeas:~> cat /etc/inetd.conf | grep svn
36
+ svn stream tcp nowait svn /usr/local/bin/svnserve svnserve -i -r /home/svn
37
+
38
+ In all the above the creation of a user 'svn' is implied. Also, all
39
+ the repositories will be created under his home directory.
40
+
41
+ 2. Create a repository
42
+
43
+ % svnadmin create /home/svn/navel
44
+
45
+ 3. Checking Out
46
+
47
+ [elathan@velka navel]$ svn checkout svn://morfeas.navel.gr/navel
48
+
49
+ svn://morfeas.navel.gr is the SVN Server.
50
+ navel is the repository
51
+
52
+ 4. Updating
53
+
54
+ svn update
55
+
56
+ 5. Adding
57
+
58
+ svn add foo
59
+
60
+ 6. Committing
61
+
62
+ svn commit foo
63
+
64
+ 7. Seeing the changes
65
+
66
+ svn status [--verbose]
67
+
68
+ 8. Id tag use
69
+
70
+ Put these in your .subversion/config:
71
+
72
+ [miscellany]
73
+ enable-auto-props = yes
74
+
75
+ [auto-props]
76
+ *.rb = svn:keywords=Id
77
+ *.rx = svn:keywords=Id
78
+ *.sx = svn:keywords=Id
79
+ *.si = svn:keywords=Id
80
+ *.ss = svn:keywords=Id
81
+ *.xsl = svn:keywords=Id
82
+ *.css = svn:keywords=Id
@@ -0,0 +1,30 @@
1
+
2
+ beutify:
3
+
4
+ - better solution than initialize(*args)
5
+
6
+ db:
7
+
8
+ - support N::Entity.db_get(oid).
9
+
10
+ features:
11
+
12
+ - synchronizable
13
+
14
+ client:
15
+
16
+ - handle checkboxes
17
+
18
+ research:
19
+
20
+ - template system like amrita (more portable through langs)
21
+
22
+
23
+ optimization:
24
+
25
+ - custom webserver instead of webrick, only for .sx/.rx
26
+
27
+
28
+ debugging:
29
+
30
+ - debug part
@@ -0,0 +1,18 @@
1
+ # = New Project Wizzard
2
+ #
3
+ # Creates the directory structure for a new project.
4
+ #
5
+ #--
6
+ # code:
7
+ # George Moschovitis <gm@navel.gr>
8
+ #
9
+ # (c) 2004 Navel, all rights reserved.
10
+ # $Id: new-project.rb 86 2004-10-19 13:58:40Z gmosx $
11
+ #++
12
+
13
+ base_dir = ARGV[0]
14
+
15
+ %x{
16
+ mkdir root;
17
+ }
18
+
@@ -0,0 +1,15 @@
1
+ = A Simple Web Application
2
+
3
+ == Setup
4
+
5
+ To setup this example web application run the follwing script:
6
+
7
+ $ ruby install.rb
8
+
9
+ To start the application
10
+
11
+ ./ctl start
12
+
13
+ To stop the application
14
+
15
+ ./ctl stop
@@ -0,0 +1,31 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ # = Simple Example
4
+ #
5
+ # A simple Web Application to demonstrate the Engine.
6
+ #
7
+ # code:
8
+ # George Moschovitis <gm@navel.gr>
9
+ #
10
+ # (c) 2004 Navel, all rights reserved.
11
+ # $Id: app.rb 87 2004-10-19 17:27:45Z gmosx $
12
+
13
+ $:.unshift "simple/lib"
14
+ $:.unshift "../lib"
15
+
16
+ # Set this to false to optimize for speed.
17
+ $DBG = true
18
+ $DBG ? (require "simple/conf/debug-config") : (require "simple/conf/live-config")
19
+
20
+ require "n/app/webrick"
21
+
22
+ module App
23
+
24
+ class Server < N::App::Webrick
25
+ include App::Config
26
+ end
27
+
28
+ end # module
29
+
30
+ $app = App::Server.new.exec()
31
+
@@ -0,0 +1,100 @@
1
+ # Apache proxy configuration
2
+ # code: gmosx, drak, elathan, ekarak
3
+
4
+ # gmosx: FIXME (optimize this!)
5
+ LoadModule access_module /usr/lib/httpd/modules/mod_access.so
6
+ LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so
7
+ LoadModule mime_magic_module /usr/lib/httpd/modules/mod_mime_magic.so
8
+ LoadModule expires_module /usr/lib/httpd/modules/mod_expires.so
9
+ LoadModule headers_module /usr/lib/httpd/modules/mod_headers.so
10
+ LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so
11
+ LoadModule status_module /usr/lib/httpd/modules/mod_status.so
12
+ LoadModule autoindex_module /usr/lib/httpd/modules/mod_autoindex.so
13
+ LoadModule vhost_alias_module /usr/lib/httpd/modules/mod_vhost_alias.so
14
+ LoadModule dir_module /usr/lib/httpd/modules/mod_dir.so
15
+ LoadModule alias_module /usr/lib/httpd/modules/mod_alias.so
16
+ LoadModule rewrite_module /usr/lib/httpd/modules/mod_rewrite.so
17
+ LoadModule proxy_module /usr/lib/httpd/modules/mod_proxy.so
18
+ LoadModule proxy_http_module /usr/lib/httpd/modules/mod_proxy_http.so
19
+ LoadModule proxy_connect_module /usr/lib/httpd/modules/mod_proxy_connect.so
20
+ LoadModule cgi_module /usr/lib/httpd/modules/mod_cgi.so
21
+
22
+ Listen 8080
23
+
24
+ User navel
25
+ Group users
26
+
27
+ PidFile /tmp/simple-apache.pid
28
+ ErrorLog logs/apache.log
29
+ LogLevel warn
30
+
31
+ # used for debuging
32
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
33
+ LogFormat "%h %l %u %t \"%r\" %>s %b" common
34
+ CustomLog logs/access_log common
35
+
36
+ Timeout 300
37
+
38
+ # Keepalive
39
+
40
+ KeepAlive On
41
+ MaxKeepAliveRequests 64
42
+ KeepAliveTimeout 5
43
+
44
+ ServerTokens Off
45
+ ServerSignature Off
46
+ ExtendedStatus Off
47
+
48
+ UseCanonicalName Off
49
+ HostnameLookups Off
50
+
51
+ #DirectoryIndex index.sx
52
+
53
+ TypesConfig /etc/mime.types
54
+ DefaultType text/plain
55
+
56
+ MIMEMagicFile /etc/httpd/conf/magic
57
+
58
+ IndexOptions None
59
+
60
+ AddEncoding x-compress Z
61
+ AddEncoding x-gzip gz tgz
62
+ AddType application/x-tar .tgz
63
+ AddType image/x-icon .ico
64
+ AddType text/css .css # gmosx: needed! fixes a bug!
65
+
66
+ AddLanguage en .en
67
+ AddLanguage el .el
68
+
69
+ AddDefaultCharset ISO-8859-7
70
+
71
+ AddCharset ISO-8859-1 .iso8859-1 .latin1
72
+ AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk
73
+ AddCharset UTF-8 .utf8
74
+
75
+ # enable expirations
76
+
77
+ ExpiresActive On
78
+
79
+ # expire GIF images after a month in the client's cache
80
+ ExpiresByType image/gif A2592000
81
+ ExpiresByType image/jpg A2592000
82
+ ExpiresByType image/bmp A2592000
83
+
84
+ ExpiresByType text/css A2592000
85
+ ExpiresByType text/javascript A2592000
86
+
87
+ # prefork MPM
88
+ StartServers 5
89
+ MinSpareServers 1
90
+ MaxSpareServers 7
91
+ MaxClients 50
92
+ MaxRequestsPerChild 10000
93
+
94
+ DocumentRoot "/navel/nitro/examples/simple/root"
95
+
96
+ RewriteEngine on
97
+
98
+ RewriteRule ^/(.*[sr][bix])$ http://127.0.0.1:9090/$1 [P]
99
+ RewriteRule ^(.*)/$ http://127.0.0.1:9090$1/index.sx [P]
100
+ RewriteRule ^/([^\.]*)$ http://127.0.0.1:9090/$1/index.sx [P]