nitro 0.14.0 → 0.15.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.
Files changed (60) hide show
  1. data/CHANGELOG +117 -0
  2. data/INSTALL +4 -0
  3. data/README +30 -31
  4. data/Rakefile +2 -2
  5. data/bin/nitro +10 -1
  6. data/bin/{new_app.rb → nitrogen} +12 -22
  7. data/doc/AUTHORS +4 -13
  8. data/doc/RELEASES +98 -0
  9. data/examples/ajax/run.rb +1 -3
  10. data/examples/blog/cache/entriesadmin +1 -1
  11. data/examples/blog/conf/locales/de.yml +4 -0
  12. data/examples/blog/conf/locales/en.yml +4 -0
  13. data/examples/blog/public/fcgi.rb +2 -3
  14. data/examples/blog/run.rb +10 -5
  15. data/examples/blog/src/controller.rb +21 -10
  16. data/examples/blog/src/mailer.rb +1 -1
  17. data/examples/blog/src/views/index.xhtml +2 -2
  18. data/examples/blog/src/xsl/style.xsl +6 -1
  19. data/examples/flash/run.rb +1 -3
  20. data/examples/no_xsl_blog/conf/locales/de.yml +4 -0
  21. data/examples/no_xsl_blog/conf/locales/en.yml +4 -0
  22. data/examples/no_xsl_blog/lib/blog/controller.rb +10 -0
  23. data/examples/no_xsl_blog/lib/blog/template.rb +4 -0
  24. data/examples/no_xsl_blog/public/fcgi.rb +2 -1
  25. data/examples/no_xsl_blog/public/index.xhtml +1 -1
  26. data/examples/no_xsl_blog/run.rb +8 -4
  27. data/examples/tiny/public/deep/dir/hello.xhtml +1 -0
  28. data/examples/tiny/public/fcgi.rb +2 -1
  29. data/examples/tiny/public/index.xhtml +5 -2
  30. data/examples/tiny/run.rb +1 -3
  31. data/examples/wee_style/run.rb +1 -3
  32. data/examples/why_wiki/run.rb +1 -3
  33. data/lib/nitro.rb +5 -2
  34. data/lib/nitro/builders/form.rb +8 -3
  35. data/lib/nitro/caching/stores.rb +3 -3
  36. data/lib/nitro/controller.rb +26 -6
  37. data/lib/nitro/dispatcher.rb +21 -13
  38. data/lib/nitro/environment.rb +23 -0
  39. data/lib/nitro/filters.rb +10 -8
  40. data/lib/nitro/localization.rb +127 -13
  41. data/lib/nitro/part.rb +24 -0
  42. data/lib/nitro/render.rb +19 -15
  43. data/lib/nitro/runner.rb +2 -1
  44. data/lib/nitro/scaffold.rb +69 -17
  45. data/lib/nitro/shaders.rb +54 -83
  46. data/lib/nitro/template.rb +7 -1
  47. data/proto/README +11 -0
  48. data/proto/conf/apache.conf +51 -0
  49. data/proto/conf/lhttpd.conf +107 -0
  50. data/proto/public/error.xhtml +56 -0
  51. data/proto/public/fcgi.rb +5 -0
  52. data/proto/public/index.xhtml +83 -0
  53. data/proto/public/js/ajax.js +63 -0
  54. data/proto/public/media/nitro.png +0 -0
  55. data/proto/run.rb +11 -0
  56. data/test/nitro/tc_controller.rb +1 -4
  57. data/test/nitro/tc_dispatcher.rb +8 -0
  58. data/test/nitro/tc_localization.rb +49 -0
  59. metadata +34 -6
  60. data/bin/new_form.rb +0 -54
