nitro 0.5.0 → 0.6.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 (50) hide show
  1. data/ChangeLog +4 -2201
  2. data/ChangeLog.1 +2344 -0
  3. data/README +4 -4
  4. data/RELEASES +22 -0
  5. data/bin/new_app.rb +17 -3
  6. data/bin/proto/README +34 -0
  7. data/bin/proto/apache.conf +1 -0
  8. data/bin/proto/app.rb +20 -0
  9. data/bin/proto/config.rb +77 -0
  10. data/bin/proto/root/index.xhtml +43 -0
  11. data/bin/proto/root/style.css +218 -0
  12. data/bin/proto/root/style.xsl +130 -0
  13. data/examples/blog/app.rb +1 -2
  14. data/examples/blog/config.rb +20 -18
  15. data/examples/blog/env.rb +22 -0
  16. data/examples/blog/lib/blog.rb +43 -15
  17. data/examples/blog/root/entry_form.xhtml +1 -1
  18. data/examples/blog/root/index.xhtml +5 -0
  19. data/examples/blog/root/login.xhtml +2 -0
  20. data/examples/blog/root/m/nitro.gif +0 -0
  21. data/examples/blog/root/style.css +83 -0
  22. data/examples/blog/root/style.xsl +7 -3
  23. data/examples/og/run.rb +41 -2
  24. data/examples/tiny/app.rb +1 -2
  25. data/examples/tiny/root/index.xhtml +8 -2
  26. data/examples/tiny/root/nitro-small.png +0 -0
  27. data/lib/glue.rb +1 -1
  28. data/lib/glue/property.rb +9 -3
  29. data/lib/nitro/application.rb +18 -1
  30. data/lib/nitro/builders/form.rb +84 -0
  31. data/lib/nitro/builders/rss.rb +4 -5
  32. data/lib/nitro/builders/table.rb +23 -0
  33. data/lib/nitro/filters.rb +157 -0
  34. data/lib/nitro/l10n.rb +11 -3
  35. data/lib/nitro/scaffold.rb +1 -1
  36. data/lib/nitro/server/render.rb +101 -4
  37. data/lib/nitro/server/shaders.rb +17 -5
  38. data/lib/nitro/service.rb +5 -5
  39. data/lib/nitro/ui/pager.rb +35 -11
  40. data/lib/nitro/version.rb +2 -2
  41. data/lib/og.rb +25 -17
  42. data/lib/og/backend.rb +15 -3
  43. data/lib/og/backends/mysql.rb +30 -3
  44. data/lib/og/backends/psql.rb +44 -3
  45. data/lib/og/meta.rb +117 -10
  46. data/lib/og/version.rb +1 -1
  47. data/lib/xsl/base.xsl +75 -6
  48. data/lib/xsl/ui.xsl +51 -0
  49. data/test/nitro/ui/tc_pager.rb +6 -0
  50. metadata +23 -2
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = Nitro 0.5.0
1
+ = Nitro 0.6.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
@@ -116,7 +116,7 @@ A short summary of the major features:
116
116
 
117
117
  * Support for 'nice' urls.
118
118
 
119
- Experimental.
119
+ Allows
120
120
 
121
121
  * Simple events manager.
122
122
 
@@ -145,11 +145,11 @@ A short summary of the major features:
145
145
 
146
146
  Nitro is distributed with a collection of usefull UI components
147
147
  to make form based application development easier (for example
148
- an efficient, ndb-aware Pager component).
148
+ an efficient, database-aware Pager component).
149
149
 
150
150
  * Path overloading
151
151
 
152
- Experimental
152
+ Experimental.
153
153
 
154
154
  * Localization
155
155
 
data/RELEASES CHANGED
@@ -1,3 +1,25 @@
1
+ == Version 0.6 was released on 13/12/2004.
2
+
3
+ This is a preview release, the api for the new features is not
4
+ finalized. This early release gives other developers to offer suggestions
5
+ on the final form of those features.
6
+
7
+ Most notable additions:
8
+
9
+ * Og many_to_many relations with auto generation of the join table.
10
+ * Og has_one relation.
11
+ * PHP-style nested output buffering.
12
+ * Rails-style Filters.
13
+ * autoreload services.
14
+ * complile time evaluation of ruby code in templates.
15
+ * improved pager ui.
16
+ * initial version of FormBuilder.
17
+ * initial version of new_app wizard.
18
+ * Improved Blog example.
19
+
20
+ and... the nitro logo :)
21
+
22
+
1
23
  == Version 0.5 was released on 23/11/2004.
