nitro 0.12.0 → 0.13.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 (193) hide show
  1. data/{ChangeLog → CHANGELOG} +137 -0
  2. data/INSTALL +1 -2
  3. data/README +1 -1
  4. data/Rakefile +10 -61
  5. data/benchmark/{nitro/bench.rb → bench.rb} +1 -1
  6. data/benchmark/{nitro/simple-webrick-n-200.txt → simple-webrick-n-200.txt} +0 -0
  7. data/benchmark/{nitro/static-webrick-n-200.txt → static-webrick-n-200.txt} +0 -0
  8. data/benchmark/{nitro/tiny-lhttpd-n-200-c-5.txt → tiny-lhttpd-n-200-c-5.txt} +0 -0
  9. data/benchmark/{nitro/tiny-webrick-n-200-c-5.txt → tiny-webrick-n-200-c-5.txt} +0 -0
  10. data/benchmark/{nitro/tiny-webrick-n-200.txt → tiny-webrick-n-200.txt} +0 -0
  11. data/benchmark/{nitro/tiny2-webrick-n-200.txt → tiny2-webrick-n-200.txt} +0 -0
  12. data/doc/{ChangeLog.1 → CHANGELOG.1} +0 -0
  13. data/{RELEASES → doc/RELEASES} +46 -0
  14. data/doc/faq.txt +7 -0
  15. data/examples/README.windows +1 -1
  16. data/examples/ajax/controller.rb +21 -0
  17. data/examples/ajax/public/index.xhtml +70 -0
  18. data/examples/ajax/public/js/ajax.js +64 -0
  19. data/examples/ajax/run.rb +16 -0
  20. data/examples/blog/README +6 -3
  21. data/examples/blog/conf/apache.conf +2 -2
  22. data/examples/blog/conf/lhttpd.conf +2 -2
  23. data/examples/blog/log/apache.error_log +777 -0
  24. data/examples/blog/{root → public}/base.xsl +0 -0
  25. data/examples/blog/{root → public}/fcgi.rb +0 -0
  26. data/examples/blog/{root → public}/m/bubbles.gif +0 -0
  27. data/examples/blog/{root → public}/m/comments_curve.gif +0 -0
  28. data/examples/blog/{root → public}/m/down.gif +0 -0
  29. data/examples/blog/{root → public}/m/footer_bg.gif +0 -0
  30. data/examples/blog/{root → public}/m/garrow.gif +0 -0
  31. data/examples/blog/{root → public}/m/gbull.gif +0 -0
  32. data/examples/blog/{root → public}/m/grbull.gif +0 -0
  33. data/examples/blog/{root → public}/m/h1_bg.gif +0 -0
  34. data/examples/blog/{root → public}/m/header_bg.gif +0 -0
  35. data/examples/blog/{root → public}/m/nitro.gif +0 -0
  36. data/examples/blog/{root → public}/m/obull.gif +0 -0
  37. data/examples/blog/{root → public}/m/page_bg.gif +0 -0
  38. data/examples/blog/{root → public}/m/rss.gif +0 -0
  39. data/examples/blog/{root → public}/m/side_title_bg.gif +0 -0
  40. data/examples/blog/{root → public}/m/sidebar_bg.gif +0 -0
  41. data/examples/{no_xsl_blog/root → blog/public}/style.css +6 -0
  42. data/examples/blog/run.rb +10 -12
  43. data/examples/blog/{lib → src}/blog.rb +3 -3
  44. data/examples/blog/{lib/blog → src}/controller.rb +13 -2
  45. data/examples/blog/src/mailer.rb +23 -0
  46. data/examples/blog/{lib/blog/model.rb → src/models/blog.rb} +4 -7
  47. data/examples/blog/src/models/content.rb +52 -0
  48. data/examples/blog/src/views/blog_entry_email.xhtml +16 -0
  49. data/examples/blog/{root → src/views}/comments.xhtml +0 -0
  50. data/examples/blog/{root → src/views}/entry_form.xhtml +0 -0
  51. data/examples/blog/{root → src/views}/error.xhtml +0 -0
  52. data/examples/blog/{root → src/views}/index.xhtml +0 -0
  53. data/examples/blog/{root → src/views}/login.xhtml +0 -0
  54. data/examples/blog/{root → src/views}/recent_posts.xhtml +0 -0
  55. data/examples/blog/{root → src/views}/view_entry.xhtml +8 -0
  56. data/examples/blog/{root → src/views}/view_entry.xml +0 -0
  57. data/examples/blog/src/xsl/base.xsl +153 -0
  58. data/examples/blog/{root → src/xsl}/style.xsl +2 -2
  59. data/examples/no_xsl_blog/README +5 -1
  60. data/examples/no_xsl_blog/conf/apache.conf +2 -2
  61. data/examples/no_xsl_blog/conf/lhttpd.conf +2 -2
  62. data/examples/no_xsl_blog/lib/blog/model.rb +1 -1
  63. data/{lib/parts → examples/no_xsl_blog/lib}/content.rb +1 -11
  64. data/examples/no_xsl_blog/log/apache.error_log +405 -0
  65. data/examples/no_xsl_blog/{root → public}/comments.xhtml +0 -0
  66. data/examples/no_xsl_blog/{root → public}/entry_form.xhtml +0 -0
  67. data/examples/no_xsl_blog/{root → public}/fcgi.rb +0 -0
  68. data/examples/no_xsl_blog/{root → public}/index.xhtml +0 -0
  69. data/examples/no_xsl_blog/{root → public}/login.xhtml +0 -0
  70. data/examples/no_xsl_blog/{root → public}/m/bubbles.gif +0 -0
  71. data/examples/no_xsl_blog/{root → public}/m/comments_curve.gif +0 -0
  72. data/examples/no_xsl_blog/{root → public}/m/down.gif +0 -0
  73. data/examples/no_xsl_blog/{root → public}/m/footer_bg.gif +0 -0
  74. data/examples/no_xsl_blog/{root → public}/m/garrow.gif +0 -0
  75. data/examples/no_xsl_blog/{root → public}/m/gbull.gif +0 -0
  76. data/examples/no_xsl_blog/{root → public}/m/grbull.gif +0 -0
  77. data/examples/no_xsl_blog/{root → public}/m/h1_bg.gif +0 -0
  78. data/examples/no_xsl_blog/{root → public}/m/header_bg.gif +0 -0
  79. data/examples/no_xsl_blog/{root → public}/m/nitro.gif +0 -0
  80. data/examples/no_xsl_blog/{root → public}/m/obull.gif +0 -0
  81. data/examples/no_xsl_blog/{root → public}/m/page_bg.gif +0 -0
  82. data/examples/no_xsl_blog/{root → public}/m/rss.gif +0 -0
  83. data/examples/no_xsl_blog/{root → public}/m/side_title_bg.gif +0 -0
  84. data/examples/no_xsl_blog/{root → public}/m/sidebar_bg.gif +0 -0
  85. data/examples/no_xsl_blog/{root → public}/recent_posts.xhtml +0 -0
  86. data/examples/{blog/root → no_xsl_blog/public}/style.css +0 -0
  87. data/examples/no_xsl_blog/{root → public}/view_entry.xhtml +0 -0
  88. data/examples/no_xsl_blog/{root → public}/view_entry.xml +0 -0
  89. data/examples/tiny/conf/apache.conf +2 -2
  90. data/examples/tiny/log/apache.error_log +100 -0
  91. data/examples/tiny/{root → public}/fcgi.rb +0 -0
  92. data/examples/tiny/{root → public}/include.xhtml +0 -0
  93. data/examples/tiny/{root → public}/index.xhtml +0 -0
  94. data/{bin/proto/root/m → examples/tiny/public}/nitro.png +0 -0
  95. data/examples/tiny/{root → public}/upload.xhtml +0 -0
  96. data/examples/tiny/run.rb +1 -2
  97. data/examples/why_wiki/wiki.yml +1 -0
  98. data/install.rb +5 -2
  99. data/lib/nitro.rb +2 -6
  100. data/lib/nitro/adapters/fastcgi.rb +2 -2
  101. data/lib/nitro/adapters/webrick.rb +4 -4
  102. data/lib/nitro/conf.rb +5 -2
  103. data/lib/nitro/controller.rb +2 -2
  104. data/lib/nitro/dispatcher.rb +19 -8
  105. data/lib/nitro/mail.rb +252 -8
  106. data/lib/nitro/render.rb +24 -21
  107. data/lib/nitro/runner.rb +1 -1
  108. data/lib/nitro/scaffold.rb +2 -5
  109. data/lib/nitro/simple.rb +2 -1
  110. data/lib/nitro/template.rb +42 -2
  111. data/test/nitro/tc_controller.rb +9 -4
  112. data/test/nitro/tc_dispatcher.rb +4 -6
  113. data/test/nitro/tc_mail.rb +95 -0
  114. data/test/{root → public}/blog/list.xhtml +0 -0
  115. data/test/public/dummy_mailer/registration.xhtml +5 -0
  116. data/vendor/README +0 -1
  117. metadata +136 -181
  118. data/benchmark/og/bench.rb +0 -75
  119. data/benchmark/og/sqlite-no-prepare.1.txt +0 -13
  120. data/benchmark/og/sqlite-no-prepare.2.txt +0 -13
  121. data/benchmark/og/sqlite-prepare.1.txt +0 -13
  122. data/benchmark/og/sqlite-prepare.2.txt +0 -13
  123. data/bin/proto/README +0 -34
  124. data/bin/proto/conf/apache.conf +0 -1
  125. data/bin/proto/conf/app.conf.rb +0 -14
  126. data/bin/proto/conf/lhttpd.conf +0 -236
  127. data/bin/proto/ctl +0 -4
  128. data/bin/proto/lib/README +0 -5
  129. data/bin/proto/log/README +0 -3
  130. data/bin/proto/root/fcgi.rb +0 -6
  131. data/bin/proto/root/index.xhtml +0 -69
  132. data/bin/proto/root/style.css +0 -152
  133. data/bin/proto/root/style.xsl +0 -99
  134. data/doc/og_config.txt +0 -35
  135. data/doc/og_tutorial.txt +0 -595
  136. data/examples/og/README +0 -11
  137. data/examples/og/mock_example.rb +0 -50
  138. data/examples/og/mysql_to_psql.rb +0 -96
  139. data/examples/og/run.rb +0 -286
  140. data/examples/tiny/root/nitro.png +0 -0
  141. data/lib/glue.rb +0 -55
  142. data/lib/glue/array.rb +0 -61
  143. data/lib/glue/attribute.rb +0 -83
  144. data/lib/glue/cache.rb +0 -138
  145. data/lib/glue/flexob.rb +0 -12
  146. data/lib/glue/hash.rb +0 -122
  147. data/lib/glue/inflector.rb +0 -91
  148. data/lib/glue/logger.rb +0 -147
  149. data/lib/glue/misc.rb +0 -14
  150. data/lib/glue/mixins.rb +0 -36
  151. data/lib/glue/number.rb +0 -24
  152. data/lib/glue/object.rb +0 -32
  153. data/lib/glue/pool.rb +0 -60
  154. data/lib/glue/property.rb +0 -408
  155. data/lib/glue/string.rb +0 -162
  156. data/lib/glue/time.rb +0 -85
  157. data/lib/glue/validation.rb +0 -394
  158. data/lib/og.rb +0 -185
  159. data/lib/og/adapter.rb +0 -513
  160. data/lib/og/adapters/filesys.rb +0 -121
  161. data/lib/og/adapters/mysql.rb +0 -347
  162. data/lib/og/adapters/oracle.rb +0 -375
  163. data/lib/og/adapters/psql.rb +0 -273
  164. data/lib/og/adapters/sqlite.rb +0 -262
  165. data/lib/og/backend.rb +0 -297
  166. data/lib/og/connection.rb +0 -304
  167. data/lib/og/database.rb +0 -282
  168. data/lib/og/enchant.rb +0 -125
  169. data/lib/og/meta.rb +0 -373
  170. data/lib/og/mock.rb +0 -165
  171. data/lib/og/observer.rb +0 -53
  172. data/lib/og/typemacros.rb +0 -23
  173. data/lib/parts/README +0 -9
  174. data/test/glue/tc_attribute.rb +0 -22
  175. data/test/glue/tc_cache.rb +0 -45
  176. data/test/glue/tc_hash.rb +0 -38
  177. data/test/glue/tc_logger.rb +0 -39
  178. data/test/glue/tc_numbers.rb +0 -20
  179. data/test/glue/tc_property.rb +0 -89
  180. data/test/glue/tc_property_mixins.rb +0 -93
  181. data/test/glue/tc_property_type_checking.rb +0 -35
  182. data/test/glue/tc_strings.rb +0 -103
  183. data/test/glue/tc_validation.rb +0 -188
  184. data/test/og/tc_filesys.rb +0 -83
  185. data/test/og/tc_lifecycle.rb +0 -104
  186. data/test/og/tc_many_to_many.rb +0 -62
  187. data/test/og/tc_meta.rb +0 -55
  188. data/test/og/tc_observer.rb +0 -85
  189. data/test/og/tc_sqlite.rb +0 -87
  190. data/test/tc_og.rb +0 -355
  191. data/vendor/composite_sexp_processor.rb +0 -43
  192. data/vendor/parse_tree.rb +0 -745
  193. data/vendor/sexp_processor.rb +0 -453
