innate 2009.10 → 2010.01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +4 -2
- data/CHANGELOG +80 -0
- data/README.md +15 -15
- data/Rakefile +4 -4
- data/innate.gemspec +11 -11
- data/lib/innate/adapter.rb +9 -0
- data/lib/innate/helper/redirect.rb +1 -1
- data/lib/innate/helper/render.rb +1 -1
- data/lib/innate/node.rb +22 -3
- data/lib/innate/version.rb +1 -1
- data/lib/innate/view/etanni.rb +7 -6
- data/spec/innate/helper/redirect.rb +2 -2
- data/spec/innate/helper/render.rb +3 -1
- data/tasks/gem_setup.rake +3 -3
- metadata +6 -6
data/AUTHORS
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
Following persons have contributed to innate.
|
|
2
2
|
(Sorted by number of submitted patches, then alphabetically)
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
749 Michael Fellinger <m.fellinger@gmail.com>
|
|
5
5
|
31 Tadahiko Uehara <kikofx@gmail.com>
|
|
6
6
|
8 Pistos <gitsomegrace.5.pistos@geoshell.com>
|
|
7
7
|
5 Ryan Grove <ryan@wonko.com>
|
|
8
|
+
3 Lin Jen-Shin <godfat@godfat.org>
|
|
8
9
|
2 Andreas Karlsson <andreas@proxel.se>
|
|
9
10
|
2 Antti Tuomi <antti.tuomi@tkk.fi>
|
|
11
|
+
2 Arnaud Meuret <arnaud@meuret.name>
|
|
10
12
|
2 TJ Vanderpoel <bougy.man@gmail.com>
|
|
11
|
-
|
|
13
|
+
2 Zoxc <zoxc32@gmail.com>
|
|
12
14
|
1 Jérémy Zurcher <jeremy@asynk.ch>
|
|
13
15
|
1 ravage <ravage@fragmentized.net>
|
|
14
16
|
1 Sam Carr <samcarr@gmail.com>
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
+
[82cd8d9 | 2010-01-06 06:53:24 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
2
|
+
|
|
3
|
+
* Version 2010.01
|
|
4
|
+
|
|
5
|
+
[2511e2b | 2010-01-06 06:52:49 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
6
|
+
|
|
7
|
+
* Update Rakefile
|
|
8
|
+
|
|
9
|
+
[07f9238 | 2009-12-01 14:57:56 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
10
|
+
|
|
11
|
+
* Revert "Major performance improvement for Etanni."
|
|
12
|
+
|
|
13
|
+
This reverts commit 1b736b793e9f31cf79fad2820f3f20a00802c2c8.
|
|
14
|
+
|
|
15
|
+
[1b736b7 | 2009-11-30 19:17:23 UTC] Zoxc <zoxc32@gmail.com>
|
|
16
|
+
|
|
17
|
+
* Major performance improvement for Etanni.
|
|
18
|
+
|
|
19
|
+
[7b14652 | 2009-11-30 09:50:01 UTC] Zoxc <zoxc32@gmail.com>
|
|
20
|
+
|
|
21
|
+
* Performance improvement for Etanni.
|
|
22
|
+
|
|
23
|
+
[17dba1a | 2009-11-18 19:12:29 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
24
|
+
|
|
25
|
+
* Remove comment
|
|
26
|
+
|
|
27
|
+
[aac4faf | 2009-11-16 13:16:56 UTC] Lin Jen-Shin <godfat@godfat.org>
|
|
28
|
+
|
|
29
|
+
* [helper/render.rb] dup on variables arg is not needed. never refered.
|
|
30
|
+
|
|
31
|
+
[5d1e95d | 2009-11-16 12:52:12 UTC] Lin Jen-Shin <godfat@godfat.org>
|
|
32
|
+
|
|
33
|
+
* [helper/render.rb] fixed render_file's sync_variables. see detail:
|
|
34
|
+
|
|
35
|
+
This line syncs variables from current action to newly created action:
|
|
36
|
+
action.sync_variables(self.action)
|
|
37
|
+
|
|
38
|
+
but later this line eliminates above effect:
|
|
39
|
+
action.variables = variables.dup
|
|
40
|
+
|
|
41
|
+
Assume we would like variables from current action, but
|
|
42
|
+
would like to override (or hide, shadow) them by passing
|
|
43
|
+
another hash of variables in render_file's second arguments.
|
|
44
|
+
Then change that line to:
|
|
45
|
+
action.variables.merge!(variables.dup)
|
|
46
|
+
|
|
47
|
+
spec this behavior in SpecHelperRenderFile.
|
|
48
|
+
|
|
49
|
+
[42b5ec5 | 2009-10-28 12:43:54 UTC] Lin Jen-Shin <godfat@godfat.org>
|
|
50
|
+
|
|
51
|
+
* Add a simple Unicorn wrapper in innate/adapter.rb
|
|
52
|
+
|
|
53
|
+
[14a340f | 2009-10-17 18:01:48 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
54
|
+
|
|
55
|
+
* Allow skipping the template discovery to speed things up
|
|
56
|
+
|
|
57
|
+
[d02bd71 | 2009-10-17 17:50:51 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
58
|
+
|
|
59
|
+
* Fix gem_setup task
|
|
60
|
+
|
|
61
|
+
[0f3c5fe | 2009-10-05 09:32:30 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
62
|
+
|
|
63
|
+
* Allow for change of the default action name as proposed by Daniel Azuma
|
|
64
|
+
|
|
65
|
+
[ee96b28 | 2009-10-04 08:37:44 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
66
|
+
|
|
67
|
+
* Remove temp README
|
|
68
|
+
|
|
69
|
+
[3e90299 | 2009-10-04 08:37:07 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
70
|
+
|
|
71
|
+
* Fix precedence issue in redirect_referer
|
|
72
|
+
|
|
73
|
+
[44f40da | 2009-10-03 14:33:11 UTC] Arnaud Meuret <arnaud@meuret.name>
|
|
74
|
+
|
|
75
|
+
* Typos and minor rephrasing.
|
|
76
|
+
|
|
77
|
+
[7ad5fd9 | 2009-10-02 15:04:37 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
78
|
+
|
|
79
|
+
* Sync metadata after release
|
|
80
|
+
|
|
1
81
|
[1b0702f | 2009-10-02 13:24:16 UTC] Michael Fellinger <m.fellinger@gmail.com>
|
|
2
82
|
|
|
3
83
|
* Version 2009.10
|
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Innate is the core of Ramaze, but useful on its own.
|
|
|
5
5
|
|
|
6
6
|
## Philosophy
|
|
7
7
|
|
|
8
|
-
The philosophy behind Innate is to provide a simple web
|
|
8
|
+
The philosophy behind Innate is to provide a simple web framework that:
|
|
9
9
|
|
|
10
10
|
* Stays below 2000 easily readable lines of code
|
|
11
11
|
* Has Rack as the only dependency
|
|
@@ -48,7 +48,7 @@ sequel, logging with analogger or growl, templating with haml or erubis, just to
|
|
|
48
48
|
name a few.
|
|
49
49
|
|
|
50
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
|
|
51
|
+
concepts of what's going on inside an App are completely abstracted by Innate.
|
|
52
52
|
|
|
53
53
|
To summarize, Innate really keeps it simple, acts as a learning tool and
|
|
54
54
|
encourages everybody to build on top of it whatever they want.
|
|
@@ -117,7 +117,8 @@ access to alternate branches, bugfixes, and new features.
|
|
|
117
117
|
|
|
118
118
|
git clone git://github.com/manveru/innate.git
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
Do not forget to add the innate/lib directory to your `RUBYLIB` environment
|
|
121
|
+
variable.
|
|
121
122
|
|
|
122
123
|
For unixish systems you may want to add it to `~/.bashrc` or the equivalent for
|
|
123
124
|
your shell:
|
|
@@ -159,7 +160,6 @@ the list yet.
|
|
|
159
160
|
|
|
160
161
|
### View
|
|
161
162
|
|
|
162
|
-
Innate has support for only
|
|
163
163
|
Innate supports multiple templating engines and it is very easy to add your
|
|
164
164
|
own.
|
|
165
165
|
At the moment we offer following engines out of the box:
|
|
@@ -178,7 +178,7 @@ How to build your own is discussed at
|
|
|
178
178
|
|
|
179
179
|
Innate follows a different approach than most frameworks, making the controller
|
|
180
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.
|
|
181
|
+
include Innate::Node and map it to the location you would like to serve.
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
## Differences from Ramaze
|
|
@@ -194,13 +194,13 @@ Ramaze started out without any of the benefits that Rack gives us these days,
|
|
|
194
194
|
especially regarding the server handlers, request/response, and middleware.
|
|
195
195
|
|
|
196
196
|
Still it tried to provide everything one might need with the least effort,
|
|
197
|
-
leading to a lot
|
|
198
|
-
|
|
197
|
+
leading to a lot dependencies (we had things like bacon, simple_http, gettext,
|
|
198
|
+
mime types, ...)
|
|
199
199
|
|
|
200
200
|
|
|
201
201
|
### Configuration
|
|
202
202
|
|
|
203
|
-
Innate provides the Innate::Options DSL, in some aspects to the old
|
|
203
|
+
Innate provides the Innate::Options DSL, similar in some aspects to the old
|
|
204
204
|
Ramaze::Global, but a lot more flexible.
|
|
205
205
|
|
|
206
206
|
Options has namespaces, inheritance, defaults, triggers, documentation, and a
|
|
@@ -272,7 +272,7 @@ actions.
|
|
|
272
272
|
|
|
273
273
|
This strikes me as important, because I consider layouts to be superior to
|
|
274
274
|
Ezamar elements and equal to render_partial or render_template, just about
|
|
275
|
-
every application uses
|
|
275
|
+
every application uses them, so they should be handled in the best way possible.
|
|
276
276
|
|
|
277
277
|
The root directory for layouts is in line with the other default locations:
|
|
278
278
|
|
|
@@ -284,7 +284,7 @@ The root directory for layouts is in line with the other default locations:
|
|
|
284
284
|
`-- view
|
|
285
285
|
|
|
286
286
|
While none of these directories is necessary, they are the default locations and
|
|
287
|
-
should be included in a new proto for Ramaze (
|
|
287
|
+
should be included in a new proto for Ramaze (except that ramaze uses
|
|
288
288
|
`/controller` instead of `/node`.
|
|
289
289
|
|
|
290
290
|
Innate will not have project generating capabilities, so we just have to
|
|
@@ -315,7 +315,7 @@ a suitable layout as well.
|
|
|
315
315
|
|
|
316
316
|
This is very alien to old Ramaze, which always has a 1:1 mapping between actions
|
|
317
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
|
|
318
|
+
sass as css or how to respond with json for a AJAX request until they finally
|
|
319
319
|
were pointed to setting content-type, using respond and setting up custom
|
|
320
320
|
routes.
|
|
321
321
|
|
|
@@ -356,7 +356,7 @@ right for any web application.
|
|
|
356
356
|
Innate defines the caching API that enables everybody to add caches with very
|
|
357
357
|
little code.
|
|
358
358
|
|
|
359
|
-
Innate provides caching by following means:
|
|
359
|
+
Innate provides caching by the following means:
|
|
360
360
|
|
|
361
361
|
* DRb
|
|
362
362
|
* Hash
|
|
@@ -373,7 +373,7 @@ And as time goes on there will be many more.
|
|
|
373
373
|
|
|
374
374
|
### Response
|
|
375
375
|
|
|
376
|
-
Very little code, just
|
|
376
|
+
Very little code, it just provides some options regarding default headers and easy
|
|
377
377
|
ways to reset the response.
|
|
378
378
|
Ramaze adds some more convenient methods.
|
|
379
379
|
|
|
@@ -413,7 +413,7 @@ Despite being quite popular it has many issues and is totally unusable if you
|
|
|
413
413
|
don't have full knowledge about what is going to be served.
|
|
414
414
|
|
|
415
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
|
|
416
|
+
to be a very easy and straightforward way of doing localization.
|
|
417
417
|
|
|
418
418
|
It think it is better suited as middleware which can be included into
|
|
419
419
|
rack-contrib and doesn't rely on the normal session but a simple unobfuscated
|
|
@@ -430,7 +430,7 @@ This one was removed, Rack::Mime is the way to go.
|
|
|
430
430
|
### Spec helpers
|
|
431
431
|
|
|
432
432
|
Over the years, Ramaze has collected a wide variety of spec helpers that are
|
|
433
|
-
not really compatible
|
|
433
|
+
not really compatible with each other and rely on real request/response with a
|
|
434
434
|
running server.
|
|
435
435
|
|
|
436
436
|
Innate provides a better alternative via Innate::Mock for specs, the output
|
data/Rakefile
CHANGED
|
@@ -10,18 +10,18 @@ PROJECT_README = 'README.md'
|
|
|
10
10
|
PROJECT_VERSION = ENV['VERSION'] || Date.today.strftime('%Y.%m.%d')
|
|
11
11
|
|
|
12
12
|
DEPENDENCIES = {
|
|
13
|
-
'rack' => {:version => '
|
|
13
|
+
'rack' => {:version => '= 1.1.0'},
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
DEVELOPMENT_DEPENDENCIES = {
|
|
17
17
|
'bacon' => {:version => '>= 1.1.0'},
|
|
18
|
-
'rack-test' => {:version => '>= 0.5.
|
|
18
|
+
'rack-test' => {:version => '>= 0.5.3', :lib => 'rack/test'}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if defined?(RUBY_PLATFORM) && RUBY_PLATFORM =~ /jruby/
|
|
22
|
-
DEVELOPMENT_DEPENDENCIES['json-jruby'] = {:version => '~> 1.
|
|
22
|
+
DEVELOPMENT_DEPENDENCIES['json-jruby'] = {:version => '~> 1.2.0'}
|
|
23
23
|
else
|
|
24
|
-
DEVELOPMENT_DEPENDENCIES['json'] = {:version => '~> 1.
|
|
24
|
+
DEVELOPMENT_DEPENDENCIES['json'] = {:version => '~> 1.2.0'}
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
GEMSPEC = Gem::Specification.new{|s|
|
data/innate.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{innate}
|
|
5
|
-
s.version = "
|
|
5
|
+
s.version = "2010.01"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.1") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Michael 'manveru' Fellinger"]
|
|
9
|
-
s.date = %q{
|
|
9
|
+
s.date = %q{2010-01-06}
|
|
10
10
|
s.description = %q{Simple, straight-forward base for web-frameworks.}
|
|
11
11
|
s.email = %q{m.fellinger@gmail.com}
|
|
12
12
|
s.files = ["AUTHORS", "CHANGELOG", "COPYING", "MANIFEST", "README.md", "Rakefile", "example/app/retro_games.rb", "example/app/todo/layout/default.xhtml", "example/app/todo/spec/todo.rb", "example/app/todo/start.rb", "example/app/todo/view/index.xhtml", "example/app/whywiki_erb/layout/wiki.html.erb", "example/app/whywiki_erb/spec/wiki.rb", "example/app/whywiki_erb/start.rb", "example/app/whywiki_erb/view/edit.erb", "example/app/whywiki_erb/view/index.erb", "example/custom_middleware.rb", "example/hello.rb", "example/howto_spec.rb", "example/link.rb", "example/provides.rb", "example/session.rb", "innate.gemspec", "lib/innate.rb", "lib/innate/action.rb", "lib/innate/adapter.rb", "lib/innate/cache.rb", "lib/innate/cache/api.rb", "lib/innate/cache/drb.rb", "lib/innate/cache/file_based.rb", "lib/innate/cache/marshal.rb", "lib/innate/cache/memory.rb", "lib/innate/cache/yaml.rb", "lib/innate/current.rb", "lib/innate/dynamap.rb", "lib/innate/helper.rb", "lib/innate/helper/aspect.rb", "lib/innate/helper/cgi.rb", "lib/innate/helper/flash.rb", "lib/innate/helper/link.rb", "lib/innate/helper/redirect.rb", "lib/innate/helper/render.rb", "lib/innate/helper/send_file.rb", "lib/innate/log.rb", "lib/innate/log/color_formatter.rb", "lib/innate/log/hub.rb", "lib/innate/middleware_compiler.rb", "lib/innate/mock.rb", "lib/innate/node.rb", "lib/innate/options.rb", "lib/innate/options/dsl.rb", "lib/innate/options/stub.rb", "lib/innate/request.rb", "lib/innate/response.rb", "lib/innate/route.rb", "lib/innate/session.rb", "lib/innate/session/flash.rb", "lib/innate/spec.rb", "lib/innate/spec/bacon.rb", "lib/innate/state.rb", "lib/innate/state/accessor.rb", "lib/innate/traited.rb", "lib/innate/trinity.rb", "lib/innate/version.rb", "lib/innate/view.rb", "lib/innate/view/erb.rb", "lib/innate/view/etanni.rb", "lib/innate/view/none.rb", "spec/example/app/retro_games.rb", "spec/example/hello.rb", "spec/example/link.rb", "spec/example/provides.rb", "spec/example/session.rb", "spec/helper.rb", "spec/innate/action/layout.rb", "spec/innate/action/layout/file_layout.xhtml", "spec/innate/cache/common.rb", "spec/innate/cache/marshal.rb", "spec/innate/cache/memory.rb", "spec/innate/cache/yaml.rb", "spec/innate/dynamap.rb", "spec/innate/helper.rb", "spec/innate/helper/aspect.rb", "spec/innate/helper/cgi.rb", "spec/innate/helper/flash.rb", "spec/innate/helper/link.rb", "spec/innate/helper/redirect.rb", "spec/innate/helper/render.rb", "spec/innate/helper/send_file.rb", "spec/innate/helper/view/aspect_hello.xhtml", "spec/innate/helper/view/locals.xhtml", "spec/innate/helper/view/loop.xhtml", "spec/innate/helper/view/num.xhtml", "spec/innate/helper/view/partial.xhtml", "spec/innate/helper/view/recursive.xhtml", "spec/innate/mock.rb", "spec/innate/modes.rb", "spec/innate/node/mapping.rb", "spec/innate/node/node.rb", "spec/innate/node/resolve.rb", "spec/innate/node/view/another_layout/another_layout.xhtml", "spec/innate/node/view/bar.xhtml", "spec/innate/node/view/cat2/cat22.xhtml", "spec/innate/node/view/cat3/cat33.xhtml", "spec/innate/node/view/foo.html.xhtml", "spec/innate/node/view/only_view.xhtml", "spec/innate/node/view/sub/baz.xhtml", "spec/innate/node/view/sub/foo/baz.xhtml", "spec/innate/node/view/with_layout.xhtml", "spec/innate/node/wrap_action_call.rb", "spec/innate/options.rb", "spec/innate/parameter.rb", "spec/innate/provides.rb", "spec/innate/provides/list.html.xhtml", "spec/innate/provides/list.txt.xhtml", "spec/innate/request.rb", "spec/innate/route.rb", "spec/innate/session.rb", "spec/innate/traited.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_setup.rake", "tasks/grancher.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/ycov.rake"]
|
|
@@ -21,20 +21,20 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.specification_version = 3
|
|
22
22
|
|
|
23
23
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
24
|
-
s.add_runtime_dependency(%q<rack>, ["
|
|
24
|
+
s.add_runtime_dependency(%q<rack>, ["= 1.1.0"])
|
|
25
25
|
s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
|
|
26
|
-
s.add_development_dependency(%q<rack-test>, [">= 0.5.
|
|
27
|
-
s.add_development_dependency(%q<json>, ["~> 1.
|
|
26
|
+
s.add_development_dependency(%q<rack-test>, [">= 0.5.3"])
|
|
27
|
+
s.add_development_dependency(%q<json>, ["~> 1.2.0"])
|
|
28
28
|
else
|
|
29
|
-
s.add_dependency(%q<rack>, ["
|
|
29
|
+
s.add_dependency(%q<rack>, ["= 1.1.0"])
|
|
30
30
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
|
31
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.
|
|
32
|
-
s.add_dependency(%q<json>, ["~> 1.
|
|
31
|
+
s.add_dependency(%q<rack-test>, [">= 0.5.3"])
|
|
32
|
+
s.add_dependency(%q<json>, ["~> 1.2.0"])
|
|
33
33
|
end
|
|
34
34
|
else
|
|
35
|
-
s.add_dependency(%q<rack>, ["
|
|
35
|
+
s.add_dependency(%q<rack>, ["= 1.1.0"])
|
|
36
36
|
s.add_dependency(%q<bacon>, [">= 1.1.0"])
|
|
37
|
-
s.add_dependency(%q<rack-test>, [">= 0.5.
|
|
38
|
-
s.add_dependency(%q<json>, ["~> 1.
|
|
37
|
+
s.add_dependency(%q<rack-test>, [">= 0.5.3"])
|
|
38
|
+
s.add_dependency(%q<json>, ["~> 1.2.0"])
|
|
39
39
|
end
|
|
40
40
|
end
|
data/lib/innate/adapter.rb
CHANGED
|
@@ -77,5 +77,14 @@ module Innate
|
|
|
77
77
|
::Thin::Logging.silent = true
|
|
78
78
|
handler.run(app, config)
|
|
79
79
|
end
|
|
80
|
+
|
|
81
|
+
# A simple Unicorn wrapper.
|
|
82
|
+
def self.start_unicorn(app, config)
|
|
83
|
+
require 'unicorn'
|
|
84
|
+
config = {
|
|
85
|
+
:listeners => ["#{config[:Host]}:#{config[:Port]}"]
|
|
86
|
+
}
|
|
87
|
+
::Unicorn.run(app, config)
|
|
88
|
+
end
|
|
80
89
|
end
|
|
81
90
|
end
|
|
@@ -71,7 +71,7 @@ module Innate
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def redirect_referrer(fallback = '/')
|
|
74
|
-
if referer = request.
|
|
74
|
+
if (referer = request.env['HTTP_REFERER']) && (url = request.url)
|
|
75
75
|
referer_uri, request_uri = URI(referer), URI(url)
|
|
76
76
|
|
|
77
77
|
redirect(referer) unless referer_uri == request_uri
|
data/lib/innate/helper/render.rb
CHANGED
data/lib/innate/node.rb
CHANGED
|
@@ -47,6 +47,7 @@ module Innate
|
|
|
47
47
|
trait :layout => nil
|
|
48
48
|
trait :alias_view => {}
|
|
49
49
|
trait :provide => {}
|
|
50
|
+
trait :fast_mappings => false
|
|
50
51
|
|
|
51
52
|
# @see wrap_action_call
|
|
52
53
|
trait :wrap => SortedSet.new
|
|
@@ -54,6 +55,10 @@ module Innate
|
|
|
54
55
|
trait :needs_method => false
|
|
55
56
|
trait :skip_node_map => false
|
|
56
57
|
|
|
58
|
+
# @see patterns_for
|
|
59
|
+
trait :separate_default_action => false
|
|
60
|
+
trait :default_action_name => 'index'
|
|
61
|
+
|
|
57
62
|
# Upon inclusion we make ourselves comfortable.
|
|
58
63
|
def self.included(into)
|
|
59
64
|
into.__send__(:include, Helper)
|
|
@@ -80,7 +85,6 @@ module Innate
|
|
|
80
85
|
NODE_LIST.each{|node|
|
|
81
86
|
node.map(generate_mapping(node.name)) unless node.trait[:skip_node_map]
|
|
82
87
|
}
|
|
83
|
-
# Log.debug("Mapped Nodes: %p" % DynaMap.to_hash) unless NODE_LIST.empty?
|
|
84
88
|
end
|
|
85
89
|
|
|
86
90
|
def self.generate_mapping(object_name = self.name)
|
|
@@ -720,14 +724,21 @@ module Innate
|
|
|
720
724
|
# @see Node#fill_action
|
|
721
725
|
# @author manveru
|
|
722
726
|
def patterns_for(path)
|
|
727
|
+
default_action_name = ancestral_trait[:default_action_name]
|
|
728
|
+
separate_default_action = ancestral_trait[:separate_default_action]
|
|
729
|
+
|
|
723
730
|
atoms = path.split('/')
|
|
724
731
|
atoms.delete('')
|
|
725
732
|
result = nil
|
|
726
|
-
|
|
727
733
|
atoms.size.downto(0) do |len|
|
|
728
734
|
action_name = atoms[0...len].join('__')
|
|
735
|
+
|
|
736
|
+
next if separate_default_action && action_name == default_action_name
|
|
737
|
+
|
|
729
738
|
params = atoms[len..-1]
|
|
730
|
-
|
|
739
|
+
|
|
740
|
+
action_name = default_action_name if action_name.empty? &&
|
|
741
|
+
(separate_default_action || params != [default_action_name])
|
|
731
742
|
|
|
732
743
|
return result if result = yield(action_name, params)
|
|
733
744
|
end
|
|
@@ -785,11 +796,19 @@ module Innate
|
|
|
785
796
|
end
|
|
786
797
|
|
|
787
798
|
def update_view_mappings
|
|
799
|
+
if ancestral_trait[:fast_mappings]
|
|
800
|
+
return @view_templates if instance_variable_defined?(:@view_templates)
|
|
801
|
+
end
|
|
802
|
+
|
|
788
803
|
paths = possible_paths_for(view_mappings)
|
|
789
804
|
@view_templates = update_mapping_shared(paths)
|
|
790
805
|
end
|
|
791
806
|
|
|
792
807
|
def update_layout_mappings
|
|
808
|
+
if ancestral_trait[:fast_mappings]
|
|
809
|
+
return @layout_templates if instance_variable_defined?(:@layout_templates)
|
|
810
|
+
end
|
|
811
|
+
|
|
793
812
|
paths = possible_paths_for(layout_mappings)
|
|
794
813
|
@layout_templates = update_mapping_shared(paths)
|
|
795
814
|
end
|
data/lib/innate/version.rb
CHANGED
data/lib/innate/view/etanni.rb
CHANGED
|
@@ -11,9 +11,9 @@ module Innate
|
|
|
11
11
|
|
|
12
12
|
class Etanni
|
|
13
13
|
SEPARATOR = "E69t116A65n110N78i105S83e101P80a97R82a97T84o111R82"
|
|
14
|
-
START = "\
|
|
14
|
+
START = "\n_out_ << <<#{SEPARATOR}.chomp!\n"
|
|
15
15
|
STOP = "\n#{SEPARATOR}\n"
|
|
16
|
-
|
|
16
|
+
REPLACEMENT = "#{STOP}\\1#{START}"
|
|
17
17
|
|
|
18
18
|
def initialize(template)
|
|
19
19
|
@template = template
|
|
@@ -22,12 +22,13 @@ module Innate
|
|
|
22
22
|
|
|
23
23
|
def compile
|
|
24
24
|
temp = @template.dup
|
|
25
|
-
temp.
|
|
26
|
-
|
|
25
|
+
temp.strip!
|
|
26
|
+
temp.gsub!(/<\?r\s+(.*?)\s+\?>/m, REPLACEMENT)
|
|
27
|
+
@compiled = "_out_ = [<<#{SEPARATOR}.chomp!]\n#{temp}#{STOP}_out_"
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def result(binding, filename = '<Etanni>')
|
|
30
|
-
eval(@compiled, binding, filename).
|
|
31
|
+
eval(@compiled, binding, filename).join
|
|
31
32
|
end
|
|
32
|
-
|
|
33
|
+
end
|
|
33
34
|
end
|
|
@@ -90,7 +90,7 @@ describe Innate::Helper::Redirect do
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
should 'redirect to referer' do
|
|
93
|
-
header '
|
|
93
|
+
header 'REFERER', "#@uri/index"
|
|
94
94
|
get("#@uri/redirect_referer_action")
|
|
95
95
|
|
|
96
96
|
last_response.status.should == 302
|
|
@@ -99,7 +99,7 @@ describe Innate::Helper::Redirect do
|
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
should 'redirect to fallback if referrer is identical' do
|
|
102
|
-
header '
|
|
102
|
+
header 'REFERER', "#@uri/redirect_referer_action"
|
|
103
103
|
get("#@uri/redirect_referer_action")
|
|
104
104
|
|
|
105
105
|
last_response.status.should == 302
|
|
@@ -86,10 +86,12 @@ class SpecHelperRenderFile
|
|
|
86
86
|
FILE = File.expand_path('../view/aspect_hello.xhtml', __FILE__)
|
|
87
87
|
|
|
88
88
|
def absolute
|
|
89
|
+
@bar = 'bar'
|
|
89
90
|
render_file(FILE)
|
|
90
91
|
end
|
|
91
92
|
|
|
92
93
|
def absolute_with(foo, bar)
|
|
94
|
+
@foo = 'foo'
|
|
93
95
|
render_file(FILE, :foo => foo, :bar => bar)
|
|
94
96
|
end
|
|
95
97
|
end
|
|
@@ -155,7 +157,7 @@ describe Innate::Helper::Render do
|
|
|
155
157
|
behaves_like :rack_test
|
|
156
158
|
|
|
157
159
|
it 'renders file from absolute path' do
|
|
158
|
-
get('/render_file/absolute').body.should == '{ ! }'
|
|
160
|
+
get('/render_file/absolute').body.should == '{ bar! }'
|
|
159
161
|
end
|
|
160
162
|
|
|
161
163
|
it 'renders file from absolute path with variables' do
|
data/tasks/gem_setup.rake
CHANGED
|
@@ -58,16 +58,16 @@ task :gem_setup do
|
|
|
58
58
|
rescue Gem::LoadError
|
|
59
59
|
log "activating #{name} failed, try to install"
|
|
60
60
|
|
|
61
|
-
install_gem(name, options)
|
|
61
|
+
install_gem(name, version, options)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
# tell rubygems to install a gem
|
|
65
|
-
def install_gem(name, options)
|
|
65
|
+
def install_gem(name, version, options)
|
|
66
66
|
installer = Gem::DependencyInstaller.new(options)
|
|
67
67
|
|
|
68
68
|
temp_argv(options[:extconf]) do
|
|
69
69
|
log "installing #{name}"
|
|
70
|
-
installer.install(name,
|
|
70
|
+
installer.install(name, *version)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
Gem.activate(name, *version)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: innate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: "
|
|
4
|
+
version: "2010.01"
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael 'manveru' Fellinger
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2010-01-06 00:00:00 +09:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -18,9 +18,9 @@ dependencies:
|
|
|
18
18
|
version_requirement:
|
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
|
20
20
|
requirements:
|
|
21
|
-
- -
|
|
21
|
+
- - "="
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: 1.
|
|
23
|
+
version: 1.1.0
|
|
24
24
|
version:
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: bacon
|
|
@@ -40,7 +40,7 @@ dependencies:
|
|
|
40
40
|
requirements:
|
|
41
41
|
- - ">="
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.5.
|
|
43
|
+
version: 0.5.3
|
|
44
44
|
version:
|
|
45
45
|
- !ruby/object:Gem::Dependency
|
|
46
46
|
name: json
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - ~>
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 1.
|
|
53
|
+
version: 1.2.0
|
|
54
54
|
version:
|
|
55
55
|
description: Simple, straight-forward base for web-frameworks.
|
|
56
56
|
email: m.fellinger@gmail.com
|