innate 2009.04

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/CHANGELOG +2981 -0
  2. data/COPYING +18 -0
  3. data/MANIFEST +127 -0
  4. data/README.md +563 -0
  5. data/Rakefile +35 -0
  6. data/example/app/retro_games.rb +60 -0
  7. data/example/app/todo/layout/default.xhtml +11 -0
  8. data/example/app/todo/spec/todo.rb +63 -0
  9. data/example/app/todo/start.rb +51 -0
  10. data/example/app/todo/view/index.xhtml +39 -0
  11. data/example/app/whywiki_erb/layout/wiki.html.erb +15 -0
  12. data/example/app/whywiki_erb/spec/wiki.rb +19 -0
  13. data/example/app/whywiki_erb/start.rb +42 -0
  14. data/example/app/whywiki_erb/view/edit.erb +6 -0
  15. data/example/app/whywiki_erb/view/index.erb +12 -0
  16. data/example/custom_middleware.rb +35 -0
  17. data/example/hello.rb +11 -0
  18. data/example/howto_spec.rb +35 -0
  19. data/example/link.rb +27 -0
  20. data/example/provides.rb +31 -0
  21. data/example/session.rb +38 -0
  22. data/innate.gemspec +29 -0
  23. data/lib/innate.rb +269 -0
  24. data/lib/innate/action.rb +150 -0
  25. data/lib/innate/adapter.rb +76 -0
  26. data/lib/innate/cache.rb +134 -0
  27. data/lib/innate/cache/api.rb +128 -0
  28. data/lib/innate/cache/drb.rb +58 -0
  29. data/lib/innate/cache/file_based.rb +41 -0
  30. data/lib/innate/cache/marshal.rb +17 -0
  31. data/lib/innate/cache/memory.rb +22 -0
  32. data/lib/innate/cache/yaml.rb +17 -0
  33. data/lib/innate/current.rb +37 -0
  34. data/lib/innate/dynamap.rb +96 -0
  35. data/lib/innate/helper.rb +183 -0
  36. data/lib/innate/helper/aspect.rb +124 -0
  37. data/lib/innate/helper/cgi.rb +54 -0
  38. data/lib/innate/helper/flash.rb +36 -0
  39. data/lib/innate/helper/link.rb +94 -0
  40. data/lib/innate/helper/redirect.rb +85 -0
  41. data/lib/innate/helper/render.rb +87 -0
  42. data/lib/innate/helper/send_file.rb +26 -0
  43. data/lib/innate/log.rb +20 -0
  44. data/lib/innate/log/color_formatter.rb +43 -0
  45. data/lib/innate/log/hub.rb +73 -0
  46. data/lib/innate/middleware_compiler.rb +65 -0
  47. data/lib/innate/mock.rb +49 -0
  48. data/lib/innate/node.rb +1025 -0
  49. data/lib/innate/options.rb +37 -0
  50. data/lib/innate/options/dsl.rb +202 -0
  51. data/lib/innate/options/stub.rb +7 -0
  52. data/lib/innate/request.rb +141 -0
  53. data/lib/innate/response.rb +23 -0
  54. data/lib/innate/route.rb +110 -0
  55. data/lib/innate/session.rb +121 -0
  56. data/lib/innate/session/flash.rb +94 -0
  57. data/lib/innate/spec.rb +23 -0
  58. data/lib/innate/state.rb +27 -0
  59. data/lib/innate/state/accessor.rb +130 -0
  60. data/lib/innate/state/fiber.rb +74 -0
  61. data/lib/innate/state/thread.rb +47 -0
  62. data/lib/innate/traited.rb +85 -0
  63. data/lib/innate/trinity.rb +18 -0
  64. data/lib/innate/version.rb +3 -0
  65. data/lib/innate/view.rb +60 -0
  66. data/lib/innate/view/erb.rb +15 -0
  67. data/lib/innate/view/etanni.rb +36 -0
  68. data/lib/innate/view/none.rb +9 -0
  69. data/spec/example/app/retro_games.rb +30 -0
  70. data/spec/example/hello.rb +13 -0
  71. data/spec/example/link.rb +25 -0
  72. data/spec/example/provides.rb +16 -0
  73. data/spec/example/session.rb +22 -0
  74. data/spec/helper.rb +10 -0
  75. data/spec/innate/action/layout.rb +107 -0
  76. data/spec/innate/action/layout/file_layout.xhtml +1 -0
  77. data/spec/innate/cache/common.rb +47 -0
  78. data/spec/innate/cache/marshal.rb +5 -0
  79. data/spec/innate/cache/memory.rb +5 -0
  80. data/spec/innate/cache/yaml.rb +5 -0
  81. data/spec/innate/dynamap.rb +22 -0
  82. data/spec/innate/helper.rb +86 -0
  83. data/spec/innate/helper/aspect.rb +75 -0
  84. data/spec/innate/helper/cgi.rb +37 -0
  85. data/spec/innate/helper/flash.rb +118 -0
  86. data/spec/innate/helper/link.rb +139 -0
  87. data/spec/innate/helper/redirect.rb +160 -0
  88. data/spec/innate/helper/render.rb +133 -0
  89. data/spec/innate/helper/send_file.rb +21 -0
  90. data/spec/innate/helper/view/aspect_hello.xhtml +1 -0
  91. data/spec/innate/helper/view/locals.xhtml +1 -0
  92. data/spec/innate/helper/view/loop.xhtml +4 -0
  93. data/spec/innate/helper/view/num.xhtml +1 -0
  94. data/spec/innate/helper/view/partial.xhtml +1 -0
  95. data/spec/innate/helper/view/recursive.xhtml +7 -0
  96. data/spec/innate/mock.rb +84 -0
  97. data/spec/innate/node/mapping.rb +37 -0
  98. data/spec/innate/node/node.rb +134 -0
  99. data/spec/innate/node/resolve.rb +82 -0
  100. data/spec/innate/node/view/another_layout/another_layout.xhtml +3 -0
  101. data/spec/innate/node/view/bar.xhtml +1 -0
  102. data/spec/innate/node/view/foo.html.xhtml +1 -0
  103. data/spec/innate/node/view/only_view.xhtml +1 -0
  104. data/spec/innate/node/view/with_layout.xhtml +1 -0
  105. data/spec/innate/node/wrap_action_call.rb +83 -0
  106. data/spec/innate/options.rb +115 -0
  107. data/spec/innate/parameter.rb +154 -0
  108. data/spec/innate/provides.rb +99 -0
  109. data/spec/innate/provides/list.html.xhtml +1 -0
  110. data/spec/innate/provides/list.txt.xhtml +1 -0
  111. data/spec/innate/request.rb +77 -0
  112. data/spec/innate/route.rb +135 -0
  113. data/spec/innate/session.rb +54 -0
  114. data/spec/innate/state/fiber.rb +58 -0
  115. data/spec/innate/state/thread.rb +40 -0
  116. data/spec/innate/traited.rb +55 -0
  117. data/tasks/bacon.rake +66 -0
  118. data/tasks/changelog.rake +18 -0
  119. data/tasks/gem.rake +22 -0
  120. data/tasks/gem_installer.rake +76 -0
  121. data/tasks/grancher.rake +12 -0
  122. data/tasks/install_dependencies.rake +4 -0
  123. data/tasks/manifest.rake +4 -0
  124. data/tasks/rcov.rake +19 -0
  125. data/tasks/release.rake +51 -0
  126. data/tasks/reversion.rake +8 -0
  127. data/tasks/setup.rake +28 -0
  128. metadata +181 -0