data/lib/nitro/render.rb CHANGED
@@ -42,31 +42,31 @@ module Rendering
42
42
 
43
43
  mattr_accessor :shader; @@shader = RubyShader.new
44
44
 
45
- # If true, reloads all controllers. Useful in
45
+ # If set to :full, reloads all controllers. Useful in
46
46
  # development.
47
47
 
48
- mattr_accessor :reload, :partial
48
+ mattr_accessor :reload, false
49
49
 
50
50
  # Given the action try find the matching template.
51
51
  # Can search for xhtml or xml templates.
52
52
  # Returns nil if no template file is found.
53
53
 
54
- def self.template_for_action(base, action, ext = :xhtml)
55
-
54
+ def self.template_for_action(template_root, action, ext = :xhtml)
55
+
56
56
  # attempt to find a template of the form
57
- # base/action.xhtml
57
+ # template_root/action.xhtml
58
+
59
+ path = "#{template_root}/#{action}.#{ext}".squeeze('/')
58
60
 
59
- path = "#{base}/#{action}.#{ext}".squeeze('/')
60
-
61
61
  unless File.exist?(path)
62
62
 
63
63
  # attempt to find a template of the form
64
- # base/action/index.xhtml
64
+ # template_root/action/index.xhtml
65
65
 
66
- path = "#{base}/#{action}/#{Rendering.default_template}.#{ext}".squeeze('/')
67
-
66
+ path = "#{template_root}/#{action}/#{Rendering.default_template}.#{ext}".squeeze('/')
67
+
68
68
  unless File.exist?(path)
