manveru-innate 2009.03.24 → 2009.04
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +354 -0
- data/MANIFEST +34 -22
- data/README.md +2 -10
- data/Rakefile +30 -247
- data/example/app/retro_games.rb +8 -8
- data/example/app/todo/layout/{default.erb → default.xhtml} +1 -1
- data/example/app/todo/view/{index.erb → index.xhtml} +11 -11
- data/example/app/whywiki_erb/start.rb +2 -1
- data/example/app/whywiki_erb/view/{edit.html.erb → edit.erb} +0 -0
- data/example/app/whywiki_erb/view/{index.html.erb → index.erb} +0 -0
- data/example/howto_spec.rb +1 -1
- data/example/provides.rb +9 -6
- data/example/session.rb +3 -3
- data/innate.gemspec +23 -127
- data/lib/innate/action.rb +24 -13
- data/lib/innate/adapter.rb +5 -27
- data/lib/innate/cache/file_based.rb +2 -0
- data/lib/innate/cache.rb +1 -1
- data/lib/innate/current.rb +5 -5
- data/lib/innate/dynamap.rb +5 -0
- data/lib/innate/helper/cgi.rb +32 -19
- data/lib/innate/helper/link.rb +2 -2
- data/lib/innate/helper/redirect.rb +1 -1
- data/lib/innate/helper/render.rb +87 -0
- data/lib/innate/helper/send_file.rb +9 -1
- data/lib/innate/helper.rb +20 -29
- data/lib/innate/log/hub.rb +1 -1
- data/lib/innate/middleware_compiler.rb +1 -15
- data/lib/innate/mock.rb +2 -3
- data/lib/innate/node.rb +85 -55
- data/lib/innate/options/dsl.rb +1 -1
- data/lib/innate/options.rb +1 -1
- data/lib/innate/request.rb +3 -76
- data/lib/innate/response.rb +1 -8
- data/lib/innate/session.rb +2 -3
- data/lib/innate/spec.rb +6 -50
- data/lib/innate/version.rb +1 -1
- data/lib/innate/view/erb.rb +1 -5
- data/lib/innate/view/etanni.rb +36 -0
- data/lib/innate/view/none.rb +1 -1
- data/lib/innate/view.rb +14 -16
- data/lib/innate.rb +27 -53
- data/spec/example/app/retro_games.rb +30 -0
- data/spec/example/provides.rb +16 -0
- data/spec/example/session.rb +8 -14
- data/spec/innate/action/layout/file_layout.xhtml +1 -0
- data/spec/innate/action/layout.rb +1 -1
- data/spec/innate/helper/aspect.rb +6 -6
- data/spec/innate/helper/flash.rb +28 -47
- data/spec/innate/helper/link.rb +8 -0
- data/spec/innate/helper/redirect.rb +58 -43
- data/spec/innate/helper/render.rb +133 -0
- data/spec/innate/helper/view/aspect_hello.xhtml +1 -0
- data/spec/innate/helper/view/locals.xhtml +1 -0
- data/spec/innate/helper/view/loop.xhtml +4 -0
- data/spec/innate/helper/view/num.xhtml +1 -0
- data/spec/innate/helper/view/partial.xhtml +1 -0
- data/spec/innate/helper/view/recursive.xhtml +7 -0
- data/spec/innate/node/node.rb +5 -13
- data/spec/innate/node/view/another_layout/{another_layout.erb → another_layout.xhtml} +1 -1
- data/spec/innate/node/view/{bar.erb → bar.xhtml} +0 -0
- data/spec/innate/node/view/foo.html.xhtml +1 -0
- data/spec/innate/node/view/{only_view.erb → only_view.xhtml} +0 -0
- data/spec/innate/node/view/with_layout.xhtml +1 -0
- data/spec/innate/provides/list.html.xhtml +1 -0
- data/spec/innate/provides/list.txt.xhtml +1 -0
- data/spec/innate/provides.rb +2 -2
- data/spec/innate/request.rb +0 -9
- data/spec/innate/session.rb +14 -15
- data/spec/innate/state/fiber.rb +8 -7
- data/tasks/bacon.rake +66 -0
- data/tasks/changelog.rake +18 -0
- data/tasks/gem.rake +22 -0
- data/tasks/gem_installer.rake +76 -0
- data/tasks/grancher.rake +12 -0
- data/tasks/install_dependencies.rake +4 -0
- data/tasks/manifest.rake +4 -0
- data/tasks/rcov.rake +19 -0
- data/tasks/release.rake +51 -0
- data/tasks/reversion.rake +8 -0
- data/tasks/setup.rake +28 -0
- metadata +41 -38
- data/lib/innate/core_compatibility/basic_object.rb +0 -10
- data/lib/innate/core_compatibility/string.rb +0 -3
- data/lib/innate/helper/partial.rb +0 -93
- data/spec/innate/action/layout/file_layout.erb +0 -1
- data/spec/innate/helper/partial.rb +0 -101
- data/spec/innate/helper/view/aspect_hello.erb +0 -1
- data/spec/innate/helper/view/locals.erb +0 -1
- data/spec/innate/helper/view/loop.erb +0 -4
- data/spec/innate/helper/view/num.erb +0 -1
- data/spec/innate/helper/view/partial.erb +0 -1
- data/spec/innate/helper/view/recursive.erb +0 -8
- data/spec/innate/node/view/foo.html.erb +0 -1
- data/spec/innate/node/view/with_layout.erb +0 -1
- data/spec/innate/provides/list.html.erb +0 -1
- data/spec/innate/provides/list.txt.erb +0 -1
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: 2009.
|
4
|
+
version: "2009.04"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael 'manveru' Fellinger
|
@@ -9,20 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
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
|
-
description: Simple, straight-forward, base for web-frameworks.
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Simple, straight-forward base for web-frameworks.
|
26
17
|
email: m.fellinger@gmail.com
|
27
18
|
executables: []
|
28
19
|
|
@@ -37,15 +28,15 @@ files:
|
|
37
28
|
- README.md
|
38
29
|
- Rakefile
|
39
30
|
- example/app/retro_games.rb
|
40
|
-
- example/app/todo/layout/default.
|
31
|
+
- example/app/todo/layout/default.xhtml
|
41
32
|
- example/app/todo/spec/todo.rb
|
42
33
|
- example/app/todo/start.rb
|
43
|
-
- example/app/todo/view/index.
|
34
|
+
- example/app/todo/view/index.xhtml
|
44
35
|
- example/app/whywiki_erb/layout/wiki.html.erb
|
45
36
|
- example/app/whywiki_erb/spec/wiki.rb
|
46
37
|
- example/app/whywiki_erb/start.rb
|
47
|
-
- example/app/whywiki_erb/view/edit.
|
48
|
-
- example/app/whywiki_erb/view/index.
|
38
|
+
- example/app/whywiki_erb/view/edit.erb
|
39
|
+
- example/app/whywiki_erb/view/index.erb
|
49
40
|
- example/custom_middleware.rb
|
50
41
|
- example/hello.rb
|
51
42
|
- example/howto_spec.rb
|
@@ -63,8 +54,6 @@ files:
|
|
63
54
|
- lib/innate/cache/marshal.rb
|
64
55
|
- lib/innate/cache/memory.rb
|
65
56
|
- lib/innate/cache/yaml.rb
|
66
|
-
- lib/innate/core_compatibility/basic_object.rb
|
67
|
-
- lib/innate/core_compatibility/string.rb
|
68
57
|
- lib/innate/current.rb
|
69
58
|
- lib/innate/dynamap.rb
|
70
59
|
- lib/innate/helper.rb
|
@@ -72,8 +61,8 @@ files:
|
|
72
61
|
- lib/innate/helper/cgi.rb
|
73
62
|
- lib/innate/helper/flash.rb
|
74
63
|
- lib/innate/helper/link.rb
|
75
|
-
- lib/innate/helper/partial.rb
|
76
64
|
- lib/innate/helper/redirect.rb
|
65
|
+
- lib/innate/helper/render.rb
|
77
66
|
- lib/innate/helper/send_file.rb
|
78
67
|
- lib/innate/log.rb
|
79
68
|
- lib/innate/log/color_formatter.rb
|
@@ -99,13 +88,16 @@ files:
|
|
99
88
|
- lib/innate/version.rb
|
100
89
|
- lib/innate/view.rb
|
101
90
|
- lib/innate/view/erb.rb
|
91
|
+
- lib/innate/view/etanni.rb
|
102
92
|
- lib/innate/view/none.rb
|
93
|
+
- spec/example/app/retro_games.rb
|
103
94
|
- spec/example/hello.rb
|
104
95
|
- spec/example/link.rb
|
96
|
+
- spec/example/provides.rb
|
105
97
|
- spec/example/session.rb
|
106
98
|
- spec/helper.rb
|
107
99
|
- spec/innate/action/layout.rb
|
108
|
-
- spec/innate/action/layout/file_layout.
|
100
|
+
- spec/innate/action/layout/file_layout.xhtml
|
109
101
|
- spec/innate/cache/common.rb
|
110
102
|
- spec/innate/cache/marshal.rb
|
111
103
|
- spec/innate/cache/memory.rb
|
@@ -116,36 +108,47 @@ files:
|
|
116
108
|
- spec/innate/helper/cgi.rb
|
117
109
|
- spec/innate/helper/flash.rb
|
118
110
|
- spec/innate/helper/link.rb
|
119
|
-
- spec/innate/helper/partial.rb
|
120
111
|
- spec/innate/helper/redirect.rb
|
112
|
+
- spec/innate/helper/render.rb
|
121
113
|
- spec/innate/helper/send_file.rb
|
122
|
-
- spec/innate/helper/view/aspect_hello.
|
123
|
-
- spec/innate/helper/view/locals.
|
124
|
-
- spec/innate/helper/view/loop.
|
125
|
-
- spec/innate/helper/view/num.
|
126
|
-
- spec/innate/helper/view/partial.
|
127
|
-
- spec/innate/helper/view/recursive.
|
114
|
+
- spec/innate/helper/view/aspect_hello.xhtml
|
115
|
+
- spec/innate/helper/view/locals.xhtml
|
116
|
+
- spec/innate/helper/view/loop.xhtml
|
117
|
+
- spec/innate/helper/view/num.xhtml
|
118
|
+
- spec/innate/helper/view/partial.xhtml
|
119
|
+
- spec/innate/helper/view/recursive.xhtml
|
128
120
|
- spec/innate/mock.rb
|
129
121
|
- spec/innate/node/mapping.rb
|
130
122
|
- spec/innate/node/node.rb
|
131
123
|
- spec/innate/node/resolve.rb
|
132
|
-
- spec/innate/node/view/another_layout/another_layout.
|
133
|
-
- spec/innate/node/view/bar.
|
134
|
-
- spec/innate/node/view/foo.html.
|
135
|
-
- spec/innate/node/view/only_view.
|
136
|
-
- spec/innate/node/view/with_layout.
|
124
|
+
- spec/innate/node/view/another_layout/another_layout.xhtml
|
125
|
+
- spec/innate/node/view/bar.xhtml
|
126
|
+
- spec/innate/node/view/foo.html.xhtml
|
127
|
+
- spec/innate/node/view/only_view.xhtml
|
128
|
+
- spec/innate/node/view/with_layout.xhtml
|
137
129
|
- spec/innate/node/wrap_action_call.rb
|
138
130
|
- spec/innate/options.rb
|
139
131
|
- spec/innate/parameter.rb
|
140
132
|
- spec/innate/provides.rb
|
141
|
-
- spec/innate/provides/list.html.
|
142
|
-
- spec/innate/provides/list.txt.
|
133
|
+
- spec/innate/provides/list.html.xhtml
|
134
|
+
- spec/innate/provides/list.txt.xhtml
|
143
135
|
- spec/innate/request.rb
|
144
136
|
- spec/innate/route.rb
|
145
137
|
- spec/innate/session.rb
|
146
138
|
- spec/innate/state/fiber.rb
|
147
139
|
- spec/innate/state/thread.rb
|
148
140
|
- spec/innate/traited.rb
|
141
|
+
- tasks/bacon.rake
|
142
|
+
- tasks/changelog.rake
|
143
|
+
- tasks/gem.rake
|
144
|
+
- tasks/gem_installer.rake
|
145
|
+
- tasks/grancher.rake
|
146
|
+
- tasks/install_dependencies.rake
|
147
|
+
- tasks/manifest.rake
|
148
|
+
- tasks/rcov.rake
|
149
|
+
- tasks/release.rake
|
150
|
+
- tasks/reversion.rake
|
151
|
+
- tasks/setup.rake
|
149
152
|
has_rdoc: true
|
150
153
|
homepage: http://github.com/manveru/innate
|
151
154
|
post_install_message:
|
@@ -167,10 +170,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
170
|
version:
|
168
171
|
requirements: []
|
169
172
|
|
170
|
-
rubyforge_project:
|
173
|
+
rubyforge_project: innate
|
171
174
|
rubygems_version: 1.2.0
|
172
175
|
signing_key:
|
173
|
-
specification_version:
|
176
|
+
specification_version: 3
|
174
177
|
summary: Powerful web-framework wrapper for Rack.
|
175
178
|
test_files: []
|
176
179
|
|
@@ -1,10 +0,0 @@
|
|
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)
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
module Innate
|
5
|
-
module Helper
|
6
|
-
|
7
|
-
# = Helper::Partial
|
8
|
-
#
|
9
|
-
# === Example Usage
|
10
|
-
#
|
11
|
-
# class MyController
|
12
|
-
# def index
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# def list
|
16
|
-
# plain = request['plain']
|
17
|
-
# "Hello World from List! Plain List == #{plain}"
|
18
|
-
# end
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# <html>
|
23
|
-
# <head><title>Partial Render Index</title></head>
|
24
|
-
# <body>
|
25
|
-
# #{render_partial(Rs(:list), 'plain' => true)}
|
26
|
-
# </body>
|
27
|
-
# </html>
|
28
|
-
module Partial
|
29
|
-
module_function
|
30
|
-
|
31
|
-
# Renders a url 'inline'.
|
32
|
-
#
|
33
|
-
# +url+ normal URL, like you'd use for redirecting.
|
34
|
-
# +options+ optional, will be used as request parameters.
|
35
|
-
#
|
36
|
-
# Issues a mock request to the given +url+ with +options+ turned into
|
37
|
-
# query arguments.
|
38
|
-
def render_partial(url, options = {})
|
39
|
-
uri = URI(url)
|
40
|
-
query = options # Innate::Current.request.params.merge(options)
|
41
|
-
uri.query = Rack::Utils.build_query(query)
|
42
|
-
|
43
|
-
body = nil
|
44
|
-
|
45
|
-
Innate::Mock.session do |session|
|
46
|
-
cookie = Innate::Current.session.cookie
|
47
|
-
session.cookie = cookie
|
48
|
-
body = session.get(uri.to_s, options).body
|
49
|
-
end
|
50
|
-
|
51
|
-
body
|
52
|
-
end
|
53
|
-
|
54
|
-
# Render the template file in view_root of the
|
55
|
-
# current controller.
|
56
|
-
#
|
57
|
-
# TODO:
|
58
|
-
# * Doesn't work for absolute paths, but there are no specs for that yet.
|
59
|
-
# * the local variable hack isn't working because innate allocates a new
|
60
|
-
# binding.
|
61
|
-
# For now one can simply use instance variables, which I prefer anyway.
|
62
|
-
#
|
63
|
-
# the local binding hack:
|
64
|
-
#
|
65
|
-
# variables.each do |key, value|
|
66
|
-
# value = "ObjectSpace._id2ref(#{value.object_id})"
|
67
|
-
# eval "#{key} = #{value}", action.binding
|
68
|
-
# end
|
69
|
-
|
70
|
-
def render_template(path, variables = {})
|
71
|
-
path = path.to_s
|
72
|
-
|
73
|
-
ext = File.extname(path)
|
74
|
-
basename = File.basename(path, ext)
|
75
|
-
|
76
|
-
action = Innate::Current.action.dup
|
77
|
-
action.layout = nil
|
78
|
-
action.view = action.node.find_view(basename, 'html')
|
79
|
-
action.method = action.node.find_method(basename, action.params)
|
80
|
-
|
81
|
-
action.variables = action.variables.merge(variables)
|
82
|
-
action.sync_variables(action)
|
83
|
-
|
84
|
-
return action.call if action.valid?
|
85
|
-
raise(ArgumentError, "cannot render %p" % path)
|
86
|
-
end
|
87
|
-
|
88
|
-
def render_action(method, *params)
|
89
|
-
render_partial(r(method), *params)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<p><%= @content %></p>
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'spec/helper'
|
2
|
-
|
3
|
-
class SpecHelperPartial
|
4
|
-
Innate.node '/'
|
5
|
-
map_views '/'
|
6
|
-
|
7
|
-
def index
|
8
|
-
'<html><head><title><%= render_partial("/title") %></title></head></html>'
|
9
|
-
end
|
10
|
-
|
11
|
-
def title
|
12
|
-
"Title"
|
13
|
-
end
|
14
|
-
|
15
|
-
def with_params
|
16
|
-
'<html><head><title><%= render_partial("/message", :msg => "hello") %></title></head></html>'
|
17
|
-
end
|
18
|
-
|
19
|
-
def message
|
20
|
-
"Message: #{request[:msg]}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def without_ext
|
24
|
-
render_template('partial')
|
25
|
-
end
|
26
|
-
|
27
|
-
def with_real_ext
|
28
|
-
render_template('partial.erb')
|
29
|
-
end
|
30
|
-
|
31
|
-
def with_needed_ext
|
32
|
-
render_template('partial.html')
|
33
|
-
end
|
34
|
-
|
35
|
-
def composed
|
36
|
-
@here = 'there'
|
37
|
-
'From Action | ' << render_template("partial")
|
38
|
-
end
|
39
|
-
|
40
|
-
def recursive
|
41
|
-
@n = 1
|
42
|
-
end
|
43
|
-
|
44
|
-
def with_variable
|
45
|
-
here = 'there'
|
46
|
-
render_template("partial", :here => here)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class SpecHelperPartialWithLayout < SpecHelperPartial
|
51
|
-
Innate.node '/with_layout'
|
52
|
-
layout('layout')
|
53
|
-
|
54
|
-
def layout
|
55
|
-
'<h1>with layout</h1><%= @content %>'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe Innate::Helper::Partial do
|
60
|
-
behaves_like :mock
|
61
|
-
|
62
|
-
should 'render partials' do
|
63
|
-
get('/').body.should == '<html><head><title>Title</title></head></html>'
|
64
|
-
end
|
65
|
-
|
66
|
-
should 'render partials with params' do
|
67
|
-
get('/with_params').body.should == '<html><head><title>Message: hello</title></head></html>'
|
68
|
-
end
|
69
|
-
|
70
|
-
should 'be able to render a template in the current scope' do
|
71
|
-
get('/composed').body.strip.should == "From Action | From Partial there"
|
72
|
-
end
|
73
|
-
|
74
|
-
should 'not require file extension' do
|
75
|
-
get('/without_ext').body.should == "From Partial \n"
|
76
|
-
end
|
77
|
-
|
78
|
-
it "the real extension will just be stripped" do
|
79
|
-
got = get('/with_real_ext').body.should == "From Partial \n"
|
80
|
-
end
|
81
|
-
|
82
|
-
it "works with the content representation instead" do
|
83
|
-
get('/with_needed_ext').body.should == "From Partial \n"
|
84
|
-
end
|
85
|
-
|
86
|
-
should 'render_template in a loop' do
|
87
|
-
get('/loop').body.gsub(/\s/,'').should == '12345'
|
88
|
-
end
|
89
|
-
|
90
|
-
should 'work recursively' do
|
91
|
-
get('/recursive').body.gsub(/\s/,'').should == '{1{2{3{44}4}3}2}'
|
92
|
-
end
|
93
|
-
|
94
|
-
should 'render template with layout' do
|
95
|
-
get('/with_layout/without_ext').body.should == "<h1>with layout</h1>From Partial \n"
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'makes passed variables available in the template as instance variables' do
|
99
|
-
get('/with_variable').body.should == "From Partial there\n"
|
100
|
-
end
|
101
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @foo %> <%= @bar %>!
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= say %>, <%= to %>!
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @n %>
|
@@ -1 +0,0 @@
|
|
1
|
-
From Partial <%= @here %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<% 10.times do |n| %><%= n %><% end %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<div class="content"><%= @content %></div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<ul><% @users.each do |user| %><li><%= user %></li><% end %></ul>
|
@@ -1 +0,0 @@
|
|
1
|
-
<% @users.each do |user| %><%= "#{user}\n" %><% end %>
|