ramaze 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +20 -3
- data/bin/ramaze +1 -4
- data/doc/AUTHORS +2 -1
- data/doc/CHANGELOG +539 -32
- data/doc/LEGAL +4 -0
- data/doc/meta/announcement.txt +79 -47
- data/examples/blog/README +2 -2
- data/examples/blog/spec/blog.rb +33 -48
- data/examples/blog/src/controller.rb +15 -13
- data/examples/blog/src/model.rb +28 -10
- data/examples/blog/start.rb +0 -10
- data/examples/blog/template/edit.xhtml +1 -1
- data/examples/blog/template/index.xhtml +2 -2
- data/examples/facebook.rb +152 -0
- data/examples/linking.rb +28 -0
- data/examples/ramaise.rb +4 -11
- data/examples/rammit/spec/rammit.rb +30 -0
- data/examples/rammit/src/controller/main.rb +3 -0
- data/examples/rammit/src/controller/page.rb +16 -0
- data/examples/rammit/src/model.rb +33 -0
- data/examples/rammit/start.rb +7 -0
- data/examples/rammit/template/index.xhtml +14 -0
- data/examples/rammit/template/page/view.xhtml +4 -0
- data/examples/rapaste/Rakefile +28 -0
- data/examples/rapaste/public/css/active4d.css +114 -0
- data/examples/rapaste/public/css/all_hallows_eve.css +72 -0
- data/examples/rapaste/public/css/amy.css +147 -0
- data/examples/rapaste/public/css/blackboard.css +88 -0
- data/examples/rapaste/public/css/brilliance_black.css +605 -0
- data/examples/rapaste/public/css/brilliance_dull.css +599 -0
- data/examples/rapaste/public/css/cobalt.css +149 -0
- data/examples/rapaste/public/css/dawn.css +121 -0
- data/examples/rapaste/public/css/display.css +179 -0
- data/examples/rapaste/public/css/eiffel.css +121 -0
- data/examples/rapaste/public/css/espresso_libre.css +109 -0
- data/examples/rapaste/public/css/idle.css +62 -0
- data/examples/rapaste/public/css/iplastic.css +80 -0
- data/examples/rapaste/public/css/lazy.css +73 -0
- data/examples/rapaste/public/css/mac_classic.css +123 -0
- data/examples/rapaste/public/css/magicwb_amiga.css +104 -0
- data/examples/rapaste/public/css/pastels_on_dark.css +188 -0
- data/examples/rapaste/public/css/slush_poppies.css +85 -0
- data/examples/rapaste/public/css/spacecadet.css +51 -0
- data/examples/rapaste/public/css/sunburst.css +180 -0
- data/examples/rapaste/public/css/twilight.css +137 -0
- data/examples/rapaste/public/css/zenburnesque.css +91 -0
- data/examples/rapaste/public/js/jquery.js +11 -0
- data/examples/rapaste/rapaste.sqlite +0 -0
- data/examples/rapaste/spec/rapaste.rb +49 -0
- data/examples/rapaste/src/controller.rb +69 -0
- data/examples/rapaste/src/model.rb +61 -0
- data/examples/rapaste/start.rb +20 -0
- data/examples/rapaste/template/copy.xhtml +10 -0
- data/examples/rapaste/template/index.xhtml +9 -0
- data/examples/rapaste/template/layout.xhtml +22 -0
- data/examples/rapaste/template/list.xhtml +28 -0
- data/examples/rapaste/template/view.xhtml +37 -0
- data/examples/sourceview/sourceview.rb +3 -3
- data/examples/templates/template_amrita2.rb +1 -3
- data/examples/todolist/spec/todolist.rb +15 -18
- data/examples/whywiki/spec/whywiki.rb +15 -20
- data/examples/whywiki/start.rb +0 -1
- data/examples/wikore/spec/wikore.rb +14 -19
- data/examples/wiktacular/spec/wiktacular.rb +8 -15
- data/lib/proto/{src/controller → controller}/main.rb +4 -4
- data/lib/proto/public/css/ramaze_error.css +39 -3
- data/lib/proto/public/js/jquery.js +2039 -1020
- data/lib/proto/spec/main.rb +27 -0
- data/lib/proto/start.rb +5 -5
- data/lib/proto/view/error.xhtml +62 -0
- data/lib/proto/view/index.xhtml +34 -0
- data/lib/proto/view/page.xhtml +15 -0
- data/lib/ramaze.rb +9 -7
- data/lib/ramaze/action.rb +7 -3
- data/lib/ramaze/action/render.rb +15 -5
- data/lib/ramaze/adapter.rb +5 -5
- data/lib/ramaze/adapter/base.rb +2 -2
- data/lib/ramaze/adapter/cgi.rb +1 -1
- data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
- data/lib/ramaze/adapter/fcgi.rb +2 -2
- data/lib/ramaze/adapter/mongrel.rb +1 -1
- data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
- data/lib/ramaze/adapter/thin.rb +25 -0
- data/lib/ramaze/adapter/webrick.rb +1 -1
- data/lib/ramaze/cache.rb +3 -2
- data/lib/ramaze/cache/memcached.rb +1 -1
- data/lib/ramaze/cache/memory.rb +1 -1
- data/lib/ramaze/cache/yaml_store.rb +1 -1
- data/lib/ramaze/contrib.rb +1 -1
- data/lib/ramaze/contrib/auto_params.rb +12 -5
- data/lib/ramaze/contrib/auto_params/get_args.rb +1 -0
- data/lib/ramaze/contrib/facebook.rb +23 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +168 -0
- data/lib/ramaze/contrib/gettext.rb +111 -0
- data/lib/ramaze/contrib/gettext/mo.rb +155 -0
- data/lib/ramaze/contrib/gettext/po.rb +109 -0
- data/lib/ramaze/contrib/gzip_filter.rb +1 -1
- data/lib/ramaze/contrib/route.rb +15 -5
- data/lib/ramaze/contrib/sequel/fill.rb +1 -1
- data/lib/ramaze/controller.rb +10 -4
- data/lib/ramaze/controller/error.rb +5 -13
- data/lib/ramaze/controller/main.rb +2 -0
- data/lib/ramaze/controller/resolve.rb +18 -10
- data/lib/ramaze/dispatcher.rb +1 -1
- data/lib/ramaze/dispatcher/action.rb +1 -1
- data/lib/ramaze/dispatcher/directory.rb +3 -2
- data/lib/ramaze/dispatcher/error.rb +5 -5
- data/lib/ramaze/dispatcher/file.rb +13 -2
- data/lib/ramaze/error.rb +1 -1
- data/lib/ramaze/gestalt.rb +2 -2
- data/lib/ramaze/global.rb +5 -5
- data/lib/ramaze/global/dsl.rb +1 -1
- data/lib/ramaze/global/globalstruct.rb +11 -5
- data/lib/ramaze/helper.rb +1 -1
- data/lib/ramaze/helper/aspect.rb +1 -1
- data/lib/ramaze/helper/auth.rb +2 -2
- data/lib/ramaze/helper/cache.rb +1 -1
- data/lib/ramaze/helper/cgi.rb +1 -1
- data/lib/ramaze/helper/file.rb +1 -1
- data/lib/ramaze/helper/flash.rb +1 -1
- data/lib/ramaze/helper/formatting.rb +1 -1
- data/lib/ramaze/helper/identity.rb +1 -1
- data/lib/ramaze/helper/inform.rb +1 -1
- data/lib/ramaze/helper/link.rb +4 -4
- data/lib/ramaze/helper/markaby.rb +1 -1
- data/lib/ramaze/helper/nitroform.rb +1 -1
- data/lib/ramaze/helper/pager.rb +2 -1
- data/lib/ramaze/helper/partial.rb +1 -1
- data/lib/ramaze/helper/redirect.rb +6 -1
- data/lib/ramaze/helper/sequel.rb +54 -0
- data/lib/ramaze/helper/stack.rb +1 -1
- data/lib/ramaze/inform.rb +1 -1
- data/lib/ramaze/inform/analogger.rb +1 -1
- data/lib/ramaze/inform/growl.rb +1 -1
- data/lib/ramaze/inform/hub.rb +1 -1
- data/lib/ramaze/inform/informer.rb +1 -1
- data/lib/ramaze/inform/informing.rb +2 -2
- data/lib/ramaze/inform/knotify.rb +1 -1
- data/lib/ramaze/inform/syslog.rb +1 -1
- data/lib/ramaze/inform/xosd.rb +1 -1
- data/lib/ramaze/snippets.rb +1 -1
- data/lib/ramaze/snippets/array/put_within.rb +1 -1
- data/lib/ramaze/snippets/blankslate.rb +7 -0
- data/lib/ramaze/snippets/dictionary.rb +6 -1
- data/lib/ramaze/snippets/divide.rb +1 -1
- data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
- data/lib/ramaze/snippets/kernel/acquire.rb +39 -0
- data/lib/ramaze/snippets/kernel/aquire.rb +1 -34
- data/lib/ramaze/snippets/kernel/constant.rb +1 -1
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +1 -1
- data/lib/ramaze/snippets/numeric/filesize_format.rb +1 -1
- data/lib/ramaze/snippets/object/traits.rb +1 -1
- data/lib/ramaze/snippets/ordered_set.rb +12 -7
- data/lib/ramaze/snippets/ramaze/caller_info.rb +1 -1
- data/lib/ramaze/snippets/ramaze/caller_lines.rb +1 -1
- data/lib/ramaze/snippets/string/camel_case.rb +1 -1
- data/lib/ramaze/snippets/string/color.rb +2 -4
- data/lib/ramaze/snippets/string/each.rb +1 -1
- data/lib/ramaze/snippets/string/ord.rb +15 -0
- data/lib/ramaze/snippets/string/snake_case.rb +1 -1
- data/lib/ramaze/snippets/struct/fill.rb +4 -2
- data/lib/ramaze/snippets/struct/values_at.rb +2 -2
- data/lib/ramaze/snippets/symbol/to_proc.rb +15 -8
- data/lib/ramaze/snippets/thread/into.rb +1 -1
- data/lib/ramaze/sourcereload.rb +4 -3
- data/lib/ramaze/spec/helper.rb +85 -32
- data/lib/ramaze/spec/helper/bacon.rb +7 -0
- data/lib/ramaze/spec/helper/browser.rb +1 -2
- data/lib/ramaze/spec/helper/mock_http.rb +1 -1
- data/lib/ramaze/spec/helper/pretty_output.rb +70 -0
- data/lib/ramaze/spec/helper/requester.rb +1 -1
- data/lib/ramaze/spec/helper/simple_http.rb +5 -4
- data/lib/ramaze/spec/helper/snippets.rb +6 -0
- data/lib/ramaze/store/default.rb +1 -1
- data/lib/ramaze/template.rb +1 -1
- data/lib/ramaze/template/amrita2.rb +6 -5
- data/lib/ramaze/template/erubis.rb +1 -1
- data/lib/ramaze/template/ezamar.rb +1 -1
- data/lib/ramaze/template/ezamar/element.rb +1 -1
- data/lib/ramaze/template/ezamar/engine.rb +1 -1
- data/lib/ramaze/template/ezamar/morpher.rb +1 -1
- data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
- data/lib/ramaze/template/haml.rb +1 -1
- data/lib/ramaze/template/liquid.rb +1 -1
- data/lib/ramaze/template/markaby.rb +1 -1
- data/lib/ramaze/template/nagoro.rb +4 -6
- data/lib/ramaze/template/none.rb +1 -1
- data/lib/ramaze/template/remarkably.rb +1 -1
- data/lib/ramaze/template/sass.rb +1 -1
- data/lib/ramaze/tool.rb +1 -1
- data/lib/ramaze/tool/create.rb +7 -1
- data/lib/ramaze/tool/localize.rb +7 -14
- data/lib/ramaze/tool/mime.rb +1 -1
- data/lib/ramaze/tool/record.rb +1 -1
- data/lib/ramaze/trinity.rb +1 -1
- data/lib/ramaze/trinity/request.rb +4 -2
- data/lib/ramaze/trinity/response.rb +1 -1
- data/lib/ramaze/trinity/session.rb +7 -1
- data/lib/ramaze/version.rb +3 -3
- data/lib/vendor/bacon.rb +317 -0
- data/rake_tasks/conf.rake +1 -1
- data/rake_tasks/maintenance.rake +7 -5
- data/rake_tasks/spec.rake +54 -40
- data/spec/contrib/auto_params.rb +21 -4
- data/spec/contrib/route.rb +31 -4
- data/spec/contrib/sequel/fill.rb +3 -4
- data/spec/examples/caching.rb +5 -2
- data/spec/examples/css.rb +5 -2
- data/spec/examples/element.rb +5 -4
- data/spec/examples/hello.rb +1 -0
- data/spec/examples/linking.rb +18 -0
- data/spec/examples/simple.rb +13 -18
- data/spec/examples/templates/template_amrita2.rb +3 -2
- data/spec/examples/templates/template_erubis.rb +3 -2
- data/spec/examples/templates/template_ezamar.rb +2 -1
- data/spec/examples/templates/template_haml.rb +3 -2
- data/spec/examples/templates/template_liquid.rb +3 -2
- data/spec/examples/templates/template_markaby.rb +3 -2
- data/spec/examples/templates/template_remarkably.rb +3 -2
- data/spec/ramaze/action/basics.rb +4 -4
- data/spec/ramaze/action/cache.rb +11 -13
- data/spec/ramaze/action/layout.rb +47 -3
- data/spec/ramaze/action/render.rb +3 -3
- data/spec/ramaze/action/template/instancevars/layout.xhtml +1 -0
- data/spec/ramaze/adapter.rb +7 -7
- data/spec/ramaze/adapter/mongrel.rb +1 -1
- data/spec/ramaze/adapter/record.rb +7 -7
- data/spec/ramaze/adapter/webrick.rb +1 -1
- data/spec/ramaze/cache.rb +6 -8
- data/spec/ramaze/controller.rb +77 -65
- data/spec/ramaze/controller/resolve.rb +2 -1
- data/spec/ramaze/controller/template_resolving.rb +3 -4
- data/spec/ramaze/dispatcher.rb +3 -4
- data/spec/ramaze/dispatcher/directory.rb +35 -35
- data/spec/ramaze/dispatcher/file.rb +8 -5
- data/spec/ramaze/element.rb +4 -4
- data/spec/ramaze/error.rb +13 -11
- data/spec/ramaze/gestalt.rb +1 -1
- data/spec/ramaze/helper/aspect.rb +2 -1
- data/spec/ramaze/helper/auth.rb +4 -2
- data/spec/ramaze/helper/cache.rb +10 -9
- data/spec/ramaze/helper/cgi.rb +2 -2
- data/spec/ramaze/helper/file.rb +1 -0
- data/spec/ramaze/helper/flash.rb +5 -4
- data/spec/ramaze/helper/formatting.rb +1 -1
- data/spec/ramaze/helper/link.rb +3 -3
- data/spec/ramaze/helper/pager.rb +44 -80
- data/spec/ramaze/helper/partial.rb +2 -3
- data/spec/ramaze/helper/redirect.rb +10 -1
- data/spec/ramaze/helper/stack.rb +4 -3
- data/spec/ramaze/helper/template/loop.xhtml +2 -1
- data/spec/ramaze/inform/informer.rb +2 -2
- data/spec/ramaze/inform/syslog.rb +1 -1
- data/spec/ramaze/localize.rb +26 -26
- data/spec/ramaze/morpher.rb +6 -7
- data/spec/ramaze/params.rb +7 -8
- data/spec/ramaze/request.rb +27 -6
- data/spec/ramaze/request/mongrel.rb +1 -1
- data/spec/ramaze/request/thin.rb +9 -0
- data/spec/ramaze/session.rb +2 -1
- data/spec/ramaze/store/default.rb +14 -17
- data/spec/ramaze/template.rb +5 -7
- data/spec/ramaze/template/amrita2.rb +4 -1
- data/spec/ramaze/template/erubis.rb +2 -1
- data/spec/ramaze/template/ezamar.rb +2 -3
- data/spec/ramaze/template/ezamar/other__index.xhtml +1 -0
- data/spec/ramaze/template/haml.rb +2 -1
- data/spec/ramaze/template/liquid.rb +4 -2
- data/spec/ramaze/template/markaby.rb +4 -2
- data/spec/ramaze/template/nagoro.rb +3 -4
- data/spec/ramaze/template/remarkably.rb +4 -2
- data/spec/ramaze/template/sass.rb +3 -2
- data/spec/ramaze/template/xslt.rb +4 -7
- data/spec/ramaze/trinity/request.rb +4 -3
- data/spec/ramaze/trinity/session.rb +6 -4
- data/spec/snippets/array/put_within.rb +3 -2
- data/spec/snippets/divide.rb +1 -4
- data/spec/snippets/kernel/__dir__.rb +1 -1
- data/spec/snippets/kernel/acquire.rb +71 -0
- data/spec/snippets/kernel/constant.rb +4 -8
- data/spec/snippets/numeric/filesize_format.rb +1 -1
- data/spec/snippets/ordered_set.rb +9 -2
- data/spec/snippets/ramaze/caller_info.rb +3 -3
- data/spec/snippets/ramaze/caller_lines.rb +3 -3
- data/spec/snippets/string/camel_case.rb +1 -1
- data/spec/snippets/string/color.rb +2 -2
- data/spec/snippets/string/snake_case.rb +5 -1
- data/spec/snippets/string/unindent.rb +1 -1
- data/spec/snippets/struct/fill.rb +14 -15
- data/spec/snippets/struct/values_at.rb +15 -10
- data/spec/snippets/symbol/to_proc.rb +13 -0
- data/spec/snippets/thread/into.rb +3 -4
- metadata +458 -386
- data/doc/README.html +0 -729
- data/doc/changes.txt +0 -5044
- data/doc/changes.xml +0 -5046
- data/lib/proto/public/error.zmr +0 -61
- data/lib/proto/src/element/page.rb +0 -17
- data/lib/proto/src/model.rb +0 -6
- data/lib/proto/template/index.xhtml +0 -15
- data/lib/ramaze/spec/helper/layout.rb +0 -58
- data/lib/ramaze/spec/helper/minimal.rb +0 -23
- data/lib/ramaze/spec/helper/wrap.rb +0 -198
- data/spec/snippets/kernel/aquire.rb +0 -71
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'ramaze'
|
5
|
+
require 'ramaze/spec/helper'
|
6
|
+
|
7
|
+
require __DIR__/'..'/'start'
|
8
|
+
|
9
|
+
describe MainController do
|
10
|
+
behaves_like 'http', 'xpath'
|
11
|
+
ramaze :template_root => __DIR__/'../view',
|
12
|
+
:public_root => __DIR__/'../public'
|
13
|
+
|
14
|
+
it 'should show start page' do
|
15
|
+
got = get('/')
|
16
|
+
got.status.should == 200
|
17
|
+
got.at_xpath('//title').text.strip.should ==
|
18
|
+
MainController.new.index
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should show /notemplate' do
|
22
|
+
got = get('/notemplate')
|
23
|
+
got.status.should == 200
|
24
|
+
got.at_xpath('//body').text.strip.should ==
|
25
|
+
MainController.new.notemplate
|
26
|
+
end
|
27
|
+
end
|
data/lib/proto/start.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
5
|
require 'ramaze'
|
6
6
|
|
7
|
-
require
|
8
|
-
|
9
|
-
|
7
|
+
# require all controllers and models
|
8
|
+
acquire __DIR__/:controller/'*'
|
9
|
+
acquire __DIR__/:model/'*'
|
10
10
|
|
11
|
-
Ramaze.start :port => 7000
|
11
|
+
Ramaze.start :adapter => :webrick, :port => 7000
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<link rel="stylesheet" href="/css/ramaze_error.css" />
|
2
|
+
<script type="text/javascript" src="/js/jquery.js"></script>
|
3
|
+
|
4
|
+
<p>The backtrace gives filenames and line numbers for all parts of the call stack.<br />
|
5
|
+
Click on any of them to view the surrounding source code.</p>
|
6
|
+
|
7
|
+
<table class="main">
|
8
|
+
<tr class="head">
|
9
|
+
<td>File</td><td>Line</td><td>Method</td>
|
10
|
+
</tr>
|
11
|
+
<?r @backtrace.each do |lines, hash, file, lineno, meth| ?>
|
12
|
+
<tr class="line" id="#{hash}">
|
13
|
+
<td>#{file}</td><td class="lineno">#{lineno}</td><td><pre>#{meth}</pre></td>
|
14
|
+
</tr>
|
15
|
+
<tr id="source_#{hash}" style="display:none;">
|
16
|
+
<td colspan="3">
|
17
|
+
<div class="source">
|
18
|
+
<table style="width:100%;">
|
19
|
+
<tr>
|
20
|
+
<td class="editor" colspan="2">
|
21
|
+
#{@editor} #{file} +#{lineno}
|
22
|
+
<div style="float: right">
|
23
|
+
<a href="txmt://open?url=file://#{file}&line=#{lineno}">open in textmate</a>
|
24
|
+
</div>
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
<?r lines.each do |llineno, lcode, lcurrent| ?>
|
28
|
+
<tr class="source" #{'style="background:#faa;"' if lcurrent}>
|
29
|
+
<td class="lineno">#{llineno}</td>
|
30
|
+
<td class="code"><pre>#{lcode.to_s.rstrip}</pre></td>
|
31
|
+
</tr>
|
32
|
+
<?r end ?>
|
33
|
+
</table>
|
34
|
+
</div>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
<?r end ?>
|
38
|
+
</table>
|
39
|
+
|
40
|
+
<?r
|
41
|
+
{ 'Session' => Thread.current[:session],
|
42
|
+
'Request' => Thread.current[:request],
|
43
|
+
'Response' => Thread.current[:response],
|
44
|
+
'Global' => Global,
|
45
|
+
}.each do |title, content|
|
46
|
+
hash = [title, content].object_id.abs
|
47
|
+
?>
|
48
|
+
<div class="additional">
|
49
|
+
<h3 id="#{hash}">#{title}</h3>
|
50
|
+
<pre style="display:none" id="is_#{hash}">#{CGI.escapeHTML(content.pretty_inspect)}</pre>
|
51
|
+
</div>
|
52
|
+
<?r end ?>
|
53
|
+
|
54
|
+
<script type="text/javascript">
|
55
|
+
$("tr.line").click(function(){
|
56
|
+
$("tr#source_"+this.id).toggle()
|
57
|
+
});
|
58
|
+
|
59
|
+
$("div.additional > h3").click(function(){
|
60
|
+
$("pre#is_"+this.id).toggle()
|
61
|
+
});
|
62
|
+
</script>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<p>Ramaze is working correctly with this application, now you can start
|
2
|
+
working.</p>
|
3
|
+
|
4
|
+
<p>To start you can modify:
|
5
|
+
<ol>
|
6
|
+
<li>
|
7
|
+
<code>view/index.xhtml</code>, this page.
|
8
|
+
</li>
|
9
|
+
<li>
|
10
|
+
<code>view/page.xhtml</code>, the layout for this page.
|
11
|
+
</li>
|
12
|
+
<li>
|
13
|
+
<code>controller/main.rb</code>, where you can change the header of this
|
14
|
+
page and the <a href="/notemplate">notemplate</a> action
|
15
|
+
</li>
|
16
|
+
</ol>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<p>For more documentation, check out <a href="http://ramaze.net">www.ramaze.net</a>, which includes:
|
20
|
+
<ul>
|
21
|
+
<li>a <a href="http://ramaze.net/getting-started">getting started</a> guide</li>
|
22
|
+
<li>some <a href="http://ramaze.net/screencasts">screencasts</a></li>
|
23
|
+
<li>and an <a href="http://ramaze.rubyforge.org/tutorial/todolist.html">introductory tutorial</a></li>
|
24
|
+
</ul>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p>You can also read the
|
28
|
+
<a href="http://ramaze.rubyforge.org/rdoc/files/doc/README.html">rdocs</a> or browse
|
29
|
+
around the <a href="http://source.ramaze.net">Ramaze source code</a>.
|
30
|
+
</p>
|
31
|
+
|
32
|
+
<p>For help with Ramaze, visit the <a href="irc://chat.freenode.net/ramaze">#ramaze on irc.freenode.net</a> (you can use <a href="http://java.freenode.net/?channel=ramaze">this browser-based frontend</a>),
|
33
|
+
or post on the <a href="http://groups.google.com/group/ramaze">Ramaze Google Group</a>.
|
34
|
+
</p>
|
data/lib/ramaze.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
require 'fileutils'
|
@@ -10,10 +10,11 @@ end
|
|
10
10
|
|
11
11
|
# The main namespace for Ramaze
|
12
12
|
module Ramaze
|
13
|
-
BASEDIR = File.dirname(File.expand_path(__FILE__))
|
14
13
|
SEEED = $0.dup
|
15
14
|
APPDIR = File.dirname(File.expand_path($0))
|
16
|
-
|
15
|
+
BASEDIR = File.dirname(File.expand_path(__FILE__))
|
16
|
+
$LOAD_PATH.unshift BASEDIR
|
17
|
+
$LOAD_PATH.uniq!
|
17
18
|
end
|
18
19
|
|
19
20
|
Thread.abort_on_exception = true
|
@@ -35,6 +36,7 @@ require 'ramaze/sourcereload'
|
|
35
36
|
require 'ramaze/dispatcher'
|
36
37
|
require 'ramaze/template/ezamar'
|
37
38
|
require 'ramaze/contrib'
|
39
|
+
require 'ramaze/controller/main'
|
38
40
|
|
39
41
|
module Ramaze
|
40
42
|
|
@@ -50,12 +52,12 @@ module Ramaze
|
|
50
52
|
# each class in trait[:essentials] by calling ::startup on them.
|
51
53
|
|
52
54
|
def startup options = {}
|
53
|
-
|
55
|
+
runner = options.delete(:runner) || caller[0].split(':').first
|
54
56
|
|
55
|
-
if $0 ==
|
57
|
+
if $0 == runner or options.delete(:force)
|
56
58
|
Inform.info("Starting up Ramaze (Version #{VERSION})")
|
57
|
-
SEEED.replace(
|
58
|
-
APPDIR.replace(File.dirname(File.expand_path(
|
59
|
+
SEEED.replace(runner)
|
60
|
+
APPDIR.replace(File.dirname(File.expand_path(runner)))
|
59
61
|
|
60
62
|
trait[:essentials].each do |obj|
|
61
63
|
obj.startup(options)
|
data/lib/ramaze/action.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
module Ramaze
|
@@ -84,9 +84,13 @@ module Ramaze
|
|
84
84
|
return default if engines.empty?
|
85
85
|
|
86
86
|
ext = File.extname(template).gsub(/^\./, '')
|
87
|
-
|
87
|
+
ext_engines = engines.reject{|k,v| not v.include?(ext) }
|
88
88
|
|
89
|
-
|
89
|
+
if ext_engines.has_key?(default)
|
90
|
+
self[:engine] = default
|
91
|
+
else
|
92
|
+
self[:engine] = ext_engines.keys.sort.first
|
93
|
+
end
|
90
94
|
end
|
91
95
|
|
92
96
|
# Returns an instance of controller, will be cached on first access.
|
data/lib/ramaze/action/render.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
module Ramaze
|
@@ -82,7 +82,10 @@ module Ramaze
|
|
82
82
|
after_process].join
|
83
83
|
|
84
84
|
if path and tlayout = layout
|
85
|
-
instance
|
85
|
+
[instance, tlayout.instance].each do |i|
|
86
|
+
i.instance_variable_set("@content", content)
|
87
|
+
end
|
88
|
+
|
86
89
|
content = tlayout.render
|
87
90
|
|
88
91
|
# restore Action.current after render above
|
@@ -110,9 +113,16 @@ module Ramaze
|
|
110
113
|
return false
|
111
114
|
end
|
112
115
|
|
113
|
-
layout_action.
|
114
|
-
|
115
|
-
|
116
|
+
unless layout_action.controller == controller
|
117
|
+
instance.instance_variables.each do |x|
|
118
|
+
layout_action.instance.instance_variable_set(x, instance.instance_variable_get(x))
|
119
|
+
end
|
120
|
+
else
|
121
|
+
layout_action.binding = binding
|
122
|
+
layout_action.controller = controller
|
123
|
+
layout_action.instance = instance
|
124
|
+
end
|
125
|
+
|
116
126
|
layout_action.path = nil
|
117
127
|
layout_action
|
118
128
|
end
|
data/lib/ramaze/adapter.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
require 'socket'
|
@@ -39,10 +39,10 @@ module Ramaze
|
|
39
39
|
start_adapter
|
40
40
|
|
41
41
|
Timeout.timeout(3) do
|
42
|
-
sleep 0.01 until Global.adapters.
|
42
|
+
sleep 0.01 until Global.adapters.any?
|
43
43
|
end
|
44
44
|
|
45
|
-
Global.adapters.
|
45
|
+
Global.adapters.each{|a| a.join} unless Global.run_loose
|
46
46
|
|
47
47
|
rescue SystemExit
|
48
48
|
Ramaze.shutdown
|
@@ -79,13 +79,13 @@ module Ramaze
|
|
79
79
|
|
80
80
|
def shutdown
|
81
81
|
Timeout.timeout(1) do
|
82
|
-
Global.adapters.
|
82
|
+
Global.adapters.each do |adapter|
|
83
83
|
a = adapter[:adapter]
|
84
84
|
a.shutdown if a.respond_to?(:shutdown)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
rescue Timeout::Error
|
88
|
-
Global.adapters.
|
88
|
+
Global.adapters.each{|a| a.kill! }
|
89
89
|
# Hard exit! because it won't be able to kill Webrick otherwise
|
90
90
|
exit!
|
91
91
|
end
|
data/lib/ramaze/adapter/base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
module Ramaze
|
@@ -36,7 +36,7 @@ module Ramaze
|
|
36
36
|
def call(env)
|
37
37
|
if Ramaze::Global.benchmarking
|
38
38
|
time = Benchmark.measure{ respond(env) }
|
39
|
-
Inform.debug(
|
39
|
+
Inform.debug('request took %.5fs [~%.0f r/s]' % [time.real, 1.0/time.real])
|
40
40
|
else
|
41
41
|
respond env
|
42
42
|
end
|
data/lib/ramaze/adapter/cgi.rb
CHANGED
data/lib/ramaze/adapter/fcgi.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
require 'ramaze/adapter'
|
@@ -12,7 +12,7 @@ module Ramaze::Adapter
|
|
12
12
|
# start FastCGI in a new thread, host and port parameter are only taken
|
13
13
|
# to make it compatible with other adapters but have no influence and
|
14
14
|
# can be omitted
|
15
|
-
def
|
15
|
+
def run_server host = nil, ports = nil
|
16
16
|
Thread.new do
|
17
17
|
Thread.current[:task] = :cgi
|
18
18
|
Rack::Handler::FastCGI.run(self)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'thin'
|
2
|
+
require 'ramaze/adapter'
|
3
|
+
require 'rack/handler/thin'
|
4
|
+
|
5
|
+
module Ramaze
|
6
|
+
module Adapter
|
7
|
+
|
8
|
+
class Thin < Base
|
9
|
+
class << self
|
10
|
+
|
11
|
+
# start server on given host and port.
|
12
|
+
def run_server host, port
|
13
|
+
server = ::Thin::Server.new(host, port, self)
|
14
|
+
server.silent = true
|
15
|
+
server.timeout = 3
|
16
|
+
server.start
|
17
|
+
|
18
|
+
thread = Thread.new{ server.listen! }
|
19
|
+
thread[:adapter] = server
|
20
|
+
thread
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/ramaze/cache.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
require 'ramaze/cache/memory'
|
@@ -25,7 +25,8 @@ module Ramaze
|
|
25
25
|
# Ramaze.trait(:essentials).
|
26
26
|
|
27
27
|
def startup(options)
|
28
|
-
Cache.add :compiled, :actions, :patterns,
|
28
|
+
Cache.add :compiled, :actions, :patterns,
|
29
|
+
:resolved, :shield, :action_methods
|
29
30
|
end
|
30
31
|
|
31
32
|
# This will define a method to access a new cache directly over
|
data/lib/ramaze/cache/memory.rb
CHANGED
data/lib/ramaze/contrib.rb
CHANGED
@@ -86,13 +86,20 @@ module Ramaze
|
|
86
86
|
# use Method#get_args to insert values from request.params into Action#params
|
87
87
|
|
88
88
|
def self.resolve_method(name, *params)
|
89
|
-
if method = [ name, name.gsub('__','/') ].find{|n|
|
89
|
+
if method = [ name, name.gsub('__','/') ].find{|n|
|
90
|
+
cached_action_methods.include?(n) }
|
90
91
|
meth = instance_method(method)
|
91
92
|
arity = meth.arity
|
92
93
|
|
93
94
|
if meth.respond_to? :get_args
|
94
|
-
Cache.args[name]
|
95
|
-
|
95
|
+
unless args = Cache.args[name]
|
96
|
+
if args = meth.get_args
|
97
|
+
args = args.select{|e| e.to_s !~ /^\*/}
|
98
|
+
else
|
99
|
+
args = []
|
100
|
+
end
|
101
|
+
Cache.args[name] = args
|
102
|
+
end
|
96
103
|
|
97
104
|
param_keys = request.params.keys
|
98
105
|
|
@@ -100,7 +107,7 @@ module Ramaze
|
|
100
107
|
if args.size > params.size or args.find{|k,v| param_keys.include?(k.to_s) }
|
101
108
|
args.each_with_index do |(name, val), i|
|
102
109
|
r_params = request.params[name.to_s]
|
103
|
-
if params[i] and r_params.size > 0
|
110
|
+
if params[i] and r_params and r_params.size > 0
|
104
111
|
params[i] = [params[i], r_params].flatten
|
105
112
|
else
|
106
113
|
params[i] ||= r_params
|
@@ -125,4 +132,4 @@ module Ramaze
|
|
125
132
|
|
126
133
|
end
|
127
134
|
|
128
|
-
end
|
135
|
+
end
|