ramaze 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -29
- data/bin/ramaze +2 -3
- data/doc/AUTHORS +5 -2
- data/doc/CHANGELOG +262 -9
- data/doc/FAQ +6 -6
- data/doc/meta/announcement.txt +5 -19
- data/doc/tutorial/todolist.html +47 -57
- data/doc/tutorial/todolist.mkd +47 -55
- data/examples/memleak_detector.rb +31 -0
- data/examples/todolist/src/controller/main.rb +14 -13
- data/examples/todolist/src/element/page.rb +2 -2
- data/examples/todolist/src/model.rb +2 -2
- data/examples/todolist/todolist.db +0 -4
- data/examples/whywiki/main.rb +2 -2
- data/examples/whywiki/template/edit.xhtml +1 -1
- data/examples/whywiki/template/show.xhtml +3 -3
- data/lib/proto/src/controller/main.rb +18 -1
- data/lib/proto/template/index.xhtml +11 -2
- data/lib/ramaze.rb +1 -1
- data/lib/ramaze/action.rb +104 -5
- data/lib/ramaze/action/render.rb +54 -0
- data/lib/ramaze/adapter.rb +2 -1
- data/lib/ramaze/adapter/mongrel.rb +13 -4
- data/lib/ramaze/cache.rb +17 -8
- data/lib/ramaze/cache/memcached.rb +1 -5
- data/lib/ramaze/controller.rb +51 -18
- data/lib/ramaze/controller/resolve.rb +19 -14
- data/lib/ramaze/dispatcher.rb +13 -16
- data/lib/ramaze/dispatcher/action.rb +2 -3
- data/lib/ramaze/dispatcher/error.rb +8 -3
- data/lib/ramaze/dispatcher/file.rb +1 -4
- data/lib/ramaze/error.rb +5 -5
- data/lib/ramaze/global.rb +7 -1
- data/lib/ramaze/global/globalstruct.rb +1 -3
- data/lib/ramaze/helper/aspect.rb +8 -10
- data/lib/ramaze/helper/cgi.rb +21 -3
- data/lib/ramaze/helper/identity.rb +4 -6
- data/lib/ramaze/helper/link.rb +4 -4
- data/lib/ramaze/helper/pager.rb +316 -0
- data/lib/ramaze/helper/partial.rb +37 -0
- data/lib/ramaze/helper/stack.rb +1 -1
- data/lib/ramaze/inform.rb +9 -0
- data/lib/ramaze/inform/hub.rb +5 -0
- data/lib/ramaze/inform/informer.rb +12 -6
- data/lib/ramaze/inform/informing.rb +32 -7
- data/lib/ramaze/inform/knotify.rb +21 -0
- data/lib/ramaze/inform/xosd.rb +58 -24
- data/lib/ramaze/sourcereload.rb +30 -1
- data/lib/ramaze/template.rb +33 -12
- data/lib/ramaze/template/amrita2.rb +21 -20
- data/lib/ramaze/template/erubis.rb +18 -14
- data/lib/ramaze/template/ezamar.rb +15 -26
- data/lib/ramaze/template/ezamar/element.rb +1 -1
- data/lib/ramaze/template/ezamar/engine.rb +45 -36
- data/lib/ramaze/template/ezamar/morpher.rb +3 -3
- data/lib/ramaze/template/ezamar/render_partial.rb +26 -0
- data/lib/ramaze/template/haml.rb +23 -18
- data/lib/ramaze/template/liquid.rb +5 -3
- data/lib/ramaze/template/markaby.rb +14 -11
- data/lib/ramaze/template/remarkably.rb +11 -5
- data/lib/ramaze/tool/localize.rb +12 -4
- data/lib/ramaze/tool/tidy.rb +26 -23
- data/lib/ramaze/trinity/request.rb +11 -7
- data/lib/ramaze/trinity/session.rb +24 -8
- data/lib/ramaze/version.rb +1 -1
- data/rake_tasks/maintaince.rake +136 -11
- data/spec/examples/templates/template_liquid.rb +6 -3
- data/spec/examples/todolist.rb +1 -2
- data/spec/helper/minimal.rb +7 -7
- data/spec/ramaze/action/basics.rb +19 -0
- data/spec/ramaze/action/render.rb +18 -0
- data/spec/ramaze/controller.rb +1 -1
- data/spec/ramaze/controller/template_resolving.rb +1 -1
- data/spec/ramaze/dispatcher/file.rb +24 -0
- data/spec/ramaze/error.rb +28 -29
- data/spec/ramaze/helper/cgi.rb +43 -0
- data/spec/ramaze/helper/pager.rb +27 -0
- data/spec/ramaze/helper/partial.rb +38 -0
- data/spec/ramaze/helper/template/partial.xhtml +1 -0
- data/spec/ramaze/inform/informer.rb +1 -1
- data/spec/ramaze/localize.rb +1 -1
- data/spec/ramaze/morpher.rb +3 -3
- data/spec/ramaze/request.rb +1 -3
- data/spec/ramaze/template.rb +9 -7
- data/spec/ramaze/template/haml.rb +2 -1
- metadata +21 -7
- data/examples/todolist/public/404.jpg +0 -0
- data/examples/todolist/public/error.xhtml +0 -74
- data/lib/ramaze/controller/render.rb +0 -90
Binary file
|
@@ -1,74 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>#{@title}</title>
|
4
|
-
<link rel="stylesheet" href="/css/coderay.css" />
|
5
|
-
<link rel="stylesheet" href="/css/ramaze_error.css" />
|
6
|
-
<script type="text/javascript" src="/js/jquery.js"></script>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<img id="logo" alt="Ramaze" src="/ramaze.png" />
|
10
|
-
|
11
|
-
<h1>#{@title}</h1>
|
12
|
-
|
13
|
-
<table class="main">
|
14
|
-
<tr class="head">
|
15
|
-
<td>File</td><td>Line</td><td>Method</td>
|
16
|
-
</tr>
|
17
|
-
<?r @backtrace.each do |lines, hash, file, lineno, meth| ?>
|
18
|
-
<tr id="line_#{hash}" style="background:rgb(#{@colors.shift},70,60);">
|
19
|
-
<td>#{file}</td><td>#{lineno}</td><td>#{meth}</td>
|
20
|
-
</tr>
|
21
|
-
<tr id="source_#{hash}" style="display:none;">
|
22
|
-
<td colspan="3">
|
23
|
-
<div class="source">
|
24
|
-
<table style="width:100%;">
|
25
|
-
<tr>
|
26
|
-
<td colspan="2">vim #{file} +#{lineno}</td>
|
27
|
-
</tr>
|
28
|
-
<?r
|
29
|
-
if @coderay
|
30
|
-
code = lines.map{|no, code, cur| code}.join("\n")
|
31
|
-
line = lines.first[0]
|
32
|
-
options = {
|
33
|
-
:wrap => :div,
|
34
|
-
:line_numbers => :inline,
|
35
|
-
:line_number_start => line
|
36
|
-
}
|
37
|
-
?>
|
38
|
-
#{CodeRay.scan(code, :ruby).html(options)}
|
39
|
-
<?r else ?>
|
40
|
-
<?r lines.each do |llineno, lcode, lcurrent| ?>
|
41
|
-
<tr class="source" #{'style="background:#faa;"' if lcurrent}>
|
42
|
-
<td>#{llineno}</td>
|
43
|
-
<td>#{lcode.rstrip}</td>
|
44
|
-
</tr>
|
45
|
-
<?r end ?>
|
46
|
-
<?r end ?>
|
47
|
-
</table>
|
48
|
-
</div>
|
49
|
-
<script type="text/javascript">
|
50
|
-
$("tr#line_#{hash}").click(function(){$("tr#source_#{hash}").toggle()});
|
51
|
-
</script>
|
52
|
-
</td>
|
53
|
-
</tr>
|
54
|
-
<?r end ?>
|
55
|
-
</table>
|
56
|
-
<?r
|
57
|
-
{
|
58
|
-
'Session' => Thread.current[:session],
|
59
|
-
'Request' => Thread.current[:request],
|
60
|
-
'Response' => Thread.current[:response],
|
61
|
-
'Global' => Global,
|
62
|
-
}.each do |title, content|
|
63
|
-
hash = [title, content].object_id.abs
|
64
|
-
?>
|
65
|
-
<div class="additional">
|
66
|
-
<h3 id="show_#{hash}">#{title}</h3>
|
67
|
-
<pre style="display:none" id="is_#{hash}">#{content.pretty_inspect}</pre>
|
68
|
-
<script type="text/javascript">
|
69
|
-
$("h3#show_#{hash}").click(function(){$("pre#is_#{hash}").toggle()});
|
70
|
-
</script>
|
71
|
-
</div>
|
72
|
-
<?r end ?>
|
73
|
-
</body>
|
74
|
-
</html>
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
module Ramaze
|
5
|
-
class Controller
|
6
|
-
class << self
|
7
|
-
def render(action = {})
|
8
|
-
action = Action.fill(action) if action.is_a?(Hash)
|
9
|
-
Inform.debug("The Action: #{action}")
|
10
|
-
|
11
|
-
action.method = action.method.to_s if action.method
|
12
|
-
action.params.compact!
|
13
|
-
|
14
|
-
if cached?(action)
|
15
|
-
cached_render(action)
|
16
|
-
else
|
17
|
-
uncached_render(action)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def cached?(action)
|
22
|
-
actions_cached = trait[:actions_cached]
|
23
|
-
|
24
|
-
[ Global.cache_all,
|
25
|
-
trait[:cache_all],
|
26
|
-
actions_cached.map{|k| k.to_s}.include?(action.method),
|
27
|
-
].any?
|
28
|
-
end
|
29
|
-
|
30
|
-
def uncached_render(action)
|
31
|
-
controller = self.new
|
32
|
-
controller.instance_variable_set('@action', action)
|
33
|
-
Thread.current[:controller] = controller
|
34
|
-
|
35
|
-
action.binding = controller.instance_eval{ binding }
|
36
|
-
action.controller = controller
|
37
|
-
|
38
|
-
before = before_process(action)
|
39
|
-
|
40
|
-
engine = select_engine(action.template)
|
41
|
-
answer = engine.transform(action)
|
42
|
-
|
43
|
-
after = after_process(action)
|
44
|
-
[before, answer, after].join
|
45
|
-
end
|
46
|
-
|
47
|
-
def before_process(action)
|
48
|
-
''
|
49
|
-
end
|
50
|
-
|
51
|
-
def after_process(action)
|
52
|
-
''
|
53
|
-
end
|
54
|
-
|
55
|
-
def cached_render action
|
56
|
-
action_cache = Cache.actions
|
57
|
-
|
58
|
-
if out = action_cache[action]
|
59
|
-
Inform.debug("Using Cached version for #{action}")
|
60
|
-
return out
|
61
|
-
end
|
62
|
-
|
63
|
-
Inform.debug("Compiling Action: #{action}")
|
64
|
-
action_cache[action] = uncached_render(action)
|
65
|
-
end
|
66
|
-
|
67
|
-
def select_engine(file)
|
68
|
-
trait_engine = class_trait[:engine]
|
69
|
-
default = [trait_engine, Template::Ezamar].compact.first
|
70
|
-
return default unless file
|
71
|
-
|
72
|
-
engines = Controller.trait[:template_extensions]
|
73
|
-
return default if engines.empty?
|
74
|
-
|
75
|
-
ext = File.extname(file).gsub(/^\./, '')
|
76
|
-
ext_engine = engines[ext]
|
77
|
-
return ext_engine ? ext_engine : default
|
78
|
-
end
|
79
|
-
|
80
|
-
# This method is called by templating-engines to register themselves with
|
81
|
-
# a list of extensions that will be looked up on #render of an action.
|
82
|
-
|
83
|
-
def register_engine engine, *extensions
|
84
|
-
extensions.flatten.each do |ext|
|
85
|
-
trait[:template_extensions][ext] = engine
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|