innate 2009.04 → 2009.04.12
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +0 -162
- data/MANIFEST +4 -5
- data/README.md +9 -1
- data/Rakefile +3 -2
- data/innate.gemspec +5 -6
- data/lib/innate.rb +9 -1
- data/lib/innate/action.rb +10 -20
- data/lib/innate/core_compatibility/basic_object.rb +10 -0
- data/lib/innate/core_compatibility/string.rb +3 -0
- data/lib/innate/dynamap.rb +0 -5
- data/lib/innate/helper.rb +2 -2
- data/lib/innate/helper/cgi.rb +0 -3
- data/lib/innate/helper/link.rb +2 -2
- data/lib/innate/helper/redirect.rb +1 -1
- data/lib/innate/helper/render.rb +1 -8
- data/lib/innate/helper/send_file.rb +1 -9
- data/lib/innate/node.rb +1 -1
- data/lib/innate/response.rb +7 -0
- data/lib/innate/version.rb +1 -1
- data/spec/innate/helper/link.rb +0 -8
- data/tasks/release.rake +9 -48
- metadata +7 -7
data/CHANGELOG
CHANGED
@@ -1,165 +1,3 @@
|
|
1
|
-
[ffd8edd | Sat Apr 25 14:59:47 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
2
|
-
|
3
|
-
* Give innate a rubyforge project
|
4
|
-
|
5
|
-
[cf62a9c | Sat Apr 25 14:59:20 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
6
|
-
|
7
|
-
* Version 2009.04
|
8
|
-
|
9
|
-
[0ec2012 | Thu Apr 23 06:21:17 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
10
|
-
|
11
|
-
* Allow deletion of mapped apps in DynaMap
|
12
|
-
|
13
|
-
[cbedd9c | Thu Apr 23 05:04:04 UTC 2009] Ryan Grove <ryan@wonko.com>
|
14
|
-
|
15
|
-
* Add path and full_path to Innate::Action
|
16
|
-
|
17
|
-
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
18
|
-
|
19
|
-
[b9a0d4b | Mon Apr 20 05:12:29 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
20
|
-
|
21
|
-
* Make the u and h aliases for the CGI helper module_functions too
|
22
|
-
|
23
|
-
[b68aad4 | Mon Apr 20 05:12:10 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
24
|
-
|
25
|
-
* Allow further modification of the Action in the render_* methods via block
|
26
|
-
|
27
|
-
[dca3531 | Sun Apr 19 23:38:06 UTC 2009] Ryan Grove <ryan@wonko.com>
|
28
|
-
|
29
|
-
* Preserve response headers when redirecting. Closes #1
|
30
|
-
|
31
|
-
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
32
|
-
|
33
|
-
[d465ca3 | Sat Apr 18 02:46:09 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
34
|
-
|
35
|
-
* Version 2009.04.18
|
36
|
-
|
37
|
-
[987c5d7 | Sat Apr 18 02:44:26 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
38
|
-
|
39
|
-
* Update the release tasks
|
40
|
-
|
41
|
-
[f927c9d | Fri Apr 17 11:51:35 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
42
|
-
|
43
|
-
* Add Content-Disposition support to send_file
|
44
|
-
|
45
|
-
[888318c | Fri Apr 17 10:43:10 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
46
|
-
|
47
|
-
* Better English in render_custom error
|
48
|
-
|
49
|
-
[15078e6 | Wed Apr 15 16:49:04 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
50
|
-
|
51
|
-
* Add comment about planned deprecation of SendFile helper's default status
|
52
|
-
|
53
|
-
[4b487aa | Wed Apr 15 16:48:09 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
54
|
-
|
55
|
-
* Remove the length from Response, Rack provides that
|
56
|
-
|
57
|
-
[1634391 | Wed Apr 15 11:02:11 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
58
|
-
|
59
|
-
* Don't camel-case the helper module name, simply remove underscores, we do case-insensitive lookup anyway
|
60
|
-
|
61
|
-
[f97e8d7 | Wed Apr 15 10:58:35 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
62
|
-
|
63
|
-
* Remove core_extensions, we don't need String#each or BasicObject anymore
|
64
|
-
|
65
|
-
[0b33546 | Wed Apr 15 09:16:24 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
66
|
-
|
67
|
-
* Action may be invalid if the node requires a method and view
|
68
|
-
|
69
|
-
[39dd843 | Wed Apr 15 09:15:30 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
70
|
-
|
71
|
-
* Escape non-hash arguments to Helper::Link#route (ryan grove)
|
72
|
-
|
73
|
-
[22ee4df | Wed Apr 15 07:25:02 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
74
|
-
|
75
|
-
* Raise if the Render helper cannot obtain an Action
|
76
|
-
|
77
|
-
[e229299 | Mon Apr 13 12:48:05 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
78
|
-
|
79
|
-
* Allow Action#call even if we are outside Current#wrap
|
80
|
-
|
81
|
-
[b6e9558 | Mon Apr 13 04:37:42 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
82
|
-
|
83
|
-
* Remove Action#exts member and use better terms
|
84
|
-
|
85
|
-
[46d2a5e | Sun Apr 12 05:03:58 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
86
|
-
|
87
|
-
* FileBased caches have access to @filename now
|
88
|
-
|
89
|
-
[f84f18f | Sun Apr 12 05:03:39 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
90
|
-
|
91
|
-
* Set a PROJECT_README for some rake tasks
|
92
|
-
|
93
|
-
[8920482 | Sun Apr 12 05:03:21 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
94
|
-
|
95
|
-
* Improvment and spec for provide example
|
96
|
-
|
97
|
-
[a892dea | Sun Apr 12 05:02:50 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
98
|
-
|
99
|
-
* Minor improvment and spec for retro games example
|
100
|
-
|
101
|
-
[b3aeb97 | Fri Apr 10 12:30:08 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
102
|
-
|
103
|
-
* Allow overriding of middleware mode for specs
|
104
|
-
|
105
|
-
[7d65255 | Fri Apr 10 12:07:15 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
106
|
-
|
107
|
-
* Compact code
|
108
|
-
|
109
|
-
[cde9366 | Fri Apr 10 10:51:03 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
110
|
-
|
111
|
-
* Simplify specs and make them pass using rack-test
|
112
|
-
|
113
|
-
[f4c9572 | Fri Apr 10 10:50:34 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
114
|
-
|
115
|
-
* Don't forget to specify an app for rack-test
|
116
|
-
|
117
|
-
[41b1955 | Fri Apr 10 10:17:42 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
118
|
-
|
119
|
-
* Remove spec for render_template
|
120
|
-
|
121
|
-
[a3b73ca | Fri Apr 10 10:17:27 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
122
|
-
|
123
|
-
* Add `rake setup` task to comply to convention. I will put up the corresponding gems ASAP
|
124
|
-
|
125
|
-
[c648bf7 | Fri Apr 10 10:16:12 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
126
|
-
|
127
|
-
* Switch to using rack-test for our specs, needs rack-test from the master branch head
|
128
|
-
|
129
|
-
[5c08e25 | Thu Apr 09 17:52:28 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
130
|
-
|
131
|
-
* Use ContentLength middleware
|
132
|
-
|
133
|
-
[0dc50d4 | Thu Apr 09 16:10:51 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
134
|
-
|
135
|
-
* Fix template caching... was using html instead of the wish the glob was for
|
136
|
-
|
137
|
-
[622bbe3 | Thu Apr 09 16:01:08 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
138
|
-
|
139
|
-
* Fix example apps
|
140
|
-
|
141
|
-
[6e9e843 | Tue Apr 07 09:56:56 UTC 2009] Sam Carr <samcarr@gmail.com>
|
142
|
-
|
143
|
-
* Minor tidy-ups to fix comments, add missing requires, add comments etc.
|
144
|
-
|
145
|
-
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
146
|
-
|
147
|
-
[8f9af98 | Tue Apr 07 18:42:35 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
148
|
-
|
149
|
-
* Set default interval for reloader to 2 seconds
|
150
|
-
|
151
|
-
[9f7e749 | Tue Apr 07 18:42:14 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
152
|
-
|
153
|
-
* Never assign $0, bad mojo
|
154
|
-
|
155
|
-
[281501e | Tue Apr 07 17:53:08 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
156
|
-
|
157
|
-
* Don't assign a directory to $0
|
158
|
-
|
159
|
-
[8a2ddc7 | Tue Apr 07 17:16:37 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
160
|
-
|
161
|
-
* Version 2009.04.08
|
162
|
-
|
163
1
|
[89ab244 | Tue Apr 07 16:17:07 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
164
2
|
|
165
3
|
* bring the retro_games example up to date
|
data/MANIFEST
CHANGED
@@ -4,10 +4,10 @@ MANIFEST
|
|
4
4
|
README.md
|
5
5
|
Rakefile
|
6
6
|
example/app/retro_games.rb
|
7
|
-
example/app/todo/layout/default.
|
7
|
+
example/app/todo/layout/default.erb
|
8
8
|
example/app/todo/spec/todo.rb
|
9
9
|
example/app/todo/start.rb
|
10
|
-
example/app/todo/view/index.
|
10
|
+
example/app/todo/view/index.erb
|
11
11
|
example/app/whywiki_erb/layout/wiki.html.erb
|
12
12
|
example/app/whywiki_erb/spec/wiki.rb
|
13
13
|
example/app/whywiki_erb/start.rb
|
@@ -30,6 +30,8 @@ lib/innate/cache/file_based.rb
|
|
30
30
|
lib/innate/cache/marshal.rb
|
31
31
|
lib/innate/cache/memory.rb
|
32
32
|
lib/innate/cache/yaml.rb
|
33
|
+
lib/innate/core_compatibility/basic_object.rb
|
34
|
+
lib/innate/core_compatibility/string.rb
|
33
35
|
lib/innate/current.rb
|
34
36
|
lib/innate/dynamap.rb
|
35
37
|
lib/innate/helper.rb
|
@@ -66,10 +68,8 @@ lib/innate/view.rb
|
|
66
68
|
lib/innate/view/erb.rb
|
67
69
|
lib/innate/view/etanni.rb
|
68
70
|
lib/innate/view/none.rb
|
69
|
-
spec/example/app/retro_games.rb
|
70
71
|
spec/example/hello.rb
|
71
72
|
spec/example/link.rb
|
72
|
-
spec/example/provides.rb
|
73
73
|
spec/example/session.rb
|
74
74
|
spec/helper.rb
|
75
75
|
spec/innate/action/layout.rb
|
@@ -124,4 +124,3 @@ tasks/manifest.rake
|
|
124
124
|
tasks/rcov.rake
|
125
125
|
tasks/release.rake
|
126
126
|
tasks/reversion.rake
|
127
|
-
tasks/setup.rake
|
data/README.md
CHANGED
@@ -67,7 +67,7 @@ encourages everybody to build on top of it whatever they want.
|
|
67
67
|
* No clutter in your application directory structure, scales from a single file
|
68
68
|
upwards
|
69
69
|
* Seamless integration with Rack middleware
|
70
|
-
* No patching of ruby core or stdlib.
|
70
|
+
* No patching[4] of ruby core or stdlib.
|
71
71
|
* Direct access to the current Request, Response, and Session from anywhere via
|
72
72
|
Trinity
|
73
73
|
* Works out of the box with ERB the templating engine.
|
@@ -77,6 +77,7 @@ encourages everybody to build on top of it whatever they want.
|
|
77
77
|
[1]: What you may think of as Controller.
|
78
78
|
[2]: This includes: Ruby 1.8, Ruby 1.9.1, JRuby, Rubinius
|
79
79
|
[3]: Fiber is available on 1.9 only at this point.
|
80
|
+
[4]: However, we add String#each if it isn't there to be compatible with Rack.
|
80
81
|
|
81
82
|
## Usage
|
82
83
|
|
@@ -448,6 +449,13 @@ authorization, etc.
|
|
448
449
|
|
449
450
|
Innate abandons the snippets, keeping your core clean.
|
450
451
|
|
452
|
+
Two things that we need are (currently) String#each, because Rack relies on it,
|
453
|
+
and BasicObject as superclass for the Option class. They are only applied on
|
454
|
+
demand.
|
455
|
+
|
456
|
+
These are in the directory called core_extensions, to make it very, very clear
|
457
|
+
what we are doing and how we are doing it.
|
458
|
+
|
451
459
|
Ramaze has still a lot of these snippets and will continue to, although I will
|
452
460
|
constantly strive to reduce them slowly.
|
453
461
|
|
data/Rakefile
CHANGED
@@ -4,7 +4,9 @@ require 'rake/gempackagetask'
|
|
4
4
|
require 'time'
|
5
5
|
require 'date'
|
6
6
|
|
7
|
-
|
7
|
+
specs = Dir['spec/{innate,example}/**/*.rb']
|
8
|
+
specs -= Dir['spec/innate/cache/common.rb']
|
9
|
+
PROJECT_SPECS = specs
|
8
10
|
PROJECT_MODULE = 'Innate'
|
9
11
|
PROJECT_README = 'README.md'
|
10
12
|
|
@@ -20,7 +22,6 @@ GEMSPEC = Gem::Specification.new{|s|
|
|
20
22
|
s.files = `git ls-files`.split("\n").sort
|
21
23
|
s.has_rdoc = true
|
22
24
|
s.require_path = 'lib'
|
23
|
-
s.rubyforge_project = "innate"
|
24
25
|
|
25
26
|
# s.add_runtime_dependency('rack', '>= 0.9.1') # lies!
|
26
27
|
# s.add_development_dependency('bacon', '>= 1.0')
|
data/innate.gemspec
CHANGED
@@ -2,24 +2,23 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{innate}
|
5
|
-
s.version = "2009.04"
|
5
|
+
s.version = "2009.04.08"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael 'manveru' Fellinger"]
|
9
|
-
s.date = %q{2009-04-
|
9
|
+
s.date = %q{2009-04-08}
|
10
10
|
s.description = %q{Simple, straight-forward base for web-frameworks.}
|
11
11
|
s.email = %q{m.fellinger@gmail.com}
|
12
|
-
s.files = ["CHANGELOG", "COPYING", "MANIFEST", "README.md", "Rakefile", "example/app/retro_games.rb", "example/app/todo/layout/default.
|
12
|
+
s.files = ["CHANGELOG", "COPYING", "MANIFEST", "README.md", "Rakefile", "example/app/retro_games.rb", "example/app/todo/layout/default.erb", "example/app/todo/spec/todo.rb", "example/app/todo/start.rb", "example/app/todo/view/index.erb", "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/core_compatibility/basic_object.rb", "lib/innate/core_compatibility/string.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/state.rb", "lib/innate/state/accessor.rb", "lib/innate/state/fiber.rb", "lib/innate/state/thread.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/hello.rb", "spec/example/link.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/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/foo.html.xhtml", "spec/innate/node/view/only_view.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/state/fiber.rb", "spec/innate/state/thread.rb", "spec/innate/traited.rb", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_installer.rake", "tasks/grancher.rake", "tasks/install_dependencies.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake"]
|
13
13
|
s.has_rdoc = true
|
14
14
|
s.homepage = %q{http://github.com/manveru/innate}
|
15
15
|
s.require_paths = ["lib"]
|
16
|
-
s.
|
17
|
-
s.rubygems_version = %q{1.3.2}
|
16
|
+
s.rubygems_version = %q{1.3.1}
|
18
17
|
s.summary = %q{Powerful web-framework wrapper for Rack.}
|
19
18
|
|
20
19
|
if s.respond_to? :specification_version then
|
21
20
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
-
s.specification_version =
|
21
|
+
s.specification_version = 2
|
23
22
|
|
24
23
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
24
|
else
|
data/lib/innate.rb
CHANGED
@@ -3,7 +3,11 @@
|
|
3
3
|
#
|
4
4
|
# Name-space of Innate, just about everything goes in here.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# Exceptions are:
|
7
|
+
#
|
8
|
+
# * Logger::ColorFormatter
|
9
|
+
# * In 1.8, we define ::BasicObject
|
10
|
+
# * In 1.9, we define ::String#each
|
7
11
|
#
|
8
12
|
module Innate
|
9
13
|
ROOT = File.expand_path(File.dirname(__FILE__))
|
@@ -26,6 +30,10 @@ module Innate
|
|
26
30
|
# 3rd party
|
27
31
|
require 'rack'
|
28
32
|
|
33
|
+
# innate's ruby core patches
|
34
|
+
require 'innate/core_compatibility/string'
|
35
|
+
require 'innate/core_compatibility/basic_object'
|
36
|
+
|
29
37
|
# innate core
|
30
38
|
require 'innate/version'
|
31
39
|
require 'innate/traited'
|
data/lib/innate/action.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Innate
|
2
|
-
ACTION_MEMBERS = [ :node, :
|
3
|
-
:
|
2
|
+
ACTION_MEMBERS = [ :node, :method, :params, :view, :layout, :instance, :exts,
|
3
|
+
:wish, :options, :variables, :value, :view_value, :engine ]
|
4
4
|
|
5
5
|
class Action < Struct.new(*ACTION_MEMBERS)
|
6
6
|
# Create a new Action instance.
|
@@ -32,7 +32,10 @@ module Innate
|
|
32
32
|
# @api stable
|
33
33
|
# @author manveru
|
34
34
|
def call
|
35
|
-
Current.actions
|
35
|
+
Current.actions << self
|
36
|
+
render
|
37
|
+
ensure
|
38
|
+
Current.actions.delete(self)
|
36
39
|
end
|
37
40
|
|
38
41
|
# @return [Binding] binding of the instance for this Action
|
@@ -98,11 +101,11 @@ module Innate
|
|
98
101
|
|
99
102
|
instance.wrap_action_call(self) do
|
100
103
|
copy_variables # this might need another position after all
|
101
|
-
self.
|
102
|
-
self.view_value =
|
104
|
+
self.value = instance.__send__(method, *params) if method
|
105
|
+
self.view_value = File.read(view) if view
|
103
106
|
|
104
107
|
body, content_type = wrap_in_layout{
|
105
|
-
engine.call(self, view_value ||
|
108
|
+
engine.call(self, view_value || value || '') }
|
106
109
|
options[:content_type] ||= content_type if content_type
|
107
110
|
body
|
108
111
|
end
|
@@ -125,26 +128,13 @@ module Innate
|
|
125
128
|
[:layout, :view].include?(name) ? [arg, nil] : [nil, arg]
|
126
129
|
end
|
127
130
|
|
128
|
-
def wrap_in_current
|
129
|
-
Current.actions << self
|
130
|
-
yield
|
131
|
-
ensure
|
132
|
-
Current.actions.delete(self)
|
133
|
-
end
|
134
|
-
|
135
131
|
# Try to figure out a sane name for current action.
|
136
132
|
def name
|
137
133
|
File.basename((method || view).to_s).split('.').first
|
138
134
|
end
|
139
135
|
|
140
|
-
# Path to this action, including params, with the mapping of the current
|
141
|
-
# controller prepended.
|
142
|
-
def full_path
|
143
|
-
File.join(node.mapping, path)
|
144
|
-
end
|
145
|
-
|
146
136
|
def valid?
|
147
|
-
|
137
|
+
method || view
|
148
138
|
end
|
149
139
|
end
|
150
140
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# We define BasicObject for compatibility with 1.9 if it isn't there yet.
|
2
|
+
class BasicObject
|
3
|
+
# Remove all but these methods
|
4
|
+
# NOTE: __id__ is not there in 1.9, but would give a warning in 1.8
|
5
|
+
KEEP = %w[== equal? ! != instance_eval instance_exec __send__ __id__]
|
6
|
+
|
7
|
+
(instance_methods - KEEP).each do |im|
|
8
|
+
undef_method(im)
|
9
|
+
end
|
10
|
+
end unless defined?(BasicObject)
|
data/lib/innate/dynamap.rb
CHANGED
data/lib/innate/helper.rb
CHANGED
@@ -152,10 +152,10 @@ module Innate
|
|
152
152
|
# helper :foo_bar # => FooBar
|
153
153
|
# helper :foo # => Foo
|
154
154
|
def get(name)
|
155
|
-
|
155
|
+
name = name.to_s.split('_').map{|e| e.capitalize}.join
|
156
156
|
|
157
157
|
options.namespaces.each do |namespace|
|
158
|
-
found = namespace.constants.grep(
|
158
|
+
found = namespace.constants.grep(/^#{name}$/i).first
|
159
159
|
return namespace.const_get(found) if found
|
160
160
|
end
|
161
161
|
|
data/lib/innate/helper/cgi.rb
CHANGED
data/lib/innate/helper/link.rb
CHANGED
@@ -28,12 +28,12 @@ module Innate
|
|
28
28
|
hashes, names = args.partition{|arg| arg.respond_to?(:merge!) }
|
29
29
|
hashes.each{|to_merge| hash.merge!(to_merge) }
|
30
30
|
|
31
|
-
escape = Rack::Utils.method(:escape)
|
32
31
|
location = route_location(self)
|
33
|
-
front = Array[location, name, *names
|
32
|
+
front = Array[location, name, *names].join('/').squeeze('/')
|
34
33
|
|
35
34
|
return URI(front) if hash.empty?
|
36
35
|
|
36
|
+
escape = Rack::Utils.method(:escape)
|
37
37
|
query = hash.map{|k, v| "#{escape[k]}=#{escape[v]}" }.join(';')
|
38
38
|
URI("#{front}?#{query}")
|
39
39
|
end
|
@@ -57,7 +57,7 @@ module Innate
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def raw_redirect(target, options = {}, &block)
|
60
|
-
header =
|
60
|
+
header = {'Location' => target.to_s}
|
61
61
|
status = options[:status] || 302
|
62
62
|
body = options[:body] || redirect_body(target)
|
63
63
|
|
data/lib/innate/helper/render.rb
CHANGED
@@ -38,21 +38,17 @@ module Innate
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# Renders an action without any layout.
|
41
|
-
# You can further tweak the action to be rendered by passing a block.
|
42
|
-
#
|
43
41
|
# @api external
|
44
42
|
# @see render_custom
|
45
43
|
# @author manveru
|
46
44
|
def render_partial(action_name, variables = {})
|
47
45
|
render_custom(action_name, variables) do |action|
|
48
46
|
action.layout = nil
|
49
|
-
yield(action) if block_given?
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
53
50
|
# Renders an action view, doesn't execute any methods and won't wrap it
|
54
51
|
# into a layout.
|
55
|
-
# You can further tweak the action to be rendered by passing a block.
|
56
52
|
#
|
57
53
|
# @api external
|
58
54
|
# @see render_custom
|
@@ -61,14 +57,11 @@ module Innate
|
|
61
57
|
render_custom(action_name, variables) do |action|
|
62
58
|
action.layout = nil
|
63
59
|
action.method = nil
|
64
|
-
yield(action) if block_given?
|
65
60
|
end
|
66
61
|
end
|
67
62
|
|
68
63
|
def render_custom(action_name, variables = {})
|
69
|
-
|
70
|
-
raise(ArgumentError, "No Action %p on #{self}" % action_name)
|
71
|
-
end
|
64
|
+
action = resolve(action_name.to_s)
|
72
65
|
|
73
66
|
action.sync_variables(self.action)
|
74
67
|
action.instance = action.node.new
|
@@ -3,20 +3,12 @@ module Innate
|
|
3
3
|
module SendFile
|
4
4
|
# Not optimally performing but convenient way to send files by their
|
5
5
|
# filename.
|
6
|
-
|
7
|
-
# I think we should remove this from the default helpers and move it into
|
8
|
-
# Ramaze, the functionality is almost never used, the naming is ambigous,
|
9
|
-
# and it doesn't use the send_file capabilities of frontend servers.
|
10
|
-
#
|
11
|
-
# So for now, I'll mark it for deprecation
|
12
|
-
def send_file(filename, content_type = nil, content_disposition = nil)
|
6
|
+
def send_file(filename, content_type = nil)
|
13
7
|
content_type ||= Rack::Mime.mime_type(::File.extname(filename))
|
14
|
-
content_disposition ||= File.basename(filename)
|
15
8
|
|
16
9
|
response.body = ::File.readlines(filename, 'rb')
|
17
10
|
response['Content-Length'] = ::File.size(filename).to_s
|
18
11
|
response['Content-Type'] = content_type
|
19
|
-
response['Content-Disposition'] = content_disposition
|
20
12
|
response.status = 200
|
21
13
|
|
22
14
|
throw(:respond, response)
|
data/lib/innate/node.rb
CHANGED
@@ -364,7 +364,7 @@ module Innate
|
|
364
364
|
def resolve(path)
|
365
365
|
name, wish, engine = find_provide(path)
|
366
366
|
node = (respond_to?(:ancestors) && respond_to?(:new)) ? self : self.class
|
367
|
-
action = Action.create(:node => node, :wish => wish, :engine => engine
|
367
|
+
action = Action.create(:node => node, :wish => wish, :engine => engine)
|
368
368
|
|
369
369
|
if content_type = node.ancestral_trait["#{wish}_content_type"]
|
370
370
|
action.options = {:content_type => content_type}
|
data/lib/innate/response.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
module Innate
|
2
|
+
|
3
|
+
# In order to reset the body contents we also need to reset the length set by
|
4
|
+
# Response#write - until I can submit a patch to Rack and the next release we
|
5
|
+
# just do this.
|
6
|
+
|
2
7
|
class Response < Rack::Response
|
3
8
|
include Optioned
|
4
9
|
|
@@ -7,6 +12,8 @@ module Innate
|
|
7
12
|
:headers, {'Content-Type' => 'text/html'}
|
8
13
|
end
|
9
14
|
|
15
|
+
attr_accessor :length
|
16
|
+
|
10
17
|
def reset
|
11
18
|
self.status = 200
|
12
19
|
self.header.delete('Content-Type')
|
data/lib/innate/version.rb
CHANGED
data/spec/innate/helper/link.rb
CHANGED
@@ -56,14 +56,6 @@ describe Innate::Helper::Link do
|
|
56
56
|
Two.route(:foo, :bar).should == URI('/two/foo/bar')
|
57
57
|
end
|
58
58
|
|
59
|
-
should 'respond with URI for node with path /foo/bar+baz' do
|
60
|
-
One.route('/foo/bar+baz').should == URI('/foo/bar+baz')
|
61
|
-
One.route(:foo, 'bar baz').should == URI('/foo/bar+baz')
|
62
|
-
|
63
|
-
Two.route('/foo/bar+baz').should == URI('/two/foo/bar+baz')
|
64
|
-
Two.route(:foo, 'bar baz').should == URI('/two/foo/bar+baz')
|
65
|
-
end
|
66
|
-
|
67
59
|
should 'respond with URI for node with GET params' do
|
68
60
|
One.route('/', :a => :b).should == URI('/?a=b')
|
69
61
|
|
data/tasks/release.rake
CHANGED
@@ -1,51 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
desc 'publish to github'
|
2
|
+
task :release => [:reversion, :gemspec] do
|
3
|
+
name, version = GEMSPEC.name, GEMSPEC.version
|
3
4
|
|
4
|
-
|
5
|
-
task :github => [:reversion, :gemspec] do
|
6
|
-
name, version = GEMSPEC.name, GEMSPEC.version
|
5
|
+
sh("git add MANIFEST CHANGELOG #{name}.gemspec lib/#{name}/version.rb")
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
git
|
12
|
-
|
13
|
-
Then commit them, tag the commit, and push:
|
14
|
-
|
15
|
-
git commit -m 'Version #{version}'
|
16
|
-
git tag -a -m '#{version}' '#{version}'
|
17
|
-
git push
|
18
|
-
|
19
|
-
INSTRUCTIONS
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
# TODO: Not tested
|
24
|
-
desc 'Display instructions to release on rubyforge'
|
25
|
-
task :rubyforge => [:reversion, :gemspec, :package] do
|
26
|
-
name, version = GEMSPEC.name, GEMSPEC.version
|
27
|
-
|
28
|
-
puts <<INSTRUCTIONS
|
29
|
-
To publish to rubyforge do following:
|
30
|
-
|
31
|
-
rubyforge login
|
32
|
-
rubyforge add_release #{name} '#{version}' pkg/#{name}-#{version}.gem
|
33
|
-
|
34
|
-
After you have done these steps, see:
|
35
|
-
|
36
|
-
rake release:rubyforge_archives
|
37
|
-
|
38
|
-
INSTRUCTIONS
|
39
|
-
end
|
40
|
-
|
41
|
-
desc 'Display instructions to add archives after release:rubyforge'
|
42
|
-
task :rubyforge_archives do
|
43
|
-
puts "Adding archives for distro packagers is:", ""
|
44
|
-
|
45
|
-
Dir["pkg/#{name}-#{version}.{gz,zip}"].each do |file|
|
46
|
-
puts "rubyforge add_file #{name} #{name} '#{version}' '#{file}'"
|
47
|
-
end
|
48
|
-
|
49
|
-
puts
|
50
|
-
end
|
7
|
+
puts "I added the relevant files, you can now run:", ''
|
8
|
+
puts "git commit -m 'Version #{version}'"
|
9
|
+
puts "git tag -a -m '#{version}' '#{version}'"
|
10
|
+
puts "git push"
|
11
|
+
puts
|
51
12
|
end
|
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: 2009.04.12
|
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: 2009-04-
|
12
|
+
date: 2009-04-12 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -54,6 +54,8 @@ files:
|
|
54
54
|
- lib/innate/cache/marshal.rb
|
55
55
|
- lib/innate/cache/memory.rb
|
56
56
|
- lib/innate/cache/yaml.rb
|
57
|
+
- lib/innate/core_compatibility/basic_object.rb
|
58
|
+
- lib/innate/core_compatibility/string.rb
|
57
59
|
- lib/innate/current.rb
|
58
60
|
- lib/innate/dynamap.rb
|
59
61
|
- lib/innate/helper.rb
|
@@ -151,8 +153,6 @@ files:
|
|
151
153
|
- tasks/setup.rake
|
152
154
|
has_rdoc: true
|
153
155
|
homepage: http://github.com/manveru/innate
|
154
|
-
licenses: []
|
155
|
-
|
156
156
|
post_install_message:
|
157
157
|
rdoc_options: []
|
158
158
|
|
@@ -172,10 +172,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version:
|
173
173
|
requirements: []
|
174
174
|
|
175
|
-
rubyforge_project:
|
176
|
-
rubygems_version: 1.3.
|
175
|
+
rubyforge_project:
|
176
|
+
rubygems_version: 1.3.1
|
177
177
|
signing_key:
|
178
|
-
specification_version:
|
178
|
+
specification_version: 2
|
179
179
|
summary: Powerful web-framework wrapper for Rack.
|
180
180
|
test_files: []
|
181
181
|
|