69
- # No template found!
69
+ # No template founD!
70
70
  path = nil
71
71
  end
72
72
  end
@@ -87,7 +87,7 @@ module Rendering
87
87
 
88
88
  # Compile a controller action.
89
89
 
90
- def self.compile_action(klass, action, base)
90
+ def self.compile_action(klass, action, template_root)
91
91
  @@sync.synchronize do
92
92
  dummy, api, action = action.to_s.split('__')
93
93
 
@@ -95,7 +95,7 @@ module Rendering
95
95
 
96
96
  return false unless action
97
97
 
98
- Logger.debug "Compiling action '#{base}/#{action}'" if $DBG
98
+ Logger.debug "Compiling action '#{template_root}/#{action}'" if $DBG
99
99
 
100
100
  valid = false
101
101
 
@@ -138,7 +138,7 @@ module Rendering
138
138
 
139
139
  # call the template if exists.
140
140
 
141
- if template = template_for_action(base, action)
141
+ if template = template_for_action(template_root, action)
142
142
  valid = true
143
143
  code << %{
144
144
  return unless __#{api}__#{action}__template();
@@ -169,8 +169,6 @@ module Rendering
169
169
  }
170
170
  end
171
171
 
172
- # puts '---', code, '---'
173
-
174
172
  klass.class_eval(code)
175
173
  end
176
174
 
@@ -203,15 +201,19 @@ module Render
203
201
 
204
202
  attr_accessor :rendering_errors
205
203
 
204
+ # The template root for this render.
205
+
206
+ cattr_accessor :template_root
207
+
206
208
  # Initialize the render.
207
209
  #
208
210
  # [+context+]
209
211
  # A parent render/controller acts as the context.
210
212
 
211
- def initialize(context, base)
213
+ def initialize(context)
212
214
  @request = @context = context
213
215
  @out = context.out
214
- @base = base
216
+ @template_root = @context.dispatcher.template_root
215
217
  end
216
218
 
217
219
  # Renders the action denoted by path. The path
@@ -221,16 +223,17 @@ module Render
221
223
  def render(path)
222
224
  Logger.debug "Rendering '#{path}'." if $DBG
223
225
 
224
- klass, action, base, ctype = @context.dispatcher.dispatch(path, @context)
226
+ # klass, action, template_root, ctype = @context.dispatcher.dispatch(path, @context)
227
+ klass, action, content_type = @context.dispatcher.dispatch(path, @context)
225
228
 
226
- @context.content_type = ctype
229
+ @context.content_type = content_type
227
230
 
228
231
  raise 'No controller for action' unless klass
229
232
 
230
233
  if self.class == klass
231
234
  self.send(action)
232
235
  else
233
- klass.new(self, base).send(action)
236
+ klass.new(self).send(action)
234
237
  end
235
238
 
236
239
  rescue RenderExit => e
data/lib/nitro/runner.rb CHANGED
@@ -240,7 +240,7 @@ class Runner
240
240
  end
241
241
  end
242
242
 
243
- puts "\n==> Application listening at #{conf.host}:#{conf.port}.\n\n"
243
+ puts "\n==> Listening at #{conf.host}:#{conf.port}.\n\n"
244
244
 
