manveru-innate 2009.02.06
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1409 -0
- data/COPYING +18 -0
- data/MANIFEST +100 -0
- data/README.md +485 -0
- data/Rakefile +139 -0
- data/example/app/retro_games.rb +57 -0
- data/example/app/whywiki_erb/layout/wiki.html.erb +15 -0
- data/example/app/whywiki_erb/spec/wiki.rb +19 -0
- data/example/app/whywiki_erb/start.rb +45 -0
- data/example/app/whywiki_erb/view/edit.html.erb +6 -0
- data/example/app/whywiki_erb/view/index.html.erb +10 -0
- data/example/custom_middleware.rb +43 -0
- data/example/error_handling.rb +31 -0
- data/example/hello.rb +12 -0
- data/example/howto_spec.rb +60 -0
- data/example/link.rb +35 -0
- data/example/providing_hash.rb +46 -0
- data/example/session.rb +42 -0
- data/innate.gemspec +118 -0
- data/lib/innate.rb +191 -0
- data/lib/innate/action.rb +156 -0
- data/lib/innate/adapter.rb +89 -0
- data/lib/innate/cache.rb +117 -0
- data/lib/innate/cache/api.rb +106 -0
- data/lib/innate/cache/drb.rb +58 -0
- data/lib/innate/cache/file_based.rb +39 -0
- data/lib/innate/cache/marshal.rb +17 -0
- data/lib/innate/cache/memory.rb +22 -0
- data/lib/innate/cache/yaml.rb +17 -0
- data/lib/innate/core_compatibility/basic_object.rb +9 -0
- data/lib/innate/core_compatibility/string.rb +3 -0
- data/lib/innate/current.rb +37 -0
- data/lib/innate/dynamap.rb +81 -0
- data/lib/innate/helper.rb +195 -0
- data/lib/innate/helper/aspect.rb +62 -0
- data/lib/innate/helper/cgi.rb +39 -0
- data/lib/innate/helper/flash.rb +36 -0
- data/lib/innate/helper/link.rb +55 -0
- data/lib/innate/helper/partial.rb +90 -0
- data/lib/innate/helper/redirect.rb +85 -0
- data/lib/innate/helper/send_file.rb +18 -0
- data/lib/innate/log.rb +23 -0
- data/lib/innate/log/color_formatter.rb +43 -0
- data/lib/innate/log/hub.rb +72 -0
- data/lib/innate/mock.rb +49 -0
- data/lib/innate/node.rb +471 -0
- data/lib/innate/options.rb +91 -0
- data/lib/innate/options/dsl.rb +155 -0
- data/lib/innate/request.rb +165 -0
- data/lib/innate/response.rb +18 -0
- data/lib/innate/route.rb +109 -0
- data/lib/innate/session.rb +104 -0
- data/lib/innate/session/flash.rb +94 -0
- data/lib/innate/setup.rb +23 -0
- data/lib/innate/spec.rb +42 -0
- data/lib/innate/state.rb +22 -0
- data/lib/innate/state/accessor.rb +130 -0
- data/lib/innate/state/fiber.rb +68 -0
- data/lib/innate/state/thread.rb +39 -0
- data/lib/innate/traited.rb +20 -0
- data/lib/innate/trinity.rb +22 -0
- data/lib/innate/version.rb +3 -0
- data/lib/innate/view.rb +67 -0
- data/lib/innate/view/erb.rb +17 -0
- data/lib/innate/view/none.rb +9 -0
- data/lib/rack/middleware_compiler.rb +62 -0
- data/lib/rack/reloader.rb +192 -0
- data/spec/example/hello.rb +14 -0
- data/spec/example/link.rb +29 -0
- data/spec/helper.rb +2 -0
- data/spec/innate/cache/common.rb +45 -0
- data/spec/innate/cache/marshal.rb +5 -0
- data/spec/innate/cache/memory.rb +5 -0
- data/spec/innate/cache/yaml.rb +5 -0
- data/spec/innate/dynamap.rb +22 -0
- data/spec/innate/helper.rb +66 -0
- data/spec/innate/helper/aspect.rb +80 -0
- data/spec/innate/helper/cgi.rb +37 -0
- data/spec/innate/helper/flash.rb +148 -0
- data/spec/innate/helper/link.rb +82 -0
- data/spec/innate/helper/partial.rb +66 -0
- data/spec/innate/helper/redirect.rb +148 -0
- data/spec/innate/helper/send_file.rb +21 -0
- data/spec/innate/helper/view/aspect_hello.erb +1 -0
- data/spec/innate/helper/view/locals.erb +1 -0
- data/spec/innate/helper/view/loop.erb +4 -0
- data/spec/innate/helper/view/num.erb +1 -0
- data/spec/innate/helper/view/partial.erb +1 -0
- data/spec/innate/helper/view/recursive.erb +8 -0
- data/spec/innate/mock.rb +84 -0
- data/spec/innate/node.rb +180 -0
- data/spec/innate/node/bar.html +1 -0
- data/spec/innate/node/foo.html.erb +1 -0
- data/spec/innate/node/with_layout.erb +3 -0
- data/spec/innate/options.rb +90 -0
- data/spec/innate/parameter.rb +154 -0
- data/spec/innate/request.rb +73 -0
- data/spec/innate/route.rb +129 -0
- data/spec/innate/session.rb +59 -0
- data/spec/innate/traited.rb +55 -0
- metadata +160 -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.
|
data/MANIFEST
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
CHANGELOG
|
2
|
+
COPYING
|
3
|
+
MANIFEST
|
4
|
+
README.md
|
5
|
+
Rakefile
|
6
|
+
example/app/retro_games.rb
|
7
|
+
example/app/whywiki_erb/layout/wiki.html.erb
|
8
|
+
example/app/whywiki_erb/spec/wiki.rb
|
9
|
+
example/app/whywiki_erb/start.rb
|
10
|
+
example/app/whywiki_erb/view/edit.html.erb
|
11
|
+
example/app/whywiki_erb/view/index.html.erb
|
12
|
+
example/custom_middleware.rb
|
13
|
+
example/error_handling.rb
|
14
|
+
example/hello.rb
|
15
|
+
example/howto_spec.rb
|
16
|
+
example/link.rb
|
17
|
+
example/providing_hash.rb
|
18
|
+
example/session.rb
|
19
|
+
innate.gemspec
|
20
|
+
lib/innate.rb
|
21
|
+
lib/innate/action.rb
|
22
|
+
lib/innate/adapter.rb
|
23
|
+
lib/innate/cache.rb
|
24
|
+
lib/innate/cache/api.rb
|
25
|
+
lib/innate/cache/drb.rb
|
26
|
+
lib/innate/cache/file_based.rb
|
27
|
+
lib/innate/cache/marshal.rb
|
28
|
+
lib/innate/cache/memory.rb
|
29
|
+
lib/innate/cache/yaml.rb
|
30
|
+
lib/innate/core_compatibility/basic_object.rb
|
31
|
+
lib/innate/core_compatibility/string.rb
|
32
|
+
lib/innate/current.rb
|
33
|
+
lib/innate/dynamap.rb
|
34
|
+
lib/innate/helper.rb
|
35
|
+
lib/innate/helper/aspect.rb
|
36
|
+
lib/innate/helper/cgi.rb
|
37
|
+
lib/innate/helper/flash.rb
|
38
|
+
lib/innate/helper/link.rb
|
39
|
+
lib/innate/helper/partial.rb
|
40
|
+
lib/innate/helper/redirect.rb
|
41
|
+
lib/innate/helper/send_file.rb
|
42
|
+
lib/innate/log.rb
|
43
|
+
lib/innate/log/color_formatter.rb
|
44
|
+
lib/innate/log/hub.rb
|
45
|
+
lib/innate/mock.rb
|
46
|
+
lib/innate/node.rb
|
47
|
+
lib/innate/options.rb
|
48
|
+
lib/innate/options/dsl.rb
|
49
|
+
lib/innate/request.rb
|
50
|
+
lib/innate/response.rb
|
51
|
+
lib/innate/route.rb
|
52
|
+
lib/innate/session.rb
|
53
|
+
lib/innate/session/flash.rb
|
54
|
+
lib/innate/setup.rb
|
55
|
+
lib/innate/spec.rb
|
56
|
+
lib/innate/state.rb
|
57
|
+
lib/innate/state/accessor.rb
|
58
|
+
lib/innate/state/fiber.rb
|
59
|
+
lib/innate/state/thread.rb
|
60
|
+
lib/innate/traited.rb
|
61
|
+
lib/innate/trinity.rb
|
62
|
+
lib/innate/version.rb
|
63
|
+
lib/innate/view.rb
|
64
|
+
lib/innate/view/erb.rb
|
65
|
+
lib/innate/view/none.rb
|
66
|
+
lib/rack/middleware_compiler.rb
|
67
|
+
lib/rack/reloader.rb
|
68
|
+
spec/example/hello.rb
|
69
|
+
spec/example/link.rb
|
70
|
+
spec/helper.rb
|
71
|
+
spec/innate/cache/common.rb
|
72
|
+
spec/innate/cache/marshal.rb
|
73
|
+
spec/innate/cache/memory.rb
|
74
|
+
spec/innate/cache/yaml.rb
|
75
|
+
spec/innate/dynamap.rb
|
76
|
+
spec/innate/helper.rb
|
77
|
+
spec/innate/helper/aspect.rb
|
78
|
+
spec/innate/helper/cgi.rb
|
79
|
+
spec/innate/helper/flash.rb
|
80
|
+
spec/innate/helper/link.rb
|
81
|
+
spec/innate/helper/partial.rb
|
82
|
+
spec/innate/helper/redirect.rb
|
83
|
+
spec/innate/helper/send_file.rb
|
84
|
+
spec/innate/helper/view/aspect_hello.erb
|
85
|
+
spec/innate/helper/view/locals.erb
|
86
|
+
spec/innate/helper/view/loop.erb
|
87
|
+
spec/innate/helper/view/num.erb
|
88
|
+
spec/innate/helper/view/partial.erb
|
89
|
+
spec/innate/helper/view/recursive.erb
|
90
|
+
spec/innate/mock.rb
|
91
|
+
spec/innate/node.rb
|
92
|
+
spec/innate/node/bar.html
|
93
|
+
spec/innate/node/foo.html.erb
|
94
|
+
spec/innate/node/with_layout.erb
|
95
|
+
spec/innate/options.rb
|
96
|
+
spec/innate/parameter.rb
|
97
|
+
spec/innate/request.rb
|
98
|
+
spec/innate/route.rb
|
99
|
+
spec/innate/session.rb
|
100
|
+
spec/innate/traited.rb
|
data/README.md
ADDED
@@ -0,0 +1,485 @@
|
|
1
|
+
# Innate
|
2
|
+
|
3
|
+
Innate is the new core of Ramaze, but useful on its own.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
* Powerful Helper system
|
8
|
+
* Nodes[1] simply include Innate::Node, so class inheritance is your choice.
|
9
|
+
* The only hard dependency is Rack
|
10
|
+
* Easy to get started
|
11
|
+
* Compatible with major Ruby implementations[2].
|
12
|
+
* Usage of Fiber[3] instead of Thread if possible.
|
13
|
+
* Namespaced serializable configuration system
|
14
|
+
* Simple testing without need of a running server
|
15
|
+
* No clutter in your application directory structure, scales from a single file
|
16
|
+
upwards
|
17
|
+
* Seamless integration with Rack middleware
|
18
|
+
* No patching[4] of ruby core or stdlib.
|
19
|
+
* Direct access to the current Request, Response, and Session from anywhere via
|
20
|
+
Trinity
|
21
|
+
* Supporting numerous templating engines.
|
22
|
+
* Any action can be presented in multiple ways.
|
23
|
+
|
24
|
+
[1]: What you may think of as Controller.
|
25
|
+
[2]: This includes: Ruby 1.8, Ruby 1.9.1, JRuby, Rubinius
|
26
|
+
[3]: Fiber is available on 1.9 only at this point.
|
27
|
+
[4]: However, we add String#each if it isn't there to be compatible with Rack.
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
A simple example of using Innate that also shows you how to add your custom
|
32
|
+
middleware, write specs and the overall concept:
|
33
|
+
|
34
|
+
require 'innate'
|
35
|
+
|
36
|
+
Innate.setup_middleware
|
37
|
+
|
38
|
+
Innate.map('/') do |env|
|
39
|
+
Rack::Response.new(['Hello, World!']).finish
|
40
|
+
end
|
41
|
+
|
42
|
+
Innate::Mock.get('/')
|
43
|
+
|
44
|
+
And another example, using Node with a normal server:
|
45
|
+
|
46
|
+
require 'innate'
|
47
|
+
|
48
|
+
class Hi
|
49
|
+
include Innate::Node
|
50
|
+
map '/'
|
51
|
+
|
52
|
+
def index
|
53
|
+
"Hello, World!"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
Innate.start :adapter => :mongrel
|
58
|
+
|
59
|
+
## Installation
|
60
|
+
|
61
|
+
### Via git (recommended)
|
62
|
+
|
63
|
+
Installing Innate from git is highly recommended, since it gives you easy
|
64
|
+
access to alternate branches, bugfixes, and new features.
|
65
|
+
|
66
|
+
git clone git://github.com/manveru/innate.git
|
67
|
+
|
68
|
+
And add the innate/lib directory to your `RUBYLIB` environment variable.
|
69
|
+
|
70
|
+
For unixish systems you may want to add it to `~/.bashrc` or the equivalent for
|
71
|
+
your shell:
|
72
|
+
|
73
|
+
export RUBYLIB="~/path/to/innate/lib:$RUBYLIB"
|
74
|
+
|
75
|
+
### Via gem install
|
76
|
+
|
77
|
+
#### From Github
|
78
|
+
|
79
|
+
gem install manveru-innate --source=http://gems.github.com
|
80
|
+
|
81
|
+
#### From Rubyforge
|
82
|
+
|
83
|
+
Not yet, and not sure when I'll get around to do this, feel free to ask if you
|
84
|
+
want to maintain the project at rubyforge.
|
85
|
+
|
86
|
+
## Concepts
|
87
|
+
|
88
|
+
First let's see about the good old MVC:
|
89
|
+
|
90
|
+
### Model
|
91
|
+
|
92
|
+
Innate doesn't have any ties to models, it does not offer helpers or rake tasks
|
93
|
+
or whatever you may be expecting, there is no M, use whatever you like.
|
94
|
+
Innate is, however, known to be compatible with the ORMs listed below:
|
95
|
+
|
96
|
+
* ActiveRecord
|
97
|
+
* DataMapper
|
98
|
+
* M4DBI
|
99
|
+
* Og
|
100
|
+
* Sequel
|
101
|
+
|
102
|
+
Please consider giving us a heads up about what worked for you if it isn't in
|
103
|
+
the list yet.
|
104
|
+
|
105
|
+
### View
|
106
|
+
|
107
|
+
Innate supports multiple templating engines and it is very easy to add your
|
108
|
+
own.
|
109
|
+
At the moment we offer following engines out of the box:
|
110
|
+
|
111
|
+
* [Builder](http://builder.rubyforge.org)
|
112
|
+
* [Haml](http://haml.hamptoncatlin.com/)
|
113
|
+
* [Sass](http://haml.hamptoncatlin.com/docs/sass)
|
114
|
+
* [Erubis](http://rubyforge.org/projects/erubis)
|
115
|
+
* [Tenjin](http://www.kuwata-lab.com/tenjin/)
|
116
|
+
|
117
|
+
How to build your own is discussed at
|
118
|
+
[HowTo:View](http://ramaze.net/HowTo:View).
|
119
|
+
|
120
|
+
### Controller
|
121
|
+
|
122
|
+
Innate follows a different approach than most frameworks, making the controller
|
123
|
+
subclassing obsolete. To make an object accessible from the outside simply
|
124
|
+
include Innate::Node and map it to the location you would like.
|
125
|
+
|
126
|
+
## Differences from Ramaze
|
127
|
+
|
128
|
+
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
|
130
|
+
applications.
|
131
|
+
|
132
|
+
For this reason, Innate won't just be a standalone framework, but will also
|
133
|
+
become the new core for Ramaze.
|
134
|
+
|
135
|
+
Ramaze started out without any of the benefits that Rack gives us these days,
|
136
|
+
especially regarding the server handlers, request/response, and middleware.
|
137
|
+
|
138
|
+
Still it tried to provide everything one might need with the least effort,
|
139
|
+
leading to a lot of incorporation of dependencies (we have things like bacon,
|
140
|
+
simple_http, gettext, mime types, ...)
|
141
|
+
|
142
|
+
### Configuration
|
143
|
+
|
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...
|
148
|
+
|
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.
|
152
|
+
|
153
|
+
With Innate I hope to tackle this problem, it's currently not as fast as
|
154
|
+
Ramaze::Global, but offers namespaces and inheritance.
|
155
|
+
|
156
|
+
The areas wherein Ramaze::Global excels (CLI arguments, documentation and
|
157
|
+
annotation for options) will soon be integrated as well.
|
158
|
+
|
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.
|
162
|
+
|
163
|
+
So for example, one can provide some slice that handles feeds:
|
164
|
+
|
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
|
170
|
+
|
171
|
+
class Feeds
|
172
|
+
include Innate::Node
|
173
|
+
options :feed_slice
|
174
|
+
end
|
175
|
+
|
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
|
+
|
179
|
+
### Controller
|
180
|
+
|
181
|
+
Well, that's the part I worry most about. Every existing Ramaze application
|
182
|
+
relies on the Ramaze::Controller.
|
183
|
+
|
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?
|
186
|
+
|
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.
|
190
|
+
|
191
|
+
Other things are layouts and provides.
|
192
|
+
|
193
|
+
#### Layouts
|
194
|
+
|
195
|
+
Since layouts were an afterthought in Ramaze, they were made normal actions
|
196
|
+
like every other on the respective controllers, leading to lots of confusion
|
197
|
+
over the correct way to use layouts, the Controller::layout syntax in respect
|
198
|
+
to the real location of layouts, how to exclude/include single actions, where
|
199
|
+
layouts should be stored, how to prevent lookup from external requests, ...
|
200
|
+
|
201
|
+
I made layouts just as important as views and methods for the Action in Innate,
|
202
|
+
and they have their own root directory to live in and will not be considered as
|
203
|
+
a normal view template, so they cannot be accidentally be rendered as their own
|
204
|
+
actions.
|
205
|
+
|
206
|
+
This strikes me as important, because I consider layouts to be superior to
|
207
|
+
Ezamar elements and equal to render_partial or render_template, just about
|
208
|
+
every application uses it, so they should be handled in the best way possible.
|
209
|
+
|
210
|
+
The root directory for layouts is in line with the other default locations:
|
211
|
+
|
212
|
+
/node
|
213
|
+
/layout
|
214
|
+
/view
|
215
|
+
/model
|
216
|
+
/public
|
217
|
+
|
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.
|
220
|
+
|
221
|
+
Innate will not have project generating capabilities, so we just have to
|
222
|
+
document it very well and provide some example apps.
|
223
|
+
|
224
|
+
#### Provides
|
225
|
+
|
226
|
+
This is a major new feature stolen from Merb and adapted for the ease of use of
|
227
|
+
Innate/Ramaze.
|
228
|
+
It won't have all the capabilities one might be used to out of the box, but
|
229
|
+
extending them is easy.
|
230
|
+
|
231
|
+
Having "provides" means that every Action has different ways of being rendered,
|
232
|
+
depending on so-called wishes.
|
233
|
+
|
234
|
+
A wish may be anything related to the request object, and by default it will
|
235
|
+
trigger on the filename extension asked for.
|
236
|
+
This enables you to create a single action that can be rendered in
|
237
|
+
json/rss/atom/yaml/xml/xhtml/html/wap or different languages...
|
238
|
+
|
239
|
+
The dispatching in Node depends on the filename extension by default, but more
|
240
|
+
decision paths can be added to Action by overriding some defaults.
|
241
|
+
|
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.
|
244
|
+
|
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.
|
250
|
+
|
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
|
+
|
254
|
+
### More specifics
|
255
|
+
|
256
|
+
Here I try to list the most important things that Ramaze will offer but that
|
257
|
+
are not included in Innate itself in terms of globs:
|
258
|
+
|
259
|
+
* cache.rb and cache/*.rb
|
260
|
+
* current/response.rb
|
261
|
+
* tool/{create,mime,localize,daemonize,record,project_creator}.rb
|
262
|
+
* spec/helper/*.rb
|
263
|
+
* snippets/**/*.rb
|
264
|
+
* gestalt.rb
|
265
|
+
* store/default.rb
|
266
|
+
* contrib.rb or any contribs
|
267
|
+
* adapter/*.rb (superseded by a lightweight adapter.rb)
|
268
|
+
* template/ezamar*/*
|
269
|
+
* bacon.rb
|
270
|
+
* dispatcher.rb
|
271
|
+
* dispatcher/*.rb
|
272
|
+
|
273
|
+
There might be a couple of things I've forgotten, but that's what a quick
|
274
|
+
glance tells me.
|
275
|
+
|
276
|
+
Let's go through them one by one and consider what's gonna happen to them:
|
277
|
+
|
278
|
+
### Cache
|
279
|
+
|
280
|
+
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.
|
288
|
+
|
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.
|
292
|
+
|
293
|
+
At this point I would really like to thank all of the people who contributed to
|
294
|
+
caching as it is today.
|
295
|
+
|
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
|
+
|
299
|
+
### Response
|
300
|
+
|
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.
|
304
|
+
|
305
|
+
### Tools
|
306
|
+
|
307
|
+
Ramaze acquired quite a lot of tools, some of those are not useful anymore,
|
308
|
+
other ones might have to stick around.
|
309
|
+
|
310
|
+
#### Tool::Create
|
311
|
+
|
312
|
+
This has been used by `bin/ramaze --create` and I think it will stick around
|
313
|
+
for some more time.
|
314
|
+
|
315
|
+
#### Tool::ProjectCreator
|
316
|
+
|
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.
|
322
|
+
|
323
|
+
##### Tool::Daemonize
|
324
|
+
|
325
|
+
Nothing but issues with this one although it is just a very thin wrapper for
|
326
|
+
the daemons gem. Nobody has contributed to this so far despite the issues and
|
327
|
+
it seems that there are a lot of different solutions for this problem.
|
328
|
+
This will be removed from both Ramaze and Innate.
|
329
|
+
|
330
|
+
##### Ramaze::Record
|
331
|
+
|
332
|
+
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.
|
335
|
+
|
336
|
+
##### Tool::Localize
|
337
|
+
|
338
|
+
I and a lot of other people have used this over time and it has proven itself
|
339
|
+
to be a very easy and straight-forward way of doing localization.
|
340
|
+
|
341
|
+
It think it is better suited as middleware which can be included into
|
342
|
+
rack-contrib and doesn't rely on the normal session but a simple unobfuscated
|
343
|
+
cookie.
|
344
|
+
|
345
|
+
##### Tool::MIME
|
346
|
+
|
347
|
+
This one will be removed, Rack::Mime is a viable alternative.
|
348
|
+
|
349
|
+
### Spec helpers
|
350
|
+
|
351
|
+
Over the years, Ramaze has collected a wide variety of spec helpers that are
|
352
|
+
not really compatible to each other and rely on real request/response with a
|
353
|
+
running server.
|
354
|
+
|
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).
|
360
|
+
|
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
|
+
|
367
|
+
### Snippets
|
368
|
+
|
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.
|
374
|
+
|
375
|
+
Two things that we need are (currently) String#each, because Rack relies on it,
|
376
|
+
and BasicObject as superclass for the Option class. They are only applied on
|
377
|
+
demand.
|
378
|
+
|
379
|
+
These are in the directory called core_extensions, to make it very, very clear
|
380
|
+
what we are doing and how we are doing it.
|
381
|
+
|
382
|
+
Ramaze has still a lot of these snippets and will continue to, although I will
|
383
|
+
constantly strive to reduce them slowly.
|
384
|
+
|
385
|
+
### Gestalt
|
386
|
+
|
387
|
+
Gestalt has been the first "templating_engine" for Ramaze and is still used in
|
388
|
+
some fractions of the code and various applications. There are a lot of other
|
389
|
+
html/xml builders out there these days so I think this is no good choice for
|
390
|
+
inclusion into Innate. I will keep it inside Ramaze.
|
391
|
+
|
392
|
+
### Ramaze::Store::Default
|
393
|
+
|
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.
|
397
|
+
|
398
|
+
It's very slow, might raise exceptions under heavy load and a plain YAML::Store
|
399
|
+
or PStore or any other persistence mechanism is generally a better choice, so
|
400
|
+
there is no need to keep this around.
|
401
|
+
|
402
|
+
### Contrib
|
403
|
+
|
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:
|
407
|
+
|
408
|
+
* gzip_filter
|
409
|
+
* profiling
|
410
|
+
|
411
|
+
Then there's things that don't see much use. They should stay in the future
|
412
|
+
Ramaze contrib or face removal:
|
413
|
+
|
414
|
+
* facebook
|
415
|
+
* gettext
|
416
|
+
* maruku_uv
|
417
|
+
* sequel_cache
|
418
|
+
* rest
|
419
|
+
|
420
|
+
And other things that should be moved into Ramaze proper:
|
421
|
+
|
422
|
+
* email
|
423
|
+
* file_cache (done)
|
424
|
+
* gems
|
425
|
+
|
426
|
+
None of these will be included in Innate.
|
427
|
+
|
428
|
+
### Adapters
|
429
|
+
|
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.
|
433
|
+
|
434
|
+
### Templating
|
435
|
+
|
436
|
+
Templating will also be handled by Innate for the most part.
|
437
|
+
|
438
|
+
#### Ezamar
|
439
|
+
|
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.
|
443
|
+
|
444
|
+
### Bacon
|
445
|
+
|
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.
|
448
|
+
|
449
|
+
### Dispatcher
|
450
|
+
|
451
|
+
Innate uses a stripped down version of the Ramaze dispatcher. The Ramaze
|
452
|
+
dispatcher was strongly influenced by Nitro, but proved to be a difficult
|
453
|
+
part. We are now using Rack's URLMap directly, and have a minimal dispatching
|
454
|
+
mechanism directly in Node (like we used to have one in Controller).
|
455
|
+
|
456
|
+
A lot of the functionality that used to be in the different dispatchers is now
|
457
|
+
provided by Rack middleware.
|
458
|
+
|
459
|
+
The Dispatcher itself isn't needed anymore. It used to setup
|
460
|
+
Request/Response/Session, which was superseded by Current, this again is now
|
461
|
+
superseded by STATE::wrap.
|
462
|
+
|
463
|
+
We are going to remove all the other dispatchers as well, providing default
|
464
|
+
ways to provide the same functionality, and various middleware to use.
|
465
|
+
|
466
|
+
#### Dispatcher::Action
|
467
|
+
|
468
|
+
This dispatcher was used to initiate the controller dispatching, this is now
|
469
|
+
not needed anymore.
|
470
|
+
|
471
|
+
#### Dispatcher::Directory
|
472
|
+
|
473
|
+
This will also be removed. There is a directory listing middleware already.
|
474
|
+
|
475
|
+
#### Dispatcher::Error
|
476
|
+
|
477
|
+
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.
|
480
|
+
|
481
|
+
#### Dispatcher::File
|
482
|
+
|
483
|
+
This is a combination of the etag and conditionalget middlewares, ergo Innate
|
484
|
+
and Ramaze will not serve static files themselves anymore, but leave the job to
|
485
|
+
Rack or external servers.
|