nitro 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/ChangeLog +175 -0
  2. data/README +41 -7
  3. data/RELEASES +24 -0
  4. data/Rakefile +5 -7
  5. data/bin/new_app.rb +26 -4
  6. data/bin/new_form.rb +54 -0
  7. data/bin/proto/config.rb +3 -3
  8. data/bin/proto/root/index.xhtml +2 -34
  9. data/bin/proto/root/style.css +4 -70
  10. data/bin/proto/root/style.xsl +8 -39
  11. data/doc/tutorial.txt +5 -0
  12. data/examples/blog/app.rb +2 -1
  13. data/examples/blog/config.rb +7 -2
  14. data/examples/blog/root/style.xsl +1 -2
  15. data/examples/flash/README +34 -0
  16. data/examples/flash/app.rb +20 -0
  17. data/examples/flash/config.rb +38 -0
  18. data/examples/flash/lib/flash.rb +40 -0
  19. data/examples/flash/root/index.xhtml +25 -0
  20. data/examples/flash/root/show_inline_text.xhtml +12 -0
  21. data/examples/flash/tmp.swf +0 -0
  22. data/examples/og/README +7 -0
  23. data/examples/og/mock_example.rb +58 -0
  24. data/examples/og/run.rb +9 -5
  25. data/examples/tiny/root/include.xhtml +3 -0
  26. data/examples/tiny/root/index.xhtml +2 -1
  27. data/lib/glue/property.rb +166 -107
  28. data/lib/glue/property.rb.old +307 -0
  29. data/lib/nitro/builders/form.rb +26 -17
  30. data/lib/nitro/events.rb +1 -1
  31. data/lib/nitro/markup.rb +120 -0
  32. data/lib/nitro/server/cookie.rb +1 -1
  33. data/lib/nitro/server/dispatcher.rb +5 -6
  34. data/lib/nitro/server/filters.rb +1 -1
  35. data/lib/nitro/server/render.rb +33 -29
  36. data/lib/nitro/server/shaders.rb +32 -3
  37. data/lib/nitro/server/user.rb +1 -1
  38. data/lib/nitro/server/webrick.rb +9 -4
  39. data/lib/nitro/ui/popup.rb +1 -1
  40. data/lib/nitro/ui/select.rb +1 -1
  41. data/lib/nitro/ui/tabs.rb +1 -1
  42. data/lib/nitro/version.rb +2 -2
  43. data/lib/og.rb +17 -6
  44. data/lib/og/backend.rb +34 -4
  45. data/lib/og/backends/mysql.rb +3 -17
  46. data/lib/og/backends/psql.rb +5 -17
  47. data/lib/og/meta.rb +41 -26
  48. data/lib/og/mock.rb +223 -0
  49. data/lib/og/version.rb +2 -2
  50. data/lib/parts/content.rb +61 -0
  51. data/test/glue/{tc_properties.rb → tc_property.rb} +0 -1
  52. data/test/glue/tc_property_mixins.rb +62 -0
  53. data/test/og/tc_lifecycle.rb +107 -0
  54. data/test/tc_og.rb +31 -4
  55. data/vendor/README +6 -0
  56. data/vendor/binding_of_caller.rb +81 -0
  57. data/vendor/breakpoint.rb +526 -0
  58. data/vendor/breakpoint_client.rb +157 -0
  59. metadata +135 -95
data/ChangeLog CHANGED
@@ -1,6 +1,181 @@
1
+ 27-12-2004 George Moschovitis <gm@navel.gr>
1
2
 
3
+ * lib/og/mock.rb: fix, dont wrap methods.
4
+
5
+ * Rakefile: fix.
6
+
7
+ 26-12-2004 George Moschovitis <gm@navel.gr>
8
+
9
+ * lib/nitro/server/render.rb (#compile_xxx_method): better handling
10
+ of redirects,
11
+ (RenderExit): introduced,
12
+ (#redirect): rewritem, raise RenderExit.
13
+
14
+ * lib/nitro/markup.rb (PropertyUtils#prop_setter): override.
15
+ (#markup): removed.
16
+ (#expand, #narrow): fixed,
17
+ YEAH, markup works.
18
+
19
+ * lib/glue/property.rb (PropertyUtils#prop_setter): factored out.
20
+
21
+ * lib/nitro/markup.rb: narrow -> compact (better english) [knasis].
22
+
23
+ 25-12-2004 George Moschovitis <gm@navel.gr>
24
+
25
+ * MERRY XMAS :)
26
+
27
+ 22-12-2004 George Moschovitis <gm@navel.gr>
28
+
29
+ * lib/nitro/markup.rb: introduced,
30
+ (#markup): implemented.
31
+
32
+ * lib/nitro/server/render.rb: stop the pipeline if return false,
33
+ fixed redirect bug.
34
+
35
+ * lib/nitro/server/dispatcher.rb: dump rendering_errors in error page.
36
+
37
+ * lib/parts/content.rb: working with modules,
38
+ (Markup): introduced.
39
+
40
+ * lib/nitro/builders/form.rb: :ui modifier instead of :form,
41
+ (#render): handle the :markup meta data.
42
+
43
+ * Rakefile: og distribution includes tests + Rakefile [tquas]
44
+
45
+ 21-12-2004 George Moschovitis <gm@navel.gr>
46
+
47
+ * lib/og/mock.rb: Call wrap methods.
48
+
49
+ * test/glue/tc_property_mixins.rb: automanagement unit tests [by tquas],
50
+ made it pass.
51
+
52
+ * test/og/tc_lifecycle.rb: lifecycle unit tests [by tquas]
53
+
54
+ * lib/og/meta.rb (#has_many): enchant with add_XXX the container
55
+ class [mneumann].
56
+
57
+ * test/tc_og.rb: added test for create.
58
+
59
+ * Rakefile: add ChangeLog in og distribution.
60
+
61
+ * lib/og/backend.rb (#table): use the $og_table_prefix.
62
+
63
+ * lib/og.rb: $og_table_prefix,
64
+ (#enchant): use module_eval with __FILE__, __LINE__,
65
+ (#enchant): add create method [mneumann]
66
+
67
+ * README: updated with breakpoint info.
68
+
69
+ * lib/og/mock.rb: fixed [tquas].
70
+
71
+ * vendor: added 'breakpoint' by Florian Gross [fgross].
72
+ tested breakpoint integration, it works!
73
+
74
+ 20-12-2004 George Moschovitis <gm@navel.gr>
75
+
76
+ * test/glue/tc_propert.rb: fixed test.
77
+
78
+ * lib/glue/propery.rb: (#prop) totaly recoded, doesnt polute Module any
79
+ more,
80
+ (#__add_prop): recoded, gets target, no more reader, writer params.
81
+ use <<-"end_eval" to get better error reporting!
82
+ (#property): ultra cool append feature hack avoids passing @@__props from
83
+ a Module to the Class that includes it --> BLACK MAGIC.
84
+ (Property#enchant): implemented.
85
+ (PropertyUtils): introduced.
86
+ (PropertyUtils#add_prop): yeah, removed from Module!
87
+ (#meta): recoded.
88
+ (PropertyUtils#*): also handle meta.
89
+ (#inherit_meta): removed.
90
+ (#meta): fixed bug.
91
+ fix: no more @@__props redifen warnings when running with -w [tquas]
92
+
93
+ * lib/og.rb: (#initialize): automanage classes that include a manageable
94
+ Module (hack),
95
+ (#convert): convert classes that include a manageable Module (hack).
96
+ (#convert): no need to call inherit_meta.
97
+
98
+ 19-12-2004 George Moschovitis <gm@navel.gr>
99
+
100
+ * benchmark/nitro: introduced.
101
+
102
+ * benchmark/og: introduced.
103
+
104
+ 18-12-2004 George Moschovitis <gm@navel.gr>
105
+
106
+ * README: updated some texts,
107
+ added description of contents section.
108
+
109
+ 17-12-2004 George Moschovitis <gm@navel.gr>
110
+
111
+ * bin/new_app.rb: made win32 compatible.
112
+
113
+ * lib/nitro/server/webrick.rb: win32 compatible.
114
+
115
+ * bin/new_form.rb: introduced and implemented.
116
+
117
+ * lib/nitro/builders/form.rb: require safehash,
118
+ better formatting.
119
+
120
+ 16-12-2004 George Moschovitis <gm@navel.gr>
121
+
122
+ * lib/og/meta.rb (many_to_many): changed API.
123
+
124
+ * test/tc_og.rb: updated.
125
+
126
+ * lib/og/backends/mysql.rb (#create_table): use create_fields,
127
+ NOT NULL in join tables.
128
+
129
+ * lib/og/backends/psql.rb (#create_table): use create_fields,
130
+ NOT NULL in join tables.
131
+
132
+ * lib/og/backend.rb (#create_fields): implemented,
133
+ also use :extra_sql modifier [req tquas].
134
+
135
+ 15-12-2004 George Moschovitis <gm@navel.gr>
136
+
137
+ * bin/new_app.rb: handle trailing '/'.
138
+
139
+ * bin/proto/root/style.css: cleaned up.
140
+
141
+ * bin/proto/root/style.xsl: cleaned up.
142
+
143
+ * bin/proto/root/index.xhtml: cleaned up.
144
+
145
+ * lib/parts/content.rb: introduced,
146
+ (Content): introduced,
147
+ (Category): introduced,
148
+ (ACL): introduced.
149
+
150
+ * lib/og/meta.rb: changed has_one signature [patch by tquas]
151
+
152
+ * examples/og/mock_example.rb: introduced,
153
+ improved, added test-unit code.
154
+
155
+ * lib/og/mock.rb: implemented mock database. [patch by tquas]
156
+
157
+ 14-12-2004 George Moschovitis <gm@navel.gr>
158
+
159
+ * examples/blog/root/style.xsl: fixed a bug.
160
+
161
+ 13-12-2004 George Moschovitis <gm@navel.gr>
162
+
163
+ * lib/shaders.rb (RubyShader): added support for statically including
164
+ files.
165
+
166
+ * lib/server/render.rb (RenderUtils): dump method helps in debugging.
167
+
168
+ * examples/flash/lib/flash.rb: introduced service,
169
+ yeah with some SHITY ming code the example works.
170
+
171
+ * examples/flash: introduced flash example.
172
+
2
173
  10-12-2004 George Moschovitis <gm@navel.gr>
3
174
 
175
+ * lib/og/backends/psql-pr.rb: introduced Postgres-PR backend.
176
+
177
+ * --- VERSION 0.6.0 ---
178
+
4
179
  * bin/new_app.rb: remove .svn dirs.
5
180
 
6
181
  * final preparations for release.
data/README CHANGED
@@ -39,16 +39,17 @@ A short summary of the major features:
39
39
 
40
40
  * Shaders, XSLT templates
41
41
 
42
+ Nitro features a fully programmable source transformation pipeline.
43
+ A transformation stage in this pipeline is called a Shader. An example
44
+ shader transforms an XHTML document with embeded ruby-code processing
45
+ instructions to a Ruby method. Another shader might be an XSLT stage.
46
+
42
47
  Nitro promotes the usage of XSLT for web templates. The functional
43
48
  nature of XSL is ideal for the Web. Moreover, the engine efficiently
44
49
  precompiles the xsl transformation along with other transformations
45
50
  (for example localization) essentially providing a computationally
46
51
  free transformation step.
47
52
 
48
- A shader integrates many XSLT templates and or CSS stylesheets
49
- to encapsulate all styling/skinning requirements of a Web Application.
50
-
51
- Nitro features a fully programmable shader pipeline.
52
53
 
53
54
  * Multi phase evaluation
54
55
 
@@ -60,7 +61,7 @@ A short summary of the major features:
60
61
  'RunTime' time.
61
62
 
62
63
  <!-- compile time include (static include) -->
63
- <?include xl:href="myfile.si" />
64
+ <?include href="myfile.si" />
64
65
 
65
66
  <!-- run time include (dynamic include) -->
66
67
  <include href="myfile.si" />
@@ -79,7 +80,8 @@ A short summary of the major features:
79
80
  to describe the relations between objects, a flexible and intuitive api
80
81
  for querieng the database, raw access to the SQL language if needed
81
82
  (for example to fine tune the automatically generated SQL tables, or
82
- for custom queries), suports deserialization to Ruby objects or tuples
83
+ for custom queries), suports deserialization to Ruby objects or tuples,
84
+ automatically generates join tables for many_to_many relations
83
85
  and provides a collection of usefull Mixins to synthesize common
84
86
  Entities.
85
87
 
@@ -100,6 +102,10 @@ A short summary of the major features:
100
102
  Request filters are a powerfull mechanism for customized processing
101
103
  of special requests. Example filters are the autologin filter,
102
104
  a gzip filter etc.
105
+
106
+ Moreover, Nitro provides the fine-grained filtering method pioneered
107
+ by Rails where you can attach single methods, blocks, objects or
108
+ modules, before, after or arrounf actions.
103
109
 
104
110
  * Hierarchical Caching
105
111
 
@@ -116,7 +122,7 @@ A short summary of the major features:
116
122
 
117
123
  * Support for 'nice' urls.
118
124
 
119
- Allows
125
+ Experimental.
120
126
 
121
127
  * Simple events manager.
122
128
 
@@ -132,6 +138,11 @@ A short summary of the major features:
132
138
  server. You can use the irb console to investigate all variables
133
139
  and code in your running server process.
134
140
 
141
+ * integrates the 'breakpoint' library by Florian Gross. The Breakpoint
142
+ library provides the convenience of being able to inspect and modify
143
+ state, diagnose bugs all via IRB by simply setting breakpoints in
144
+ your applications by the call of a method.
145
+
135
146
  * Parts
136
147
 
137
148
  Parts are organized modules of web services. A Web Framework that
@@ -281,6 +292,7 @@ to stop the application execute:
281
292
 
282
293
  $ ./ctl stop
283
294
 
295
+
284
296
  == Debuging Nitro applications
285
297
 
286
298
  Have "tail -f" commands running on logs/app.log in your application
@@ -289,6 +301,28 @@ information to these files. Debugging info will also be shown in the
289
301
  browser when running in debug mode.
290
302
 
291
303
 
304
+ == Description of contents
305
+
306
+ bin
307
+ Commands and wizards.
308
+
309
+ examples/
310
+ Various examples. 'tiny' is a minimal example, 'blog' is a fully working and
311
+ nice looking Blog implementation, 'og' contains some Og examples and 'flash'
312
+ is an example for generating binary content for a Nitro response.
313
+
314
+ lib/nitro
315
+ Nitro library source files.
316
+
317
+ lib/og
318
+ Og library source files.
319
+
320
+ lib/glue
321
+ Common source files.
322
+
323
+ test
324
+ Unit and functional tests.
325
+
292
326
  == Support
293
327
 
294
328
  For any questions regarding Nitro, feel free to ask on the ruby-talk
data/RELEASES CHANGED
@@ -1,3 +1,27 @@
1
+ == Version 0.7 was released on 27/12/2004.
2
+
3
+ A snapshot of the latest code. Many fixes and new features result
4
+ in a more mature product. Many thanks to the ruby hackers that sent
5
+ suggestions and patches used in this release!
6
+
7
+ Most notable additions:
8
+
9
+ * Improved win32 compatibility (Tiny example runs out of the box).
10
+ * Binary content example (Flash, needs ruby-ming installed to run).
11
+ * Totaly recoded prop_accessor mechanism, avoids polution of the Module
12
+ class.
13
+ * prop_accessors for Modules, allows synthesizing of managed objects
14
+ from Mixins.
15
+ * new automatically generated methods in Og.
16
+ * MockDatabase leverages the FlexMock object for easier unit testing.
17
+ * Integrated the cool Breakpointer library by Florian Gross.
18
+ * Markup mixin to automatically expand/compact generalized markup code.
19
+ * new_form wizard.
20
+ * Statically (compile time) included subscripts.
21
+ * Important bug fix in redirects.
22
+
23
+ and many many bugfixes! :)
24
+
1
25
  == Version 0.6 was released on 13/12/2004.
2
26
 
3
27
  This is a preview release, the api for the new features is not
data/Rakefile CHANGED
@@ -1,7 +1,5 @@
1
- # = Rakefile
2
- #
3
1
  # code:
4
- # George Moschovitis <gm@navel.gr>
2
+ # * George Moschovitis <gm@navel.gr>
5
3
  #
6
4
  # (c) 2004 Navel, all rights reserved.
7
5
  # $Id: connection.rb 71 2004-10-18 10:50:22Z gmosx $
@@ -56,7 +54,7 @@ if 'nitro' == project
56
54
 
57
55
  PKG_VERSION = $srv_version
58
56
  PKG_FILES = FileList[
59
- "[A-Z]*", "{bin,etc,ext,examples,doc,lib,test}/**/*"
57
+ "[A-Z]*", "{bin,benchmark,etc,ext,examples,doc,lib,test,vendor}/**/*"
60
58
  # "examples/*.rb"
61
59
  ].exclude(".svn/**/*").exclude("*.og").exclude("**/*.log")
62
60
 
@@ -65,9 +63,9 @@ if 'nitro' == project
65
63
  s.version = PKG_VERSION
66
64
  s.summary = "Web Engine"
67
65
  s.description = "An efficient, yet simple engine for Web Applications"
66
+ # s.add_dependency("postgres-pr", ">= 0.3.0")
68
67
  # s.add_dependency("postgres", ">= 0.7.1")
69
68
  # s.add_dependency("extensions", ">= 0.5")
70
- # s.add_dependency("builder")
71
69
  s.required_ruby_version = ">= 1.8.1"
72
70
  s.files = PKG_FILES.to_a
73
71
  s.require_path = "lib"
@@ -91,9 +89,9 @@ else
91
89
 
92
90
  PKG_VERSION = $og_version
93
91
  PKG_FILES = FileList[
94
- "README.og", "RELEASES.og", "LICENSE", "AUTHORS",
92
+ "README.og", "RELEASES.og", "LICENSE", "AUTHORS", "Rakefile", "ChangeLog*",
95
93
  "examples/og/*", "lib/glue.rb", "lib/glue/**/*", "lib/og/**/*", "lib/og.rb",
96
- "test/*og*.rb"
94
+ "test/*og*.rb", "test/og/*"
97
95
  ].exclude(".svn/**/*").exclude("**/*.log")
98
96
 
99
97
  spec = Gem::Specification.new do |s|
data/bin/new_app.rb CHANGED
@@ -4,22 +4,44 @@
4
4
  #
5
5
  # Creates the directory structure for a new project.
6
6
  #
7
- #--
8
7
  # code:
9
- # George Moschovitis <gm@navel.gr>
8
+ # * George Moschovitis <gm@navel.gr>
10
9
  #
11
10
  # (c) 2004 Navel, all rights reserved.
12
- # $Id: new_app.rb 188 2004-12-10 14:14:17Z gmosx $
13
- #++
11
+ # $Id: new_app.rb 194 2004-12-20 20:23:57Z gmosx $
12
+
13
+ require 'fileutils'
14
+
15
+ # gmosx, TODO: move to a library
16
+ #
17
+ def ll_r(path, &block)
18
+ Dir.foreach(path) do |f|
19
+ next if [".", ".."].include?(f)
20
+ fullname = path + "/" + f
21
+ yield(fullname)
22
+ ll_r(fullname, &block) if FileTest.directory?fullname and not FileTest.symlink?fullname
23
+ end
24
+ end
14
25
 
15
26
  bin_dir = File.dirname(__FILE__)
16
27
 
17
28
  if base_dir = ARGV[0]
18
29
 
30
+ # remove the trailing '/' if it exists.
31
+ base_dir = base_dir.gsub(/\/$/, '')
32
+
33
+ # the following code is win32 compatible.
34
+ #
35
+ FileUtils.cp_r "#{bin_dir}/proto", base_dir
36
+ ll_r(base_dir) { |f| FileUtils.rm_rf(f) if /\.svn$/ =~ f }
37
+
38
+ =begin
39
+ Unix implementation
19
40
  %x{
20
41
  cp -R #{bin_dir}/proto #{base_dir}
21
42
  find #{base_dir} | grep "\.svn$" | xargs rm -rf
22
43
  }
44
+ =end
23
45
 
24
46
  else
25
47
 
data/bin/new_form.rb ADDED
@@ -0,0 +1,54 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ # = New Form Wizzard
4
+ #
5
+ # Leverages the FormBuilder functionality to generate a scaffold
6
+ # form for the given managed object
7
+ #
8
+ # Example usage:
9
+ #
10
+ # ./new_form.rb N::Article lib/articles.rb [article_form.xhtml]
11
+ #
12
+ # code:
13
+ # * George Moschovitis <gm@navel.gr>
14
+ #
15
+ # (c) 2004 Navel, all rights reserved.
16
+ # $Id: new_app.rb 188 2004-12-10 14:14:17Z gmosx $
17
+
18
+ $LOAD_PATH.unshift 'lib'
19
+
20
+ require 'glue/property'
21
+ require 'glue/inflector'
22
+ require 'nitro/builders/form'
23
+ require 'og'
24
+
25
+ def die(str)
26
+ puts str
27
+ exit!
28
+ end
29
+
30
+ if klass_name = ARGV[0] and lib_filename = ARGV[1]
31
+
32
+ require lib_filename
33
+ klass = nil
34
+ eval "klass = #{klass_name}"
35
+ dst_dir = File.dirname(lib_filename)
36
+ dst_filename = ARGV[3] || File.join(dst_dir, "#{G::Inflector.name(klass_name)}_form.xhtml")
37
+
38
+ # p klass, lib_filename, dst_filename
39
+
40
+ form = N::FormBuilder.render(klass.new)
41
+
42
+ File.open(dst_filename, 'w') do |file|
43
+ file.write(form)
44
+ end
45
+
46
+ else
47
+
48
+ puts %{
49
+ USAGE:
50
+ new_form class_name library_filename [base_filename]
51
+ }
52
+
53
+ end
54
+