nitro 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/ChangeLog +150 -0
  2. data/README +1 -1
  3. data/RELEASES +89 -0
  4. data/Rakefile +3 -3
  5. data/{AUTHORS → doc/AUTHORS} +0 -0
  6. data/{LICENSE → doc/LICENSE} +0 -0
  7. data/doc/bugs.txt +2 -1
  8. data/examples/README.windows +2 -2
  9. data/examples/blog/lib/blog/controller.rb +9 -8
  10. data/examples/blog/log/apache.error_log +71 -0
  11. data/{lib/xsl → examples/blog/root}/base.xsl +0 -0
  12. data/examples/blog/root/error.xhtml +56 -0
  13. data/examples/blog/root/index.xhtml +2 -2
  14. data/examples/blog/root/recent_posts.xhtml +1 -1
  15. data/examples/blog/root/style.xsl +4 -4
  16. data/examples/blog/run.rb +1 -2
  17. data/examples/no_xsl_blog/root/index.xhtml +2 -2
  18. data/examples/no_xsl_blog/root/recent_posts.xhtml +1 -1
  19. data/examples/why_wiki/run.rb +19 -19
  20. data/lib/nitro.rb +2 -21
  21. data/lib/nitro/adapters/webrick.rb +19 -3
  22. data/lib/nitro/context.rb +15 -1
  23. data/lib/nitro/controller.rb +84 -49
  24. data/lib/nitro/dispatcher.rb +30 -6
  25. data/lib/nitro/markup.rb +4 -2
  26. data/lib/nitro/render.rb +15 -11
  27. data/lib/nitro/routing.rb +33 -0
  28. data/lib/nitro/runner.rb +38 -3
  29. data/lib/nitro/scaffold.rb +7 -4
  30. data/lib/nitro/shaders.rb +11 -4
  31. data/lib/nitro/template.rb +140 -0
  32. data/lib/og.rb +25 -11
  33. data/lib/og/adapter.rb +141 -7
  34. data/lib/og/adapters/mysql.rb +41 -3
  35. data/lib/og/adapters/oracle.rb +4 -3
  36. data/lib/og/adapters/psql.rb +3 -3
  37. data/lib/og/adapters/sqlite.rb +3 -3
  38. data/lib/og/connection.rb +5 -1
  39. data/lib/og/database.rb +26 -12
  40. data/lib/og/enchant.rb +50 -16
  41. data/lib/og/meta.rb +15 -15
  42. data/lib/og/observer.rb +53 -0
  43. data/test/glue/tc_property_type_checking.rb +3 -0
  44. data/test/nitro/tc_controller.rb +1 -1
  45. data/test/nitro/tc_dispatcher.rb +1 -1
  46. data/test/nitro/tc_template.rb +32 -0
  47. data/test/og/tc_many_to_many.rb +62 -0
  48. data/test/og/tc_observer.rb +85 -0
  49. data/test/tc_og.rb +16 -2
  50. metadata +12 -14
  51. data/bin/cluster +0 -218
  52. data/examples/why_wiki/wiki.yml +0 -6
  53. data/examples/wiki.yml +0 -1
  54. data/lib/nitro/ui/select.rb +0 -40
  55. data/lib/nitro/ui/sitemap.rb +0 -183
  56. data/test/nitro/ui/tc_sitemap.rb +0 -37
