nitro 0.9.5 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/ChangeLog +260 -0
  2. data/INSTALL +60 -0
  3. data/LICENSE +1 -0
  4. data/README +19 -20
  5. data/RELEASES +48 -0
  6. data/Rakefile +102 -92
  7. data/benchmark/og/bench.rb +74 -0
  8. data/benchmark/og/sqlite-no-prepare.1.txt +13 -0
  9. data/benchmark/og/sqlite-no-prepare.2.txt +13 -0
  10. data/benchmark/og/sqlite-prepare.1.txt +13 -0
  11. data/benchmark/og/sqlite-prepare.2.txt +13 -0
  12. data/bin/cluster +1 -1
  13. data/bin/nitro +3 -0
  14. data/bin/proto/conf/app.conf.rb +2 -10
  15. data/examples/README.windows +9 -0
  16. data/examples/blog/README +16 -4
  17. data/examples/blog/lib/blog.rb +3 -3
  18. data/examples/blog/lib/blog/controller.rb +7 -9
  19. data/examples/blog/root/fcgi.rb +2 -4
  20. data/examples/blog/root/style.xsl +4 -6
  21. data/examples/blog/run.rb +41 -0
  22. data/examples/flash/run.rb +9 -0
  23. data/examples/no_xsl_blog/README +0 -1
  24. data/examples/no_xsl_blog/conf/app.conf.rb +6 -13
  25. data/examples/no_xsl_blog/lib/blog.rb +2 -2
  26. data/examples/no_xsl_blog/lib/blog/controller.rb +6 -6
  27. data/examples/no_xsl_blog/root/fcgi.rb +2 -4
  28. data/examples/no_xsl_blog/run.rb +38 -0
  29. data/examples/og/mock_example.rb +0 -2
  30. data/examples/og/mysql_to_psql.rb +0 -2
  31. data/examples/og/run.rb +23 -22
  32. data/examples/tiny/root/fcgi.rb +2 -4
  33. data/examples/tiny/root/index.xhtml +21 -5
  34. data/examples/tiny/root/upload.xhtml +23 -0
  35. data/examples/tiny/run.rb +9 -0
  36. data/examples/wee_style/{wee.rb → run.rb} +13 -13
  37. data/install.rb +44 -0
  38. data/lib/glue/array.rb +6 -10
  39. data/lib/glue/attribute.rb +0 -3
  40. data/lib/glue/cache.rb +1 -1
  41. data/lib/glue/inflector.rb +5 -5
  42. data/lib/glue/mixins.rb +3 -12
  43. data/lib/glue/number.rb +1 -1
  44. data/lib/glue/object.rb +7 -1
  45. data/lib/glue/property.rb +32 -22
  46. data/lib/glue/string.rb +13 -75
  47. data/lib/glue/time.rb +2 -2
  48. data/lib/glue/validation.rb +7 -11
  49. data/lib/nitro.rb +16 -1
  50. data/lib/nitro/{adaptors → adapters}/cgi.rb +101 -20
  51. data/lib/nitro/{adaptors → adapters}/fastcgi.rb +3 -2
  52. data/lib/nitro/{adaptors → adapters}/webrick.rb +4 -4
  53. data/lib/nitro/builders/rss.rb +1 -1
  54. data/lib/nitro/builders/xml.rb +8 -10
  55. data/lib/nitro/cluster.rb +1 -1
  56. data/lib/nitro/conf.rb +34 -0
  57. data/lib/nitro/controller.rb +8 -9
  58. data/lib/nitro/dispatcher.rb +38 -11
  59. data/lib/nitro/filters.rb +1 -1
  60. data/lib/nitro/markup.rb +14 -1
  61. data/lib/nitro/render.rb +7 -10
  62. data/lib/nitro/runner.rb +232 -0
  63. data/lib/nitro/ui/pager.rb +2 -6
  64. data/lib/nitro/uri.rb +7 -11
  65. data/lib/og.rb +27 -261
  66. data/lib/og/adapter.rb +352 -0
  67. data/lib/og/adapters/mysql.rb +304 -0
  68. data/lib/og/adapters/psql.rb +286 -0
  69. data/lib/og/adapters/sqlite.rb +262 -0
  70. data/lib/og/backend.rb +1 -1
  71. data/lib/og/connection.rb +123 -87
  72. data/lib/og/database.rb +268 -0
  73. data/lib/og/meta.rb +23 -22
  74. data/lib/og/mock.rb +2 -3
  75. data/lib/xsl/base.xsl +1 -55
  76. data/test/glue/tc_property.rb +2 -0
  77. data/test/glue/tc_property_type_checking.rb +32 -0
  78. data/test/glue/tc_strings.rb +2 -2
  79. data/test/glue/tc_validation.rb +2 -0
  80. data/test/nitro/adapters/raw_post1.bin +0 -0
  81. data/test/nitro/{adaptors → adapters}/tc_cgi.rb +11 -2
  82. data/test/nitro/{adaptors → adapters}/tc_webrick.rb +3 -3
  83. data/test/nitro/builders/tc_xml.rb +14 -5
  84. data/test/nitro/tc_dispatcher.rb +3 -3
  85. data/test/nitro/tc_uri.rb +2 -4
  86. data/test/og/tc_lifecycle.rb +22 -25
  87. data/test/og/tc_sqlite.rb +87 -0
  88. data/test/tc_og.rb +61 -42
  89. metadata +67 -33
  90. data/examples/blog/conf/app.conf.rb +0 -52
  91. data/examples/blog/ctl +0 -4
  92. data/examples/flash/conf/app.conf.rb +0 -21
  93. data/examples/flash/ctl +0 -4
  94. data/examples/no_xsl_blog/conf/apache.conf +0 -0
  95. data/examples/no_xsl_blog/ctl +0 -4
  96. data/examples/tiny/conf/app.conf.rb +0 -17
  97. data/examples/tiny/ctl +0 -4
  98. data/lib/glue/macro.rb +0 -56
  99. data/lib/nitro/adaptors/runner.rb +0 -123
  100. data/lib/nitro/version.rb +0 -15
  101. data/lib/og/backends/mysql.rb +0 -370
  102. data/lib/og/backends/psql.rb +0 -386
  103. data/lib/og/backends/sqlite.rb +0 -383
  104. data/lib/og/version.rb +0 -9