data/CHANGELOG CHANGED
@@ -1,5 +1,122 @@
1
+ 04-04-2005 George Moschovitis <gm@navel.gr>
2
+
3
+ * bin/nitro: fix
4
+
5
+ * bin/nitrogen: fix
6
+
7
+ * --- VERSION 0.15.0 ---
8
+
9
+ * Rakefile: added nitrogen executable.
10
+
11
+ * examples/blog/public/fcgi.rb: fixed for path.
12
+
13
+ * doc/RELEASES: updated.
14
+
15
+ * bin/new_form.rb: deprecated.
16
+
17
+ * bin/new_app.rb: deprecated.
18
+
19
+ * bin/nitrogen: implemented.
20
+
21
+ * bin/nitro: implemented to start default application,
22
+ use -rubygems.
23
+
24
+ 03-04-2005 George Moschovitis <gm@navel.gr>
25
+
26
+ * lib/nitro/render.rb (#compile_action): handle __ separators,
27
+ (#template_for_action): fixed to look into subdirectories.
28
+
29
+ * test/nitro/tc_dispatcher.rb: added more tests.
30
+
31
+ * lib/nitro/dispatcher.rb (#dispatch): updated to
32
+ handle actions in subdirs.
33
+
34
+ * doc/RELEASES: updated.
35
+
36
+ 01-04-2005 George Moschovitis <gm@navel.gr>
37
+
38
+ * some fixes to make the tests pass again.
39
+
40
+ * doc/RELEASES: updated.
41
+
42
+ * doc/AUTHORS: updated.
43
+
44
+ * README: updated.
45
+
46
+ * examples/no_xsl_blog/*: added localization support.
47
+
48
+ * examples/*: fixed for default environment.
49
+
50
+ * lib/nitro.rb: setups a default environment [james_b].
51
+
52
+ * lib/nitro/environment.rb: introduced and implemented.
53
+
54
+ 01-04-2005 James Britt <james_b@neurogami.com>
55
+
56
+ * lib/nitro/controller.rb: fixed DEF_FILE calc for win32.
57
+
58
+ 31-03-2005 George Moschovitis <gm@navel.gr>
59
+
60
+ * examples/blig/src/controller.rb (#toggle_locale): implemented.
61
+
62
+ * examples/blog/*: added localization support.
63
+
64
+ * test/nitro/localization.rb: introced and implemented tests.
65
+
66
+ * lib/nitro/localization.rb: worked on this,
67
+ (Locale): introduced,
68
+ yeah localization kinda works,
69
+ added support for sprintf interpolation.
70
+ support for procs as localization agents,
71
+ added some documentation.
72
+ (LocalizationShader): introduced.
73
+ (LocalizationFilter): reimplemented,
74
+ fixed default locale.
75
+ added support for parsing localization rules from yaml files.
76
+
77
+ 30-03-2005 George Moschovitis <gm@navel.gr>
78
+
79
+ * examples/blog/*: use the new, easier/powerful way to set
80
+ the template root.
81
+
82
+ * lib/nitro/caching/stores.rb (FileStore): better handling of
83
+ cache_root.
84
+
85
+ * lib/nitro/controller.rb (#method_missing): use the class
86
+ template_root,
87
+ many changes to handle the template_root here.
88
+
89
+ * lib/nitro/scaffold.rb (#scaffold):
90
+ added new, edit, form default methods,
91
+ save: implemented.
92
+ override default rendering if a template is provided.
93
+
94
+ * lib/nitro/shaders: introduced.
95
+
96
+ 29-03-2005 George Moschovitis <gm@navel.gr>
97
+
98
+ * lib/nitro/shaders.rb: cleaned up old code,
99
+ (MorphingShader): introduced,
100
+ (ElementsShader): introduced,
101
+ implemented times morphing,
102
+ after a lot of experiments got the regexp right.
103
+ each morphing,
104
+ if/unless morphing.
105
+
106
+ * lib/nitro/render.rb: add base to template root.
107
+
108
+ * lib/nitro/dispatcher.rb: return base.
109
+
110
+ * lib/nitro/part.rb: reintroduced.
111
+
112
+ * worked a lot on the high level framework.
113
+
1
114
  28-03-2005 George Moschovitis <gm@navel.gr>
2
115
 
116
+ * lib/nitro/template.rb: added support for erb style interpolators <% %>.
117
+
118
+ * --- VERSION 0.14.0 ---
119
+
3
120
  * lib/nitro/controller.rb (#inherited): made compatible with Win32.
4
121
 
5
122
  * examples/why_wiki/run.rb: set pwd.
data/INSTALL CHANGED
@@ -27,6 +27,10 @@
27
27
 
28
28
  ruby -rubygem xxx.rb
29
29
 
30
+ 4. To verify that everything works ok, run the command
31
+
32
+ nitro
33
+
30
34
  = Installation without RubyGems using script.
31
35
 
32
36
  Installation without RubyGems is *strongly* discouraged.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = Nitro 0.14.0
1
+ = Nitro 0.15.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
@@ -18,15 +18,15 @@ A short summary of the major features:
18
18
  * Multiparadigm web applications.
19
19
 
20
20
  You can write applications in the ASP/JSP/PHP style, ie by writting
21
- server pages that are automatically transalted to Ruby code by
21
+ server pages that are automatically translated to Ruby code by
22
22
  Nitro.
23
23
 
24
- Alternatively, you can write Rails style application by utilizing
25
- the powerfull Controller mechanism.
24
+ Alternatively, you can write MVC style applications (like Rails) by
25
+ utilizing the powerfull Controller mechanism.
26
26
 
27
27
  * Advanced Code generation.
28
28
 
29
- Nitro in essence writes your Web application for you. The system
29
+ Nitro in essence writes the Web application for you. The system
30
30
  provides a number of domain spefic language extensions (meta-languages)
31
31
  to automate generate of common code (OR mapping, validation,
32
32
  forms generation, syndication, markup and more).
@@ -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, MySQL and SQLite are included.
50
+ PostgreSQL, MySQL, SQLite3, Oracle and SQL Server are included.
51
51
 
52
52
  * XML server pages (.xhtml)
53
53
 
@@ -119,7 +119,7 @@ A short summary of the major features:
119
119
  Runs on Linux and Windows. Has not been tested under MacOSX and
120
120
  other Unices.
121
121
 
122
- * Multiple Adaptors
122
+ * Multiple Adapters
123
123
 
124
124
  Nitro supports multiple web server configurations. Out of the box
125
125
  it supports WEBrick (pure ruby), Lighttpd (fastcgi), Apache (fastcgi).
@@ -130,12 +130,18 @@ A short summary of the major features:
130
130
  Configuration files are kept to the absolute minimum. The target
131
131
  is to have no configuration files at all.
132
132
 
133
+ * Scaffolding
134
+
135
+ This enables the developer to get started as fast as possible.
136
+
133
137
  * Distributed State
134
138
 
135
139
  Nitro provides a powerfull distributed state mechanism that utilizes
136
140
  the DRb library. A typicall use of this infrastructure is to provide
137
141
  distributed sessions when running your application over a server
138
142
  cluster. Distributed sessions are fully transparent to the developer.
143
+
144
+ Support for Memcached will be available soon.
139
145
 
140
146
  * Request Filters
141
147
 
@@ -157,14 +163,16 @@ A short summary of the major features:
157
163
  Other libraries of parts are expected from the Ruby community when
158
164
  the Part API is finalized.
159
165
 
160
- * Hierarchical Caching
166
+ * Fine-grained Caching
161
167
 
162
168
  Nitro provides a well designed and efficient caching mechanism. Caching
163
169
  will be provided at the following levels:
164
170
 
165
- * DB Cache
166
- * Object Cache (deserialized objects)
171
+ * Object Cache (deserialized objects) (coming soon)
167
172
  * Fragment Caching (cache generated sub-parts of a page, or a page)
173
+ * Action Caching (full pages)
174
+ * Output Caching (the whole page is stored as html and served by
175
+ the front web server, thus completely bypassing Nitro)
168
176
  * HTTP 1.1 Caching (downstream caching of whole pages)
169
177
 
170
178
  The engine calculates intra-page dependencies automatically. A variety
@@ -202,10 +210,10 @@ A short summary of the major features:
202
210
  p u.errors[:password]
203
211
  end
204
212
 
205
- * Support for 'nice' urls.
206
-
207
- Experimental.
213
+ * Routing
208
214
 
215
+ This enables portable rewrites and 'nice' urls.
216
+
209
217
  * Advanced debuging features
210
218
 
211
219
  * When running in debug mode, all exceptions raised are logged
@@ -227,24 +235,21 @@ A short summary of the major features:
227
235
  to make form based application development easier (for example
228
236
  an efficient, database-aware Pager component).
229
237
 
230
- * Path overloading
231
-
232
- Experimental.
233
-
234
238
  * Localization
235
239
 
236
- Nitro supports efficient localization of web applications.
240
+ Nitro supports efficient and fully transparent localization of
241
+ web applications.
237
242
 
238
243
 
239
244
  == Download
240
245
 
241
246
  The latest version of Nitro can be found at
242
247
 
243
- * http://www.rubyforge.com/projects/nitro
248
+ * http://nitro.rubyforge.org
244
249
 
245
250
  Documentation for Nitro can be found at
246
251
 
247
- * http://www.rubyforge.com/projects/nitro
252
+ * http://nitro.rubyforge.org
248
253
 
249
254
 
250
255
  == Requirements
@@ -307,6 +312,9 @@ gem install nitro
307
312
  Then try to run the examples/tiny Example application.
308
313
 
309
314
  A tar.gz distribution is also available on http://www.rubyforge.com/projects/nitro
315
+ This distribution is intended to allow developers to get a
316
+ quick look at the platform. For real development please use
317
+ the gem distribution.
310
318
 
311
319
 
312
320
  == Running the example applications
@@ -331,7 +339,7 @@ $ vi run.rb
331
339
 
332
340
  $ ruby run.rb
333
341
 
334
- browse http://127.0.0.1:8069
342
+ browse http://127.0.0.1:9999
335
343
 
336
344
  * examples/blog
337
345
 
@@ -368,7 +376,7 @@ $ ruby run.rb
368
376
  this script starts the the blog application using the WEBrick
369
377
  adapter.
370
378
 
371
- browse http://127.0.0.1:8069
379
+ browse http://127.0.0.1:9999
372
380
 
373
381
  You can run the application in debug mode with the following
374
382
  command:
@@ -399,15 +407,6 @@ examples/
399
407
  lib/nitro
400
408
  Nitro library source files.
401
409
 
402
- lib/og
403
- Og library source files.
404
-
405
- lib/glue
406
- Common source files.
407
-
408
- lib/parts
409
- Nitro Web Framework parts. A part is a module of functionality
410
-
411
410
  test
412
411
  Unit and functional tests.
413
412
 
data/Rakefile CHANGED
@@ -56,7 +56,7 @@ spec = Gem::Specification.new do |s|
56
56
  s.required_ruby_version = '>= 1.8.1'
57
57
 
58
58
  s.files = FileList[
59
- '[A-Z]*', 'install.rb', '{bin,benchmark,examples,doc,lib,test,vendor}/**/*'
59
+ '[A-Z]*', 'install.rb', '{bin,benchmark,examples,doc,proto,lib,test,vendor}/**/*'
60
60
  ].exclude('.svn/**/*').exclude('*.og').exclude('**/*.log').to_a
61
61
 
62
62
  s.require_path = 'lib'
@@ -70,7 +70,7 @@ spec = Gem::Specification.new do |s|
70
70
  s.test_files = []
71
71
 
72
72
  s.bindir = 'bin'
73
- s.executables = ['nitro']
73
+ s.executables = ['nitro', 'nitrogen']
74
74
  s.default_executable = 'nitro'
75
75
 
76
76
  s.author = 'George Moschovitis'
data/bin/nitro CHANGED
@@ -1,3 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- puts 'Not implemented!'
3
+ $NITRO_NO_ENVIRONMENT = true
4
+
5
+ require 'nitro'
6
+
7
+ if File.exist?('run.rb')
8
+ system('ruby -rubygems run.rb')
9
+ else
10
+ puts 'No application found, starting default application.'
11
+ system('ruby -rubygems ' + File.join(Nitro::LibPath, '..', 'proto', 'run.rb'))
12
+ end
@@ -1,19 +1,17 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
- # = New Project Wizzard
4
- #
5
- # Creates the directory structure for a new project.
6
- #
7
- # code:
8
3
  # * George Moschovitis <gm@navel.gr>
9
- #
10
- # (c) 2004 Navel, all rights reserved.
11
- # $Id: new_app.rb 194 2004-12-20 20:23:57Z gmosx $
4
+ # (c) 2004-2005 Navel, all rights reserved.
5
+ # $Id$
12
6
 
13
7
  require 'fileutils'
14
8
 
9
+ $NITRO_NO_ENVIRONMENT = true
10
+
11
+ require 'nitro'
12
+
15
13
  # gmosx, TODO: move to a library
16
- #
14
+
17
15
  def ll_r(path, &block)
18
16
  Dir.foreach(path) do |f|
19
17
  next if [".", ".."].include?(f)
@@ -23,32 +21,24 @@ def ll_r(path, &block)
23
21
  end
24
22
  end
25
23
 
26
- bin_dir = File.dirname(__FILE__)
24
+ proto_dir = File.join(Nitro::LibPath, '..', 'proto')
27
25
 
28
26
  if base_dir = ARGV[0]
29
27
 
30
28
  # remove the trailing '/' if it exists.
29
+
31
30
  base_dir = base_dir.gsub(/\/$/, '')
32
31
 
33
32
  # the following code is win32 compatible.
34
- #
35
- FileUtils.cp_r "#{bin_dir}/proto", base_dir
36
- ll_r(base_dir) { |f| FileUtils.rm_rf(f) if /\.svn$/ =~ f }
37
33
 
38
- =begin
39
- Unix implementation
40
- %x{
41
- cp -R #{bin_dir}/proto #{base_dir}
42
- find #{base_dir} | grep "\.svn$" | xargs rm -rf
43
- }
44
- =end
34
+ FileUtils.cp_r proto_dir, base_dir
35
+ ll_r(base_dir) { |f| FileUtils.rm_rf(f) if /\.svn$/ =~ f }
45
36
 
46
37
  else
47
38
 
48
39
  puts %{
49
40
  USAGE:
50
- new_app base_dir
41
+ nitrogen base_dir
51
42
  }
52
43
 
53
44
  end
54
-
data/doc/AUTHORS CHANGED
@@ -6,26 +6,17 @@ MAIN DEVELOPER:
6
6
 
7
7
  IDEAS, ADDITIONAL CODING, SUPPORT:
8
8
 
9
- * Michael Neumann <mneumann@ntecs.de>
10
- Design, additional coding and bug reports.
11
-
12
- * Matt Bowen <matt.bowen@farweststeel.com>
13
- Additional code and documentation.
14
-
15
9
  * Anastasios Koutoumanos <ak@navel.gr>
16
10
  Design, additional coding.
17
11
 
18
- * Elias Athanasopoulos <elathan@navel.gr>
19
- Additional coding.
12
+ * Matt Bowen <matt.bowen@farweststeel.com>
13
+ Additional code and documentation.
20
14
 
21
- * Gavin Sinclair <gsinclair@soyabean.com.au>
22
- Logger#trace method.
15
+ * James Britt <james_b@neurogami.com>
16
+ Design, bug reports.
23
17
 
24
18
  * Thomas Quas <tquas@yahoo.com>
25
19
  Ideas, bug reports, unit tests.
26
20
 
27
21
  * Kostas Nasis <kostas@nasis.com>
28
22
  Ideas and bug reports.
29
-
30
- * Elias Karakoulakis <ekarak@navel.gr>
31
- Additional design.
data/doc/RELEASES CHANGED
@@ -1,3 +1,101 @@
1
+ == Version 0.15.0 was released on 4/03/2005.
2
+
3
+ A great release. Many cool new features and tons of subtle
4
+ improvements. We also welcome a new core developer, Anastastios
5
+ Koutoumanos, who's first contribution is the new SqlServer adapter.
6
+
7
+ Most notable additions:
8
+
9
+ * Advanced localization support:
10
+
11
+ locale_en = {
12
+ 'See you' => 'See you',
13
+ :long_paragraph => 'The best new books, up to 30% reduced price',
14
+ :price => 'Price: %d %s',
15
+ :proc_price => proc { |value, cur| "Price: #{value} #{cur}" }
16
+ }
17
+
18
+ locale_de = {
19
+ 'See you' => 'Auf wieder sehen',
20
+ ...
21
+ }
22
+
23
+ lc = Localization.get
24
+ lc['See you'] -> See you
25
+ lc[:price, 100, 'euro'] -> Price: 100 euro
26
+ lc = Localization.get[:de]
27
+ lc['See you'] -> Auf wiedersehen
28
+
29
+ Using the LocalizationShader you can have templates like this:
30
+
31
+ <h1>[[This is a localized]] String</h1>
32
+ <p>
33
+ do you [[:like]] this?
34
+ </p>
35
+
36
+ All strings enclosed in [[ ]] are replaced with localized
37
+ versions (honouring the session locale). Check out the updated
38
+ blog example.
39
+
40
+ * Dynamic/Parametrised mixins. A great extension to Ruby's mixin
41
+ feature. The Og::list implementation is replaced with the new
42
+ Orderable dynamic mixin, here is an example:
43
+
44
+ class Comment
45
+ property :body, String
46
+ belongs_to :article, Article
47
+ include Orderable, :scope => article
48
+ end
49
+
50
+ c.move_higher
51
+
52
+ The Orderable mixin uses the :scope parameter to dynamically alter
53
+ the methods appended to the Comment class. This new feature will be
54
+ used throughout the platform.
55
+
56
+ * NestedSets mixin:
57
+
58
+ class Comment
59
+ include NestedSets
60
+ end
61
+
62
+ or
63
+
64
+ class Comment
65
+ include Hierarchical, :method => :nested_sets
66
+ end
67
+
68
+ c.add_comment(child_comment)
69
+ c.full_children
70
+ c.direct_children
71
+ c.children
72
+
73
+ this is a reimplementation of the SqlTraversable mixin
74
+ available in older versions.
75
+
76
+ * Improved templating system. Now allows <% %> intrerpolators
77
+ and provides a number of html morphing effects:
78
+
79
+ <div if="admin">
80
+ admin interface
81
+ </div>
82
+
83
+ <ul>
84
+ <li each="u in @users">#{u.first_name} #{u.last_name}
85
+ </ul>
86
+
87
+ and more...
88
+
89
+ * Og provides an SqlServer adapter out of the box.
90
+
91
+ * Improved scaffolding code (still a lot more to come).
92
+
93
+ * Build default environment, introduced nitro and nitrogen
94
+ commands to help new users.
95
+
96
+ * Many, many small improvements and fixes.
97
+
98
+
1
99
  == Version 0.14.0 was released on 28/03/2005.
2
100
 
3
101
  This release fixes *important* bugs amd improves various