nitro 0.16.0 → 0.17.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 (45) hide show
  1. data/CHANGELOG +94 -1
  2. data/INSTALL +3 -0
  3. data/README +9 -1
  4. data/Rakefile +2 -1
  5. data/doc/RELEASES +183 -2
  6. data/examples/blog/run.rb +4 -9
  7. data/examples/blog/src/controller.rb +1 -5
  8. data/examples/blog/src/models/blog.rb +1 -5
  9. data/examples/blog/src/models/content.rb +0 -5
  10. data/examples/blog/src/views/comments.xhtml +6 -11
  11. data/examples/blog/src/views/index.xhtml +2 -3
  12. data/examples/blog/src/views/recent_posts.xhtml +1 -1
  13. data/examples/no_xsl_blog/lib/blog/controller.rb +1 -5
  14. data/examples/no_xsl_blog/lib/blog/model.rb +2 -6
  15. data/examples/no_xsl_blog/lib/blog.rb +0 -4
  16. data/examples/no_xsl_blog/lib/content.rb +7 -11
  17. data/examples/no_xsl_blog/public/comments.xhtml +6 -11
  18. data/examples/no_xsl_blog/public/index.xhtml +2 -2
  19. data/examples/no_xsl_blog/public/recent_posts.xhtml +1 -1
  20. data/examples/no_xsl_blog/run.rb +2 -9
  21. data/lib/nitro/adapters/cgi.rb +7 -8
  22. data/lib/nitro/adapters/fastcgi.rb +17 -19
  23. data/lib/nitro/adapters/webrick.rb +3 -3
  24. data/lib/nitro/buffering.rb +0 -4
  25. data/lib/nitro/builders/form.rb +3 -3
  26. data/lib/nitro/builders/rss.rb +33 -4
  27. data/lib/nitro/builders/xhtml.rb +1 -1
  28. data/lib/nitro/builders/xml.rb +1 -1
  29. data/lib/nitro/context.rb +0 -4
  30. data/lib/nitro/controller.rb +0 -4
  31. data/lib/nitro/dispatcher.rb +5 -5
  32. data/lib/nitro/element.rb +151 -0
  33. data/lib/nitro/part.rb +0 -4
  34. data/lib/nitro/render.rb +79 -40
  35. data/lib/nitro/request.rb +15 -4
  36. data/lib/nitro/scaffold.rb +2 -6
  37. data/lib/nitro/shaders.rb +4 -3
  38. data/lib/nitro/template.rb +3 -1
  39. data/lib/nitro.rb +7 -6
  40. data/proto/public/error.xhtml +1 -1
  41. data/proto/public/js/prototype.js +764 -0
  42. data/test/nitro/adapters/tc_cgi.rb +1 -0
  43. data/test/nitro/tc_element.rb +46 -0
  44. metadata +27 -6
  45. data/examples/blog/cache/entriesadmintrue +0 -3