data/ChangeLog CHANGED
@@ -1,5 +1,155 @@
1
+ 07-03-2005 George Moschovitis <gm@navel.gr>
2
+
3
+ * lib/og/adapters/mysql.rb: overide create_fields.
4
+
5
+ * examples/why_wiki: updated, added nice urls.
6
+
7
+ * lib/nitro/adapters/webrick.rb: use CgiUtils.parse_params and
8
+ CgiUtils.parse_cookies to be more compatible with FastiCGI, and
9
+ fix some bugs.
10
+
11
+ * examples/blog/roor/base.xsl: moved temporarily here.
12
+
13
+ * lib/xsl: deprecated.
14
+
15
+ * lib/nitro.rb: removed resolve_action_arguments option.
16
+
17
+ * examples/no_xsl_blog/*: updated.
18
+
19
+ * RELEASES.og: updated.
20
+
21
+ * RELEASES: updated.
22
+
23
+ * bin/cluster: deprecated.
24
+
25
+ * doc/LICENCE: moved from root.
26
+
27
+ * doc/AUTHORS: moved from root.
28
+
29
+ * after some fixes, tests pass again.
30
+
31
+ * test/nitro/ui/sitemap.rb: deprecated.
32
+
33
+ * lib/nitro/ui/sitemap.rb: deprecated.
34
+
35
+ * lib/nitro/controller.rb (#action_methods): better removal of pp methods,
36
+ remove Controller methods.
37
+
38
+ * lib/nitro/render.rb: no require of nitro, caused problems.
39
+
40
+ * lib/og/adapters/*: added typcast overrides to the other
41
+ adapters.
42
+
43
+ * test/og/tc_observer.rb: added tests.
44
+
45
+ 06-03-2005 George Moschovitis <gm@navel.gr>
46
+
47
+ * lib/og/meta.rb: fixed linkback to_s bug.
48
+
49
+ * test/og/tc_observer.rb: implemeted, many cases.
50
+
51
+ * lib/og.rb: added og_pre_read / og_post_read callbacks.
52
+
53
+ * lib/og/adapter.rb (#eval_lifecycle_methods): evaluate callbacks,
54
+ (#eval_og_insert): evaluate observer callbacks,
55
+ fix for class observer,
56
+ (#eval_og_update): evaluate observer callbacks,
57
+ (#eval_og_update): evaluate observer callbacks.
58
+
59
+ * lib/og/observer.rb: scrapped the STUPID rails design,
60
+ introduced an ultra cool, efficient, and ruby compatible design.
61
+ (#add_observer): accepts multiple observers.
62
+
63
+ 05-03-2005 George Moschovitis <gm@navel.gr>
64
+
65
+ * examples/blog/root/error.xhtml: click to reload.
66
+
67
+ * lib/nitro/runner.rb: added --crawl option.
68
+ added --render option.
69
+
70
+ * examples/blog/root/shader.xsl: fixed base href bug.
71
+
72
+ * lib/nitro/template.rb: #() alias, useful in xslt stylesheets.
73
+
74
+ * examples/blog/root/*: use scaffolded view_uri.
75
+
76
+ * lib/nitro/scaffold.rb: add support for routes.
77
+ :nosuffix option.
78
+
79
+ * lib/nitro/controller.rb (#action): implemented.
80
+ (#update_routes): implemented.
81
+ (ActionParam): implemented.
82
+ (ActionMeta): implemented.
83
+ (#action_method_arguments): deprecated.
84
+
85
+ 04-03-2005 George Moschovitis <gm@navel.gr>
86
+
87
+ * lib/nitro/controller.rb: introduced the concept of the action
88
+ keyword.
89
+
90
+ * lib/nitro/routing.rb: introduced,
91
+ (Router): introduced.
92
+ (#route): works.
93
+
94
+ * lib/nitro/dispatcher.rb: added routes map,
95
+ experimental rewrite support.
96
+
97
+ * lib/og/adapters/*: added support for multiple many_to_many relations.
98
+
99
+ * test/og/tc_many_to_many.rb: implemented.
100
+
101
+ * lib/og/meta.rb: accept :linkback as symbol,
102
+ added support for multiple many_to_many relations. [mneumann]
103
+
104
+ * lib/og/adapter.rb (join_table): encode a field name
105
+ to allow for multiple many_to_many relations with the same klass. [mneumann]
106
+
107
+ * lib/nitro/markup.rb: markup >, <.
108
+
109
+ * examples/blog/root/error.xhtml: Introduced and made really
110
+ useful.
111
+
112
+ * lib/nitro/render.rb (#log_error): reimplemented
113
+ to be more flexible and allow for much better error reporting.
114
+
115
+ * lib/nitro/context.rb (#out): override, to catch errors.
116
+
117
+ * lib/nitro/shaders.rb (RubyShader): use the TemplateMixin.
118
+
119
+ * RELEASES: updated.
120
+
121
+ * lib/nitro/template.rb: factored out TemplateMixin,
122
+ improved API.
123
+
124
+ 03-03-2005 George Moschovitis <gm@navel.gr>
125
+
126
+ * lib/nitro/template.rb: introduced as standalone template engine,
127
+ pass binding and buffer to store the result.
128
+
129
+ 01-03-2005 George Moschovitis <gm@navel.gr>
130
+
131
+ * lib/og/enchant.rb: COOL: generate finders for all properties,
132
+ take :unique into account when generating finders,
133
+ finders use typecast system.
134
+ find* alias for select* methods.
135
+ converted Og.db -> @@og_db.
136
+
137
+ * lib/og/adapter.rb: use :unique metadata,
138
+ introduced typecast system.
139
+
140
+ * lib/og.rb: better comments.
141
+
142
+ * test/og/tc_observer.rb: introduced.
143
+
144
+ * lib/og/observer.rb: introduced,
145
+ (Observable): implemented.
146
+
147
+ * lib/nitro/ui/select.rb: deprecated.
148
+
1
149
  28-02-2005 George Moschovitis <gm@navel.gr>
2
150
 
151
+ * --- VERSION 0.11.0 ---
152
+
3
153
  * lib/nitro/controller.rb (#action_method_arguments): implemented.
4
154
 
5
155
  * lib/nitro.rb: added resolve_action_arguments,
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = Nitro 0.11.0
1
+ = Nitro 0.12.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
data/RELEASES CHANGED
@@ -1,3 +1,92 @@
1
+ == Version 0.12.0 was released on 07/03/2005.
2
+
3
+ A careful blend of new features and subtle improvements
4
+ to the existing infrastructure. Some important bugs where
5
+ fixed aswell.
6
+
7
+ Most notable additions:
8
+
9
+ * Nitro allows the definition of metadata for each action.
10
+ Routing (rewrite) rules, parameter constrains, hierarchy information
11
+ and custom data can easily be attached to actions:
12
+
13
+ def view
14
+ @entry = Article[@oid]
15
+ end
16
+ action :view, :route => /view\/(.*)/, 'oid' => 1
17
+
18
+ just browse
19
+
20
+ view/1
21
+
22
+ and @oid is automatically initialized with request['oid']
23
+
24
+ Browse the source to see how to add additional constrains,
25
+ more is comming in the next version. This feature replaces
26
+ the non portable ParseTree implementation. The scaffolder
27
+ is updated to generate routings for nice urls.
28
+
29
+ * Og automatically generates finders for all properties, for
30
+ even easier (and portable) querying:
31
+
32
+ class Article
33
+ property :title, :body, String
34
+ property :hits, Fixnum
35
+ property :create_time, Time
36
+ end
37
+
38
+ you get the finders:
39
+
40
+ Article.find_by_title
41
+ Article.find_by_body
42
+ Article.find_by_hits
43
+ Article.find_by_create_time
44
+
45
+ The finders take into account the unique constrain, to return
46
+ an array or just an object as needed.
47
+
48
+ * Og introduces lifecycle observers to avoid 'poluting' the model
49
+ objects with excess functionality. You can use every object
50
+ as observer (duck typing) or extend from an AR style Observer
51
+ class. The observer callbacks are precompiled in the lifecycle
52
+ methods only if defined, so the perfomance is not affected
53
+ in the general case.
54
+
55
+ * Factored out templating engine, can now be used in stand-alone
56
+ mode. Usefull for example to render email templates etc:
57
+
58
+ template = %q{
59
+ Hello #{user}
60
+
61
+ dont forget the following facts:
62
+
63
+ <?r for item in items ?>
64
+ <li>#{item}</li>
65
+ <?r end ?>
66
+ }
67
+
68
+ user = 'gmosx'
69
+ items = %w{ nitro is really great }
70
+ out = '' # the rendered template comes here.
71
+
72
+ Template.process(template, :out, binding)
73
+
74
+ * New options in the default runner:
75
+
76
+ --render crawls a web application and renders all pages
77
+ as static html files. Allows you to leverage Nitro's
78
+ advanced templating features to generate static sites.
79
+
80
+ --crawl spiders the application, useful for testing.
81
+
82
+ * Better error page, with more information (see blog example).
83
+
84
+ * Fixed Og bug: multiple many_to_many relations with the
85
+ same target class.
86
+
87
+ * further code cleanup, improved examples and more.
88
+
89
+
1
90
  == Version 0.11.0 was released on 28/02/2005.
2
91
 
3
92
  The platform continues to evolve and now supports the
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/rdoctask'
6
6
  require 'rake/testtask'
7
7
  require 'rake/gempackagetask'
8
8
 
9
- og = false
9
+ og = false # true
10
10
 
11
11
  task :default => :package
12
12
 
@@ -59,7 +59,7 @@ spec = Gem::Specification.new do |s|
59
59
  s.required_ruby_version = '>= 1.8.0'
60
60
 
61
61
  s.files = FileList[
62
- 'README.og', 'RELEASES.og', 'LICENSE', 'AUTHORS', 'Rakefile', 'ChangeLog*',
62
+ 'README.og', 'RELEASES.og', 'doc/LICENSE', 'doc/AUTHORS', 'Rakefile', 'ChangeLog*',
63
63
  'install.rb',
64
64
  'examples/og/*', 'lib/glue.rb', 'lib/glue/**/*', 'lib/og/**/*', 'lib/og.rb',
65
65
  'test/*og*.rb', 'test/og/*', 'vendor/extensions/**/*'
@@ -69,7 +69,7 @@ spec = Gem::Specification.new do |s|
69
69
  s.autorequire = 'og'
70
70
 
71
71
  s.has_rdoc = true
72
- s.extra_rdoc_files = FileList['README.og', 'RELEASES.og', 'LICENSE', 'AUTHORS'].to_a
72
+ s.extra_rdoc_files = FileList['README.og', 'RELEASES.og', 'doc/LICENSE', 'doc/AUTHORS'].to_a
73
73
  s.rdoc_options << '--main' << 'README.og' << '--title' << 'Og Documentation'
74
74
  s.rdoc_options << '--all' << '--inline-source'
75
75
 
File without changes
File without changes
data/doc/bugs.txt CHANGED
@@ -3,6 +3,7 @@
3
3
  === Important
4
4
 
5
5
  * multipart handling in fcgi adapter.
6
+ * filter code attached multiple times?
6
7
 
7
8
  === Security
8
9
 
@@ -11,4 +12,4 @@
11
12
  === Small
12
13
 
13
14
  * not correct content type in blog syndication.
14
-
15
+ * tc_property_type_checking does not pass when run with rake test.
@@ -1,8 +1,8 @@
1
1
  = Windows
2
2
 
3
3
  If you are running under windows, first run the
4
- tiny, og, wee_style and no_xsl_blog examples. The blog
5
- example needs special libraries that are harder to
4
+ tiny, og, wee_style, why_wiki and no_xsl_blog examples.
5
+ The blog example needs special libraries that are harder to
6
6
  setup under Windows.
7
7
 
8
8
  The example no_xsl_blog is a stripped down version
@@ -3,7 +3,6 @@
3
3
  # $Id$
4
4
 
5
5
  require 'nitro/controller'
6
- require 'nitro/builders/rss'
7
6
  require 'nitro/ui/pager'
8
7
 
9
8
  require 'lib/blog/model'
@@ -15,7 +14,7 @@ class BlogController < N::Controller
15
14
  before_filter :get_errors
16
15
  after_filter :cache
17
16
 
18
- scaffold BlogEntry, :name => 'entry', :index => true
17
+ scaffold BlogEntry, :name => 'entry', :index => true # , :nosuffix => true
19
18
  scaffold Comment
20
19
 
21
20
  def list_entry
@@ -32,19 +31,21 @@ class BlogController < N::Controller
32
31
  session[:errors] = entry.errors
33
32
  redirect_referer '#new_entry'
34
33
  end
35
-
36
34
  entry.save!
37
35
  end
38
36
 
39
- # example of action with parameter. The parameter
37
+ # An example route.
38
+
39
+ # Example of action with parameter. The parameter
40
40
  # request['oid'] is referenced by the oid method
41
- # parameter.
41
+ # parameter. This also demonstrates implicit routing.
42
42
 
43
- def myview(oid)
44
- entry = BlogEntry[oid]
43
+ def myview
44
+ entry = BlogEntry[@oid]
45
45
  @out << entry.title
46
46
  end