245
245
  case @server
246
246
  when :webrick
@@ -1,6 +1,6 @@
1
1
  # * George Moschovitis <gm@navel.gr>
2
2
  # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: scaffold.rb 270 2005-03-07 17:52:16Z gmosx $
3
+ # $Id: scaffold.rb 300 2005-03-16 13:23:10Z gmosx $
4
4
 
5
5
  require 'glue/inflector'
6
6
 
@@ -8,10 +8,7 @@ module N
8
8
 
9
9
  module Scaffolding
10
10
 
11
- # Ruby is sometimes VERY surprising, the following trick is
12
- # needed to include singleton methods in other classes.
13
-
14
- def self.append_features(base)
11
+ def self.append_features(base) # :nodoc:
15
12
  super
16
13
  base.extend(SingletonMethods)
17
14
  end
data/lib/nitro/simple.rb CHANGED
@@ -4,4 +4,5 @@ require 'nitro/controller'
4
4
  # Useful to implement php/asp/jsp style applications.
5
5
  # Dispatcher uses this as the default Controller.
6
6
 
7
- class SimpleController < N::Controller; end
7
+ class SimpleController < N::Controller;
8
+ end
@@ -1,6 +1,8 @@
1
1
  # * George Moschovitis <gm@navel.gr>
2
2
  # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: template.rb 271 2005-03-07 17:56:45Z gmosx $
3
+ # $Id: template.rb 300 2005-03-16 13:23:10Z gmosx $
4
+
5
+ require 'glue/flexob'
4
6
 
5
7
  module N
6
8
 
@@ -91,6 +93,11 @@ module TemplateMixin
91
93
 