data/CHANGELOG CHANGED
@@ -1,5 +1,98 @@
1
- 18-04-2005 George Moschovitis <gm@navel.gr>
1
+ 16-05-2005 George Moschovitis <gm@navel.gr>
2
+
3
+ * cleanup.rb: updated.
4
+
5
+ * doc/RELEASES: updated.
6
+
7
+ * Rakefile: updated facets dependency.
8
+
9
+ 15-05-2005 George Moschovitis <gm@navel.gr>
10
+
11
+ * doc/RELEASES: updated.
12
+
13
+ 13-05-2005 George Moschovitis <gm@navel.gr>
14
+
15
+ * lib/nitro/shaders.rb (ElementShader): Yeah, it passes an
16
+ example page.
17
+
18
+ * lib/nitro/element.rb: reimplemented render using the
19
+ StreamParser,
20
+ handles processing instructions,
21
+ yeah, it works again!,
22
+ added _view, _rendered attributes in element,
23
+ fixed nesting bug,
24
+ yeah, use render for template, it works!
25
+ fixed more nesting bugs.
26
+
27
+ 12-05-2005 George Moschovitis <gm@navel.gr>
28
+
29
+ * lib/nitro/shaders.rb (ElementShader): implemented,
30
+ yeah, this parses a simple page.
31
+
32
+ * test/nitro/tc_element.rb: implemented.
33
+
34
+ * lib/nitro/element.rb: introduced,
35
+ (Element): introduced.
36
+ (ElementRender): introduced.
37
+ (#parse): implemented.
38
+ (StaticElement): implemented,
39
+ It works!!
40
+ better handle elements without attributes.
41
+
42
+ 11-05-2005 George Moschovitis <gm@navel.gr>
43
+
44
+ * examples/no_xsl_blog/*: changes to make it work with new Og.
45
+
46
+ * examples/blog/*: changes to make it work with new Og,
47
+ use hals if ...each trick in comments,
48
+ yeah it works.
49
+
50
+ 05-05-2005 George Moschovitis <gm@navel.gr>
51
+
52
+ * lib/nitro/adapters/fastcgi.rb: use ensure to be more fault
53
+ tolerant.
54
+
55
+ * lib/nitro/adapters/webrick.rb: updated for new Og.
2
56
 
57
+ * examples/blog/*: converted to new og code.
58
+
59
+ 30-04-2005 George Moschovitis <gm@navel.gr>
60
+
61
+ * lib/nitro/render.rb (#compile_action): better syntax error
62
+ handling, no infinite loops [drak].
63
+
64
+ 26-04-2005 George Moschovitis <gm@navel.gr>
65
+
66
+ * lib/nitro/render.rb: hack-fixed :stop bug.
67
+
68
+ 21-04-2005 George Moschovitis <gm@navel.gr>
69
+
70
+ * proto/public/js/prototype.js: added.
71
+
72
+ 20-04-2005 George Moschovitis <gm@navel.gr>
73
+
74
+ * lib/nitro/render.rb: allow view overload.
75
+
76
+ 19-04-2005 George Moschovitis <gm@navel.gr>
77
+
78
+ * lib/nitro/scaffold.rb: view_uri -> to_href.
79
+
80
+ * Rakefile: added facets dependency.
81
+
82
+ * lib/nitro/render.rb (ActionExit): introduced.
83
+ catch stop.
84
+ (#compile_action): added param calculation code,
85
+ no return from template.
86
+
87
+ 18-04-2005 George Moschovitis <gm@navel.gr>
88
+
89
+ * lib/nitro/render.rb: response alias for context.
90
+ (#print): added as convenience method.
91
+
92
+ * lib/nitro/request.rb (#raw_body): implemented.
93
+
94
+ * --- VERSION 0.16.0 ---
95
+
3
96
  * small fixes to make tests pass again.
4
97
 
5
98
  17-04-2005 George Moschovitis <gm@navel.gr>
data/INSTALL CHANGED
@@ -65,6 +65,9 @@ Put the libray dir in the Ruby path (Unix example):
65
65
 
66
66
  $ export RUBYOPT='-I path/to/nitro/lib'
67
67
 
68
+ or, at windows
69
+
70
+ > set RUBYOPT=Ic:\dev\nitro\lib;c:\dev\og\lib;c:\dev\glue\lib
68
71
 
69
72
  = Additional libraries
70
73
 
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = Nitro 0.16.0 README
1
+ = Nitro 0.17.0 README
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
@@ -241,6 +241,14 @@ A short summary of the major features:
241
241
  web applications.
242
242
 
243
243
 
244
+ == What's new
245
+
246
+ For information about the latest changes please consult the
247
+ file
248
+
249
+ doc/RELEASES
250
+
251
+
244
252
  == Download
245
253
 
246
254
  The latest version of Nitro can be found at
data/Rakefile CHANGED
@@ -72,7 +72,8 @@ spec = Gem::Specification.new do |s|
72
72
 
73
73
  s.add_dependency 'glue', "= #{s.version}"
74
74
  s.add_dependency 'og', "= #{s.version}"
75
- # s.add_dependency 'ruby-breakpoint', '>= 0.5'
75
+ s.add_dependency 'facets', '>= 0.7.1'
76
+ s.add_dependency 'ruby-breakpoint', '>= 0.5'
76
77
 
77
78
  s.required_ruby_version = '>= 1.8.2'
78
79
 
data/doc/RELEASES CHANGED
@@ -1,10 +1,191 @@
1
- == Version 0.16.0
1
+ == Version 0.17.0
2
+
3
+ The biggest release yet, featuring the brand new implementation
4
+ of Og. Due to the many changes this should be considered a preview
5
+ release, a stabilized version is expected shortly. Bug reports and
6
+ comments on the new features are especially appreciated. Many
7
+ thanks to Michael Neumann, Dan Yoder and other hackers on the mailing
8
+ list for ideas and suggestions that made this version possible.
9
+
10
+ Most notable Og additions:
11
+
12
+ * Extremely clean source code. Better names are used thorougout.
13
+ Extra care was taken to make all features more orthogonal.
14
+
15
+ * Brand new relation mechanism. The 'enchanting' of entities
16
+ (managed classes) happens in multiple passes to be more
17
+ flexible. Totaly separated graph/metadata creation and serialization
18
+ code generation. The Graph metadata can be used for advanced
19
+ scaffolding, testing and more.
20
+
21
+ * Support for fully customizable primary keys. You are no longer
22
+ forced to use xxx_oid primary keys. Appart from the extra
23
+ flexibility this feature provides, this is an essential step
24
+ towards the planed 'reverse engineering' mode that will allow the
25
+ use of existing schemas with Og.
26
+
27
+ * More elegant inspection mechanism. Example:
28
+
29
+ Article.relation(:user) # => Og::BelongsTo(...)
30
+ Article.relations # => [...]
31
+ Article.properties # => [...]
32
+
33
+ * Joins_many relation, as an alias for one way, join table relations.
34
+
35
+ * Support for 'active' collections. Active collection are
36
+ synchronized with the backend Store and provide a more elegant
37
+ interface and the opportunity for 'session' caching:
38
+
39
+ article.comments << Comment.new
40
+
41
+ instead of
42
+
43
+ article.add_comment(Comment.new) # this is also allowed though.
44
+
45
+ p article.comments
46
+ p article.comments.size # the results of the first query is cached
47
+
48
+ * Eager relations.
49
+
50
+ comments = Article.comments(:include => User)
51
+
52
+ for comment in comments
53
+ p comment.user.name
54
+ end
55
+
56
+ Elegantly solves the N+1 query problem by using one join
57
+ query.
58
+
59
+ * No need for forward references when defining relations. Now,
60
+ the following code magically works:
61
+
62
+ class User
63
+ has_many Comment # works even though Comment is not defined!
64
+ end
65
+
66
+ class Comment
67
+ belongs_to User
68
+ end
69
+
70
+ * Use inflection where possible to infer missing configuration
71
+ options. For example
72
+
73
+ class Article
74
+ belongs_to User # infects relation name :user
75
+ ...
76
+
77
+ * New, lean and mean Store interface. The code needed to teach
78
+ Og how to serialize objects to backend store is dramatically
79
+ reduced. The new interface is SQL agnostic, so non SQL-RDBM's
80
+ stores are possible.
81
+
82
+ * SQL agnostic querying interface, compatible with non-sql
83
+ Stores. Here is an example:
84
+
85
+ Article.find(
86
+ :condition => 'hits > 2 AND rate > 3',
87
+ :order => 'title',
88
+ :offset => 30,
89
+ :limit => 10
90
+ )
91
+
92
+ * More elegant (and non-sql store compatible) way for selective
93
+ updates:
94
+
95
+ article.title = 'Changed'
96
+ article.hits += 1
97
+ article.update(:title, :hits)
98
+
99
+ * New, in-memory store that support all features. This is a pure
100
+ ruby solution useful for experimentation. It will also serve
101
+ as the base for the forthcoming madeleine Store implementation.
102
+
103
+ * Allow for multiple stores in one application. A great example,
104
+ mysql_to_psql is provided. This example uses Og's powerfull
105
+ features to automatically convert a Mysql database to a
106
+ PostgreSQL database. Database migration was never easier.
107
+
108
+ * Uses the excellent Facets utility collection to further
109
+ clenup and minimize the code.
110
+
111
+ * Managed classes or Entities should include the EntityMixin
112
+ or extend the Entity class. Example:
113
+
114
+ class Article < Entity
115
+ ..
116
+ end
117
+
118
+ class Article
119
+ include EntityMixin
120
+ end
121
+
122
+ This is done to avoid the Module module like in earlier
123
+ versions of Og. However, Og is can infer the need to include
124
+ the Managed mixin in typical cases:
125
+
126
+ class Article
127
+ property :title, String
128
+ # when a property is defined Og automatically converts the
129
+ # class to an Entity
130
+ end
131
+
132
+ class Article < AnExistingManagedEntity
133
+ # also includes the mixin
134
+ ...
135
+
136
+ class Article
137
+ include AModuleThatDefinesProperties
138
+ ...
139
+
140
+ * Improved support for og_delete interception.
141
+
142
+ * Support for nested transactions.
143
+
144
+ Check out the file test/og/tc_store.rb for a demonstration of
145
+ the new features.
146
+
147
+ And some Nitro additions:
148
+
149
+ * Integrated the Facets library, and started donating some Glue
150
+ code to this project.
151
+
152
+ * Integrated the Prototype object oriented javascript library.
153
+
154
+ * Included a preview implementation of the new tag library
155
+ system, called Elements. This is based on an original idea
156
+ by Dan Yoder. This feature is expected to change substantially
157
+ in the next version. In the meantime here is an example:
158
+
159
+ <Page>
160
+ Here is a <b>nice</b> page.
161
+ <br />
162
+ <Box>
163
+ This is #{variable}.
164
+ <?r if admin ?>
165
+ hello admin
166
+ <?r end ?>
167
+ </Box>
168
+ </Page>
169
+
170
+ The tags <Page> and <Box> automatically instantiate objects
171
+ of class Page and Box that handle the rendering. This is an
172
+ alternative to the XSLT templating system and can also be used
173
+ to implement some reusable components. The hierarchical structure
174
+ of the elements is available to each object to facilitate
175
+ advanced rendering tricks. Just like the XSLT shader the Elements
176
+ transformation is preapplied to the page to avoid the overhead
177
+ at runtime.
178
+
179
+ * Fixed many reported bugs.
180
+
181
+
182
+ == Version 0.16.0 was released on 16/04/2005.
2
183
 
3
184
  A snapshot of the latest developments. Many, many subtle improvements,
4
185
  new features and a major cleanup of the source code. Thanks to
5
186
  James Britt for significantly contributing to this release.
6
187
 
7
- Most notable attitions:
188
+ Most notable additions:
8
189
 
9
190
  * Aspect Oriented Programming support. This new system
10
191
  is used to reimplement features such as Controller filters,
data/examples/blog/run.rb CHANGED
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2005 Navel, all rights reserved.
3
- # $Id: run.rb 1 2005-04-11 11:04:30Z gmosx $
4
-
5
1
  require 'nitro'
6
2
  require 'og'
7
3
 
@@ -19,12 +15,11 @@ Nitro.run do |conf|
19
15
  :de => 'conf/locales/de.yml'
20
16
  )
21
17
 
22
- Og.connect(
23
- :adapter => 'psql',
24
- :database => 'blog',
18
+ Og.setup(
19
+ :store => 'psql',
20
+ :name => 'blog',
25
21
  :user => 'postgres',
26
- :password => 'navelrulez',
27
- :connection_count => 3
22
+ :password => 'navelrulez'
28
23
  )
29
24
 
30
25
  Rendering.shader = XSLTShader.new('src/xsl/style.xsl',
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2005 Navel, all rights reserved.
3
- # $Id: controller.rb 20 2005-04-15 15:18:36Z gmosx $
4
-
5
1
  require 'nitro/controller'
6
2
  require 'nitro/ui/pager'
7
3
  require 'nitro/localization'
@@ -34,7 +30,7 @@ class BlogController < Nitro::Controller
34
30
 
35
31
  def list_entry
36
32
  @pager = UI::Pager.new('entries', request, 3)
37
- @entries = BlogEntry.all("ORDER BY oid DESC #{@pager.sql_limit}")
33
+ @entries = BlogEntry.all(:order => 'oid DESC', :extra => @pager.sql_limit)
38
34
  @pager.set(BlogEntry.count)
39
35
  end
40
36
 
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: blog.rb 20 2005-04-15 15:18:36Z gmosx $
4
-
5
1
  require 'models/content'
6
2
 
7
3
  # Forward reference to the Comment definition.
@@ -24,7 +20,7 @@ end
24
20
 
25
21
  class BlogEntry
26
22
  include Common
27
- has_many :comments, Comment, :linkback => 'entry_oid'
23
+ has_many :comments, Comment, :foreign_name => 'entry'
28
24
  validate_value :title, :msg => 'Please provide a title'
29
25
  end
30
26
 
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: content.rb 23 2005-04-16 18:20:00Z gmosx $
4
-
5
1
  require 'nitro/markup'
6
2
 
7
3
  # The foundamental Content Unit.
@@ -20,4 +16,3 @@ module CreateTime
20
16
  pre "@create_time = @update_time = Time.now", :on => :og_insert
21
17
  pre "@update_time = Time.now", :on => :og_update
22
18
  end
23
-
@@ -2,11 +2,8 @@
2
2
 
3
3
  <root xmlns:x="http://www.navel.gr/xml/shader.xsd">
4
4
 
5
- <h2>#{@entry.comments_count} Comments:</h2>
6
- <?r
7
- if comments = @entry.comments
8
- for comment in comments
9
- ?>
5
+ <h2>#{@entry.comments.size} Comments:</h2>
6
+ <?r if @entry.comments.each do |comment| ?>
10
7
  <div class="comment">
11
8
  #{comment.body}
12
9
  <div class="footer">
@@ -16,12 +13,10 @@ if comments = @entry.comments
16
13
  <?r end ?>
17
14
  </div>
18
15
  </div>
19
- <?r
20
- end
21
- else
22
- ?>
23
- no comments.
24
- <?r end ?>
16
+ <?r end.empty? then ?>
17
+ no comments.
18
+ <?r end ?>
19
+
25
20
  <form id="new_comment" action="new_comment" method="post">
26
21
  <input type="hidden" name="entry_oid" value="#{@entry.oid}" />
27
22
  <p>
@@ -14,8 +14,8 @@
14
14
  <h3 class="title">#{entry.title}</h3>
15
15
  #{entry.body}
16
16
  <div class="footer">
17
- [[posted by]] #{entry.author} at <a href="#{entry.view_uri}">#{entry.create_time.strftime('%R %p')}</a> |
18
- <a href="#{entry.view_uri}#comments">#{entry.comments_count} comments</a>.
17
+ [[posted by]] #{entry.author} at <a href="#{entry.to_href}">#{entry.create_time.strftime('%R %p')}</a> |
18
+ <a href="#{entry.to_href}#comments">#{entry.comments.size} comments</a>.
19
19
  <?r if session[:owner] ?>
20
20
  [<a href="del_entry?oid=#{entry.oid}">del</a>]
21
21
  <?r end ?>
@@ -47,4 +47,3 @@
47
47
  </x:cell>
48
48
 
49
49
  </x:page>
50
-
@@ -5,7 +5,7 @@
5
5
  <?r if @entries ?>
6
6
  <ul>
7
7
  <?r for entry in @entries ?>
8
- <li><a href="#{entry.view_uri}">#{entry.title}</a></li>
8
+ <li><a href="#{entry.to_href}">#{entry.title}</a></li>
9
9
  <?r end ?>
10
10
  </ul>
11
11
  <?r else ?>
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: controller.rb 21 2005-04-15 15:41:20Z gmosx $
4
-
5
1
  require 'nitro/controller'
6
2
  require 'nitro/builders/rss'
7
3
  require 'nitro/ui/pager'
@@ -23,7 +19,7 @@ class BlogController < Nitro::Controller
23
19
 
24
20
  def list_entry
25
21
  @pager = UI::Pager.new('entries', request, 3)
26
- @entries = BlogEntry.all("ORDER BY oid DESC #{@pager.sql_limit}")
22
+ @entries = BlogEntry.all(:order => 'oid DESC', :extra => @pager.sql_limit)
27
23
  @pager.set(BlogEntry.count)
28
24
  end
29
25
 
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: model.rb 1 2005-04-11 11:04:30Z gmosx $
4
-
5
1
  require 'lib/content'
6
2
 
7
3
  # The models used in the Blog part.
@@ -18,7 +14,7 @@ module Common
18
14
  include BaseContent
19
15
  include CreateTime
20
16
 
21
- prop_accessor :author, String
17
+ property :author, String
22
18
  validate_value :body
23
19
  end
24
20
 
@@ -26,7 +22,7 @@ end
26
22
 
27
23
  class BlogEntry
28
24
  include Common
29
- has_many :comments, Comment, :linkback => 'entry_oid'
25
+ has_many :comments, Comment, :foreign_name => 'entry'
30
26
  validate_value :title, :msg => 'Please provide a title'
31
27
  end
32
28
 
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: blog.rb 1 2005-04-11 11:04:30Z gmosx $
4
-
5
1
  # A simple blog to demonstrate the power of Nitro.
6
2
 
7
3
  class Blog
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004 Navel, all rights reserved.
3
- # $Id: content.rb 1 2005-04-11 11:04:30Z gmosx $
4
-
5
1
  require 'nitro/markup'
6
2
 
7
3
  # The foundamental Content Unit.
@@ -9,15 +5,15 @@ require 'nitro/markup'
9
5
  module BaseContent
10
6
  include Nitro::Markup
11
7
 
12
- prop_accessor :title, String
13
- prop_accessor :body, String, :markup => true, :ui => :textarea
8
+ property :title, String
9
+ property :body, String, :markup => true, :ui => :textarea
14
10
  end
15
11
 
16
12
  # CreateTime mixin.
17
13
 
18
14
  module CreateTime
19
- prop_accessor :create_time, Time
20
- prop_accessor :update_time, Time
15
+ property :create_time, Time
16
+ property :update_time, Time
21
17
 
22
18
  def og_pre_insert(conn)
23
19
  @create_time = @update_time = Time.now
@@ -35,9 +31,9 @@ end
35
31
 
36
32
  module Content
37
33
  include BaseContent
38
- prop_accessor :name, String
39
- prop_accessor :ctime, Time
40
- prop_accessor :mtime, Time
34
+ property :name, String
35
+ property :ctime, Time
36
+ property :mtime, Time
41
37
 
42
38
  def initialize(*args)
43
39
  @ctime = @mtime = Time.now
@@ -2,11 +2,8 @@
2
2
 
3
3
  <root xmlns:x="http://www.navel.gr/xml/shader.xsd">
4
4
 
5
- <h2>#{@entry.comments_count} Comments:</h2>
6
- <?r
7
- if comments = @entry.comments
8
- for comment in comments
9
- ?>
5
+ <h2>#{@entry.comments.size} Comments:</h2>
6
+ <?r if @entry.comments.each do |comment| ?>
10
7
  <div class="comment">
11
8
  #{comment.body}
12
9
  <div class="footer">
@@ -16,12 +13,10 @@ if comments = @entry.comments
16
13
  <?r end ?>
17
14
  </div>
18
15
  </div>
19
- <?r
20
- end
21
- else
22
- ?>
23
- no comments.
24
- <?r end ?>
16
+ <?r end.empty? then ?>
17
+ no comments.
18
+ <?r end ?>
19
+
25
20
  <form id="new_comment" action="new_comment" method="post">
26
21
  <input type="hidden" name="entry_oid" value="#{@entry.oid}" />
27
22
  <p>
@@ -12,8 +12,8 @@
12
12
  <h3 class="title">#{entry.title}</h3>
13
13
  #{entry.body}
14
14
  <div class="footer">
15
- [[posted by]] #{entry.author} at <a href="#{entry.view_uri}">#{entry.create_time.strftime('%R %p')}</a> |
16
- <a href="#{entry.view_uri}#comments">#{entry.comments_count} comments</a>.
15
+ [[posted by]] #{entry.author} at <a href="#{entry.to_href}">#{entry.create_time.strftime('%R %p')}</a> |
16
+ <a href="#{entry.to_href}#comments">#{entry.comments.size} comments</a>.
17
17
  <?r if session[:owner] ?>
18
18
  [<a href="del_entry?oid=#{entry.oid}">del</a>]
19
19
  <?r end ?>
@@ -5,7 +5,7 @@
5
5
  <?r if @entries ?>
6
6
  <ul>
7
7
  <?r for entry in @entries ?>
8
- <li><a href="#{entry.view_uri}">#{entry.title}</a></li>
8
+ <li><a href="#{entry.to_href}">#{entry.title}</a></li>
9
9
  <?r end ?>
10
10
  </ul>
11
11
  <?r else ?>
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: run.rb 21 2005-04-15 15:41:20Z gmosx $
4
-
5
1
  require 'nitro'
6
2
  require 'og'
7
3
 
@@ -18,13 +14,10 @@ Nitro.run do |conf|
18
14
 
19
15
  Og.connect(
20
16
  # :address => 'localhost',
21
- :adapter => 'mysql',
22
- # :backend => 'psql',
23
- :database => 'blog',
17
+ :store => 'mysql',
18
+ :name => 'blog',
24
19
  :user => 'root',
25
20
  :password => 'navelrulez'
26
- # :user => 'postgres',
27
- # :password => 'navelrulez',
28
21
  )
29
22
 
30
23
  conf.dispatcher = Dispatcher.new(
@@ -1,7 +1,7 @@
1
1
  # * George Moschovitis <gm@navel.gr>
2
2
  # * James Britt <james_b@neurogami.com>
3
3
  # (c) 2005 Navel, all rights reserved.
4
- # $Id: cgi.rb 1 2005-04-11 11:04:30Z gmosx $
4
+ # $Id: cgi.rb 41 2005-05-05 14:56:40Z gmosx $
5
5
 
6
6
  require 'cgi'
7
7
  require 'stringio'
@@ -34,11 +34,11 @@ class Cgi
34
34
  CgiUtils.parse_cookies(context)
35
35
 
36
36
  # gmosx, TODO: move this into a filter.
37
- Og.db.get_connection if defined?(Og) and Og.db
37
+ # Og.db.get_connection if defined?(Og) and Og.db
38
38
 
39
- context.render( context.path)
39
+ context.render(context.path)
40
40
 
41
- Og.db.put_connection if defined?(Og) and Og.db
41
+ # Og.db.put_connection if defined?(Og) and Og.db
42
42
 
43
43
  cgi.print(CgiUtils.response_headers(context))
44
44
  cgi.print(context.out)
@@ -111,11 +111,10 @@ class CgiUtils
111
111
  # to arrays.
112
112
 
113
113
  def self.parse_query_string(query_string)
114
-
115
- # gmosx, THINK: better return nil here?
116
- return {} if (query_string.nil? or query_string.empty?)
117
-
118
114
  params = {}
115
+
116
+ # gmosx, THINK: better return nil here?
117
+ return params if (query_string.nil? or query_string.empty?)
119
118
 
120
119
  query_string.split(/[&;]/).each do |p|
121
120
  key, val = p.split('=')