47
-
47
+ action :myview, :route => /view\/(.*)/, 'oid' => 1
48
+
48
49
  # example of generated view
49
50
 
50
51
  def list_entry__xml
@@ -5526,3 +5526,74 @@ DEBUG: SELECT * FROM og_comment WHERE entry_oid=9
5526
5526
  INFO: cache (after filter example)
5527
5527
  INFO: cache (after filter example)
5528
5528
  [Mon Feb 28 15:48:00 2005] [notice] caught SIGTERM, shutting down
5529
+ [Mon Mar 07 12:30:48 2005] [notice] Digest: generating secret for digest authentication ...
5530
+ [Mon Mar 07 12:30:48 2005] [notice] Digest: done
5531
+ [Mon Mar 07 12:30:49 2005] [notice] FastCGI: process manager initialized (pid 4455)
5532
+ [Mon Mar 07 12:30:49 2005] [notice] Apache/2.0.53 (Unix) DAV/2 mod_fastcgi/2.4.2 configured -- resuming normal operations
5533
+ [Mon Mar 07 12:30:51 2005] [warn] FastCGI: (dynamic) server "/home/gmosx/navel/nitro/examples/blog/root/fcgi.rb" started (pid 4461)
5534
+ INFO: Connecting to database 'blog' using the 'psql' adapter.
5535
+ DEBUG: Og auto manages the following classes:
5536
+ DEBUG: [BlogEntry, N::Category, Comment]
5537
+ DEBUG: Rendering '/'.
5538
+ DEBUG: Compiling action 'root/index'
5539
+ DEBUG: Transforming 'root/index.xhtml'
5540
+ DEBUG: Parsing xsl 'root/style.xsl'
5541
+ DEBUG: SELECT * FROM og_blogentry ORDER BY oid DESC LIMIT 3
5542
+ DEBUG: SELECT COUNT(*) FROM og_blogentry
5543
+ DEBUG: SELECT COUNT(*) FROM og_comment WHERE entry_oid=3
5544
+ DEBUG: SELECT COUNT(*) FROM og_comment WHERE entry_oid=2
5545
+ DEBUG: SELECT COUNT(*) FROM og_comment WHERE entry_oid=1
5546
+ DEBUG: Rendering '/recent_posts'.
5547
+ DEBUG: Compiling action 'root/recent_posts'
5548
+ DEBUG: Transforming 'root/recent_posts.xhtml'
5549
+ DEBUG: Parsing xsl 'root/style.xsl'
5550
+ INFO: cache (after filter example)
5551
+ INFO: cache (after filter example)
5552
+ INFO: cache (after filter example)
5553
+ INFO: cache (after filter example)
5554
+ DEBUG: Rendering '/view_entry/3'.
5555
+ DEBUG: Compiling action 'root/view_entry'
5556
+ DEBUG: Transforming 'root/view_entry.xhtml'
5557
+ DEBUG: Parsing xsl 'root/style.xsl'
5558
+ DEBUG: SELECT * FROM og_blogentry WHERE oid=3
5559
+ DEBUG: Rendering '/comments'.
5560
+ DEBUG: Compiling action 'root/comments'
5561
+ DEBUG: Transforming 'root/comments.xhtml'
5562
+ DEBUG: Parsing xsl 'root/style.xsl'
5563
+ DEBUG: SELECT COUNT(*) FROM og_comment WHERE entry_oid=3
5564
+ DEBUG: SELECT * FROM og_comment WHERE entry_oid=3
5565
+ INFO: cache (after filter example)
5566
+ INFO: cache (after filter example)
5567
+ INFO: cache (after filter example)
5568
+ INFO: cache (after filter example)
5569
+ INFO: cache (after filter example)
5570
+ INFO: cache (after filter example)
5571
+ DEBUG: Rendering '/new_comment'.
5572
+ DEBUG: Compiling action 'root/new_comment'
5573
+ DEBUG: INSERT INTO og_comment (title,body,create_time,update_time,author,entry_oid,oid) VALUES (NULL,'sfdsfsdf','2005-03-07 12:30:59','2005-03-07 12:30:59','dasd',3,7)
5574
+ INFO: cache (after filter example)
5575
+ INFO: cache (after filter example)
5576
+ INFO: cache (after filter example)
5577
+ INFO: cache (after filter example)
5578
+ DEBUG: Rendering '/view_entry/3'.
5579
+ DEBUG: Compiling action 'root/view_entry'
5580
+ DEBUG: Transforming 'root/view_entry.xhtml'
5581
+ DEBUG: Parsing xsl 'root/style.xsl'
5582
+ DEBUG: SELECT * FROM og_blogentry WHERE oid=3
5583
+ DEBUG: Rendering '/comments'.
5584
+ DEBUG: Compiling action 'root/comments'
5585
+ DEBUG: Transforming 'root/comments.xhtml'
5586
+ DEBUG: Parsing xsl 'root/style.xsl'
5587
+ DEBUG: SELECT COUNT(*) FROM og_comment WHERE entry_oid=3
5588
+ DEBUG: SELECT * FROM og_comment WHERE entry_oid=3
5589
+ INFO: cache (after filter example)
5590
+ INFO: cache (after filter example)
5591
+ INFO: cache (after filter example)
5592
+ INFO: cache (after filter example)
5593
+ INFO: cache (after filter example)
5594
+ INFO: cache (after filter example)
5595
+ INFO: cache (after filter example)
5596
+ INFO: cache (after filter example)
5597
+ INFO: cache (after filter example)
5598
+ INFO: cache (after filter example)
5599
+ [Mon Mar 07 12:36:04 2005] [notice] caught SIGTERM, shutting down
File without changes
@@ -0,0 +1,56 @@
1
+ <html>
2
+ <head>
3
+ <title>Error</title>
4
+ <style>
5
+ .path {
6
+ padding: 5px;
7
+ font-size: 140%;
8
+ background: #ddd;
9
+ }
10
+ .error {
11
+ padding: 5px;
12
+ padding-top: 15px;
13
+ font-size: 140%;
14
+ color: #f00;
15
+ }
16
+ .load {
17
+ padding: 5px;
18
+ color: #555;
19
+ }
20
+ h2 {
21
+ padding-left: 5px;
22
+ background: #eee;
23
+ }
24
+ </style>
25
+ </head>
26
+ <body>
27
+ <h1>Error</h1>
28
+
29
+ <?r for error, path in @context.rendering_errors ?>
30
+ <div class="path"><strong>Path:</strong> #{path}</div>
31
+ <div class="error"><strong>#{error.class.name}:</strong> #{N::Markup.expand(error.to_s)}</div>
32
+ <div class="load">Click here to <strong><a href="#{request.uri}">reload</a></strong>.</div>
33
+ <div class="load">Click here to go to the <strong><a href="#{request.referer}">referer</a></strong>.</div>
34
+ <h2><a href="#" onclick="document.getElementById('trace').style.display = 'block'; return false">Stack Trace</a></h2>
35
+ <p id="trace" style="display: none">#{error.backtrace.join('<br />')}</p>
36
+ <?r end ?>
37
+
38
+ <h2><a href="#" onclick="document.getElementById('request').style.display = 'block'; return false">Request</a></h2>
39
+ <div id="request" style="display: none">
40
+ <p><strong>Parameters:</strong> #{request.params.reject{ |k,v| k == :__RELOADED__ }.inspect}</p>
41
+ <p><strong>Cookies:</strong> #{request.cookies.inspect}</p>
42
+ <p><strong>Headers:</strong><br />#{request.headers.collect { |k, v| "#{k} => #{v}" }.join('<br />')}</p>
43
+ </div>
44
+
45
+ <h2><a href="#" onclick="document.getElementById('response').style.display = 'block'; return false">Response</a></h2>
46
+ <div id="response" style="display: none">
47
+ <p><strong>Headers:</strong> #{request.response_headers.inspect}</p>
48
+ <p><strong>Cookies:</strong> #{request.response_cookies.inspect}</p>
49
+ </div>
50
+
51
+ <h2><a href="#" onclick="document.getElementById('session').style.display = 'block'; return false">Session</a></h2>
52
+ <div id="session" style="display: none">
53
+ <p><strong>Values:</strong> #{session.inspect}</p>
54
+ </div>
55
+ </body>
56
+ </html>