data/COPYING ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2008 Michael Fellinger <m.fellinger@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,127 @@
1
+ CHANGELOG
2
+ COPYING
3
+ MANIFEST
4
+ README.md
5
+ Rakefile
6
+ example/app/retro_games.rb
7
+ example/app/todo/layout/default.xhtml
8
+ example/app/todo/spec/todo.rb
9
+ example/app/todo/start.rb
10
+ example/app/todo/view/index.xhtml
11
+ example/app/whywiki_erb/layout/wiki.html.erb
12
+ example/app/whywiki_erb/spec/wiki.rb
13
+ example/app/whywiki_erb/start.rb
14
+ example/app/whywiki_erb/view/edit.erb
15
+ example/app/whywiki_erb/view/index.erb
16
+ example/custom_middleware.rb
17
+ example/hello.rb
18
+ example/howto_spec.rb
19
+ example/link.rb
20
+ example/provides.rb
21
+ example/session.rb
22
+ innate.gemspec
23
+ lib/innate.rb
24
+ lib/innate/action.rb
25
+ lib/innate/adapter.rb
26
+ lib/innate/cache.rb
27
+ lib/innate/cache/api.rb
28
+ lib/innate/cache/drb.rb
29
+ lib/innate/cache/file_based.rb
30
+ lib/innate/cache/marshal.rb
31
+ lib/innate/cache/memory.rb
32
+ lib/innate/cache/yaml.rb
33
+ lib/innate/current.rb
34
+ lib/innate/dynamap.rb
35
+ lib/innate/helper.rb
36
+ lib/innate/helper/aspect.rb
37
+ lib/innate/helper/cgi.rb
38
+ lib/innate/helper/flash.rb
39
+ lib/innate/helper/link.rb
40
+ lib/innate/helper/redirect.rb
41
+ lib/innate/helper/render.rb
42
+ lib/innate/helper/send_file.rb
43
+ lib/innate/log.rb
44
+ lib/innate/log/color_formatter.rb
45
+ lib/innate/log/hub.rb
46
+ lib/innate/middleware_compiler.rb
47
+ lib/innate/mock.rb
48
+ lib/innate/node.rb
49
+ lib/innate/options.rb
50
+ lib/innate/options/dsl.rb
51
+ lib/innate/options/stub.rb
52
+ lib/innate/request.rb
53
+ lib/innate/response.rb
54
+ lib/innate/route.rb
55
+ lib/innate/session.rb
56
+ lib/innate/session/flash.rb
57
+ lib/innate/spec.rb
58
+ lib/innate/state.rb
59
+ lib/innate/state/accessor.rb
60
+ lib/innate/state/fiber.rb
61
+ lib/innate/state/thread.rb
62
+ lib/innate/traited.rb
63
+ lib/innate/trinity.rb
64
+ lib/innate/version.rb
65
+ lib/innate/view.rb
66
+ lib/innate/view/erb.rb
67
+ lib/innate/view/etanni.rb
68
+ lib/innate/view/none.rb
69
+ spec/example/app/retro_games.rb
70
+ spec/example/hello.rb
71
+ spec/example/link.rb
72
+ spec/example/provides.rb
73
+ spec/example/session.rb
74
+ spec/helper.rb
75
+ spec/innate/action/layout.rb
76
+ spec/innate/action/layout/file_layout.xhtml
77
+ spec/innate/cache/common.rb
78
+ spec/innate/cache/marshal.rb
79
+ spec/innate/cache/memory.rb
80
+ spec/innate/cache/yaml.rb
81
+ spec/innate/dynamap.rb
82
+ spec/innate/helper.rb
83
+ spec/innate/helper/aspect.rb
84
+ spec/innate/helper/cgi.rb
85
+ spec/innate/helper/flash.rb
86
+ spec/innate/helper/link.rb
87
+ spec/innate/helper/redirect.rb
88
+ spec/innate/helper/render.rb
89
+ spec/innate/helper/send_file.rb
90
+ spec/innate/helper/view/aspect_hello.xhtml
91
+ spec/innate/helper/view/locals.xhtml
92
+ spec/innate/helper/view/loop.xhtml
93
+ spec/innate/helper/view/num.xhtml
94
+ spec/innate/helper/view/partial.xhtml
95
+ spec/innate/helper/view/recursive.xhtml
96
+ spec/innate/mock.rb
97
+ spec/innate/node/mapping.rb
98
+ spec/innate/node/node.rb
99
+ spec/innate/node/resolve.rb
100
+ spec/innate/node/view/another_layout/another_layout.xhtml
101
+ spec/innate/node/view/bar.xhtml
102
+ spec/innate/node/view/foo.html.xhtml
103
+ spec/innate/node/view/only_view.xhtml
104
+ spec/innate/node/view/with_layout.xhtml
105
+ spec/innate/node/wrap_action_call.rb
106
+ spec/innate/options.rb
107
+ spec/innate/parameter.rb
108
+ spec/innate/provides.rb
109
+ spec/innate/provides/list.html.xhtml
110
+ spec/innate/provides/list.txt.xhtml
111
+ spec/innate/request.rb
112
+ spec/innate/route.rb
113
+ spec/innate/session.rb
114
+ spec/innate/state/fiber.rb
115
+ spec/innate/state/thread.rb
116
+ spec/innate/traited.rb
117
+ tasks/bacon.rake
118
+ tasks/changelog.rake
119
+ tasks/gem.rake
120
+ tasks/gem_installer.rake
121
+ tasks/grancher.rake
122
+ tasks/install_dependencies.rake
123
+ tasks/manifest.rake
124
+ tasks/rcov.rake
125
+ tasks/release.rake
126
+ tasks/reversion.rake
127
+ tasks/setup.rake
@@ -0,0 +1,563 @@
1
+ # Innate
2
+
3
+ Innate is the core of Ramaze, but useful on its own.
4
+
5
+
6
+ ## Philosophy
7
+
8
+ The philosophy behind Innate is to provide a simple web-framework that:
9
+
10
+ * Stays below 2000 easily readable lines of code
11
+ * Has Rack as the only dependency
12
+ * Provides the default helpers
13
+ * Is easy to encapsulate and reuse in other contexts as a simple rack app
14
+ * Has a rock-solid and fast implementation
15
+ * Scores at least 95% in rcov
16
+ * Is fully documented using YARD
17
+
18
+
19
+ ## Innate vs. Ramaze
20
+
21
+ Numerous people asked where Innate fits into the picture of Ramaze and when it
22
+ would be appropriate to use Innate alone.
23
+
24
+ The answer to this is not as simple as I thought, given that Ramaze improves on
25
+ it a lot by taking full advantage of the encapsulation.
26
+
27
+ Innate started out as I grew increasingly annoyed by the many hacks and add-ons
28
+ that diluted the original simplicity of Ramaze as we discovered ways to do
29
+ things better, so I went on to create something that is impossible to dilute and
30
+ simply works as a multiplier.
31
+
32
+ It does work standalone, and it might be suitable for applications that just
33
+ need the little extra over plain old Rack, making it easy to deploy and rely on
34
+ the stability that comes with simple code.
35
+ It's also the starting point if you want to study the inner workings of Ramaze
36
+ without being distracted, all you need to keep in mind is Rack.
37
+
38
+ If all you need is a couple of ERB templates and a few nodes then Innate is the
39
+ way to go.
40
+ Upgrading to Ramaze later is quite easy, just change a couple of lines and the
41
+ power of your code multiplies (again).
42
+
43
+ The split between Innate and Ramaze is clear cut and gives Ramaze freedom to
44
+ expand in any direction (and I have quite some ideas where to take it).
45
+
46
+ Ramaze adds things that require other dependencies, caching with memcached or
47
+ sequel, logging with analogger or growl, templating with haml or erubis, just to
48
+ name a few.
49
+
50
+ Ramaze also adds Apps to the mix, and it is easier to understand them when the
51
+ concepts of what's going on inside an App is completely abstracted by Innate.
52
+
53
+ To summarize, Innate really keeps it simple, acts as a learning tool and
54
+ encourages everybody to build on top of it whatever they want.
55
+
56
+
57
+ ## Features
58
+
59
+ * Powerful Helper system
60
+ * Nodes[1] simply include Innate::Node, so class inheritance is your choice.
61
+ * The only hard dependency is Rack
62
+ * Easy to get started
63
+ * Compatible with major Ruby implementations[2].
64
+ * Usage of Fiber[3] instead of Thread if possible.
65
+ * Namespaced serializable configuration system
66
+ * Simple testing without need of a running server
67
+ * No clutter in your application directory structure, scales from a single file
68
+ upwards
69
+ * Seamless integration with Rack middleware
70
+ * No patching of ruby core or stdlib.
71
+ * Direct access to the current Request, Response, and Session from anywhere via
72
+ Trinity
73
+ * Works out of the box with ERB the templating engine.
74
+ * Support for all rack-compatible web-servers.
75
+ * Dynamic content-representation.
76
+
77
+ [1]: What you may think of as Controller.
78
+ [2]: This includes: Ruby 1.8, Ruby 1.9.1, JRuby, Rubinius
79
+ [3]: Fiber is available on 1.9 only at this point.
80
+
81
+ ## Usage
82
+
83
+ A simple example of using Innate that also shows you how to add your custom
84
+ middleware, write specs and the overall concept:
85
+
86
+ require 'innate'
87
+
88
+ Innate.setup_middleware
89
+
90
+ Innate.map('/') do |env|
91
+ Rack::Response.new(['Hello, World!']).finish
92
+ end
93
+
94
+ Innate::Mock.get('/')
95
+
96
+ And another example, using Node with a normal server:
97
+
98
+ require 'innate'
99
+
100
+ class Hi
101
+ include Innate::Node
102
+ map '/'
103
+
104
+ def index
105
+ "Hello, World!"
106
+ end
107
+ end
108
+
109
+ Innate.start :adapter => :mongrel
110
+
111
+ ## Installation
112
+
113
+ ### Via git (recommended)
114
+
115
+ Installing Innate from git is highly recommended, since it gives you easy
116
+ access to alternate branches, bugfixes, and new features.
117
+
118
+ git clone git://github.com/manveru/innate.git
119
+
120
+ And add the innate/lib directory to your `RUBYLIB` environment variable.
121
+
122
+ For unixish systems you may want to add it to `~/.bashrc` or the equivalent for
123
+ your shell:
124
+
125
+ export RUBYLIB="~/path/to/innate/lib:$RUBYLIB"
126
+
127
+ ### Via gem install
128
+
129
+ #### From Github
130
+
131
+ gem install manveru-innate --source=http://gems.github.com
132
+
133
+ #### From Rubyforge
134
+
135
+ Not yet, and not sure when I'll get around to do this, feel free to ask if you
136
+ want to maintain the project at rubyforge.
137
+
138
+
139
+ ## Concepts
140
+
141
+ First let's see about the good old MVC:
142
+
143
+
144
+ ### Model
145
+
146
+ Innate doesn't have any ties to models, it does not offer helpers or rake tasks
147
+ or whatever you may be expecting, there is no M, use whatever you like.
148
+ Innate is, however, known to be compatible with the ORMs listed below:
149
+
150
+ * ActiveRecord
151
+ * DataMapper
152
+ * M4DBI
153
+ * Og
154
+ * Sequel
155
+
156
+ Please consider giving us a heads up about what worked for you if it isn't in
157
+ the list yet.
158
+
159
+
160
+ ### View
161
+
162
+ Innate has support for only
163
+ Innate supports multiple templating engines and it is very easy to add your
164
+ own.
165
+ At the moment we offer following engines out of the box:
166
+
167
+ * [Builder](http://builder.rubyforge.org)
168
+ * [Haml](http://haml.hamptoncatlin.com/)
169
+ * [Sass](http://haml.hamptoncatlin.com/docs/sass)
170
+ * [Erubis](http://rubyforge.org/projects/erubis)
171
+ * [Tenjin](http://www.kuwata-lab.com/tenjin/)
172
+
173
+ How to build your own is discussed at
174
+ [HowTo:View](http://ramaze.net/HowTo:View).
175
+
176
+
177
+ ### Controller
178
+
179
+ Innate follows a different approach than most frameworks, making the controller
180
+ subclassing obsolete. To make an object accessible from the outside simply
181
+ include Innate::Node and map it to the location you would like.
182
+
183
+
184
+ ## Differences from Ramaze
185
+
186
+ Innate throws a lot overboard; it doesn't provide all the bells and whistles
187
+ that you may be used to. This makes Ramaze the way to go for larger
188
+ applications.
189
+
190
+ For this reason, Innate is not only a standalone framework, it is also the core
191
+ of Ramaze.
192
+
193
+ Ramaze started out without any of the benefits that Rack gives us these days,
194
+ especially regarding the server handlers, request/response, and middleware.
195
+
196
+ Still it tried to provide everything one might need with the least effort,
197
+ leading to a lot of incorporation of dependencies (we have things like bacon,
198
+ simple_http, gettext, mime types, ...)
199
+
200
+
201
+ ### Configuration
202
+
203
+ Innate provides the Innate::Options DSL, in some aspects to the old
204
+ Ramaze::Global, but a lot more flexible.
205
+
206
+ Options has namespaces, inheritance, defaults, triggers, documentation, and a
207
+ sane name.
208
+
209
+ The definition syntax roughly resembles Ramaze::Global.
210
+
211
+ We break with the tradition where all options one would ever need were provided
212
+ in one file. It made maintenance rather difficult and the code hard to follow.
213
+ So the new approach is to put options where they belong, alongside the class or
214
+ module they are used in.
215
+
216
+ There are some things still in Innate.options, but they have large impact on the
217
+ whole system.
218
+
219
+ Options doesn't do things like merging env variables or parsing ARGV, these are
220
+ things that Ramaze adds.
221
+
222
+ What makes Options especially useful is that you can use it in your own
223
+ application to configure it without using diverse routes like putting config
224
+ into counter-intuitive yaml files, using global variables, or relying on yet
225
+ another dependency.
226
+
227
+ A small example:
228
+
229
+ module Blog
230
+ include Innate::Optioned
231
+
232
+ options.dsl do
233
+ o "Title of the blog", :title, "My Blog"
234
+ o "Syntax highlighting engine for blog posts", :syntax, :coderay
235
+ end
236
+
237
+ class Articles
238
+ Innate.node '/'
239
+
240
+ def index
241
+ "Welcome to #{Blog.options.title}"
242
+ end
243
+ end
244
+ end
245
+
246
+
247
+ ### Controller
248
+
249
+ Away with controllers, long live the Node.
250
+
251
+ Nodes are objects that include Innate::Node and are then considered rack
252
+ applications that get automatically hooked into the routing.
253
+
254
+ Since every existing Ramaze application relies on Ramaze::Controller and normal
255
+ subclassing is not without merits as well we keep that part entirely in Ramaze,
256
+ Controller simply includes Innate::Node and makes it suitable for the usage
257
+ within Apps.
258
+
259
+
260
+ #### Layouts
261
+
262
+ Since layouts were an afterthought in Ramaze, they were made normal actions
263
+ like every other on the respective controllers, leading to lots of confusion
264
+ over the correct way to use layouts, the Controller::layout syntax in respect
265
+ to the real location of layouts, how to exclude/include single actions, where
266
+ layouts should be stored, how to prevent lookup from external requests, ...
267
+
268
+ I made layouts just as important as views and methods for the Action in Innate,
269
+ and they have their own root directory to live in and will not be considered as
270
+ a normal view template, so they cannot be accidentally be rendered as their own
271
+ actions.
272
+
273
+ This strikes me as important, because I consider layouts to be superior to
274
+ Ezamar elements and equal to render_partial or render_template, just about
275
+ every application uses it, so they should be handled in the best way possible.
276
+
277
+ The root directory for layouts is in line with the other default locations:
278
+
279
+ proto
280
+ |-- layout
281
+ |-- model
282
+ |-- node
283
+ |-- public
284
+ `-- view
285
+
286
+ While none of these directories is necessary, they are the default locations and
287
+ should be included in a new proto for Ramaze (just that ramaze uses
288
+ `/controller` instead of `/node`.
289
+
290
+ Innate will not have project generating capabilities, so we just have to
291
+ document it very well and provide some example apps.
292
+
293
+
294
+ #### Provides
295
+
296
+ This is a major new feature stolen from Merb and adapted for the ease of use of
297
+ Innate/Ramaze.
298
+ It won't have all the capabilities one might be used to out of the box, but
299
+ extending them is easy.
300
+
301
+ Having "provides" means that every Action has different ways of being rendered,
302
+ depending on so-called wishes, that's what people usually call
303
+ content-representation.
304
+
305
+ A wish may be anything related to the request object, and by default it will
306
+ trigger on the filename extension asked for.
307
+ This enables you to create a single action that can be rendered in
308
+ json/rss/atom/yaml/xml/xhtml/html/wap or different languages...
309
+
310
+ The dispatching in Node depends on the filename extension by default, but more
311
+ decision paths can be added to Action by overriding some defaults.
312
+
313
+ Layouts map to wishes just like views, so every content representation can have
314
+ a suitable layout as well.
315
+
316
+ This is very alien to old Ramaze, which always has a 1:1 mapping between actions
317
+ and their views and how they are rendered, which made people wonder how to serve
318
+ sass as css or how to respond with json for a ajax request until they finally
319
+ were pointed to setting content-type, using respond and setting up custom
320
+ routes.
321
+
322
+ I hope this feature makes things simpler for people who care about it while it
323
+ can be ignored by people who don't.
324
+
325
+
326
+ ### More specifics
327
+
328
+ Here I try to list the most important things that Ramaze will offer but that
329
+ are not included in Innate itself in terms of globs:
330
+
331
+ * cache.rb and cache/*.rb
332
+ * current/response.rb
333
+ * tool/{create,mime,localize,daemonize,record,project_creator}.rb
334
+ * spec/helper/*.rb
335
+ * snippets/**/*.rb
336
+ * gestalt.rb
337
+ * store/default.rb
338
+ * contrib.rb or any contribs
339
+ * adapter/*.rb (superseded by a lightweight adapter.rb)
340
+ * template/ezamar*/*
341
+ * bacon.rb
342
+ * dispatcher.rb
343
+ * dispatcher/*.rb
344
+
345
+ There might be a couple of things I've forgotten, but that's what a quick
346
+ glance tells me.
347
+
348
+ Let's go through them one by one and consider what's gonna happen to them:
349
+
350
+
351
+ ### Cache
352
+
353
+ Caching is a very important concern and one of the most difficult things to get
354
+ right for any web application.
355
+
356
+ Innate defines the caching API that enables everybody to add caches with very
357
+ little code.
358
+
359
+ Innate provides caching by following means:
360
+
361
+ * DRb
362
+ * Hash
363
+ * Marshal
364
+ * YAML
365
+
366
+ Ramaze adds:
367
+
368
+ * Memcached
369
+ * Sequel
370
+
371
+ And as time goes on there will be many more.
372
+
373
+
374
+ ### Response
375
+
376
+ Very little code, just provide some options regarding default headers and easy
377
+ ways to reset the response.
378
+ Ramaze adds some more convenient methods.
379
+
380
+
381
+ ### Tools
382
+
383
+ Innate doesn't provide any of the stuff in ramaze/tool and it was removed from
384
+ Ramaze as well, some of the reasoning is below.
385
+
386
+ #### Tool::Create
387
+
388
+ This has been used by `bin/ramaze --create`, bougyman is working on a new
389
+ `bin/ramaze` which won't use it, so we removed it.
390
+
391
+ #### Tool::ProjectCreator
392
+
393
+ Dependency for Tool::Create, removed as well.
394
+
395
+ ##### Tool::Daemonize
396
+
397
+ Nothing but issues with this one although it is just a very thin wrapper for
398
+ the daemons gem. Nobody has contributed to this so far despite the issues and
399
+ it seems that there are a lot of different solutions for this problem.
400
+
401
+ This was removed from Ramaze and Innate. You may use the daemonize functionality
402
+ from rackup.
403
+
404
+ ##### Ramaze::Record
405
+
406
+ Well, this might be the most obvious candidate for removal, maybe it can be
407
+ revived as middleware. The functionality itself was in the adapter and even
408
+ that's only a few lines. But so far I have never seen any usage of it.
409
+
410
+ ##### Tool::Localize
411
+
412
+ Despite being quite popular it has many issues and is totally unusable if you
413
+ don't have full knowledge about what is going to be served.
414
+
415
+ I and a lot of other people have used this over time and it has proven itself
416
+ to be a very easy and straight-forward way of doing localization.
417
+
418
+ It think it is better suited as middleware which can be included into
419
+ rack-contrib and doesn't rely on the normal session but a simple unobfuscated
420
+ cookie.
421
+
422
+ Innate does not attempt to do anything related to localization. Ramaze builds
423
+ localization on top of Helper::Localize which does a much better job.
424
+
425
+ ##### Tool::MIME
426
+
427
+ This one was removed, Rack::Mime is the way to go.
428
+
429
+
430
+ ### Spec helpers
431
+
432
+ Over the years, Ramaze has collected a wide variety of spec helpers that are
433
+ not really compatible to each other and rely on real request/response with a
434
+ running server.
435
+
436
+ Innate provides a better alternative via Innate::Mock for specs, the output
437
+ formatting is done in a rake task.
438
+
439
+ There is some work in progress to integrate Innate and Ramaze with the rack-test
440
+ library which will allow us to run specs with webrat (which is able to run using
441
+ selenium and possibly watir in a DRY way).
442
+
443
+ Rack-test will provide us also with xpath checks, multipart requests, digest
444
+ authorization, etc.
445
+
446
+
447
+ ### Snippets
448
+
449
+ Innate abandons the snippets, keeping your core clean.
450
+
451
+ Ramaze has still a lot of these snippets and will continue to, although I will
452
+ constantly strive to reduce them slowly.
453
+
454
+ ### Gestalt
455
+
456
+ Gestalt has been the first "templating engine" for Ramaze and is still used in
457
+ some fractions of the code and various applications. There are a lot of other
458
+ html/xml builders out there these days so I think this is no good choice for
459
+ inclusion into Innate. I will keep it inside Ramaze.
460
+
461
+ ### Ramaze::Store::Default
462
+
463
+ This has been removed from Innate and Ramaze.
464
+ It started out as a simple wrapper for YAML::Store to make the tutorial easier,
465
+ but I think it gives a wrong impression of being anything else.
466
+
467
+ It's very slow, might raise exceptions under heavy load and a plain YAML::Store
468
+ or PStore or any other persistence mechanism is generally a better choice, so
469
+ there is no need to keep this around.
470
+
471
+ ### Contrib
472
+
473
+ Ramaze got quite some things in contrib, some of them used widely, others not at
474
+ all.
475
+
476
+ I'm still going through these, putting what is suitable for a wider audience
477
+ into rack-contrib, including what fits into the Ramaze concept into Ramaze, but
478
+ none of these will find its way into Innate.
479
+
480
+ One exception, the file cache has been added to Innate already and the sequel
481
+ cache is in Ramaze proper.
482
+
483
+ The gzip filter has a more powerful and better maintained equivalent in
484
+ Rack::Deflater.
485
+
486
+ The profiling hook is obsolete as well, there is an equivalent in rack-contrib.
487
+
488
+ The emailer is really light-weight and but lacks support for many things you
489
+ will need, I'm working on a new Helper::Email that integrates with Mailit (a
490
+ fork of MailFactory).
491
+
492
+ Things I'll not touch for now are `facebook` and `gettext`.
493
+
494
+ The sequel related stuff will have to be removed and might find a place
495
+ somewhere else, (somebody start a sequel-contrib already!).
496
+
497
+ The `gems` was refactored and put into `ramaze/setup.rb`, where it provides you
498
+ with painless first-start experience.
499
+
500
+
501
+ ### Adapters
502
+
503
+ These are entirely the responsibility of Rack/Innate now, Ramaze doesn't need to
504
+ worry about that. WEBrick will remain the default adapter since it is in the
505
+ Ruby stdlib.
506
+
507
+
508
+ ### Templating
509
+
510
+ The basic functionality for templating is provided by Innate, it only provides a
511
+ `None` and `ERB` templating engine. The other engines are in Ramaze.
512
+
513
+ #### Ezamar
514
+
515
+ `Ezamar` has become a standalone project. It has been stable since a long time and
516
+ is suitable for other uses.
517
+ The battle for the place of the default templating engine in Ramaze is still
518
+ going on, competitors are `ERB`, `Ezamar`, and `Nagoro`.
519
+
520
+
521
+ ### Bacon
522
+
523
+ Bacon is still a dependency for specs, but we don't ship it anymore, the stable
524
+ release includes all features we need.
525
+
526
+
527
+ ### Dispatcher
528
+
529
+ Innate uses a stripped down version of the Ramaze dispatcher. The Ramaze
530
+ dispatcher was strongly influenced by Nitro, but proved to be a difficult
531
+ part. We are now using Rack's URLMap directly, and have a minimal dispatching
532
+ mechanism directly in Node (like we used to have one in Controller).
533
+
534
+ A lot of the functionality that used to be in the different dispatchers is now
535
+ provided by Rack middleware.
536
+
537
+ The Dispatcher itself isn't needed anymore. It used to setup
538
+ Request/Response/Session, which was superseded by Current, this again is now
539
+ superseded by STATE::wrap.
540
+
541
+ We are going to remove all the other dispatchers as well, providing default
542
+ ways to provide the same functionality, and various middleware to use.
543
+
544
+ #### Dispatcher::Action
545
+
546
+ This dispatcher was used to initiate the controller dispatching, this is now
547
+ not needed anymore.
548
+
549
+ #### Dispatcher::Directory
550
+
551
+ This will also be removed. There is a directory listing middleware already.
552
+
553
+ #### Dispatcher::Error
554
+
555
+ There's middleware for this as well, and a canonical way of routing errors to
556
+ other actions. This used to be one of the most difficult parts of Ramaze and
557
+ it was removed to make things simpler.
558
+
559
+ #### Dispatcher::File
560
+
561
+ This is a combination of the `ETag` and `ConditionalGet` middlewares, ergo Innate
562
+ and Ramaze will not serve static files themselves anymore, but leave the job to
563
+ Rack or external servers.