data/ChangeLog CHANGED
@@ -1,6 +1,266 @@
1
+ 15-02-2005 George Moschovitis <gm@navel.gr>
2
+
3
+ * INSTALL: added some text for manual installation.
4
+
5
+ * examples/no_xsl_blog/*: misc fixes.
6
+
7
+ * lib/nitro/dispatcher.rb (#dispatch): pass context to fix reload bug.
8
+
9
+ * examples/og/run.rb: updated.
10
+
11
+ * lib/og/meta.rb (#many_to_many): fixed bug.
12
+
13
+ * lib/nitro/controller.rb: introduced simple controller to protect
14
+ the base controller.
15
+
16
+ * lib/nitro/runner.rb (#run): call setup_debug/stage/live,
17
+ more fixes in setup.
18
+
19
+ * Rakefile: added flexmock dependency,
20
+ removed database dependencies (RubyGems is too picky),
21
+ added install.rb in distribution.
22
+
23
+ * test/: fixed some type_checking bugs.
24
+
25
+ * lib/glue/property.rb: type_checking = false by default.
26
+
27
+ * test/nitro/adapters: renamed from adaptors.
28
+
29
+ 14-02-2005 George Moschovitis <gm@navel.gr>
30
+
31
+ * lib/og.rb: require validation.
32
+
33
+ * lib/nitro.rb: require runner.
34
+
35
+ * lib/nitro/runner.rb: moved from adapters,
36
+ (self.run): added helper.
37
+ split setup in many methods to allow for overrides.
38
+
39
+ * examples/no_xsl_blog: converted.
40
+
41
+ * lib/nitro/render.rb: use @request as alias to @context.
42
+
43
+ * lib/nitro/builders/xml.rb: handle single tags like
44
+ <br/>, <hr/> etc.
45
+
46
+ * examples/wee_style/run.rb: converted,
47
+ cleaned up programmatic code.
48
+
49
+ * examples/flash: converted.
50
+
51
+ * examples/tiny: converted.
52
+
53
+ * README: updated.
54
+
55
+ * examples/README.windows: added.
56
+
57
+ * examples/: updated docs.
58
+
59
+ * lib/nitro/adapters/runner.rb: more comments,
60
+ (#run): accept hash as conf,
61
+ converted methods to non static,
62
+ (#setup): implemented,
63
+ fixed version printing,
64
+ use ENV to pass invoke methods,
65
+ ULTRA COOL: --console parameter works again.
66
+
67
+ * I love Stella (asteraki) :)
68
+
69
+ 13-02-2005 George Moschovitis <gm@navel.gr>
70
+
71
+ * lib/nitro/adapters/runner.rb: improved,
72
+ added fcgi_proc action.
73
+
74
+ * examples/blog/run.rb: introduced, runnable from everywhere.
75
+
76
+ * lib/nitro/conf.rb: introduced, default configuration paramters.
77
+
78
+ * changed base dir in applications, to be runnuble from
79
+ everywhere.
80
+
81
+ 12-02-2005 George Moschovitis <gm@navel.gr>
82
+
83
+ * INSTALL: updated.
84
+
85
+ * install.rb: implemented, refined.
86
+
87
+ * updated all example confg files.
88
+
89
+ * Introduced the 'tml' nick in the docs. :)
90
+
91
+ * README: updated.
92
+
93
+ * README.og: updated.
94
+
95
+ * lib/xsl/base.xsl: removed old tags.
96
+
97
+ * lib/glue/string.rb (#to_greeklish): removed,
98
+ (#screen_ip_address): removed.
99
+
100
+ * lib/glue/macro.rb: deprecated.
101
+
102
+ * Many fixes to many files to improve the generated RDoc
103
+ documentation.
104
+
105
+ * lib/nitro/controller.rb (#inherited): fixed caller index.
106
+
107
+ * YEAH, using a RUBYOPT trick I can develop my rubygems.
108
+
109
+ * lib/nitro/dispatcher.rb (#dispatch): beutify, added comments,
110
+ (#controller_class_for): implemented, allows for autoreloading
111
+ of controllers,
112
+ dispatcher[:index] -> dispatcher[:root], this is a better (less
113
+ confusing) name.
114
+
115
+ * small fix in ctl's.
116
+
117
+ * lib/nitro/adapters/runner.rb: added --filelog option,
118
+ some fixes,
119
+ execution modes, better handling of Rendering.reload.
120
+
121
+ 11-02-2005 George Moschovitis <gm@navel.gr>
122
+
123
+ * lib/og/adapters/sqlite.rb: added missing res.close,
124
+ use more queries to avoid array creations.
125
+
126
+ * lib/nitro/adapters/*: renamed from adaptors.
127
+
128
+ * test/tc_og.rb: added test for override db.
129
+
130
+ * lib/og/adapters/*: dont use entity,
131
+ (#calc_field_index): ensure res.close in
132
+ (#create_table): use conn.store to avoid catching the errors.
133
+
134
+ * lib/og/adapters/mysql.rb: reintroduced,
135
+ SOS: use res.free in MysqlAdapter,
136
+ set_query_with_result,
137
+ passes tests.
138
+
139
+ 10-02-2005 George Moschovitis <gm@navel.gr>
140
+
141
+ * bin/proto/conf/app.conf.rb: updated.
142
+
143
+ * Yeah, nitro/og is in the path now, no need for File.join tricks.
144
+
145
+ * Rakefile: recoded/simplified.
146
+
147
+ * bin/nitro: introduced.
148
+
149
+ * nitro.gemspec: introduced,
150
+ cleaned up, add full dependencies.
151
+
152
+ 09-02-2005 George Moschovitis <gm@navel.gr>
153
+
154
+ * lib/og/adapters/psql.rb: reintroduced,
155
+ use serial to make more compatible with mysql/sqlite,
156
+ more careful resultset clearing,
157
+ yeah, it works again.
158
+
159
+ * benchmark/og/bench.rb: introduced,
160
+ made a test with prepared statements, not a big difference.
161
+
162
+ * test/tc_og.rb: more tests.
163
+
164
+ * lib/og.rb (#adapter): introduced.
165
+
166
+ * lib/og/adapter.rb: made a singleton.
167
+ (#for_name): implemented,
168
+ pass db to all eval methods.
169
+
170
+ * lib/og/database.rb (#drop_db/#create_db): use adapter,
171
+ keep adapter.
172
+
173
+ * lib/og/*: renamed deserialize to read,
174
+ after MANY changes, this passes the simple test case.
175
+
176
+ * lib/og/adapters/sqlite.rb: reimplemented many methods,
177
+ (#count): fixed.
178
+
179
+ * lib/og/connection.rb: removed code from methods, will be implemented by the adpters,
180
+ removed deserialize option, always deserialize,
181
+ renamed conn attribute to store to avoid ubiquity.
182
+
183
+ 08-02-2005 George Moschovitis <gm@navel.gr>
184
+
185
+ * lib/og/adapter.rb: introduced, removed adapters/base.rb,
186
+ (#new_connection): implemented.
187
+
188
+ * lib/og/adapters/sqlite.rb: reintroduced.
189
+
190
+ * lib/og/database.rb: introduced, copied database related stuff from og.rb
191
+
192
+ * lib/og/adapters: renamed from adaptors.
193
+
194
+ 07-02-2005 George Moschovitis <gm@navel.gr>
195
+
196
+ * lib/og/backends/psql.rb (#initialize): use config[:address]. [rbaduin]
197
+
198
+ * lib/og/backends/sqlite.rb: passes some tests thanx to some fixes to
199
+ sqlite3 library by jamis buck,
200
+ (#start): fixed,
201
+ (#commit): fixed.
202
+ yeah it passes tc_og.rb !!
203
+
204
+ * test/nitro/adaptors/tc_cgi.rb (#test_parse_multipart): introduced.
205
+
206
+ * lib/nitro/adaptors/cgi.rb (#read_multipart): made compatible with nitro,
207
+ corect parsing of multivalues in multipart,
208
+ (#parse_multipart): custom method.
209
+ (Cgi): introduced.
210
+ (Cgi.buffer_size): introduced.
211
+
212
+ * examples/tiny/index.xhtml: upload form.
213
+
214
+ 06-02-2005 George Moschovitis <gm@navel.gr>
215
+
216
+ * lib/nitro/markup.rb: changes for type_checking.
217
+
218
+ * test/glue/tc_property_type_checking.rb: implemented.
219
+
220
+ * lib/glue/property.rb: added type_checking support.
221
+
222
+ * INSTALL: added.
223
+
224
+ * lib/og/adaptors/base.rb: introduced.
225
+
226
+ * lib/og/backends/sqlite.rb: switched to sqlite3,
227
+ fixed stupid create join tables bug,
228
+ (#create_table): correct rescue exceptions,
229
+ (#calc_field_index): fixed.
230
+
231
+ * lib/og/backends/psql.rb: fixed stupid create tables bug.
232
+
233
+ 05-02-2005 George Moschovitis <gm@navel.gr>
234
+
235
+ * cleaned up docs in many files.
236
+
237
+ * test/tc_og.rb: dont use global ($og),
238
+ run tests for all backends.
239
+
240
+ * lib/og/*: small cleanups.
241
+
242
+ * lib/og/backends/sqlite.rb (#calc_fields_index): fixed,
243
+ (#query/safe_query): fixed.
244
+ after many fixes, it kinda works.
245
+
246
+ * lib/nitro/adaptors/runner.rb: fixed lhttpd option string. [james_b]
1
247
 
2
248
  04-02-2005 George Moschovitis <gm@navel.gr>
3
249
 
250
+ * lib/og/backends/sqlite.rb: implemented many methods.
251
+
252
+ * lib/og/backends/filesys.rb: introduced.
253
+
254
+ * lib/og/version.rb: removed.
255
+
256
+ * lib/nitro/version.rb: removed.
257
+
258
+ * lib/nitro.rb: version, libpath here.
259
+
260
+ * lib/og.rb: version, libpath here.
261
+
262
+ * --- VERSION 0.9.5 ---
263
+
4
264
  * lib/nitro/adaptors/fastcgi.rb: convert conf to Flexob.
5
265
 
6
266
  * lib/nitro/adaptors/webrick.rb: added REQUEST_MUTEX to temp-fix windows bug.
data/INSTALL ADDED
@@ -0,0 +1,60 @@
1
+ = Instalation with RubyGems
2
+
3
+ 1. Download and install RubyGems:
4
+
5
+ http://rubygems.rubyforge.org
6
+
7
+ 2. Install the distribution:
8
+
9
+ gem install nitro
10
+
11
+ If you wish to install Og only:
12
+
13
+ gem install og
14
+
15
+ When asked about the dependencies to include, only accept
16
+ the dependencies for the RDBMS backends you are planning
17
+ to use.
18
+
19
+ 3. Set environment variable (required to load RubyGems):
20
+
21
+ export RUBYOPT=-rubygems
22
+
23
+ You can add this in you .bashrc in Unix.
24
+
25
+ Alternatively you can run your applications with the -rubygem
26
+ option:
27
+
28
+ ruby -rubygem xxx.rb
29
+
30
+ = Installation without RubyGems using script.
31
+
32
+ Installation without RubyGems is *strongly* discouraged.
33
+ However, as Nitro is all about freedom and possibilities,
34
+ a standard installation script is provided.
35
+
36
+ 1. Switch to an administrator account
37
+
38
+ For example in Unix:
39
+
40
+ $ su -
41
+
42
+ 2. Run the installation script.
43
+
44
+ $ ruby install.rb
45
+
46
+ This installation script also installs some vendor libraries
47
+ that you possibly have allready installed. Use with caution.
48
+
49
+ = Manual installation.
50
+
51
+ Uncompress your distribution (Unix example):
52
+
53
+ $ cd my_dir
54
+ $ tar xvfz nitro-x.x.x.tar.gz
55
+
56
+ Put the libray dir in the Ruby path (Unix example):
57
+
58
+ $ export RUBYOPT='-I path/to/my_dir/nitro/lib'
59
+
60
+
data/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  The BSD License
2
2
 
3
+ Copyright (c) 2004-2005, George 'tml' Moschovitis.
3
4
  Copyright (c) 2004-2005, Navel Ltd. (http://www.navel.gr)
4
5
  All rights reserved.
5
6
 
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = Nitro 0.9.0
1
+ = Nitro 0.10.0
2
2
 
3
3
  Nitro is an efficient, yet simple engine for developing professional Web
4
4
  Applications using the Ruby language. Nitro aims to provide a robust
@@ -15,7 +15,7 @@ from Rails, Wee, PHP, JSP and Microsoft.NET.
15
15
 
16
16
  A short summary of the major features:
17
17
 
18
- * Multiparadigm web appliacations.
18
+ * Multiparadigm web applications.
19
19
 
20
20
  You can write applications in the ASP/JSP/PHP style, ie by writting
21
21
  server pages that are automatically transalted to Ruby code by
@@ -47,7 +47,7 @@ A short summary of the major features:
47
47
 
48
48
  Og is a combination of the best features of Active Record and the
49
49
  former O-R mapping library included in Nitro (NDB). Adapters for
50
- PostgreSQL and MySQL are included.
50
+ PostgreSQL, MySQL and SQLite are included.
51
51
 
52
52
  * XML server pages (.xhtml)
53
53
 
@@ -240,11 +240,11 @@ A short summary of the major features:
240
240
 
241
241
  The latest version of Nitro can be found at
242
242
 
243
- * http://www.navel.gr/nitro
243
+ * http://www.rubyforge.com/projects/nitro
244
244
 
245
245
  Documentation for Nitro can be found at
246
246
 
247
- * http://www.navel.gr/nitro/doc
247
+ * http://www.rubyforge.com/projects/nitro
248
248
 
249
249
 
250
250
  == Requirements
@@ -325,20 +325,13 @@ or
325
325
 
326
326
  $vi conf/lhttpd.conf
327
327
 
328
- edit as needed, or
328
+ edit as needed, or edit
329
329
 
330
- $ vi conf/app.conf.rb
330
+ $ vi run.rb
331
331
 
332
- $ ruby ctl
332
+ $ ruby run.rb
333
333
 
334
- this script starts the distributed session cluster, apache and the
335
- application server.
336
-
337
- browse http://127.0.0.1:8080
338
-
339
- to stop the application execute:
340
-
341
- $ ./ctl stop
334
+ browse http://127.0.0.1:8069
342
335
 
343
336
  * examples/blog
344
337
 
@@ -352,7 +345,7 @@ $ vi conf/lhttpd.conf
352
345
 
353
346
  edit the configuration as needed.
354
347
 
355
- $ vi conf/app.conf.rb
348
+ $ vi run.rb
356
349
 
357
350
  edit the postgresql user and password
358
351
 
@@ -370,12 +363,17 @@ instead.
370
363
  there is no need to initialize the database, Og automatically
371
364
  takes cate of this.
372
365
 
373
- $ ruby ctl
366
+ $ ruby run.rb
374
367
 
375
368
  this script starts the the blog application using the WEBrick
376
369
  adapter.
377
370
 
378
- browse http://127.0.0.1:8080
371
+ browse http://127.0.0.1:8069
372
+
373
+ You can run the application in debug mode with the following
374
+ command:
375
+
376
+ $ ruby run.rb --debug
379
377
 
380
378
 
381
379
  == Debuging Nitro applications
@@ -444,7 +442,8 @@ http://rubyforge.org/mailman/listinfo/nitro-general
444
442
 
445
443
  == Licence
446
444
 
447
- Copyright (c) 2004-2005 Navel Ltd (http://www.navel.gr)
445
+ Copyright (c) 2004-2005, George 'tml' Moschovitis.
446
+ Copyright (c) 2004-2005, Navel Ltd (http://www.navel.gr)
448
447
 
449
448
  Nitro (http://www.navel.gr/nitro) is copyrighted free software
450
449
  created and maintained by George Moschovitis (mailto:gm@navel.gr)
data/RELEASES CHANGED
@@ -1,3 +1,51 @@
1
+ == Version 0.10.0 was released on 15/02/2005.
2
+
3
+ Another strong release featuring a completely recoded Og
4
+ implementation and redesigned Og adapter (formely backend)
5
+ system. An SQLite3 adapter is also provided. Moreover the
6
+ Nitro installation process is improved, and many small
7
+ changes make the framework more elegant and easier to
8
+ use: the updated examples reflect this!
9
+
10
+ Most notable additions:
11
+
12
+ * Improved Og implementation (cleaner code) and new Og
13
+ adapter subsystem.
14
+
15
+ * New SQLite3 Og adapter, improvements in MySQL and PostgreSQL
16
+ adapters (WARNING: needs version 1.1.0 of Sqlite3-Ruby).
17
+
18
+ * Added install.rb for easier installation of the tar.gz distribution.
19
+
20
+ * Better GemSpec for easier installation by RubyGems.
21
+
22
+ * Action/template/xsl auto-reloading system in debug mode,
23
+ new implementation, works again.
24
+
25
+ * New Nitro configuration system, with rational default
26
+ parameters.
27
+
28
+ * --console option attaches an irb session to a running
29
+ instace of an application (works again).
30
+
31
+ * Og supports optional typechecking by using property metadata.
32
+
33
+ * request alias for context to be compatible with older
34
+ versions of nitro and Webrick/jsp and other frameworks.
35
+
36
+ * Improved the examples, cleaner code, work from any
37
+ directory.
38
+
39
+ * Removed more obsolete code and improved directory
40
+ structure.
41
+
42
+ * and many more smaller fixes.
43
+
44
+ WARNING: If you used an earlier version of Og you
45
+ may need to drop your database and let Og recreated it
46
+ automatically.
47
+
48
+
1
49
  == Version 0.9.5 was released on 04/02/2005.
2
50
 
3
51
  A bug fix release.