manveru-innate 2009.04 → 2009.04.01
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +0 -258
- data/MANIFEST +22 -23
- data/README.md +9 -1
- data/Rakefile +6 -6
- data/example/app/retro_games.rb +8 -8
- data/example/app/todo/layout/{default.xhtml → default.erb} +1 -1
- data/example/app/todo/view/{index.xhtml → index.erb} +11 -11
- data/example/app/whywiki_erb/start.rb +1 -2
- data/example/app/whywiki_erb/view/{edit.erb → edit.html.erb} +0 -0
- data/example/app/whywiki_erb/view/{index.erb → index.html.erb} +0 -0
- data/example/howto_spec.rb +1 -1
- data/example/provides.rb +6 -9
- data/example/session.rb +3 -3
- data/innate.gemspec +14 -6
- data/lib/innate.rb +18 -12
- data/lib/innate/action.rb +11 -22
- data/lib/innate/cache/file_based.rb +0 -2
- 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 +29 -20
- data/lib/innate/helper/cgi.rb +19 -32
- data/lib/innate/helper/link.rb +2 -2
- data/lib/innate/helper/partial.rb +93 -0
- data/lib/innate/helper/redirect.rb +1 -1
- data/lib/innate/helper/send_file.rb +1 -9
- data/lib/innate/mock.rb +3 -2
- data/lib/innate/node.rb +51 -78
- data/lib/innate/options.rb +1 -1
- data/lib/innate/request.rb +23 -3
- data/lib/innate/response.rb +7 -0
- data/lib/innate/session.rb +2 -1
- data/lib/innate/spec.rb +50 -6
- data/lib/innate/version.rb +1 -1
- data/lib/innate/view/erb.rb +1 -1
- data/lib/innate/view/etanni.rb +2 -2
- data/lib/innate/view/none.rb +1 -1
- data/spec/example/session.rb +14 -8
- data/spec/innate/action/layout.rb +1 -1
- data/spec/innate/action/layout/file_layout.erb +1 -0
- data/spec/innate/helper/aspect.rb +6 -6
- data/spec/innate/helper/flash.rb +47 -28
- data/spec/innate/helper/link.rb +0 -8
- data/spec/innate/helper/partial.rb +101 -0
- data/spec/innate/helper/redirect.rb +43 -58
- 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/node/node.rb +13 -5
- data/spec/innate/node/view/another_layout/{another_layout.xhtml → another_layout.erb} +1 -1
- data/spec/innate/node/view/{bar.xhtml → bar.erb} +0 -0
- data/spec/innate/node/view/foo.html.erb +1 -0
- data/spec/innate/node/view/{only_view.xhtml → only_view.erb} +0 -0
- data/spec/innate/node/view/with_layout.erb +1 -0
- data/spec/innate/provides.rb +2 -2
- data/spec/innate/provides/list.html.erb +1 -0
- data/spec/innate/provides/list.txt.erb +1 -0
- data/spec/innate/session.rb +15 -14
- data/spec/innate/state/fiber.rb +7 -8
- data/tasks/bacon.rake +21 -38
- data/tasks/install_dependencies.rake +4 -2
- data/tasks/release.rake +9 -48
- metadata +57 -29
- data/lib/innate/helper/render.rb +0 -87
- data/spec/example/app/retro_games.rb +0 -30
- data/spec/example/provides.rb +0 -16
- data/spec/innate/action/layout/file_layout.xhtml +0 -1
- data/spec/innate/helper/render.rb +0 -133
- data/spec/innate/helper/view/aspect_hello.xhtml +0 -1
- data/spec/innate/helper/view/locals.xhtml +0 -1
- data/spec/innate/helper/view/loop.xhtml +0 -4
- data/spec/innate/helper/view/num.xhtml +0 -1
- data/spec/innate/helper/view/partial.xhtml +0 -1
- data/spec/innate/helper/view/recursive.xhtml +0 -7
- data/spec/innate/node/view/foo.html.xhtml +0 -1
- data/spec/innate/node/view/with_layout.xhtml +0 -1
- data/spec/innate/provides/list.html.xhtml +0 -1
- data/spec/innate/provides/list.txt.xhtml +0 -1
- data/tasks/setup.rake +0 -28
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manveru-innate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2009.04.01
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael 'manveru' Fellinger
|
@@ -9,10 +9,39 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rack
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.1
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bacon
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "1.0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: json
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.1.3
|
44
|
+
version:
|
16
45
|
description: Simple, straight-forward base for web-frameworks.
|
17
46
|
email: m.fellinger@gmail.com
|
18
47
|
executables: []
|
@@ -28,15 +57,15 @@ files:
|
|
28
57
|
- README.md
|
29
58
|
- Rakefile
|
30
59
|
- example/app/retro_games.rb
|
31
|
-
- example/app/todo/layout/default.
|
60
|
+
- example/app/todo/layout/default.erb
|
32
61
|
- example/app/todo/spec/todo.rb
|
33
62
|
- example/app/todo/start.rb
|
34
|
-
- example/app/todo/view/index.
|
63
|
+
- example/app/todo/view/index.erb
|
35
64
|
- example/app/whywiki_erb/layout/wiki.html.erb
|
36
65
|
- example/app/whywiki_erb/spec/wiki.rb
|
37
66
|
- example/app/whywiki_erb/start.rb
|
38
|
-
- example/app/whywiki_erb/view/edit.erb
|
39
|
-
- example/app/whywiki_erb/view/index.erb
|
67
|
+
- example/app/whywiki_erb/view/edit.html.erb
|
68
|
+
- example/app/whywiki_erb/view/index.html.erb
|
40
69
|
- example/custom_middleware.rb
|
41
70
|
- example/hello.rb
|
42
71
|
- example/howto_spec.rb
|
@@ -54,6 +83,8 @@ files:
|
|
54
83
|
- lib/innate/cache/marshal.rb
|
55
84
|
- lib/innate/cache/memory.rb
|
56
85
|
- lib/innate/cache/yaml.rb
|
86
|
+
- lib/innate/core_compatibility/basic_object.rb
|
87
|
+
- lib/innate/core_compatibility/string.rb
|
57
88
|
- lib/innate/current.rb
|
58
89
|
- lib/innate/dynamap.rb
|
59
90
|
- lib/innate/helper.rb
|
@@ -61,8 +92,8 @@ files:
|
|
61
92
|
- lib/innate/helper/cgi.rb
|
62
93
|
- lib/innate/helper/flash.rb
|
63
94
|
- lib/innate/helper/link.rb
|
95
|
+
- lib/innate/helper/partial.rb
|
64
96
|
- lib/innate/helper/redirect.rb
|
65
|
-
- lib/innate/helper/render.rb
|
66
97
|
- lib/innate/helper/send_file.rb
|
67
98
|
- lib/innate/log.rb
|
68
99
|
- lib/innate/log/color_formatter.rb
|
@@ -90,14 +121,12 @@ files:
|
|
90
121
|
- lib/innate/view/erb.rb
|
91
122
|
- lib/innate/view/etanni.rb
|
92
123
|
- lib/innate/view/none.rb
|
93
|
-
- spec/example/app/retro_games.rb
|
94
124
|
- spec/example/hello.rb
|
95
125
|
- spec/example/link.rb
|
96
|
-
- spec/example/provides.rb
|
97
126
|
- spec/example/session.rb
|
98
127
|
- spec/helper.rb
|
99
128
|
- spec/innate/action/layout.rb
|
100
|
-
- spec/innate/action/layout/file_layout.
|
129
|
+
- spec/innate/action/layout/file_layout.erb
|
101
130
|
- spec/innate/cache/common.rb
|
102
131
|
- spec/innate/cache/marshal.rb
|
103
132
|
- spec/innate/cache/memory.rb
|
@@ -108,30 +137,30 @@ files:
|
|
108
137
|
- spec/innate/helper/cgi.rb
|
109
138
|
- spec/innate/helper/flash.rb
|
110
139
|
- spec/innate/helper/link.rb
|
140
|
+
- spec/innate/helper/partial.rb
|
111
141
|
- spec/innate/helper/redirect.rb
|
112
|
-
- spec/innate/helper/render.rb
|
113
142
|
- spec/innate/helper/send_file.rb
|
114
|
-
- spec/innate/helper/view/aspect_hello.
|
115
|
-
- spec/innate/helper/view/locals.
|
116
|
-
- spec/innate/helper/view/loop.
|
117
|
-
- spec/innate/helper/view/num.
|
118
|
-
- spec/innate/helper/view/partial.
|
119
|
-
- spec/innate/helper/view/recursive.
|
143
|
+
- spec/innate/helper/view/aspect_hello.erb
|
144
|
+
- spec/innate/helper/view/locals.erb
|
145
|
+
- spec/innate/helper/view/loop.erb
|
146
|
+
- spec/innate/helper/view/num.erb
|
147
|
+
- spec/innate/helper/view/partial.erb
|
148
|
+
- spec/innate/helper/view/recursive.erb
|
120
149
|
- spec/innate/mock.rb
|
121
150
|
- spec/innate/node/mapping.rb
|
122
151
|
- spec/innate/node/node.rb
|
123
152
|
- spec/innate/node/resolve.rb
|
124
|
-
- spec/innate/node/view/another_layout/another_layout.
|
125
|
-
- spec/innate/node/view/bar.
|
126
|
-
- spec/innate/node/view/foo.html.
|
127
|
-
- spec/innate/node/view/only_view.
|
128
|
-
- spec/innate/node/view/with_layout.
|
153
|
+
- spec/innate/node/view/another_layout/another_layout.erb
|
154
|
+
- spec/innate/node/view/bar.erb
|
155
|
+
- spec/innate/node/view/foo.html.erb
|
156
|
+
- spec/innate/node/view/only_view.erb
|
157
|
+
- spec/innate/node/view/with_layout.erb
|
129
158
|
- spec/innate/node/wrap_action_call.rb
|
130
159
|
- spec/innate/options.rb
|
131
160
|
- spec/innate/parameter.rb
|
132
161
|
- spec/innate/provides.rb
|
133
|
-
- spec/innate/provides/list.html.
|
134
|
-
- spec/innate/provides/list.txt.
|
162
|
+
- spec/innate/provides/list.html.erb
|
163
|
+
- spec/innate/provides/list.txt.erb
|
135
164
|
- spec/innate/request.rb
|
136
165
|
- spec/innate/route.rb
|
137
166
|
- spec/innate/session.rb
|
@@ -148,7 +177,6 @@ files:
|
|
148
177
|
- tasks/rcov.rake
|
149
178
|
- tasks/release.rake
|
150
179
|
- tasks/reversion.rake
|
151
|
-
- tasks/setup.rake
|
152
180
|
has_rdoc: true
|
153
181
|
homepage: http://github.com/manveru/innate
|
154
182
|
post_install_message:
|
@@ -170,10 +198,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
198
|
version:
|
171
199
|
requirements: []
|
172
200
|
|
173
|
-
rubyforge_project:
|
201
|
+
rubyforge_project:
|
174
202
|
rubygems_version: 1.2.0
|
175
203
|
signing_key:
|
176
|
-
specification_version:
|
204
|
+
specification_version: 2
|
177
205
|
summary: Powerful web-framework wrapper for Rack.
|
178
206
|
test_files: []
|
179
207
|
|
data/lib/innate/helper/render.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
module Innate
|
2
|
-
module Helper
|
3
|
-
module Render
|
4
|
-
# Enables you to simply call:
|
5
|
-
#
|
6
|
-
# @example of added functionality
|
7
|
-
# YourController.render_partial(:foo, :x => 42)
|
8
|
-
#
|
9
|
-
def self.included(into)
|
10
|
-
into.extend(self)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Renders the full action in the way a real request would.
|
14
|
-
#
|
15
|
-
# Please be aware that, if this is the first request from a client, you
|
16
|
-
# will not have access to the session in the action being rendered, as no
|
17
|
-
# actual session has been put into place yet.
|
18
|
-
#
|
19
|
-
# It should work as expected on any subsequent requests.
|
20
|
-
#
|
21
|
-
# As usual, patches welcome.
|
22
|
-
#
|
23
|
-
# @api external
|
24
|
-
# @see Mock.session
|
25
|
-
# @author manveru
|
26
|
-
def render_full(path, query = {})
|
27
|
-
uri = URI(path.to_s)
|
28
|
-
uri.query = Rack::Utils.build_query(query)
|
29
|
-
|
30
|
-
if cookie = request.env['HTTP_COOKIE']
|
31
|
-
Mock.session do |mock|
|
32
|
-
mock.cookie = cookie
|
33
|
-
return mock.get(uri.to_s).body
|
34
|
-
end
|
35
|
-
else
|
36
|
-
Mock.get(uri.to_s).body
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# Renders an action without any layout.
|
41
|
-
# You can further tweak the action to be rendered by passing a block.
|
42
|
-
#
|
43
|
-
# @api external
|
44
|
-
# @see render_custom
|
45
|
-
# @author manveru
|
46
|
-
def render_partial(action_name, variables = {})
|
47
|
-
render_custom(action_name, variables) do |action|
|
48
|
-
action.layout = nil
|
49
|
-
yield(action) if block_given?
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# Renders an action view, doesn't execute any methods and won't wrap it
|
54
|
-
# into a layout.
|
55
|
-
# You can further tweak the action to be rendered by passing a block.
|
56
|
-
#
|
57
|
-
# @api external
|
58
|
-
# @see render_custom
|
59
|
-
# @author manveru
|
60
|
-
def render_view(action_name, variables = {})
|
61
|
-
render_custom(action_name, variables) do |action|
|
62
|
-
action.layout = nil
|
63
|
-
action.method = nil
|
64
|
-
yield(action) if block_given?
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def render_custom(action_name, variables = {})
|
69
|
-
unless action = resolve(action_name.to_s)
|
70
|
-
raise(ArgumentError, "No Action %p on #{self}" % action_name)
|
71
|
-
end
|
72
|
-
|
73
|
-
action.sync_variables(self.action)
|
74
|
-
action.instance = action.node.new
|
75
|
-
action.variables = action.variables.merge(variables)
|
76
|
-
|
77
|
-
yield(action) if block_given?
|
78
|
-
|
79
|
-
if action.valid?
|
80
|
-
action.render
|
81
|
-
else
|
82
|
-
Log.warn("Invalid action: %p" % action)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec/helper'
|
2
|
-
require 'example/app/retro_games'
|
3
|
-
|
4
|
-
describe 'Retro-games app' do
|
5
|
-
behaves_like :mock
|
6
|
-
|
7
|
-
it 'lists the first game' do
|
8
|
-
get '/'
|
9
|
-
last_response.should =~ /1 => Pacman/
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'has a form to add another game' do
|
13
|
-
get '/'
|
14
|
-
last_response.should =~ /<form/
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'allows you to add another game' do
|
18
|
-
post '/create', :name => 'Street Fighter II'
|
19
|
-
follow_redirect!
|
20
|
-
last_response.should =~ /0 => Street Fighter II/
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'allows you to vote for a game' do
|
24
|
-
get '/vote/Street+Fighter+II'
|
25
|
-
follow_redirect!
|
26
|
-
last_response.should =~ /1 => Street Fighter II/
|
27
|
-
end
|
28
|
-
|
29
|
-
FileUtils.rm_f('games.yaml')
|
30
|
-
end
|
data/spec/example/provides.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec/helper'
|
2
|
-
require 'example/provides'
|
3
|
-
|
4
|
-
describe 'examples/provide' do
|
5
|
-
behaves_like :mock
|
6
|
-
|
7
|
-
it 'provides YAML representation' do
|
8
|
-
get '/list.yaml'
|
9
|
-
last_response.body.should == ARTICLES.to_yaml
|
10
|
-
last_response['Content-Type'].should == 'text/yaml'
|
11
|
-
|
12
|
-
get '/list'
|
13
|
-
last_response.body.should == ''
|
14
|
-
last_response['Content-Type'].should == 'text/html'
|
15
|
-
end
|
16
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<p>#{ @content }</p>
|
@@ -1,133 +0,0 @@
|
|
1
|
-
require 'spec/helper'
|
2
|
-
|
3
|
-
class SpecHelperRenderFull
|
4
|
-
Innate.node '/render_full'
|
5
|
-
|
6
|
-
def foo
|
7
|
-
"foo: %p" % [request.params.sort]
|
8
|
-
end
|
9
|
-
|
10
|
-
def standard
|
11
|
-
render_full(r(:foo))
|
12
|
-
end
|
13
|
-
|
14
|
-
def with_query
|
15
|
-
render_full(r(:foo), 'a' => 'b')
|
16
|
-
end
|
17
|
-
|
18
|
-
def with_session
|
19
|
-
render_full(r(:get_session, :user))
|
20
|
-
end
|
21
|
-
|
22
|
-
def get_session(key)
|
23
|
-
session[key].inspect
|
24
|
-
end
|
25
|
-
|
26
|
-
def set_session(key, value)
|
27
|
-
session[key] = value
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class SpecHelperRenderPartial
|
32
|
-
Innate.node '/render_partial'
|
33
|
-
|
34
|
-
layout :layout
|
35
|
-
|
36
|
-
def standard
|
37
|
-
'hello'
|
38
|
-
end
|
39
|
-
|
40
|
-
def layout
|
41
|
-
'{ #{@content} }'
|
42
|
-
end
|
43
|
-
|
44
|
-
def without_layout
|
45
|
-
render_partial(:standard)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class SpecHelperRenderView
|
50
|
-
Innate.node '/render_view'
|
51
|
-
map_views '/'
|
52
|
-
|
53
|
-
layout :layout
|
54
|
-
|
55
|
-
def standard
|
56
|
-
'hello'
|
57
|
-
end
|
58
|
-
|
59
|
-
def layout
|
60
|
-
'{ #{@content} }'
|
61
|
-
end
|
62
|
-
|
63
|
-
def without_method_or_layout
|
64
|
-
render_view(:num, :n => 42)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
class SpecHelperRenderMisc
|
69
|
-
Innate.node '/misc'
|
70
|
-
map_views '/'
|
71
|
-
|
72
|
-
def recursive
|
73
|
-
@n ||= 1
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe Innate::Helper::Render do
|
78
|
-
describe '#render_full' do
|
79
|
-
behaves_like :mock
|
80
|
-
|
81
|
-
it 'renders a full action' do
|
82
|
-
get('/render_full/standard').body.should == 'foo: []'
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'renders full action with query parameters' do
|
86
|
-
get('/render_full/with_query').body.should == 'foo: [["a", "b"]]'
|
87
|
-
end
|
88
|
-
|
89
|
-
# this is an edge-case, we don't have a full session running if this is the
|
90
|
-
# first request from the client as Innate creates sessions only on demand
|
91
|
-
# at the end of the request/response cycle.
|
92
|
-
#
|
93
|
-
# So we have to make some request first, in this case we simply set some
|
94
|
-
# value in the session that we can get afterwards.
|
95
|
-
|
96
|
-
it 'renders full action inside a session' do
|
97
|
-
get('/render_full/set_session/user/manveru')
|
98
|
-
get('/render_full/with_session').body.should == '"manveru"'
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe '#render_partial' do
|
103
|
-
behaves_like :mock
|
104
|
-
|
105
|
-
it 'renders action with layout' do
|
106
|
-
get('/render_partial/standard').body.should == '{ hello }'
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'renders partial action without layout' do
|
110
|
-
get('/render_partial/without_layout').body.should == '{ hello }'
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe '#render_view' do
|
115
|
-
behaves_like :mock
|
116
|
-
|
117
|
-
it 'renders action without calling the method or applying layout' do
|
118
|
-
get('/render_view/without_method_or_layout').body.should == '{ 42 }'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe 'misc functionality' do
|
123
|
-
behaves_like :mock
|
124
|
-
|
125
|
-
it 'can render_partial in a loop' do
|
126
|
-
get('/misc/loop').body.scan(/\d+/).should == %w[1 2 3 4 5]
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'can recursively render_partial' do
|
130
|
-
get('/misc/recursive').body.scan(/\S/).join.should == '{1{2{3{44}3}2}1}'
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
#{@foo} #{@bar}!
|
@@ -1 +0,0 @@
|
|
1
|
-
#{say}, #{to}!
|