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
@@ -3,6 +3,7 @@ require 'spec/helper'
|
|
3
3
|
require 'examples/templates/template_ezamar'
|
4
4
|
|
5
5
|
describe 'Template Ezamar' do
|
6
|
+
behaves_like 'http'
|
6
7
|
ramaze
|
7
8
|
|
8
9
|
it '/' do
|
@@ -13,7 +14,7 @@ describe 'Template Ezamar' do
|
|
13
14
|
%w[/internal /external].each do |url|
|
14
15
|
it url do
|
15
16
|
html = get(url).body
|
16
|
-
html.
|
17
|
+
html.should.not == nil
|
17
18
|
html.should =~ %r{<title>Template::Ezamar (internal|external)</title>}
|
18
19
|
html.should =~ %r{<h1>The (internal|external) Template for Ezamar</h1>}
|
19
20
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec/helper'
|
2
2
|
|
3
|
-
|
3
|
+
spec_require 'haml'
|
4
4
|
require 'examples/templates/template_haml'
|
5
5
|
|
6
6
|
describe 'Template Haml' do
|
7
|
+
behaves_like 'http'
|
7
8
|
ramaze
|
8
9
|
|
9
10
|
it '/' do
|
@@ -14,7 +15,7 @@ describe 'Template Haml' do
|
|
14
15
|
%w[/internal /external].each do |url|
|
15
16
|
it url do
|
16
17
|
html = get(url).body
|
17
|
-
html.
|
18
|
+
html.should.not == nil
|
18
19
|
html.should =~ %r{<title>Template::Haml (internal|external)</title>}
|
19
20
|
html.should =~ %r{<h1>The (internal|external) Template for Haml</h1>}
|
20
21
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec/helper'
|
2
2
|
|
3
|
-
|
3
|
+
spec_require 'liquid'
|
4
4
|
require 'examples/templates/template_liquid'
|
5
5
|
|
6
6
|
describe 'Template Liquid' do
|
7
|
+
behaves_like 'http'
|
7
8
|
ramaze
|
8
9
|
|
9
10
|
it '/' do
|
@@ -17,7 +18,7 @@ describe 'Template Liquid' do
|
|
17
18
|
response = get(url)
|
18
19
|
response.status.should == 200
|
19
20
|
html = response.body
|
20
|
-
html.
|
21
|
+
html.should.not == nil
|
21
22
|
html.should =~ %r(<title>Template::Liquid #{name}</title>)
|
22
23
|
html.should =~ %r(<h1>The #{name} Template for Liquid</h1>)
|
23
24
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec/helper'
|
2
2
|
|
3
|
-
|
3
|
+
spec_require 'markaby'
|
4
4
|
require 'examples/templates/template_markaby'
|
5
5
|
|
6
6
|
describe 'Template Markaby' do
|
7
|
+
behaves_like 'http'
|
7
8
|
ramaze
|
8
9
|
|
9
10
|
it '/' do
|
@@ -14,7 +15,7 @@ describe 'Template Markaby' do
|
|
14
15
|
%w[/internal /external].each do |url|
|
15
16
|
it url do
|
16
17
|
html = get(url).body
|
17
|
-
html.
|
18
|
+
html.should.not == nil
|
18
19
|
html.should =~ %r{<title>Template::Markaby (internal|external)</title>}
|
19
20
|
html.should =~ %r{<h1>The (internal|external) Template for Markaby</h1>}
|
20
21
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec/helper'
|
2
2
|
|
3
|
-
|
3
|
+
spec_require 'remarkably/engines/html'
|
4
4
|
require 'examples/templates/template_remarkably'
|
5
5
|
|
6
6
|
describe 'Template Remarkably' do
|
7
|
+
behaves_like 'http'
|
7
8
|
ramaze
|
8
9
|
|
9
10
|
it '/' do
|
@@ -14,7 +15,7 @@ describe 'Template Remarkably' do
|
|
14
15
|
%w[/internal /external].each do |url|
|
15
16
|
it url do
|
16
17
|
html = get(url).body
|
17
|
-
html.
|
18
|
+
html.should.not == nil
|
18
19
|
html.should =~ %r{<title>Template::Remarkably (internal|external)</title>}
|
19
20
|
html.should =~ %r{<h1>The (internal|external) Template for Remarkably</h1>}
|
20
21
|
end
|
@@ -5,8 +5,8 @@ describe 'Action() basics' do
|
|
5
5
|
action = Ramaze::Action()
|
6
6
|
|
7
7
|
action.params.should == []
|
8
|
-
action.method.should
|
9
|
-
action.template.should
|
8
|
+
action.method.should == nil
|
9
|
+
action.template.should == nil
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should sanitize parameters' do
|
@@ -23,12 +23,12 @@ describe 'Action() basics' do
|
|
23
23
|
# TODO: in Action.new() raise on init :controller or use a default
|
24
24
|
hsh = Ramaze::Action(:controller=>Object).to_hash
|
25
25
|
hsh[:method].should == nil
|
26
|
-
hsh[:binding].should
|
26
|
+
hsh[:binding].should.instance_of?(Binding)
|
27
27
|
hsh[:controller].should == Object
|
28
28
|
hsh[:engine].should == Ramaze::Template::Ezamar
|
29
29
|
hsh[:params].should == []
|
30
30
|
hsh[:path].should == nil
|
31
|
-
hsh[:instance].should
|
31
|
+
hsh[:instance].should.instance_of?(Object)
|
32
32
|
hsh[:template].should == nil
|
33
33
|
end
|
34
34
|
|
data/spec/ramaze/action/cache.rb
CHANGED
@@ -21,25 +21,23 @@ class TCOtherCache < Ramaze::Controller
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'Action rendering' do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
behaves_like 'http'
|
25
|
+
|
26
|
+
@public_root = __DIR__ / :public
|
27
|
+
FileUtils.mkdir_p @public_root
|
28
|
+
ramaze :file_cache => true
|
29
29
|
|
30
30
|
def req(path) r = get(path); [r.content_type, r.body] end
|
31
31
|
|
32
32
|
it 'should cache to file' do
|
33
|
-
lambda{ req('/') }.
|
34
|
-
File.file?(@public_root/'index').should
|
33
|
+
lambda{ req('/') }.should.not.change{ req('/') }
|
34
|
+
File.file?(@public_root/'index').should == true
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should create subdirs as needed' do
|
38
|
-
lambda{ req('/other') }.
|
39
|
-
File.file?(@public_root/'other'/'index').should
|
38
|
+
lambda{ req('/other') }.should.not.change{ req('/other') }
|
39
|
+
File.file?(@public_root/'other'/'index').should == true
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
42
|
+
FileUtils.rm_rf @public_root
|
43
|
+
end
|
@@ -80,11 +80,46 @@ class TCActionSubLayout < Ramaze::Controller
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
class TCReUseActionLayout < Ramaze::Controller
|
84
|
+
map '/reuse'
|
85
|
+
layout '/wrapper'
|
86
|
+
|
87
|
+
def index
|
88
|
+
'hi'
|
89
|
+
end
|
90
|
+
|
91
|
+
def other_layout
|
92
|
+
"#@title: #@content"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class TCLayoutInstance < Ramaze::Controller
|
97
|
+
map '/reuse_instance'
|
98
|
+
layout '/reuse/other_layout'
|
99
|
+
|
100
|
+
def index
|
101
|
+
@title = 'hello'
|
102
|
+
'world'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class TCLayoutInstanceVars < Ramaze::Controller
|
107
|
+
map '/instancevars'
|
108
|
+
layout :layout
|
109
|
+
|
110
|
+
def layout
|
111
|
+
@title = "layout"
|
86
112
|
end
|
87
113
|
|
114
|
+
def test
|
115
|
+
'test'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe 'Action rendering' do
|
120
|
+
behaves_like 'http'
|
121
|
+
ramaze
|
122
|
+
|
88
123
|
it 'should work with layouts' do
|
89
124
|
get('/').body.should == "<pre>Hello, World!</pre>"
|
90
125
|
get('/foo').body.should == "<pre>bar</pre>"
|
@@ -115,4 +150,13 @@ describe 'Action rendering' do
|
|
115
150
|
it 'should apply relative layouts' do
|
116
151
|
get('/sub').body.should == "<h1>SubWrapper</h1>"
|
117
152
|
end
|
153
|
+
|
154
|
+
it 'should use instance vars defined in the layout action in external templates' do
|
155
|
+
get('/instancevars/test').body.should == 'layout: test'
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'should allow re-using layouts from other controllers' do
|
159
|
+
get('/reuse').body.should == "<pre>hi</pre>"
|
160
|
+
get('/reuse_instance').body.should == "hello: world"
|
161
|
+
end
|
118
162
|
end
|
@@ -16,10 +16,10 @@ class TCActionOne < Ramaze::Controller
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
ramaze
|
20
|
+
|
19
21
|
describe 'Action rendering' do
|
20
|
-
|
21
|
-
ramaze
|
22
|
-
end
|
22
|
+
behaves_like "http"
|
23
23
|
|
24
24
|
it 'should render' do
|
25
25
|
action = Ramaze::Action(:method => :index, :controller => TCActionOne)
|
@@ -0,0 +1 @@
|
|
1
|
+
#@title: #@content
|
data/spec/ramaze/adapter.rb
CHANGED
@@ -4,19 +4,19 @@
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
6
|
class TCAdapterController < Ramaze::Controller
|
7
|
+
map '/'
|
8
|
+
|
7
9
|
def index
|
8
10
|
"The index"
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
14
|
+
ramaze ramaze_options.merge(:spawn => 10)
|
15
|
+
|
12
16
|
describe "Adapter" do
|
13
|
-
|
17
|
+
behaves_like "http"
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
browser do
|
18
|
-
get('/').should == "The index"
|
19
|
-
end
|
20
|
-
end
|
19
|
+
it 'should do a simple request' do
|
20
|
+
get('/').body.should == 'The index'
|
21
21
|
end
|
22
22
|
end
|
@@ -13,18 +13,18 @@ class TCRecordController < Ramaze::Controller
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'Adapter recording' do
|
16
|
-
|
17
|
-
ramaze :adapter => :webrick, :record => lambda{|request|
|
18
|
-
request.remote_addr == '127.0.0.1'
|
19
|
-
}
|
16
|
+
behaves_like 'http'
|
20
17
|
|
21
|
-
|
22
|
-
|
18
|
+
ramaze :adapter => :webrick, :record => lambda{|request|
|
19
|
+
request.remote_addr == '127.0.0.1'
|
20
|
+
}
|
21
|
+
|
22
|
+
@record = Ramaze::Record
|
23
23
|
|
24
24
|
it 'should record' do
|
25
25
|
get('/').body.should == 'The index'
|
26
26
|
get('/foo').body.should == 'The foo'
|
27
|
-
@record.should
|
27
|
+
@record.size.should == 2
|
28
28
|
@record.first.path_info.should == '/'
|
29
29
|
@record.last.path_info.should == '/foo'
|
30
30
|
end
|
data/spec/ramaze/cache.rb
CHANGED
@@ -26,19 +26,15 @@ caches.each do |cache, name|
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "#{name} modification" do
|
29
|
-
|
29
|
+
before do
|
30
30
|
Ramaze::Global.cache = cache
|
31
31
|
@cache = Ramaze::Global.cache.new
|
32
32
|
end
|
33
33
|
|
34
|
-
after
|
34
|
+
after do
|
35
35
|
@cache.clear
|
36
36
|
end
|
37
37
|
|
38
|
-
after :all do
|
39
|
-
FileUtils.rm(@cache.file) if cache == :yaml
|
40
|
-
end
|
41
|
-
|
42
38
|
it "should be assignable with #[]=" do
|
43
39
|
@cache[:foo] = :bar
|
44
40
|
@cache[:foo].should == :bar
|
@@ -52,7 +48,7 @@ caches.each do |cache, name|
|
|
52
48
|
it "should delete keys" do
|
53
49
|
@cache[:bar] = :duh
|
54
50
|
@cache.delete(:bar)
|
55
|
-
@cache[:bar].should
|
51
|
+
@cache[:bar].should == nil
|
56
52
|
end
|
57
53
|
|
58
54
|
it "should show values for multiple keys" do
|
@@ -69,7 +65,9 @@ caches.each do |cache, name|
|
|
69
65
|
Ramaze::Cache.foo[key] = 'foo'
|
70
66
|
Ramaze::Cache.bar[key] = 'bar'
|
71
67
|
|
72
|
-
Ramaze::Cache.foo[key].
|
68
|
+
Ramaze::Cache.foo[key].should.not == Ramaze::Cache.bar[key]
|
73
69
|
end
|
70
|
+
|
71
|
+
FileUtils.rm(@cache.file) if cache == :yaml
|
74
72
|
end
|
75
73
|
end
|
data/spec/ramaze/controller.rb
CHANGED
@@ -40,70 +40,79 @@ describe "Controller" do
|
|
40
40
|
resolve(*url).values_at(:method, :params, :template)
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
],
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
],
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
43
|
+
ramaze :error_page => false
|
44
|
+
@hash = {
|
45
|
+
'/' => [
|
46
|
+
["/", 'index', []]
|
47
|
+
],
|
48
|
+
|
49
|
+
'/foo' => [
|
50
|
+
["/foo", "index", []],
|
51
|
+
["/", "foo__index", []],
|
52
|
+
["/", "foo", []],
|
53
|
+
["/", "index", ["foo"]]
|
54
|
+
|
55
|
+
],
|
56
|
+
|
57
|
+
'/foo/bar' => [
|
58
|
+
["/foo/bar", "index", []],
|
59
|
+
["/foo", "bar__index", []],
|
60
|
+
["/foo", "bar", []],
|
61
|
+
["/foo", "index", ["bar"]],
|
62
|
+
["/", "foo__bar__index", []],
|
63
|
+
["/", "foo__bar", []],
|
64
|
+
["/", "foo__index", ["bar"]],
|
65
|
+
["/", "foo", ["bar"]],
|
66
|
+
["/", "index", ["foo", "bar"]]
|
67
|
+
],
|
68
|
+
|
69
|
+
'/foo/bar/baz' => [
|
70
|
+
["/foo/bar/baz", "index", []],
|
71
|
+
["/foo/bar", "baz__index", []],
|
72
|
+
["/foo/bar", "baz", []],
|
73
|
+
["/foo/bar", "index", ["baz"]],
|
74
|
+
["/foo", "bar__baz__index", []],
|
75
|
+
["/foo", "bar__baz", []],
|
76
|
+
["/foo", "bar__index", ["baz"]],
|
77
|
+
["/foo", "bar", ["baz"]],
|
78
|
+
["/foo", "index", ["bar", "baz"]],
|
79
|
+
["/", "foo__bar__baz__index", []],
|
80
|
+
["/", "foo__bar__baz", []],
|
81
|
+
["/", "foo__bar__index", ["baz"]],
|
82
|
+
["/", "foo__bar", ["baz"]],
|
83
|
+
["/", "foo__index", ["bar", "baz"]],
|
84
|
+
["/", "foo", ["bar", "baz"]],
|
85
|
+
["/", "index", ["foo", "bar", "baz"]]
|
86
|
+
],
|
87
|
+
|
88
|
+
'/foo/bar/baz/oof' => [
|
89
|
+
["/foo/bar/baz/oof", "index", []],
|
90
|
+
["/foo/bar/baz", "oof__index", []],
|
91
|
+
["/foo/bar/baz", "oof", []],
|
92
|
+
["/foo/bar/baz", "index", ["oof"]],
|
93
|
+
["/foo/bar", "baz__oof__index", []],
|
94
|
+
["/foo/bar", "baz__oof", []],
|
95
|
+
["/foo/bar", "baz__index", ["oof"]],
|
96
|
+
["/foo/bar", "baz", ["oof"]],
|
97
|
+
["/foo/bar", "index", ["baz", "oof"]],
|
98
|
+
["/foo", "bar__baz__oof__index", []],
|
99
|
+
["/foo", "bar__baz__oof", []],
|
100
|
+
["/foo", "bar__baz__index", ["oof"]],
|
101
|
+
["/foo", "bar__baz", ["oof"]],
|
102
|
+
["/foo", "bar__index", ["baz", "oof"]],
|
103
|
+
["/foo", "bar", ["baz", "oof"]],
|
104
|
+
["/foo", "index", ["bar", "baz", "oof"]],
|
105
|
+
["/", "foo__bar__baz__oof__index", []],
|
106
|
+
["/", "foo__bar__baz__oof", []],
|
107
|
+
["/", "foo__bar__baz__index", ["oof"]],
|
108
|
+
["/", "foo__bar__baz", ["oof"]],
|
109
|
+
["/", "foo__bar__index", ["baz", "oof"]],
|
110
|
+
["/", "foo__bar", ["baz", "oof"]],
|
111
|
+
["/", "foo__index", ["bar", "baz", "oof"]],
|
112
|
+
["/", "foo", ["bar", "baz", "oof"]],
|
113
|
+
["/", "index", ["foo", "bar", "baz", "oof"]]
|
114
|
+
],
|
115
|
+
}
|
107
116
|
|
108
117
|
it "dry pattern_for" do
|
109
118
|
@hash.each do |path, correct|
|
@@ -142,13 +151,16 @@ describe "Controller" do
|
|
142
151
|
it "double underscore in templates" do
|
143
152
|
handle('/some/long/action').should == 'some long action'
|
144
153
|
handle('/another/long/action').should == 'another long action'
|
154
|
+
handle('/other').should == 'This is the index of /other'
|
145
155
|
end
|
146
156
|
|
147
157
|
TCControllerController.private_methods.sort.each do |action|
|
148
158
|
it action do
|
149
159
|
path = "/#{action}"
|
150
160
|
message = "No Action found for `#{path}' on TCControllerController"
|
151
|
-
lambda{ resolve(path) }.should
|
161
|
+
lambda{ resolve(path) }.should.
|
162
|
+
raise(Ramaze::Error::NoAction).
|
163
|
+
message.should == message
|
152
164
|
end
|
153
165
|
end
|
154
166
|
|