manveru-innate 2009.04.08 → 2009.04.18
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +126 -0
- data/MANIFEST +5 -4
- data/README.md +1 -9
- data/Rakefile +6 -6
- data/example/app/retro_games.rb +3 -3
- data/example/app/todo/layout/{default.erb → default.xhtml} +0 -0
- data/example/app/todo/view/{index.erb → index.xhtml} +0 -0
- data/example/app/whywiki_erb/start.rb +2 -2
- data/example/provides.rb +9 -6
- data/innate.gemspec +5 -5
- data/lib/innate.rb +12 -18
- data/lib/innate/action.rb +14 -10
- data/lib/innate/cache/file_based.rb +2 -0
- data/lib/innate/helper.rb +2 -2
- data/lib/innate/helper/link.rb +2 -2
- data/lib/innate/helper/render.rb +3 -1
- data/lib/innate/helper/send_file.rb +9 -1
- data/lib/innate/node.rb +1 -3
- data/lib/innate/response.rb +0 -7
- data/lib/innate/session.rb +1 -2
- data/lib/innate/spec.rb +6 -47
- data/lib/innate/version.rb +1 -1
- 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/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 +3 -27
- data/spec/innate/session.rb +14 -15
- data/tasks/install_dependencies.rake +2 -4
- data/tasks/release.rake +48 -9
- data/tasks/setup.rake +28 -0
- metadata +8 -7
- data/lib/innate/core_compatibility/basic_object.rb +0 -10
- data/lib/innate/core_compatibility/string.rb +0 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,129 @@
|
|
1
|
+
[987c5d7 | Sat Apr 18 02:44:26 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
2
|
+
|
3
|
+
* Update the release tasks
|
4
|
+
|
5
|
+
[f927c9d | Fri Apr 17 11:51:35 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
6
|
+
|
7
|
+
* Add Content-Disposition support to send_file
|
8
|
+
|
9
|
+
[888318c | Fri Apr 17 10:43:10 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
10
|
+
|
11
|
+
* Better English in render_custom error
|
12
|
+
|
13
|
+
[15078e6 | Wed Apr 15 16:49:04 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
14
|
+
|
15
|
+
* Add comment about planned deprecation of SendFile helper's default status
|
16
|
+
|
17
|
+
[4b487aa | Wed Apr 15 16:48:09 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
18
|
+
|
19
|
+
* Remove the length from Response, Rack provides that
|
20
|
+
|
21
|
+
[1634391 | Wed Apr 15 11:02:11 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
22
|
+
|
23
|
+
* Don't camel-case the helper module name, simply remove underscores, we do case-insensitive lookup anyway
|
24
|
+
|
25
|
+
[f97e8d7 | Wed Apr 15 10:58:35 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
26
|
+
|
27
|
+
* Remove core_extensions, we don't need String#each or BasicObject anymore
|
28
|
+
|
29
|
+
[0b33546 | Wed Apr 15 09:16:24 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
30
|
+
|
31
|
+
* Action may be invalid if the node requires a method and view
|
32
|
+
|
33
|
+
[39dd843 | Wed Apr 15 09:15:30 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
34
|
+
|
35
|
+
* Escape non-hash arguments to Helper::Link#route (ryan grove)
|
36
|
+
|
37
|
+
[22ee4df | Wed Apr 15 07:25:02 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
38
|
+
|
39
|
+
* Raise if the Render helper cannot obtain an Action
|
40
|
+
|
41
|
+
[e229299 | Mon Apr 13 12:48:05 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
42
|
+
|
43
|
+
* Allow Action#call even if we are outside Current#wrap
|
44
|
+
|
45
|
+
[b6e9558 | Mon Apr 13 04:37:42 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
46
|
+
|
47
|
+
* Remove Action#exts member and use better terms
|
48
|
+
|
49
|
+
[46d2a5e | Sun Apr 12 05:03:58 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
50
|
+
|
51
|
+
* FileBased caches have access to @filename now
|
52
|
+
|
53
|
+
[f84f18f | Sun Apr 12 05:03:39 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
54
|
+
|
55
|
+
* Set a PROJECT_README for some rake tasks
|
56
|
+
|
57
|
+
[8920482 | Sun Apr 12 05:03:21 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
58
|
+
|
59
|
+
* Improvment and spec for provide example
|
60
|
+
|
61
|
+
[a892dea | Sun Apr 12 05:02:50 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
62
|
+
|
63
|
+
* Minor improvment and spec for retro games example
|
64
|
+
|
65
|
+
[b3aeb97 | Fri Apr 10 12:30:08 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
66
|
+
|
67
|
+
* Allow overriding of middleware mode for specs
|
68
|
+
|
69
|
+
[7d65255 | Fri Apr 10 12:07:15 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
70
|
+
|
71
|
+
* Compact code
|
72
|
+
|
73
|
+
[cde9366 | Fri Apr 10 10:51:03 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
74
|
+
|
75
|
+
* Simplify specs and make them pass using rack-test
|
76
|
+
|
77
|
+
[f4c9572 | Fri Apr 10 10:50:34 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
78
|
+
|
79
|
+
* Don't forget to specify an app for rack-test
|
80
|
+
|
81
|
+
[41b1955 | Fri Apr 10 10:17:42 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
82
|
+
|
83
|
+
* Remove spec for render_template
|
84
|
+
|
85
|
+
[a3b73ca | Fri Apr 10 10:17:27 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
86
|
+
|
87
|
+
* Add `rake setup` task to comply to convention. I will put up the corresponding gems ASAP
|
88
|
+
|
89
|
+
[c648bf7 | Fri Apr 10 10:16:12 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
90
|
+
|
91
|
+
* Switch to using rack-test for our specs, needs rack-test from the master branch head
|
92
|
+
|
93
|
+
[5c08e25 | Thu Apr 09 17:52:28 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
94
|
+
|
95
|
+
* Use ContentLength middleware
|
96
|
+
|
97
|
+
[0dc50d4 | Thu Apr 09 16:10:51 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
98
|
+
|
99
|
+
* Fix template caching... was using html instead of the wish the glob was for
|
100
|
+
|
101
|
+
[622bbe3 | Thu Apr 09 16:01:08 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
102
|
+
|
103
|
+
* Fix example apps
|
104
|
+
|
105
|
+
[6e9e843 | Tue Apr 07 09:56:56 UTC 2009] Sam Carr <samcarr@gmail.com>
|
106
|
+
|
107
|
+
* Minor tidy-ups to fix comments, add missing requires, add comments etc.
|
108
|
+
|
109
|
+
Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
|
110
|
+
|
111
|
+
[8f9af98 | Tue Apr 07 18:42:35 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
112
|
+
|
113
|
+
* Set default interval for reloader to 2 seconds
|
114
|
+
|
115
|
+
[9f7e749 | Tue Apr 07 18:42:14 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
116
|
+
|
117
|
+
* Never assign $0, bad mojo
|
118
|
+
|
119
|
+
[281501e | Tue Apr 07 17:53:08 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
120
|
+
|
121
|
+
* Don't assign a directory to $0
|
122
|
+
|
123
|
+
[8a2ddc7 | Tue Apr 07 17:16:37 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
124
|
+
|
125
|
+
* Version 2009.04.08
|
126
|
+
|
1
127
|
[89ab244 | Tue Apr 07 16:17:07 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
|
2
128
|
|
3
129
|
* 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.xhtml
|
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.xhtml
|
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,8 +30,6 @@ 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
|
35
33
|
lib/innate/current.rb
|
36
34
|
lib/innate/dynamap.rb
|
37
35
|
lib/innate/helper.rb
|
@@ -68,8 +66,10 @@ lib/innate/view.rb
|
|
68
66
|
lib/innate/view/erb.rb
|
69
67
|
lib/innate/view/etanni.rb
|
70
68
|
lib/innate/view/none.rb
|
69
|
+
spec/example/app/retro_games.rb
|
71
70
|
spec/example/hello.rb
|
72
71
|
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,3 +124,4 @@ 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
|
70
|
+
* No patching 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,7 +77,6 @@ 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.
|
81
80
|
|
82
81
|
## Usage
|
83
82
|
|
@@ -449,13 +448,6 @@ authorization, etc.
|
|
449
448
|
|
450
449
|
Innate abandons the snippets, keeping your core clean.
|
451
450
|
|
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
|
-
|
459
451
|
Ramaze has still a lot of these snippets and will continue to, although I will
|
460
452
|
constantly strive to reduce them slowly.
|
461
453
|
|
data/Rakefile
CHANGED
@@ -4,10 +4,9 @@ require 'rake/gempackagetask'
|
|
4
4
|
require 'time'
|
5
5
|
require 'date'
|
6
6
|
|
7
|
-
|
8
|
-
specs -= Dir['spec/innate/cache/common.rb']
|
9
|
-
PROJECT_SPECS = specs
|
7
|
+
PROJECT_SPECS = FileList['spec/{innate,example}/**/*.rb'].exclude('common.rb')
|
10
8
|
PROJECT_MODULE = 'Innate'
|
9
|
+
PROJECT_README = 'README.md'
|
11
10
|
|
12
11
|
GEMSPEC = Gem::Specification.new{|s|
|
13
12
|
s.name = 'innate'
|
@@ -22,9 +21,10 @@ GEMSPEC = Gem::Specification.new{|s|
|
|
22
21
|
s.has_rdoc = true
|
23
22
|
s.require_path = 'lib'
|
24
23
|
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
24
|
+
# s.add_runtime_dependency('rack', '>= 0.9.1') # lies!
|
25
|
+
# s.add_development_dependency('bacon', '>= 1.0')
|
26
|
+
# s.add_development_dependency('json', '~> 1.1.3')
|
27
|
+
# s.add_development_dependency('rack-test', '>= 0.1.0')
|
28
28
|
}
|
29
29
|
|
30
30
|
Dir['tasks/*.rake'].each{|f| import(f) }
|
data/example/app/retro_games.rb
CHANGED
@@ -32,7 +32,8 @@ class Games
|
|
32
32
|
|
33
33
|
TEMPLATE = <<-'T'.strip
|
34
34
|
<?xml version='1.0' encoding='utf-8' ?>
|
35
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
35
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
36
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
36
37
|
<html>
|
37
38
|
<head>
|
38
39
|
<title>Top Retro Games</title>
|
@@ -47,14 +48,13 @@ class Games
|
|
47
48
|
<?r STORE.each do |name, votes| ?>
|
48
49
|
<li>
|
49
50
|
#{ a("Vote", r(:vote, u(name))) }
|
50
|
-
#{ "%5d => %s" % [votes, name] }
|
51
|
+
#{ h "%5d => %s" % [votes, name] }
|
51
52
|
</li>
|
52
53
|
<?r end ?>
|
53
54
|
</ol>
|
54
55
|
</body>
|
55
56
|
</html>
|
56
57
|
T
|
57
|
-
|
58
58
|
end
|
59
59
|
|
60
60
|
Innate.start
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@ DB = YAML::Store.new('wiki.yaml') unless defined?(DB)
|
|
7
7
|
class Wiki
|
8
8
|
Innate.node '/'
|
9
9
|
layout 'wiki'
|
10
|
-
engine :ERB
|
10
|
+
provide :html, :engine => :ERB
|
11
11
|
|
12
12
|
def index(page = 'Home')
|
13
13
|
@page = page
|
@@ -39,4 +39,4 @@ class Wiki
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
Innate.start
|
42
|
+
Innate.start
|
data/example/provides.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'innate'
|
3
|
+
require 'yaml'
|
3
4
|
|
4
5
|
ARTICLES = {
|
5
6
|
'hello' => {
|
@@ -13,15 +14,17 @@ class BlogArticles
|
|
13
14
|
Innate.node('/')
|
14
15
|
|
15
16
|
# provide a content representation for requests to /<action>.yaml
|
17
|
+
# If you request `/list.yaml`, you will get the `ARTICLES object serialized
|
18
|
+
# to YAML.
|
16
19
|
provide(:yaml, :type => 'text/yaml'){|action, value| value.to_yaml }
|
17
20
|
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
#
|
21
|
+
# Since there will always be an `html` representation (the default), you have
|
22
|
+
# to take care of it. If you simply want to return an empty page, use following.
|
23
|
+
provide(:html){|action, value| '' }
|
24
|
+
|
25
|
+
# The return value of this method is the `value` in the provides above.
|
23
26
|
def list
|
24
|
-
|
27
|
+
return ARTICLES
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
data/innate.gemspec
CHANGED
@@ -2,23 +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.18"
|
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-18}
|
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.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/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/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/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", "tasks/setup.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.rubygems_version = %q{1.3.
|
16
|
+
s.rubygems_version = %q{1.3.2}
|
17
17
|
s.summary = %q{Powerful web-framework wrapper for Rack.}
|
18
18
|
|
19
19
|
if s.respond_to? :specification_version then
|
20
20
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
21
|
-
s.specification_version =
|
21
|
+
s.specification_version = 3
|
22
22
|
|
23
23
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
24
24
|
else
|
data/lib/innate.rb
CHANGED
@@ -3,11 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Name-space of Innate, just about everything goes in here.
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# * Logger::ColorFormatter
|
9
|
-
# * In 1.8, we define ::BasicObject
|
10
|
-
# * In 1.9, we define ::String#each
|
6
|
+
# The only exception is Logger::ColorFormatter.
|
11
7
|
#
|
12
8
|
module Innate
|
13
9
|
ROOT = File.expand_path(File.dirname(__FILE__))
|
@@ -30,10 +26,6 @@ module Innate
|
|
30
26
|
# 3rd party
|
31
27
|
require 'rack'
|
32
28
|
|
33
|
-
# innates ruby core patches
|
34
|
-
require 'innate/core_compatibility/string'
|
35
|
-
require 'innate/core_compatibility/basic_object'
|
36
|
-
|
37
29
|
# innate core
|
38
30
|
require 'innate/version'
|
39
31
|
require 'innate/traited'
|
@@ -97,7 +89,7 @@ module Innate
|
|
97
89
|
# Port for the server
|
98
90
|
# @option param :started [boolean] (false)
|
99
91
|
# Indicate that calls Innate::start will be ignored
|
100
|
-
# @option param :
|
92
|
+
# @option param :adapter [Symbol] (:webrick)
|
101
93
|
# Web server to run on
|
102
94
|
# @option param :setup [Array] ([Innate::Cache, Innate::Node])
|
103
95
|
# Will send ::setup to each element during Innate::start
|
@@ -113,14 +105,14 @@ module Innate
|
|
113
105
|
root = given_options.delete(:root)
|
114
106
|
file = given_options.delete(:file)
|
115
107
|
|
116
|
-
|
117
|
-
|
118
|
-
Innate.options.roots = [found_root]
|
119
|
-
end
|
108
|
+
found_root = go_figure_root(caller, :root => root, :file => file)
|
109
|
+
Innate.options.roots = [found_root] if found_root
|
120
110
|
|
111
|
+
# Convert some top-level option keys to the internal ones that we use.
|
121
112
|
PROXY_OPTIONS.each{|k,v| given_options[v] = given_options.delete(k) }
|
122
113
|
given_options.delete_if{|k,v| v.nil? }
|
123
114
|
|
115
|
+
# Merge the user's given options into our existing set, which contains defaults.
|
124
116
|
options.merge!(given_options)
|
125
117
|
|
126
118
|
setup_dependencies
|
@@ -185,10 +177,10 @@ module Innate
|
|
185
177
|
# Innate.start :root => File.dirname(__FILE__)
|
186
178
|
#
|
187
179
|
# Either setting will surpress the warning that might show up on startup
|
188
|
-
# and tells you it
|
180
|
+
# and tells you it couldn't find an explicit root.
|
189
181
|
#
|
190
182
|
# In case these options are not passed we will try to figure out a file named
|
191
|
-
# `start.rb` in the
|
183
|
+
# `start.rb` in the process' working directory and assume it's a valid point.
|
192
184
|
def go_figure_root(backtrace, options)
|
193
185
|
if root = options[:root]
|
194
186
|
root
|
@@ -263,13 +255,15 @@ module Innate
|
|
263
255
|
# @see Rack::MiddlewareCompiler
|
264
256
|
middleware :dev do |m|
|
265
257
|
m.apps(Rack::Lint, Rack::CommonLogger, Rack::ShowExceptions,
|
266
|
-
Rack::ShowStatus, Rack::ConditionalGet, Rack::
|
258
|
+
Rack::ShowStatus, Rack::ConditionalGet, Rack::ContentLength,
|
259
|
+
Rack::Head)
|
260
|
+
m.use(Rack::Reloader, 2)
|
267
261
|
m.innate
|
268
262
|
end
|
269
263
|
|
270
264
|
middleware :live do |m|
|
271
265
|
m.apps(Rack::CommonLogger, Rack::ShowStatus, Rack::ConditionalGet,
|
272
|
-
Rack::Head)
|
266
|
+
Rack::ContentLength, Rack::Head)
|
273
267
|
m.innate
|
274
268
|
end
|
275
269
|
end
|
data/lib/innate/action.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Innate
|
2
|
-
ACTION_MEMBERS = [ :node, :
|
3
|
-
:
|
2
|
+
ACTION_MEMBERS = [ :node, :instance, :method, :params, :method_value, :view,
|
3
|
+
:view_value, :layout, :wish, :options, :variables, :engine ]
|
4
4
|
|
5
5
|
class Action < Struct.new(*ACTION_MEMBERS)
|
6
6
|
# Create a new Action instance.
|
@@ -32,10 +32,7 @@ module Innate
|
|
32
32
|
# @api stable
|
33
33
|
# @author manveru
|
34
34
|
def call
|
35
|
-
Current.actions
|
36
|
-
render
|
37
|
-
ensure
|
38
|
-
Current.actions.delete(self)
|
35
|
+
Current.actions ? wrap_in_current{ render } : render
|
39
36
|
end
|
40
37
|
|
41
38
|
# @return [Binding] binding of the instance for this Action
|
@@ -101,11 +98,11 @@ module Innate
|
|
101
98
|
|
102
99
|
instance.wrap_action_call(self) do
|
103
100
|
copy_variables # this might need another position after all
|
104
|
-
self.
|
105
|
-
self.view_value = File.read(view) if view
|
101
|
+
self.method_value = instance.__send__(method, *params) if method
|
102
|
+
self.view_value = ::File.read(view) if view
|
106
103
|
|
107
104
|
body, content_type = wrap_in_layout{
|
108
|
-
engine.call(self, view_value ||
|
105
|
+
engine.call(self, view_value || method_value || '') }
|
109
106
|
options[:content_type] ||= content_type if content_type
|
110
107
|
body
|
111
108
|
end
|
@@ -128,13 +125,20 @@ module Innate
|
|
128
125
|
[:layout, :view].include?(name) ? [arg, nil] : [nil, arg]
|
129
126
|
end
|
130
127
|
|
128
|
+
def wrap_in_current
|
129
|
+
Current.actions << self
|
130
|
+
yield
|
131
|
+
ensure
|
132
|
+
Current.actions.delete(self)
|
133
|
+
end
|
134
|
+
|
131
135
|
# Try to figure out a sane name for current action.
|
132
136
|
def name
|
133
137
|
File.basename((method || view).to_s).split('.').first
|
134
138
|
end
|
135
139
|
|
136
140
|
def valid?
|
137
|
-
method || view
|
141
|
+
node.needs_method? ? (method && view) : (method || view)
|
138
142
|
end
|
139
143
|
end
|
140
144
|
end
|