2
24
 
3
25
  Many new features:
data/bin/new_app.rb CHANGED
@@ -1,3 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+
1
3
  # = New Project Wizzard
2
4
  #
3
5
  # Creates the directory structure for a new project.
@@ -7,12 +9,24 @@
7
9
  # George Moschovitis <gm@navel.gr>
8
10
  #
9
11
  # (c) 2004 Navel, all rights reserved.
10
- # $Id: new_app.rb 112 2004-10-27 10:59:55Z gmosx $
12
+ # $Id: new_app.rb 188 2004-12-10 14:14:17Z gmosx $
11
13
  #++
12
14
 
13
- base_dir = ARGV[0]
15
+ bin_dir = File.dirname(__FILE__)
16
+
17
+ if base_dir = ARGV[0]
14
18
 
15
19
  %x{
16
- mkdir root;
20
+ cp -R #{bin_dir}/proto #{base_dir}
21
+ find #{base_dir} | grep "\.svn$" | xargs rm -rf
22
+ }
23
+
24
+ else
25
+
26
+ puts %{
27
+ USAGE:
28
+ new_app base_dir
17
29
  }
18
30
 
31
+ end
32
+
data/bin/proto/README ADDED
@@ -0,0 +1,34 @@
1
+ = Your application
2
+
3
+ Here comes the README file for your application.
4
+
5
+ == Configuration
6
+
7
+ Edit the file conf/webapp.rb as needed.
8
+
9
+ By default this skeleton app uses the PostgreSQL backend.
10
+ If you want to use a different backend dont forget to
11
+ change it for the DEBUG and LIVE configurations.
12
+
13
+ == Run
14
+
15
+ Exec the following command:
16
+
17
+ ruby app.rb --start
18
+
19
+ then point your browser to:
20
+
21
+ http://127.0.0.1:8080
22
+
23
+ (if you want to change the server address/port, edit the config.rb
24
+ file)
25
+
26
+ == Discussion
27
+
28
+ If you want to modify the skeleton app it is a nice idea to switch
29
+ to debug mode. Edit the following line in the file app.rb:
30
+
31
+ $DBG = true
32
+
33
+ In debug mode the view files (xhtml/xsl/etc) are automatically
34
+ reloaded.
@@ -0,0 +1 @@
1
+ # coming soon :)
data/bin/proto/app.rb ADDED
@@ -0,0 +1,20 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ # = YourApp
4
+ #
5
+ # A skeleton application.
6
+ #
7
+ # code:
8
+ # * George Moschovitis <gm@navel.gr>
9
+ #
10
+ # (c) 2004 Navel, all rights reserved.
11
+ # $Id: app.rb 188 2004-12-10 14:14:17Z gmosx $
12
+
13
+ # set to true for DEBUG mode.
14
+ $DBG = true
15
+
16
+ $LOAD_PATH.unshift "../nitro/lib"
17
+
18
+ require "config"
19
+
20
+ $app = N::WebrickServer.new.exec()
@@ -0,0 +1,77 @@
1
+ # = YourApp Configuration
2
+ #
3
+ # You can find additional configuration variables in
4
+ # lib/n/config.rb. Just copy the variables you want to
5
+ # change in this file
6
+ #
7
+ # WARNING: if you want to change the backend dont forget
8
+ # to change it in the DEBUG and LIVE configurations.
9
+ #
10
+ # code:
11
+ # * George Moschovitis <gm@navel.gr>
12
+ #
13
+ # (c) 2004 Navel, all rights reserved.
14
+ # $Id: config.rb 188 2004-12-10 14:14:17Z gmosx $
15
+
16
+ require "nitro"
17
+ require "glue/logger"
18
+ require "nitro/config"
19
+
20
+ require "og"
21
+ require "nitro/l10n"
22
+ require "nitro/events"
23
+ require "glue/mixins"
24
+ require "nitro/sitemap"
25
+
26
+ require "glue/number"
27
+ require "glue/string"
28
+ require "glue/array"
29
+ require "glue/hash"
30
+ require "nitro/html"
31
+
32
+ require "nitro/server/webrick"
33
+ require "nitro/server/shaders"
34
+
35
+ $name = "Your Application"
36
+
37
+ $srv_address = $appsrv_address = "127.0.0.1"
38
+ $srv_url = "http://#$srv_address:#$srv_port"
39
+
40
+ if $DBG # DEBUG mode
41
+
42
+ $og = Og::Database.new(
43
+ :address => "localhost",
44
+ # :backend => "mysql",
45
+ :backend => "psql",
46
+ :database => "blog",
47
+ :user => "postgres",
48
+ :password => "navelrulez",
49
+ :connection_count => 3
50
+ )
51
+
52
+ # dont compress when debuging, more readable code.
53
+ $shader = N::XSLTShader.new("#$root_dir/style.xsl",
54
+ N::RubyShader.new
55
+ )
56
+
57
+ else # LIVE mode
58
+
59
+ $appsrv_port = 8080
60
+
61
+ $og = Og::Database.new(
62
+ :address => "localhost",
63
+ # :backend => "mysql",
64
+ :backend => "psql",
65
+ :database => "blog",
66
+ :user => "postgres",
67
+ :password => "navelrulez",
68
+ :connection_count => 20
69
+ )
70
+
71
+ $shader = N::XSLTShader.new("#$root_dir/style.xsl",
72
+ N::RubyShader.new(
73
+ N::CompressShader.new
74
+ )
75
+ )
76
+
77
+ end
@@ -0,0 +1,43 @@
1
+ <?xml version="1.0"?>
2
+
3
+ <x:page xmlns:x="http://www.navel.gr/xml/shader.xsd">
4
+
5
+ <x:cell id="main">
6
+
7
+ <?r
8
+ if @entries
9
+ for entry in @entries
10
+ ?>
11
+ <div class="entry">
12
+ <h2 class="date">#{entry.create_time.strftime('%B %e, %G')}</h2>
13
+ <div class="post">
14
+ <h3 class="title">#{entry.title}</h3>
15
+ #{entry.body}
16
+ <div class="footer">
17
+ posted by #{entry.author} at <a href="view_entry?oid=#{entry.oid}">#{entry.create_time.strftime('%R %p')}</a> |
18
+ <a href="view_entry?oid=#{entry.oid}#comments">#{entry.comments_count} comments</a>.
19
+ <?r if session['owner'] ?>
20
+ [<a href="del_entry?oid=#{entry.oid}">del</a>]
21
+ <?r end ?>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ <?r
26
+ end
27
+ else
28
+ ?>
29
+ no entries
30
+ <?r end ?>
31
+
32
+ <?r if session['owner'] ?>
33
+ <include href="entry_form" />
34
+ <?r end ?>
35
+
36
+ </x:cell>
37
+
38
+ <x:cell id="side">
39
+ <include href="recent_posts" />
40
+ </x:cell>
41
+
42
+ </x:page>
43
+
@@ -0,0 +1,218 @@
1
+ body {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-family: Verdana, sans-serif;
5
+ font-size: small;
6
+ color: #333;
7
+ background: #e0e0e0;
8
+ }
9
+
10
+ a:link {
11
+ color: #69c;
12
+ }
13
+
14
+ a:visited {
15
+ color: #666699;
16
+ }
17
+
18
+ a:hover {
19
+ color: #693;
20
+ }
21
+
22
+ a:active {
23
+ color: #cc3333;
24
+ text-decoration: none;
25
+ }
26
+
27
+ input, textarea {
28
+ font-family: Verdana, sans-serif;
29
+ font-size: small;
30
+ }
31
+
32
+ #page {
33
+ position: relative; top: 50%; left: 50%;
34
+ margin: 0px; margin-left: -400px;
35
+ width: 847px;
36
+ background: url(m/page_bg.gif) repeat-y;
37
+ }
38
+
39
+ #header {
40
+ margin: 0px;
41
+ color: #fff;
42
+ font-family: "Lucida Grande", "Trebuchet MS";
43
+ background: url(m/header_bg.gif) no-repeat top left;
44
+ }
45
+
46
+ #header h1 {
47
+ margin: 0px;
48
+ padding: 45px 60px 50px 160px;
49
+ background: url(m/h1_bg.gif) no-repeat bottom left;
50
+ }
51
+
52
+ #footer {
53
+ height: 40px;
54
+ color: #fff;
55
+ font-size: 80%;
56
+ background: url(m/footer_bg.gif) repeat-y;
57
+ padding-top: 15px; padding-left: 90px;
58
+ }
59
+
60
+ #footer a {
61
+ color: #fff;
62
+ }
63
+
64
+ #footer a:hover {
65
+ color: #fc0;
66
+ }
67
+
68
+ .main {
69
+ float: left;
70
+ margin: 10px; margin-left: 60px;
71
+ padding-left: 2px;
72
+ margin-bottom: 20px;
73
+ width: 460px;
74
+ }
75
+
76
+ .main li {
77
+ list-style: none;
78
+ padding-left: 14px;
79
+ margin-bottom: 3px;
80
+ background: url(m/obull.gif) no-repeat 0 6px;
81
+ }
82
+
83
+ .side {
84
+ color: #999;
85
+ margin: 0 41px 0px 547px;
86
+ padding-top: 25px; padding-left: 20px; padding-right: 20px;
87
+ font-size: 85%;
88
+ line-height: 1.4em;
89
+ background: url(m/sidebar_bg.gif) no-repeat 0 0;
90
+ }
91
+
92
+ .side h2 {
93
+ margin: 0 0 0 0;
94
+ padding: 25px 0 0 30px;
95
+ color: #666;
96
+ height: 32px !important;
97
+ height /**/:57px; /* for IE5/Win */
98
+ font-family: "Lucida Grande", "Trebuchet MS";
99
+ font-size: 130%;
100
+ background: url(m/side_title_bg.gif) no-repeat 0px 15px;
101
+ }
102
+
103
+ .side ul {
104
+ margin-top: 0px;
105
+ padding: 0px;
106
+ }
107
+
108
+ .side li {
109
+ list-style: none;
110
+ margin-left: 0px; margin-bottom: 3px;
111
+ padding-left: 14px;
112
+ background: url(m/gbull.gif) no-repeat 0 6px;
113
+ }
114
+
115
+ .entry {
116
+ border-bottom: 1px solid #eee;
117
+ margin-top: 15px; margin-bottom: 15px;
118
+ }
119
+
120
+ .full-entry {
121
+ margin-top: 15px; margin-bottom: 15px;
122
+ }
123
+
124
+ h2.date {
125
+ margin-top: 0;
126
+ padding-left: 14px;
127
+ font-size: 90%;
128
+ color: #f93;
129
+ background: url(m/down.gif) no-repeat 0 50%;
130
+ }
131
+
132
+ .post {
133
+ padding-left: 15px;
134
+ padding-bottom: 15px;
135
+ }
136
+
137
+ .post h3.title {
138
+ margin-top: 0;
139
+ font-family: "Lucida Grande", "Trebuchet MS";
140
+ font-size: 130%;
141
+ letter-spacing: -1px;
142
+ color: #f63;
143
+ }
144
+
145
+ .post .footer {
146
+ margin: 0; margin-top: 10px;
147
+ padding: 0 0 0 14px;
148
+ font-size: 88%;
149
+ color: #999;
150
+ background: url(m/grbull.gif) no-repeat 0 6px;
151
+ }
152
+
153
+ #comments {
154
+ margin-top: 30px;
155
+ padding-top: 10px;
156
+ font-size: 85%;
157
+ line-height: 1.5em;
158
+ color: #666;
159
+ background: #eee url(m/comments_curve.gif) no-repeat top left;
160
+ }
161
+
162
+ #comments h2 {
163
+ margin: 20px 0 15px 0;
164
+ padding: 8px 0 0 40px;
165
+ font-family: "Lucida Grande", "Trebuchet MS";
166
+ font-size: 130%;
167
+ color: #666;
168
+ background: url(m/bubbles.gif) no-repeat 10px 0;
169
+ height: 29px !important; /* for most browsers */
170
+ height /**/:37px; /* for IE5/Win */
171
+ }
172
+
173
+ #comments form {
174
+ margin: 10px;
175
+ padding-bottom: 10px;
176
+ }
177
+
178
+ .comment {
179
+ padding: 10px;
180
+ border-bottom: 1px solid #ddd;
181
+ }
182
+
183
+ .comment .footer {
184
+ margin: 4px 0 0 0;
185
+ padding: 0 0 0 60px;
186
+ color: #999;
187
+ background: url(m/garrow.gif) no-repeat 44px 2px;
188
+ }
189
+
190
+ .error {
191
+ color: #f00;
192
+ }
193
+
194
+ .clear {
195
+ clear: both;
196
+ height: 0px;
197
+ line-height: 0px;
198
+ font-size: 0px;
199
+ overflow: hidden;
200
+ background-color: #f00;
201
+ }
202
+
203
+ #rendering-errors {
204
+ float: left;
205
+ border: 1px solid red;
206
+ background: white;
207
+ padding: 10px;
208
+ margin: 20px;
209
+ }
210
+
211
+ .rss li {
212
+ list-style: none;
213
+ padding-left: 34px; padding-top: 3px;
214
+ margin-bottom: 3px;
215
+ height: 18px;
216
+ background: url(m/rss.gif) no-repeat 0 6px;
217
+ }
218
+