92
94
  text.gsub!(/\#\((.*?)\)/, '#{\1}')
93
95
 
96
+ # Alternative for entities.
97
+ # (useful in xsl stylesheets)
98
+
99
+ text.gsub!(/%(\S*?);/, '&\1;')
100
+
94
101
  # Compile time ruby code. This code is evaluated when
95
102
  # compiling the template and the result injected directly
96
103
  # into the result. Usefull for example to prevaluate
@@ -126,7 +133,8 @@ module TemplateMixin
126
133
 
127
134
  end
128
135
 
129
- # A template class implementing the Template mixin.
136
+ # A helper class that provides access to the Template methods
137
+ # as singleton methods.
130
138
 
131
139
  class Template
132
140
  class << self
@@ -137,4 +145,36 @@ class Template
137
145
  end
138
146
  end
139
147
 
148
+ # A Template that reads from files and also
149
+ # provides a simple but effective caching scheme.
150
+ # An intuitive binding mechanism provides the
151
+ # expansion environment.
152
+
153
+ class FileTemplate < Flexob
154
+ include TemplateMixin
155
+
156
+ @@compiled_template_cache = {}
157
+
158
+ attr_accessor :template_filename
159
+
160
+ def initialize(filename = nil)
161
+ super
162
+ @template_filename = filename
163
+ end
164
+
165
+ def process
166
+ __out__ = ''
167
+
168
+ unless compiled = @@compiled_template_cache[@template_filename]
169
+ template = File.read(@template_filename)
170
+ compiled = compile_template(template, '__out__')
171
+ @@compiled_template_cache[@template_filename] = compiled
172
+ end
173
+
174
+ render_template(compiled, binding)
175
+
176
+ return __out__
177
+ end
178
+ end
179
+
140
180
  end
@@ -13,6 +13,11 @@ class TC_Controller < Test::Unit::TestCase # :nodoc: all
13
13
  class BlogController < Controller
14
14
  attr_reader :aflag, :tflag
15
15
 
16
+ def initialize(context)
17
+ super
18
+ @template_root = 'test/public/blog'
19
+ end
20
+
16
21
  def list
17
22
  @aflag = true
18
23
  end
@@ -22,7 +27,7 @@ class TC_Controller < Test::Unit::TestCase # :nodoc: all
22
27
  @disp = Dispatcher.new({
23
28
  'blog' => BlogController,
24
29
  })
25
- @disp.root = File.join(File.dirname(__FILE__), '..', 'root')
30
+ @disp.template_root = File.join(File.dirname(__FILE__), '..', 'public')
26
31
  @conf = OpenStruct.new
27
32
  @conf.dispatcher = @disp
28
33
  end
@@ -31,9 +36,9 @@ class TC_Controller < Test::Unit::TestCase # :nodoc: all
31
36
  ctx = Context.new(@conf)
32
37
  ctx.headers = {}
33
38
  ctx.params = {}
34
- puts '=', ctx.dispatcher.root
35
- klass, action, base = ctx.dispatcher.dispatch('/blog/list', ctx)
36
- c = klass.new(ctx, base)
39
+ ctx.headers['REQUEST_URI'] = '/blog/list'
40
+ klass, action = ctx.dispatcher.dispatch(ctx.path, ctx)
41
+ c = klass.new(ctx)
37
42
  begin
38
43
  c.send(action)
39
44
  rescue RenderExit
@@ -38,20 +38,18 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
38
38
  assert_equal BlogController, klass
39
39
  assert_equal '__xhtml__list', action
40
40
 
41
- klass, action, base = @d.dispatch('/blog')
41
+ klass, action, ctype = @d.dispatch('/blog')
42
42
  assert_equal BlogController, klass
43
43
  assert_equal '__xhtml__index', action
44
- assert_equal 'root/blog', base
44
+ assert_equal 'text/html', ctype
45
45
 
46
- klass, action, base = @d.dispatch('/login')
46
+ klass, action, ctype = @d.dispatch('/login')
47
47
  assert_equal MainController, klass
48
48
  assert_equal '__xhtml__login', action
49
- assert_equal 'root', base
50
49
 
51
- klass, action, base = @d.dispatch('/')
50
+ klass, action = @d.dispatch('/')
52
51
  assert_equal MainController, klass
53
52
  assert_equal '__xhtml__index', action
54
- assert_equal 'root', base
55
53
 
56
54
  # multi-api dispatcher.
57
55
 
@@ -0,0 +1,95 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+
3
+ require 'test/unit'
4
+ require 'ostruct'
5
+
6
+ require 'nitro/controller'
7
+ require 'nitro/mail'
8
+
9
+ class TestCaseMail < Test::Unit::TestCase # :nodoc: all
10
+ include N
11
+
12
+ class DummyMailer < Mailer
13
+ def initialize
14
+ super
15
+ @bcc = 'gm@navel.gr'
16
+ @template_root = 'test/public/dummy_mailer'
17
+ end
18
+
19
+ def registration(to, username, token)
20
+ @to = to
21
+ @from = 'system@navel.gr'
22
+ @subject = 'Nitro.com registration'
23
+ @cc = 'gm@navel.gr'
24
+ @body.username = username
25
+ @body.token = token
26
+ end
27
+
28
+ def greek(to)
29
+ @to = to
30
+ @from = 'system@navel.gr'
31
+ @subject = 'Ελληνικός Τίτλος'
32
+ @cc = 'gm@navel.gr'
33
+ @body = 'Τί έγινε ρε παιδιά;'
34
+ end
35
+ end
36
+
37
+ class DummyController < Controller
38
+ # mailer DummyMailer
39
+
40
+ def register
41
+ token = 999
42
+ deliver_registration('gmosx@navel.gr', 'gmosx', token)
43
+ end
44
+ end
45
+
46
+ def test_mail
47
+ m = Mail.new 'gmosx@navel.gr', 'drak@navel.gr', 'A simple test', 'This is the body of the message'
48
+ expected = %{From: gmosx@navel.gr
49
+ To: drak@navel.gr
50
+ Subject: A simple test
51
+
52
+ This is the body of the message}
53
+ assert_equal expected, m.encoded
54
+
55
+ m.to = %w{ renos@navel.gr stella@navel.gr }
56
+ expected = %{From: gmosx@navel.gr
57
+ To: renos@navel.gr, stella@navel.gr
58
+ Subject: A simple test
59
+
60
+ This is the body of the message}
61
+ assert_equal expected, m.encoded
62
+
63
+ end
64
+
65
+ def test_mailer
66
+ assert_equal 0, DummyMailer.deliveries.size
67
+
68
+ Mailer.server[:address] = 'mail.navel.gr'
69
+ assert_equal 'mail.navel.gr', DummyMailer.server[:address]
70
+
71
+ DummyMailer.delivery_method = :test
72
+ DummyMailer.template_root = File.join(File.dirname(__FILE__), '..', 'root', 'dummy_mailer')
73
+ token = 999
74
+ DummyMailer.deliver_registration('gm@navel.gr', 'gmosx', token)
75
+ assert_equal 1, DummyMailer.deliveries.size
76
+
77
+ expected = %{From: system@navel.gr
78
+ To: gm@navel.gr
79
+ Cc: gm@navel.gr
80
+ Bcc: gm@navel.gr
81
+ Subject: =?utf-8?Q?Nitro=2ecom_registration?=
82
+
83
+ Hello gmosx
84
+
85
+ how do you feel?
86
+
87
+ Here is your <b>Token</b>: 999
88
+ }
89
+ assert_equal expected, DummyMailer.deliveries[0].encoded
90
+
91
+ DummyMailer.deliver_greek('gm@navel.gr')
92
+ assert_equal 2, DummyMailer.deliveries.size
93
+ end
94
+
95
+ end
File without changes
@@ -0,0 +1,5 @@
1
+ Hello #{username}
2
+
3
+ how do you feel?
4
+
5
+ Here is your <b>Token</b>: #{token}
data/vendor/README CHANGED
@@ -8,5 +8,4 @@ Libraries from other vendors belong here. This file
8
8
  * breakpointer
9
9
  * dev-utils
10
10
  * postgres-pr
11
- * ParseTree
12
11
 
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.6
2
+ rubygems_version: 0.8.8
3
3
  specification_version: 1
4
4
  name: nitro
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.12.0
7
- date: 2005-03-07
6
+ version: 0.13.0
7
+ date: 2005-03-17
8
8
  summary: Nitro Web Engine
9
9
  require_paths:
10
10
  - lib
11
11
  email: gm@navel.gr
12
- homepage: http://www.rubyforge.com/projects/nitro
12
+ homepage: http://nitro.rubyforge.org
13
13
  rubyforge_project: nitro
14
- description: "An efficient, multiparadigm and flexible platform for rapid web application
15
- development. Implements a full development stack."
14
+ description: "Nitro provides everything you need to develop real-world, scalable web
15
+ applications."
16
16
  autorequire: nitro
17
17
  default_executable: nitro
18
18
  bindir: bin
@@ -22,53 +22,28 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
22
22
  -
23
23
  - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 1.8.0
25
+ version: 1.8.1
26
26
  version:
27
27
  platform: ruby
28
28
  authors:
29
29
  - George Moschovitis
30
30
  files:
31
31
  - Rakefile
32
- - ChangeLog
33
32
  - INSTALL
34
- - RELEASES
33
+ - CHANGELOG
35
34
  - README
36
35
  - install.rb
37
36
  - bin/nitro
38
37
  - bin/new_app.rb
39
- - bin/proto
40
38
  - bin/new_form.rb
41
- - bin/proto/ctl
42
- - bin/proto/log
43
- - bin/proto/conf
44
- - bin/proto/root
45
- - bin/proto/lib
46
- - bin/proto/README
47
- - bin/proto/log/README
48
- - bin/proto/conf/apache.conf
49
- - bin/proto/conf/lhttpd.conf
50
- - bin/proto/conf/app.conf.rb
51
- - bin/proto/root/index.xhtml
52
- - bin/proto/root/style.css
53
- - bin/proto/root/m
54
- - bin/proto/root/fcgi.rb
55
- - bin/proto/root/style.xsl
56
- - bin/proto/root/m/nitro.png
57
- - bin/proto/lib/README
58
- - benchmark/nitro
59
- - benchmark/og
60
- - benchmark/nitro/tiny-lhttpd-n-200-c-5.txt
61
- - benchmark/nitro/simple-webrick-n-200.txt
62
- - benchmark/nitro/static-webrick-n-200.txt
63
- - benchmark/nitro/tiny2-webrick-n-200.txt
64
- - benchmark/nitro/tiny-webrick-n-200-c-5.txt
65
- - benchmark/nitro/tiny-webrick-n-200.txt
66
- - benchmark/nitro/bench.rb
67
- - benchmark/og/sqlite-prepare.2.txt
68
- - benchmark/og/sqlite-no-prepare.2.txt
69
- - benchmark/og/sqlite-no-prepare.1.txt
70
- - benchmark/og/bench.rb
71
- - benchmark/og/sqlite-prepare.1.txt
39
+ - benchmark/tiny-lhttpd-n-200-c-5.txt
40
+ - benchmark/simple-webrick-n-200.txt
41
+ - benchmark/static-webrick-n-200.txt
42
+ - benchmark/tiny2-webrick-n-200.txt
43
+ - benchmark/tiny-webrick-n-200-c-5.txt
44
+ - benchmark/tiny-webrick-n-200.txt
45
+ - benchmark/bench.rb
46
+ - examples/ajax
72
47
  - examples/no_xsl_blog
73
48
  - examples/why_wiki
74
49
  - examples/flash
@@ -76,10 +51,15 @@ files:
76
51
  - examples/wee_style
77
52
  - examples/blog
78
53
  - examples/README.windows
79
- - examples/og
54
+ - examples/ajax/controller.rb
55
+ - examples/ajax/public
56
+ - examples/ajax/run.rb
57
+ - examples/ajax/public/index.xhtml
58
+ - examples/ajax/public/js
59
+ - examples/ajax/public/js/ajax.js
80
60
  - examples/no_xsl_blog/log
81
61
  - examples/no_xsl_blog/conf
82
- - examples/no_xsl_blog/root
62
+ - examples/no_xsl_blog/public
83
63
  - examples/no_xsl_blog/run.rb
84
64
  - examples/no_xsl_blog/lib
85
65
  - examples/no_xsl_blog/README
@@ -87,36 +67,38 @@ files:
87
67
  - examples/no_xsl_blog/log/README
88
68
  - examples/no_xsl_blog/conf/apache.conf
89
69
  - examples/no_xsl_blog/conf/lhttpd.conf
90
- - examples/no_xsl_blog/root/login.xhtml
91
- - examples/no_xsl_blog/root/index.xhtml
92
- - examples/no_xsl_blog/root/style.css
93
- - examples/no_xsl_blog/root/entry_form.xhtml
94
- - examples/no_xsl_blog/root/m
95
- - examples/no_xsl_blog/root/fcgi.rb
96
- - examples/no_xsl_blog/root/comments.xhtml
97
- - examples/no_xsl_blog/root/recent_posts.xhtml
98
- - examples/no_xsl_blog/root/view_entry.xhtml
99
- - examples/no_xsl_blog/root/view_entry.xml
100
- - examples/no_xsl_blog/root/m/gbull.gif
101
- - examples/no_xsl_blog/root/m/garrow.gif
102
- - examples/no_xsl_blog/root/m/comments_curve.gif
103
- - examples/no_xsl_blog/root/m/obull.gif
104
- - examples/no_xsl_blog/root/m/down.gif
105
- - examples/no_xsl_blog/root/m/bubbles.gif
106
- - examples/no_xsl_blog/root/m/page_bg.gif
107
- - examples/no_xsl_blog/root/m/header_bg.gif
108
- - examples/no_xsl_blog/root/m/side_title_bg.gif
109
- - examples/no_xsl_blog/root/m/rss.gif
110
- - examples/no_xsl_blog/root/m/h1_bg.gif
111
- - examples/no_xsl_blog/root/m/nitro.gif
112
- - examples/no_xsl_blog/root/m/sidebar_bg.gif
113
- - examples/no_xsl_blog/root/m/grbull.gif
114
- - examples/no_xsl_blog/root/m/footer_bg.gif
70
+ - examples/no_xsl_blog/public/login.xhtml
71
+ - examples/no_xsl_blog/public/index.xhtml
72
+ - examples/no_xsl_blog/public/style.css
73
+ - examples/no_xsl_blog/public/entry_form.xhtml
74
+ - examples/no_xsl_blog/public/m
75
+ - examples/no_xsl_blog/public/fcgi.rb
76
+ - examples/no_xsl_blog/public/comments.xhtml
77
+ - examples/no_xsl_blog/public/recent_posts.xhtml
78
+ - examples/no_xsl_blog/public/view_entry.xhtml
79
+ - examples/no_xsl_blog/public/view_entry.xml
80
+ - examples/no_xsl_blog/public/m/gbull.gif
81
+ - examples/no_xsl_blog/public/m/garrow.gif
82
+ - examples/no_xsl_blog/public/m/comments_curve.gif
83
+ - examples/no_xsl_blog/public/m/obull.gif
84
+ - examples/no_xsl_blog/public/m/down.gif
85
+ - examples/no_xsl_blog/public/m/bubbles.gif
86
+ - examples/no_xsl_blog/public/m/page_bg.gif
87
+ - examples/no_xsl_blog/public/m/header_bg.gif
88
+ - examples/no_xsl_blog/public/m/side_title_bg.gif
89
+ - examples/no_xsl_blog/public/m/rss.gif
90
+ - examples/no_xsl_blog/public/m/h1_bg.gif
91
+ - examples/no_xsl_blog/public/m/nitro.gif
92
+ - examples/no_xsl_blog/public/m/sidebar_bg.gif
93
+ - examples/no_xsl_blog/public/m/grbull.gif
94
+ - examples/no_xsl_blog/public/m/footer_bg.gif
95
+ - examples/no_xsl_blog/lib/content.rb
115
96
  - examples/no_xsl_blog/lib/blog
116
97
  - examples/no_xsl_blog/lib/blog.rb
117
98
  - examples/no_xsl_blog/lib/blog/template.rb
118
99
  - examples/no_xsl_blog/lib/blog/model.rb
119
100
  - examples/no_xsl_blog/lib/blog/controller.rb
101
+ - examples/why_wiki/wiki.yml
120
102
  - examples/why_wiki/run.rb
121
103
  - examples/why_wiki/README
122
104
  - examples/flash/log
@@ -128,83 +110,80 @@ files:
128
110
  - examples/flash/root/show_inline_text.xhtml
129
111
  - examples/tiny/log
130
112
  - examples/tiny/conf
131
- - examples/tiny/root
113
+ - examples/tiny/public
132
114
  - examples/tiny/run.rb
133
115
  - examples/tiny/README
134
116
  - examples/tiny/log/apache.error_log
135
117
  - examples/tiny/log/README
136
118
  - examples/tiny/conf/apache.conf
137
119
  - examples/tiny/conf/lhttpd.conf
138
- - examples/tiny/root/index.xhtml
139
- - examples/tiny/root/nitro.png
140
- - examples/tiny/root/upload.xhtml
141
- - examples/tiny/root/fcgi.rb
142
- - examples/tiny/root/include.xhtml
120
+ - examples/tiny/public/index.xhtml
121
+ - examples/tiny/public/nitro.png
122
+ - examples/tiny/public/upload.xhtml
123
+ - examples/tiny/public/fcgi.rb
124
+ - examples/tiny/public/include.xhtml
143
125
  - examples/wee_style/run.rb
144
126
  - examples/wee_style/README
145
127
  - examples/blog/log
146
128
  - examples/blog/conf
147
- - examples/blog/root
129
+ - examples/blog/public
130
+ - examples/blog/src
148
131
  - examples/blog/run.rb
149
- - examples/blog/lib
150
132
  - examples/blog/README
151
133
  - examples/blog/log/apache.error_log
152
134
  - examples/blog/log/README
153
135
  - examples/blog/conf/apache.conf
154
136
  - examples/blog/conf/lhttpd.conf
155
- - examples/blog/root/login.xhtml
156
- - examples/blog/root/error.xhtml
157
- - examples/blog/root/index.xhtml
158
- - examples/blog/root/style.css
159
- - examples/blog/root/entry_form.xhtml
160
- - examples/blog/root/m
161
- - examples/blog/root/fcgi.rb
162
- - examples/blog/root/comments.xhtml
163
- - examples/blog/root/style.xsl
164
- - examples/blog/root/base.xsl
165
- - examples/blog/root/recent_posts.xhtml
166
- - examples/blog/root/view_entry.xhtml
167
- - examples/blog/root/view_entry.xml
168
- - examples/blog/root/m/gbull.gif
169
- - examples/blog/root/m/garrow.gif
170
- - examples/blog/root/m/comments_curve.gif
171
- - examples/blog/root/m/obull.gif
172
- - examples/blog/root/m/down.gif
173
- - examples/blog/root/m/bubbles.gif
174
- - examples/blog/root/m/page_bg.gif
175
- - examples/blog/root/m/header_bg.gif
176
- - examples/blog/root/m/side_title_bg.gif
177
- - examples/blog/root/m/rss.gif
178
- - examples/blog/root/m/h1_bg.gif
179
- - examples/blog/root/m/nitro.gif
180
- - examples/blog/root/m/sidebar_bg.gif
181
- - examples/blog/root/m/grbull.gif
182
- - examples/blog/root/m/footer_bg.gif
183
- - examples/blog/lib/blog
184
- - examples/blog/lib/blog.rb
185
- - examples/blog/lib/blog/model.rb
186
- - examples/blog/lib/blog/controller.rb
187
- - examples/og/mysql_to_psql.rb
188
- - examples/og/run.rb
189
- - examples/og/mock_example.rb
190
- - examples/og/README
191
- - doc/ChangeLog.1
137
+ - examples/blog/public/style.css
138
+ - examples/blog/public/m
139
+ - examples/blog/public/fcgi.rb
140
+ - examples/blog/public/base.xsl
141
+ - examples/blog/public/m/gbull.gif
142
+ - examples/blog/public/m/garrow.gif
143
+ - examples/blog/public/m/comments_curve.gif
144
+ - examples/blog/public/m/obull.gif
145
+ - examples/blog/public/m/down.gif
146
+ - examples/blog/public/m/bubbles.gif
147
+ - examples/blog/public/m/page_bg.gif
148
+ - examples/blog/public/m/header_bg.gif
149
+ - examples/blog/public/m/side_title_bg.gif
150
+ - examples/blog/public/m/rss.gif
151
+ - examples/blog/public/m/h1_bg.gif
152
+ - examples/blog/public/m/nitro.gif
153
+ - examples/blog/public/m/sidebar_bg.gif
154
+ - examples/blog/public/m/grbull.gif
155
+ - examples/blog/public/m/footer_bg.gif
156
+ - examples/blog/src/xsl
157
+ - examples/blog/src/models
158
+ - examples/blog/src/views
159
+ - examples/blog/src/blog.rb
160
+ - examples/blog/src/controller.rb
161
+ - examples/blog/src/mailer.rb
162
+ - examples/blog/src/xsl/style.xsl
163
+ - examples/blog/src/xsl/base.xsl
164
+ - examples/blog/src/models/content.rb
165
+ - examples/blog/src/models/blog.rb
166
+ - examples/blog/src/views/login.xhtml
167
+ - examples/blog/src/views/blog_entry_email.xhtml
168
+ - examples/blog/src/views/error.xhtml
169
+ - examples/blog/src/views/index.xhtml
170
+ - examples/blog/src/views/entry_form.xhtml
171
+ - examples/blog/src/views/comments.xhtml
172
+ - examples/blog/src/views/recent_posts.xhtml
173
+ - examples/blog/src/views/view_entry.xhtml
174
+ - examples/blog/src/views/view_entry.xml
192
175
  - doc/config.txt
193
176
  - doc/LICENSE
194
177
  - doc/AUTHORS
178
+ - doc/CHANGELOG.1
195
179
  - doc/apache.txt
180
+ - doc/faq.txt
181
+ - doc/RELEASES
196
182
  - doc/tutorial.txt
197
- - doc/og_tutorial.txt
198
183
  - doc/architecture.txt
199
184
  - doc/bugs.txt
200
- - doc/og_config.txt
201
185
  - lib/nitro
202
- - lib/parts
203
- - lib/glue.rb
204
186
  - lib/nitro.rb
205
- - lib/glue
206
- - lib/og
207
- - lib/og.rb
208
187
  - lib/nitro/localization.rb
209
188
  - lib/nitro/cookie.rb
210
189
  - lib/nitro/session.rb
@@ -249,45 +228,8 @@ files:
249
228
  - lib/nitro/ui/date-select.rb
250
229
  - lib/nitro/ui/tabs.rb
251
230
  - lib/nitro/ui/popup.rb
252
- - lib/parts/content.rb
253
- - lib/parts/content
254
- - lib/parts/README
255
- - lib/glue/mixins.rb
256
- - lib/glue/logger.rb
257
- - lib/glue/pool.rb
258
- - lib/glue/inflector.rb
259
- - lib/glue/hash.rb
260
- - lib/glue/number.rb
261
- - lib/glue/time.rb
262
- - lib/glue/property.rb
263
- - lib/glue/misc.rb
264
- - lib/glue/flexob.rb
265
- - lib/glue/cache.rb
266
- - lib/glue/string.rb
267
- - lib/glue/object.rb
268
- - lib/glue/array.rb
269
- - lib/glue/validation.rb
270
- - lib/glue/attribute.rb
271
- - lib/og/adapter.rb
272
- - lib/og/adapters
273
- - lib/og/enchant.rb
274
- - lib/og/connection.rb
275
- - lib/og/observer.rb
276
- - lib/og/database.rb
277
- - lib/og/mock.rb
278
- - lib/og/meta.rb
279
- - lib/og/typemacros.rb
280
- - lib/og/backend.rb
281
- - lib/og/adapters/oracle.rb
282
- - lib/og/adapters/filesys.rb
283
- - lib/og/adapters/mysql.rb
284
- - lib/og/adapters/sqlite.rb
285
- - lib/og/adapters/psql.rb
286
231
  - test/nitro
287
- - test/tc_og.rb
288
- - test/root
289
- - test/glue
290
- - test/og
232
+ - test/public
291
233
  - test/nitro/tc_uri.rb
292
234
  - test/nitro/tc_template.rb
293
235
  - test/nitro/tc_controller.rb
@@ -295,6 +237,7 @@ files:
295
237
  - test/nitro/tc_session.rb
296
238
  - test/nitro/builders
297
239
  - test/nitro/ui
240
+ - test/nitro/tc_mail.rb
298
241
  - test/nitro/tc_context.rb
299
242
  - test/nitro/tc_dispatcher.rb
300
243
  - test/nitro/adapters/tc_webrick.rb
@@ -305,32 +248,15 @@ files:
305
248
  - test/nitro/builders/tc_xml.rb
306
249
  - test/nitro/builders/tc_rss.rb
307
250
  - test/nitro/ui/tc_pager.rb
308
- - test/root/blog
309
- - test/root/blog/list.xhtml
310
- - test/glue/tc_strings.rb
311
- - test/glue/tc_property_type_checking.rb
312
- - test/glue/tc_logger.rb
313
- - test/glue/tc_validation.rb
314
- - test/glue/tc_property.rb
315
- - test/glue/tc_hash.rb
316
- - test/glue/tc_attribute.rb
317
- - test/glue/tc_property_mixins.rb
318
- - test/glue/tc_cache.rb
319
- - test/glue/tc_numbers.rb
320
- - test/og/tc_sqlite.rb
321
- - test/og/tc_observer.rb
322
- - test/og/tc_filesys.rb
323
- - test/og/tc_meta.rb
324
- - test/og/tc_many_to_many.rb
325
- - test/og/tc_lifecycle.rb
251
+ - test/public/blog
252
+ - test/public/dummy_mailer
253
+ - test/public/blog/list.xhtml
254
+ - test/public/dummy_mailer/registration.xhtml
326
255
  - vendor/breakpoint_client.rb
327
- - vendor/sexp_processor.rb
328
- - vendor/composite_sexp_processor.rb
329
256
  - vendor/extensions
330
257
  - vendor/binding_of_caller.rb
331
258
  - vendor/blankslate.rb
332
259
  - vendor/breakpoint.rb
333
- - vendor/parse_tree.rb
334
260
  - vendor/README
335
261
  - vendor/extensions/enumerable.rb
336
262
  - vendor/extensions/all.rb
@@ -359,15 +285,44 @@ rdoc_options:
359
285
  - "--inline-source"
360
286
  extra_rdoc_files:
361
287
  - Rakefile
362
- - ChangeLog
363
288
  - INSTALL
364
- - RELEASES
289
+ - CHANGELOG
365
290
  - README
366
291
  executables:
367
292
  - nitro
368
293
  extensions: []
369
294
  requirements: []
370
295
  dependencies:
296
+ - !ruby/object:Gem::Dependency
297
+ name: glue
298
+ version_requirement:
299
+ version_requirements: !ruby/object:Gem::Version::Requirement
300
+ requirements:
301
+ -
302
+ - "="
303
+ - !ruby/object:Gem::Version
304
+ version: 0.13.0
305
+ version:
306
+ - !ruby/object:Gem::Dependency
307
+ name: og
308
+ version_requirement:
309
+ version_requirements: !ruby/object:Gem::Version::Requirement
310
+ requirements:
311
+ -
312
+ - "="
313
+ - !ruby/object:Gem::Version
314
+ version: 0.13.0
315
+ version:
316
+ - !ruby/object:Gem::Dependency
317
+ name: ruby-breakpoint
318
+ version_requirement:
319
+ version_requirements: !ruby/object:Gem::Version::Requirement
320
+ requirements:
321
+ -
322
+ - ">="
323
+ - !ruby/object:Gem::Version
324
+ version: "0.5"
325
+ version:
371
326
  - !ruby/object:Gem::Dependency
372
327
  name: extensions
373
328
  version_requirement: