manveru-innate 2009.02.25 → 2009.03.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/CHANGELOG +383 -0
  2. data/MANIFEST +17 -8
  3. data/README.md +222 -136
  4. data/Rakefile +7 -2
  5. data/example/provides.rb +28 -0
  6. data/innate.gemspec +19 -10
  7. data/lib/innate/action.rb +21 -47
  8. data/lib/innate/adapter.rb +65 -56
  9. data/lib/innate/cache.rb +16 -8
  10. data/lib/innate/dynamap.rb +39 -29
  11. data/lib/innate/helper/aspect.rb +60 -0
  12. data/lib/innate/helper/cgi.rb +2 -0
  13. data/lib/innate/helper/link.rb +43 -11
  14. data/lib/innate/helper/partial.rb +6 -5
  15. data/lib/innate/helper.rb +10 -13
  16. data/lib/innate/log/hub.rb +1 -0
  17. data/lib/innate/log.rb +3 -6
  18. data/lib/{rack → innate}/middleware_compiler.rb +19 -12
  19. data/lib/innate/mock.rb +3 -2
  20. data/lib/innate/node.rb +573 -179
  21. data/lib/innate/options/dsl.rb +46 -6
  22. data/lib/innate/options/stub.rb +7 -0
  23. data/lib/innate/options.rb +14 -93
  24. data/lib/innate/request.rb +21 -7
  25. data/lib/innate/response.rb +12 -0
  26. data/lib/innate/route.rb +2 -3
  27. data/lib/innate/session.rb +37 -20
  28. data/lib/innate/spec.rb +4 -0
  29. data/lib/innate/state/fiber.rb +14 -7
  30. data/lib/innate/state/thread.rb +10 -2
  31. data/lib/innate/state.rb +8 -11
  32. data/lib/innate/traited.rb +14 -6
  33. data/lib/innate/trinity.rb +0 -4
  34. data/lib/innate/version.rb +1 -1
  35. data/lib/innate/view/erb.rb +4 -2
  36. data/lib/innate/view/none.rb +2 -2
  37. data/lib/innate/view.rb +14 -21
  38. data/lib/innate.rb +49 -30
  39. data/spec/helper.rb +8 -0
  40. data/spec/innate/action/layout.rb +9 -6
  41. data/spec/innate/cache/common.rb +3 -3
  42. data/spec/innate/helper/aspect.rb +3 -5
  43. data/spec/innate/helper/flash.rb +1 -1
  44. data/spec/innate/helper/link.rb +45 -2
  45. data/spec/innate/helper/partial.rb +34 -10
  46. data/spec/innate/helper/view/loop.erb +1 -1
  47. data/spec/innate/helper/view/recursive.erb +1 -1
  48. data/spec/innate/node/mapping.rb +37 -0
  49. data/spec/innate/node/node.rb +142 -0
  50. data/spec/innate/node/resolve.rb +82 -0
  51. data/spec/innate/node/{another_layout → view/another_layout}/another_layout.erb +0 -0
  52. data/spec/innate/node/{bar.html → view/bar.erb} +0 -0
  53. data/spec/innate/node/{foo.html.erb → view/foo.html.erb} +0 -0
  54. data/spec/innate/node/{only_view.html → view/only_view.erb} +0 -0
  55. data/spec/innate/node/view/with_layout.erb +1 -0
  56. data/spec/innate/node/wrap_action_call.rb +83 -0
  57. data/spec/innate/options.rb +28 -6
  58. data/spec/innate/provides/list.html.erb +1 -0
  59. data/spec/innate/provides/list.txt.erb +1 -0
  60. data/spec/innate/provides.rb +99 -0
  61. data/spec/innate/request.rb +23 -10
  62. data/spec/innate/route.rb +2 -4
  63. data/spec/innate/session.rb +1 -1
  64. data/spec/innate/state/fiber.rb +57 -0
  65. data/spec/innate/state/thread.rb +40 -0
  66. metadata +20 -11
  67. data/lib/rack/reloader.rb +0 -192
  68. data/spec/innate/node/with_layout.erb +0 -3
  69. data/spec/innate/node.rb +0 -224
data/README.md CHANGED
@@ -1,6 +1,58 @@
1
1
  # Innate
2
2
 
3
- Innate is the new core of Ramaze, but useful on its own.
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
+
4
56
 
5
57
  ## Features
6
58
 
@@ -18,8 +70,9 @@ Innate is the new core of Ramaze, but useful on its own.
18
70
  * No patching[4] of ruby core or stdlib.
19
71
  * Direct access to the current Request, Response, and Session from anywhere via
20
72
  Trinity
21
- * Supporting numerous templating engines.
22
- * Any action can be presented in multiple ways.
73
+ * Works out of the box with ERB the templating engine.
74
+ * Support for all rack-compatible web-servers.
75
+ * Dynamic content-representation.
23
76
 
24
77
  [1]: What you may think of as Controller.
25
78
  [2]: This includes: Ruby 1.8, Ruby 1.9.1, JRuby, Rubinius
@@ -83,10 +136,12 @@ your shell:
83
136
  Not yet, and not sure when I'll get around to do this, feel free to ask if you
84
137
  want to maintain the project at rubyforge.
85
138
 
139
+
86
140
  ## Concepts
87
141
 
88
142
  First let's see about the good old MVC:
89
143
 
144
+
90
145
  ### Model
91
146
 
92
147
  Innate doesn't have any ties to models, it does not offer helpers or rake tasks
@@ -102,8 +157,10 @@ Innate is, however, known to be compatible with the ORMs listed below:
102
157
  Please consider giving us a heads up about what worked for you if it isn't in
103
158
  the list yet.
104
159
 
160
+
105
161
  ### View
106
162
 
163
+ Innate has support for only
107
164
  Innate supports multiple templating engines and it is very easy to add your
108
165
  own.
109
166
  At the moment we offer following engines out of the box:
@@ -117,20 +174,22 @@ At the moment we offer following engines out of the box:
117
174
  How to build your own is discussed at
118
175
  [HowTo:View](http://ramaze.net/HowTo:View).
119
176
 
177
+
120
178
  ### Controller
121
179
 
122
180
  Innate follows a different approach than most frameworks, making the controller
123
181
  subclassing obsolete. To make an object accessible from the outside simply
124
182
  include Innate::Node and map it to the location you would like.
125
183
 
184
+
126
185
  ## Differences from Ramaze
127
186
 
128
187
  Innate throws a lot overboard; it doesn't provide all the bells and whistles
129
- that you may be used to. This makes Ramaze a very good option for larger
188
+ that you may be used to. This makes Ramaze the way to go for larger
130
189
  applications.
131
190
 
132
- For this reason, Innate won't just be a standalone framework, but will also
133
- become the new core for Ramaze.
191
+ For this reason, Innate is not only a standalone framework, it is also the core
192
+ of Ramaze.
134
193
 
135
194
  Ramaze started out without any of the benefits that Rack gives us these days,
136
195
  especially regarding the server handlers, request/response, and middleware.
@@ -139,56 +198,65 @@ Still it tried to provide everything one might need with the least effort,
139
198
  leading to a lot of incorporation of dependencies (we have things like bacon,
140
199
  simple_http, gettext, mime types, ...)
141
200
 
201
+
142
202
  ### Configuration
143
203
 
144
- Configurability has always been a major aspect of Ramaze, and I will keep it
145
- this way. The famous option.rb is the peak of what can be achieved with the
146
- approach of a single Struct for all options, making them approachable from the
147
- CLI, during runtime, on startup, in separate files, even loading from YAML...
204
+ Innate provides the Innate::Options DSL, in some aspects to the old
205
+ Ramaze::Global, but a lot more flexible.
148
206
 
149
- What was always missing was a way to add configuration to your own
150
- applications, and extending the Ramaze::Global for this purpose is very
151
- difficult.
207
+ Options has namespaces, inheritance, defaults, triggers, documentation, and a
208
+ sane name.
152
209
 
153
- With Innate I hope to tackle this problem, it's currently not as fast as
154
- Ramaze::Global, but offers namespaces and inheritance.
210
+ The definition syntax roughly resembles Ramaze::Global.
155
211
 
156
- The areas wherein Ramaze::Global excels (CLI arguments, documentation and
157
- annotation for options) will soon be integrated as well.
212
+ We break with the tradition where all options one would ever need were provided
213
+ in one file. It made maintenance rather difficult and the code hard to follow.
214
+ So the new approach is to put options where they belong, alongside the class or
215
+ module they are used in.
158
216
 
159
- Configuration namespaces will offer a nice way to merge different applications
160
- and reconcile their options in a unified manner, opening the way for slice-like
161
- behaviour.
217
+ There are some things still in Innate.options, but they have large impact on the
218
+ whole system.
162
219
 
163
- So for example, one can provide some slice that handles feeds:
220
+ Options doesn't do things like merging env variables or parsing ARGV, these are
221
+ things that Ramaze adds.
164
222
 
165
- Innate::Options.for(:feed_slice) do |feed|
166
- feed.map = '/feeds'
167
- feed.view_root = 'slice/feed/view'
168
- feed.retrieve = lambda{ Post.all }
169
- end
223
+ What makes Options especially useful is that you can use it in your own
224
+ application to configure it without using diverse routes like putting config
225
+ into counter-intuitive yaml files, using global variables, or relying on yet
226
+ another dependency.
170
227
 
171
- class Feeds
172
- include Innate::Node
173
- options :feed_slice
228
+ A small example:
229
+
230
+ module Blog
231
+ include Innate::Optional
232
+
233
+ options.dsl do
234
+ o "Title of the blog", :title, "My Blog"
235
+ o "Syntax highlighting engine for blog posts", :syntax, :coderay
236
+ end
237
+
238
+ class Articles
239
+ Innate.node '/'
240
+
241
+ def index
242
+ "Welcome to #{Blog.options.title}"
243
+ end
244
+ end
174
245
  end
175
246
 
176
- It would be a requirement to set the options before requiring the slice itself,
177
- but that's just a minor issue that I think we can live with.
178
247
 
179
248
  ### Controller
180
249
 
181
- Well, that's the part I worry most about. Every existing Ramaze application
182
- relies on the Ramaze::Controller.
250
+ Away with controllers, long live the Node.
183
251
 
184
- The major question is, should we switch Ramaze entirely to the Node approach or
185
- maybe just provide a Ramaze::Controller that has Innate::Node included?
252
+ Nodes are objects that include Innate::Node and are then considered rack
253
+ applications that get automatically hooked into the routing.
186
254
 
187
- It does have drawbacks, such as decreased support for either approach, but
188
- might give people a familiar anchor when switching, and allow them to gradually
189
- adjust their applications.
255
+ Since every existing Ramaze application relies on Ramaze::Controller and normal
256
+ subclassing is not without merits as well we keep that part entirely in Ramaze,
257
+ Controller simply includes Innate::Node and makes it suitable for the usage
258
+ within Apps.
190
259
 
191
- Other things are layouts and provides.
192
260
 
193
261
  #### Layouts
194
262
 
@@ -209,18 +277,21 @@ every application uses it, so they should be handled in the best way possible.
209
277
 
210
278
  The root directory for layouts is in line with the other default locations:
211
279
 
212
- /node
213
- /layout
214
- /view
215
- /model
216
- /public
280
+ proto
281
+ |-- layout
282
+ |-- model
283
+ |-- node
284
+ |-- public
285
+ `-- view
217
286
 
218
- While none of these directories is necessary, they will be the default
219
- locations and should be included in a new proto for Ramaze.
287
+ While none of these directories is necessary, they are the default locations and
288
+ should be included in a new proto for Ramaze (just that ramaze uses
289
+ `/controller` instead of `/node`.
220
290
 
221
291
  Innate will not have project generating capabilities, so we just have to
222
292
  document it very well and provide some example apps.
223
293
 
294
+
224
295
  #### Provides
225
296
 
226
297
  This is a major new feature stolen from Merb and adapted for the ease of use of
@@ -229,7 +300,8 @@ It won't have all the capabilities one might be used to out of the box, but
229
300
  extending them is easy.
230
301
 
231
302
  Having "provides" means that every Action has different ways of being rendered,
232
- depending on so-called wishes.
303
+ depending on so-called wishes, that's what people usually call
304
+ content-representation.
233
305
 
234
306
  A wish may be anything related to the request object, and by default it will
235
307
  trigger on the filename extension asked for.
@@ -239,17 +311,18 @@ json/rss/atom/yaml/xml/xhtml/html/wap or different languages...
239
311
  The dispatching in Node depends on the filename extension by default, but more
240
312
  decision paths can be added to Action by overriding some defaults.
241
313
 
242
- There is no convention yet of how layouts will map to these wishes, but I hope
243
- to specify this further once we have some specific requirements.
314
+ Layouts map to wishes just like views, so every content representation can have
315
+ a suitable layout as well.
316
+
317
+ This is very alien to old Ramaze, which always has a 1:1 mapping between actions
318
+ and their views and how they are rendered, which made people wonder how to serve
319
+ sass as css or how to respond with json for a ajax request until they finally
320
+ were pointed to setting content-type, using respond and setting up custom
321
+ routes.
244
322
 
245
- This feature is very alien to Ramaze, which always has a 1:1 mapping between
246
- actions and their views and how they are rendered, which made people wonder how
247
- to serve sass as css or how to respond with json for a ajax request until they
248
- finally were pointed to setting content-type, using respond and setting up
249
- custom routes.
323
+ I hope this feature makes things simpler for people who care about it while it
324
+ can be ignored by people who don't.
250
325
 
251
- I hope that adding this feature will make things simpler for people who care
252
- about it while it can be ignored by people who don't.
253
326
 
254
327
  ### More specifics
255
328
 
@@ -275,66 +348,71 @@ glance tells me.
275
348
 
276
349
  Let's go through them one by one and consider what's gonna happen to them:
277
350
 
351
+
278
352
  ### Cache
279
353
 
280
354
  Caching is a very important concern and one of the most difficult things to get
281
- right for any web application. Ramaze tried to get caching done right and I
282
- consider it fairly successful when it comes to that. There are a myriad of
283
- options available for caching, different caching mechanisms such as marshal to
284
- filesystem, memcached, in-memory, yaml to filesystem, etc. The granularity can
285
- be chosen depending on the use case, distributed caching of sessions, actions,
286
- single key/value pairs, and so on. Fine-tuning each of those to use a different
287
- mechanism will be made as painless as possible.
355
+ right for any web application.
288
356
 
289
- We have gone through a lot of difficulties, memory-leaks, disputes, and
290
- challenges to get this done, but most users won't realize this until they
291
- encounter a problem.
357
+ Innate defines the caching API that enables everybody to add caches with very
358
+ little code.
292
359
 
293
- At this point I would really like to thank all of the people who contributed to
294
- caching as it is today.
360
+ Innate provides caching by following means:
361
+
362
+ * DRb
363
+ * Hash
364
+ * Marshal
365
+ * YAML
366
+
367
+ Ramaze adds:
368
+
369
+ * Memcached
370
+ * Sequel
371
+
372
+ And as time goes on there will be many more.
295
373
 
296
- I will move caching in a lighter form to Innate, mostly what is needed for
297
- distributed sessions, giving Ramaze the opportunity to add new kinds.
298
374
 
299
375
  ### Response
300
376
 
301
- This was always a very little class since Rack started providing more features,
302
- I think it's time to retire it and lobby for integration of features into Rack
303
- itself.
377
+ Very little code, just provide some options regarding default headers and easy
378
+ ways to reset the response.
379
+ Ramaze adds some more convenient methods.
380
+
304
381
 
305
382
  ### Tools
306
383
 
307
- Ramaze acquired quite a lot of tools, some of those are not useful anymore,
308
- other ones might have to stick around.
384
+ Innate doesn't provide any of the stuff in ramaze/tool and it was removed from
385
+ Ramaze as well, some of the reasoning is below.
309
386
 
310
387
  #### Tool::Create
311
388
 
312
- This has been used by `bin/ramaze --create` and I think it will stick around
313
- for some more time.
389
+ This has been used by `bin/ramaze --create`, bougyman is working on a new
390
+ `bin/ramaze` which won't use it, so we removed it.
314
391
 
315
392
  #### Tool::ProjectCreator
316
393
 
317
- Dependency for Tool::Create, should get a lot more documentation and exposure
318
- because I think it can be very useful for sharing and creating basic
319
- application skeletons.
320
- Another route would be to find a better tool and make it a dependency for
321
- `ramaze --create`, but that would give a terrible out-of-the-box experience.
394
+ Dependency for Tool::Create, removed as well.
322
395
 
323
396
  ##### Tool::Daemonize
324
397
 
325
398
  Nothing but issues with this one although it is just a very thin wrapper for
326
399
  the daemons gem. Nobody has contributed to this so far despite the issues and
327
400
  it seems that there are a lot of different solutions for this problem.
328
- This will be removed from both Ramaze and Innate.
401
+
402
+ This was removed from Ramaze and Innate. You may use the daemonize functionality
403
+ from rackup.
329
404
 
330
405
  ##### Ramaze::Record
331
406
 
332
407
  Well, this might be the most obvious candidate for removal, maybe it can be
333
- revived as middleware. The functionality itself is in the adapter and even
334
- that's only a few lines. But so far I have never seen any usage for it.
408
+ revived as middleware. The functionality itself was in the adapter and even
409
+ that's only a few lines. But so far I have never seen any usage of it.
335
410
 
336
411
  ##### Tool::Localize
337
412
 
413
+ Despite being quite popular it has many issues and is totally unusable if you
414
+ don't have full knowledge about what is going to be served.
415
+
338
416
  I and a lot of other people have used this over time and it has proven itself
339
417
  to be a very easy and straight-forward way of doing localization.
340
418
 
@@ -342,9 +420,13 @@ It think it is better suited as middleware which can be included into
342
420
  rack-contrib and doesn't rely on the normal session but a simple unobfuscated
343
421
  cookie.
344
422
 
423
+ Innate does not attempt to do anything related to localization. Ramaze builds
424
+ localization on top of Helper::Localize which does a much better job.
425
+
345
426
  ##### Tool::MIME
346
427
 
347
- This one will be removed, Rack::Mime is a viable alternative.
428
+ This one was removed, Rack::Mime is the way to go.
429
+
348
430
 
349
431
  ### Spec helpers
350
432
 
@@ -352,25 +434,20 @@ Over the years, Ramaze has collected a wide variety of spec helpers that are
352
434
  not really compatible to each other and rely on real request/response with a
353
435
  running server.
354
436
 
355
- Innate provides a better alternative via Innate::Mock for its own specs,
356
- applications will need the power of a real scraping library and we will provide
357
- a canonical way of running a server in the background before running the specs.
358
- There will not be any other helpers in Innate, but Ramaze might provide a few
359
- standard ones to get up and running (hpricot, rexml).
437
+ Innate provides a better alternative via Innate::Mock for specs, the output
438
+ formatting is done in a rake task.
439
+
440
+ There is some work in progress to integrate Innate and Ramaze with the rack-test
441
+ library which will allow us to run specs with webrat (which is able to run using
442
+ selenium and possibly watir in a DRY way).
443
+
444
+ Rack-test will provide us also with xpath checks, multipart requests, digest
445
+ authorization, etc.
360
446
 
361
- Regarding the spec output parsers, that's a different issue. Providing
362
- readable output while running specs is a major feature that must be included in
363
- order to keep frustration low. We will provide a suitable logger replacement
364
- so one can simply extend Bacon with that in order to get nice summaries and
365
- good error output.
366
447
 
367
448
  ### Snippets
368
449
 
369
- Snippets have been in Ramaze since day 1, but I think it is wrong for Innate to
370
- provide those. Over the years there have been lots of libraries that all
371
- provide their own core extensions and interference is a major issue. Innate
372
- will keep everything as clean as possible, doing subclasses inside the Innate
373
- namespace where it needs to change things.
450
+ Innate abandons the snippets, keeping your core clean.
374
451
 
375
452
  Two things that we need are (currently) String#each, because Rack relies on it,
376
453
  and BasicObject as superclass for the Option class. They are only applied on
@@ -384,16 +461,16 @@ constantly strive to reduce them slowly.
384
461
 
385
462
  ### Gestalt
386
463
 
387
- Gestalt has been the first "templating_engine" for Ramaze and is still used in
464
+ Gestalt has been the first "templating engine" for Ramaze and is still used in
388
465
  some fractions of the code and various applications. There are a lot of other
389
466
  html/xml builders out there these days so I think this is no good choice for
390
467
  inclusion into Innate. I will keep it inside Ramaze.
391
468
 
392
469
  ### Ramaze::Store::Default
393
470
 
394
- I will remove this class from both Innate and Ramaze. It started out as a
395
- simple wrapper for YAML::Store to make the tutorial easier, but I think it
396
- gives a wrong impression of being anything else.
471
+ This has been removed from Innate and Ramaze.
472
+ It started out as a simple wrapper for YAML::Store to make the tutorial easier,
473
+ but I think it gives a wrong impression of being anything else.
397
474
 
398
475
  It's very slow, might raise exceptions under heavy load and a plain YAML::Store
399
476
  or PStore or any other persistence mechanism is generally a better choice, so
@@ -401,50 +478,59 @@ there is no need to keep this around.
401
478
 
402
479
  ### Contrib
403
480
 
404
- There's a lot in there, and some of these things are used widely, others not at
405
- all. Some things are better suited as middleware, I will move them to
406
- rack-contrib ASAP:
481
+ Ramaze got quite some things in contrib, some of them used widely, others not at
482
+ all.
407
483
 
408
- * gzip_filter
409
- * profiling
484
+ I'm still going through these, putting what is suitable for a wider audience
485
+ into rack-contrib, including what fits into the Ramaze concept into Ramaze, but
486
+ none of these will find its way into Innate.
410
487
 
411
- Then there's things that don't see much use. They should stay in the future
412
- Ramaze contrib or face removal:
488
+ One exception, the file cache has been added to Innate already and the sequel
489
+ cache is in Ramaze proper.
413
490
 
414
- * facebook
415
- * gettext
416
- * maruku_uv
417
- * sequel_cache
418
- * rest
491
+ The gzip filter has a more powerful and better maintained equivalent in
492
+ Rack::Deflater.
419
493
 
420
- And other things that should be moved into Ramaze proper:
494
+ The profiling hook is obsolete as well, there is an equivalent in rack-contrib.
421
495
 
422
- * email
423
- * file_cache (done)
424
- * gems
496
+ The emailer is really light-weight and but lacks support for many things you
497
+ will need, I'm working on a new Helper::Email that integrates with Mailit (a
498
+ fork of MailFactory).
499
+
500
+ Things I'll not touch for now are `facebook` and `gettext`.
501
+
502
+ The sequel related stuff will have to be removed and might find a place
503
+ somewhere else, (somebody start a sequel-contrib already!).
504
+
505
+ The `gems` was refactored and put into `ramaze/setup.rb`, where it provides you
506
+ with painless first-start experience.
425
507
 
426
- None of these will be included in Innate.
427
508
 
428
509
  ### Adapters
429
510
 
430
- These are entirely the responsibility of Rack/Innate now, Ramaze doesn't need
431
- to worry about that. WEBrick will remain the default adapter since it is in
432
- the Ruby stdlib.
511
+ These are entirely the responsibility of Rack/Innate now, Ramaze doesn't need to
512
+ worry about that. WEBrick will remain the default adapter since it is in the
513
+ Ruby stdlib.
514
+
433
515
 
434
516
  ### Templating
435
517
 
436
- Templating will also be handled by Innate for the most part.
518
+ The basic functionality for templating is provided by Innate, it only provides a
519
+ `None` and `ERB` templating engine. The other engines are in Ramaze.
437
520
 
438
521
  #### Ezamar
439
522
 
440
- I have plans to make Ezamar a separate project. It's been stable since over a
441
- year and I think it's time to make it available for other projects. ERB will
442
- be the new default engine since it also is in the stdlib.
523
+ `Ezamar` has become a standalone project. It has been stable since a long time and
524
+ is suitable for other uses.
525
+ The battle for the place of the default templating engine in Ramaze is still
526
+ going on, competitors are `ERB`, `Ezamar`, and `Nagoro`.
527
+
443
528
 
444
529
  ### Bacon
445
530
 
446
- Bacon will be a dependency for Ramaze and Innate specs, but we will not ship it
447
- anymore, it's stable and has all features we need included in the release.
531
+ Bacon is still a dependency for specs, but we don't ship it anymore, the stable
532
+ release includes all features we need.
533
+
448
534
 
449
535
  ### Dispatcher
450
536
 
@@ -456,7 +542,7 @@ mechanism directly in Node (like we used to have one in Controller).
456
542
  A lot of the functionality that used to be in the different dispatchers is now
457
543
  provided by Rack middleware.
458
544
 
459
- The Dispatcher itself isn't needed anymore. It used to setup
545
+ The Dispatcher itself isn't needed anymore. It used to setup
460
546
  Request/Response/Session, which was superseded by Current, this again is now
461
547
  superseded by STATE::wrap.
462
548
 
@@ -470,16 +556,16 @@ not needed anymore.
470
556
 
471
557
  #### Dispatcher::Directory
472
558
 
473
- This will also be removed. There is a directory listing middleware already.
559
+ This will also be removed. There is a directory listing middleware already.
474
560
 
475
561
  #### Dispatcher::Error
476
562
 
477
563
  There's middleware for this as well, and a canonical way of routing errors to
478
- other actions. This used to be one of the most difficult parts of Ramaze and
479
- it will be removed to make things simpler.
564
+ other actions. This used to be one of the most difficult parts of Ramaze and
565
+ it was removed to make things simpler.
480
566
 
481
567
  #### Dispatcher::File
482
568
 
483
- This is a combination of the etag and conditionalget middlewares, ergo Innate
569
+ This is a combination of the `ETag` and `ConditionalGet` middlewares, ergo Innate
484
570
  and Ramaze will not serve static files themselves anymore, but leave the job to
485
571
  Rack or external servers.
data/Rakefile CHANGED
@@ -119,20 +119,23 @@ task :spec => :setup do
119
119
  len = specs.map{|s| s.size }.sort.last
120
120
  tt = ta = tf = te = 0
121
121
 
122
- red, green = "\e[31m%s\e[0m", "\e[32m%s\e[0m"
122
+ red, yellow, green = "\e[31m%s\e[0m", "\e[33m%s\e[0m", "\e[32m%s\e[0m"
123
123
  left_format = "%4d/%d: %-#{len + 11}s"
124
124
  spec_format = "%d specifications (%d requirements), %d failures, %d errors"
125
125
 
126
126
  specs.each_with_index do |spec, idx|
127
127
  print(left_format % [idx + 1, total, spec])
128
128
 
129
- Open3.popen3("#{RUBY} #{spec}") do |sin, sout, serr|
129
+ Open3.popen3(RUBY, spec) do |sin, sout, serr|
130
130
  out = sout.read
131
131
  err = serr.read
132
132
 
133
+ ran = false
134
+
133
135
  out.each_line do |line|
134
136
  tests, assertions, failures, errors = all = line.scanf(spec_format)
135
137
  next unless all.any?
138
+ ran = true
136
139
  tt += tests; ta += assertions; tf += failures; te += errors
137
140
 
138
141
  if tests == 0 || failures + errors > 0
@@ -145,6 +148,8 @@ task :spec => :setup do
145
148
 
146
149
  break
147
150
  end
151
+
152
+ puts(yellow % " skipped") unless ran
148
153
  end
149
154
  end
150
155
 
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'innate'
3
+
4
+ ARTICLES = {
5
+ 'hello' => {
6
+ :author => 'manveru',
7
+ :title => 'Hello, World!',
8
+ :text => 'Some text'
9
+ }
10
+ }
11
+
12
+ class BlogArticles
13
+ Innate.node('/')
14
+
15
+ # provide a content representation for requests to /<action>.yaml
16
+ provide(:yaml, :type => 'text/yaml'){|action, value| value.to_yaml }
17
+
18
+ # the return value of this method is the `value` in the provide above
19
+ # Since ruby has implicit returns, `ARTICLES` will be the return value.
20
+ #
21
+ # If you request `/list.yaml` you will get the `ARTICLES` object serialized
22
+ # to YAML.
23
+ def list
24
+ @articles = ARTICLES
25
+ end
26
+ end
27
+
28
+ Innate.start