ramaze 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +52 -19
- data/bin/ramaze +19 -6
- data/doc/CHANGELOG +33 -0
- data/doc/COPYING +1 -1
- data/doc/FAQ +92 -0
- data/doc/GPL +340 -0
- data/doc/INSTALL +34 -0
- data/doc/ProjectInfo +53 -0
- data/doc/README +187 -110
- data/doc/readme_chunks/appendix.txt +13 -0
- data/doc/readme_chunks/examples.txt +38 -0
- data/doc/readme_chunks/features.txt +82 -0
- data/doc/readme_chunks/getting_help.txt +5 -0
- data/doc/readme_chunks/getting_started.txt +18 -0
- data/doc/readme_chunks/installing.txt +41 -0
- data/doc/readme_chunks/introduction.txt +18 -0
- data/doc/readme_chunks/principles.txt +41 -0
- data/doc/readme_chunks/thanks.txt +59 -0
- data/doc/tutorial/todolist.txt +546 -0
- data/examples/blog/main.rb +1 -1
- data/examples/blog/src/controller.rb +13 -11
- data/examples/blog/src/element.rb +11 -6
- data/examples/blog/src/model.rb +8 -23
- data/examples/blog/template/edit.xhtml +3 -1
- data/examples/blog/template/index.xhtml +4 -4
- data/examples/caching.rb +4 -4
- data/examples/element.rb +10 -7
- data/examples/hello.rb +3 -4
- data/examples/simple.rb +5 -3
- data/examples/templates/template/external.amrita +19 -0
- data/examples/templates/template/{external.rmze → external.zmr} +2 -2
- data/examples/templates/template_amrita2.rb +48 -0
- data/examples/templates/template_erubis.rb +5 -2
- data/examples/templates/{template_ramaze.rb → template_ezamar.rb} +13 -7
- data/examples/templates/template_haml.rb +4 -1
- data/examples/templates/template_liquid.rb +2 -1
- data/examples/templates/template_markaby.rb +2 -1
- data/examples/todolist/conf/benchmark.yaml +35 -0
- data/examples/todolist/conf/debug.yaml +34 -0
- data/examples/todolist/conf/live.yaml +33 -0
- data/examples/todolist/conf/silent.yaml +31 -0
- data/examples/todolist/conf/stage.yaml +33 -0
- data/examples/todolist/main.rb +18 -0
- data/examples/todolist/public/404.jpg +0 -0
- data/examples/todolist/public/css/coderay.css +105 -0
- data/examples/todolist/public/css/ramaze_error.css +42 -0
- data/{lib/proto → examples/todolist}/public/error.xhtml +0 -0
- data/examples/todolist/public/favicon.ico +0 -0
- data/examples/todolist/public/js/jquery.js +1923 -0
- data/examples/todolist/public/ramaze.png +0 -0
- data/examples/todolist/src/controller/main.rb +56 -0
- data/examples/todolist/src/element/page.rb +26 -0
- data/examples/todolist/src/model.rb +14 -0
- data/examples/todolist/template/index.xhtml +17 -0
- data/examples/todolist/template/new.xhtml +7 -0
- data/examples/todolist/todolist.db +9 -0
- data/examples/whywiki/main.rb +3 -8
- data/examples/whywiki/template/show.xhtml +4 -0
- data/lib/proto/public/error.zmr +77 -0
- data/lib/proto/src/controller/main.rb +2 -1
- data/lib/proto/src/element/page.rb +2 -1
- data/lib/proto/src/model.rb +3 -2
- data/lib/ramaze.rb +7 -9
- data/lib/ramaze/adapter.rb +51 -0
- data/lib/ramaze/adapter/cgi.rb +23 -0
- data/lib/ramaze/adapter/fcgi.rb +22 -0
- data/lib/ramaze/adapter/mongrel.rb +7 -86
- data/lib/ramaze/adapter/webrick.rb +14 -133
- data/lib/ramaze/cache/memcached.rb +6 -0
- data/lib/ramaze/cache/yaml_store.rb +3 -1
- data/lib/ramaze/controller.rb +292 -2
- data/lib/ramaze/dispatcher.rb +85 -213
- data/lib/ramaze/error.rb +10 -0
- data/lib/ramaze/global.rb +8 -0
- data/lib/ramaze/helper/aspect.rb +30 -7
- data/lib/ramaze/helper/auth.rb +16 -9
- data/lib/ramaze/helper/cache.rb +40 -35
- data/lib/ramaze/helper/feed.rb +1 -1
- data/lib/ramaze/helper/flash.rb +34 -0
- data/lib/ramaze/helper/link.rb +8 -2
- data/lib/ramaze/helper/openid.rb +63 -0
- data/lib/ramaze/helper/redirect.rb +12 -11
- data/lib/ramaze/helper/stack.rb +5 -7
- data/lib/ramaze/inform.rb +12 -1
- data/lib/ramaze/snippets/kernel/aquire.rb +1 -1
- data/lib/ramaze/snippets/kernel/{self_method.rb → method.rb} +3 -18
- data/lib/ramaze/snippets/kernel/{rescue_require.rb → pretty_inspect.rb} +7 -6
- data/lib/ramaze/snippets/method/name.rb +22 -0
- data/lib/ramaze/snippets/{kernel → ramaze}/autoreload.rb +0 -0
- data/lib/ramaze/snippets/ramaze/caller_info.rb +14 -0
- data/lib/ramaze/snippets/{kernel → ramaze}/caller_lines.rb +3 -10
- data/lib/ramaze/snippets/rdoc/usage_no_exit.rb +49 -23
- data/lib/ramaze/snippets/string/DIVIDE.rb +0 -1
- data/lib/ramaze/store/default.rb +58 -2
- data/lib/ramaze/store/yaml.rb +161 -0
- data/lib/ramaze/template.rb +27 -86
- data/lib/ramaze/template/amrita2.rb +14 -19
- data/lib/ramaze/template/erubis.rb +15 -38
- data/lib/ramaze/template/ezamar.rb +100 -0
- data/lib/ramaze/template/ezamar/element.rb +166 -0
- data/lib/ramaze/template/ezamar/engine.rb +124 -0
- data/lib/ramaze/template/ezamar/morpher.rb +155 -0
- data/lib/ramaze/template/haml.rb +16 -43
- data/lib/ramaze/template/liquid.rb +11 -51
- data/lib/ramaze/template/markaby.rb +44 -42
- data/lib/ramaze/tool/mime.rb +18 -0
- data/lib/ramaze/tool/mime_types.yaml +615 -0
- data/lib/ramaze/trinity/request.rb +20 -196
- data/lib/ramaze/trinity/response.rb +4 -33
- data/lib/ramaze/trinity/session.rb +150 -72
- data/lib/ramaze/version.rb +1 -1
- data/spec/adapter_spec.rb +20 -0
- data/spec/public/favicon.ico +0 -0
- data/spec/public/ramaze.png +0 -0
- data/spec/public/test_download.css +141 -0
- data/spec/{tc_request.rb → request_tc_helper.rb} +45 -21
- data/spec/spec_all.rb +77 -34
- data/spec/spec_helper.rb +8 -157
- data/spec/spec_helper_context.rb +72 -0
- data/spec/spec_helper_requester.rb +52 -0
- data/spec/spec_helper_simple_http.rb +433 -0
- data/spec/tc_adapter_mongrel.rb +3 -15
- data/spec/tc_adapter_webrick.rb +4 -14
- data/spec/tc_cache.rb +3 -5
- data/spec/tc_controller.rb +22 -12
- data/spec/tc_dependencies.rb +13 -0
- data/spec/tc_element.rb +8 -7
- data/spec/tc_error.rb +13 -7
- data/spec/tc_global.rb +16 -18
- data/spec/tc_helper_aspect.rb +2 -4
- data/spec/tc_helper_auth.rb +15 -14
- data/spec/tc_helper_cache.rb +5 -7
- data/spec/tc_helper_feed.rb +0 -2
- data/spec/tc_helper_flash.rb +103 -0
- data/spec/tc_helper_form.rb +4 -6
- data/spec/tc_helper_link.rb +1 -3
- data/spec/tc_helper_redirect.rb +23 -8
- data/spec/tc_helper_stack.rb +31 -15
- data/spec/tc_morpher.rb +1 -3
- data/spec/tc_params.rb +48 -7
- data/spec/tc_request_mongrel.rb +9 -0
- data/spec/tc_request_webrick.rb +5 -0
- data/spec/tc_session.rb +41 -25
- data/spec/tc_store.rb +55 -6
- data/spec/tc_store_yaml.rb +71 -0
- data/spec/tc_template_amrita2.rb +3 -3
- data/spec/tc_template_erubis.rb +2 -3
- data/spec/{tc_template_ramaze.rb → tc_template_ezamar.rb} +15 -5
- data/spec/tc_template_haml.rb +4 -3
- data/spec/tc_template_liquid.rb +3 -4
- data/spec/tc_template_markaby.rb +4 -6
- data/spec/tc_tidy.rb +1 -3
- data/spec/template/amrita2/{data.html → data.amrita} +0 -0
- data/spec/template/amrita2/{index.html → index.amrita} +0 -0
- data/spec/template/amrita2/{sum.html → sum.amrita} +0 -0
- data/spec/template/ezamar/another/long/action.zmr +1 -0
- data/spec/template/ezamar/combined.zmr +1 -0
- data/spec/template/{ramaze/file_only.rmze → ezamar/file_only.zmr} +0 -0
- data/spec/template/{ramaze/index.rmze → ezamar/index.zmr} +0 -0
- data/spec/template/{ramaze/nested.rmze → ezamar/nested.zmr} +0 -0
- data/spec/template/ezamar/some__long__action.zmr +1 -0
- data/spec/template/{ramaze/sum.rmze → ezamar/sum.zmr} +0 -0
- metadata +181 -123
- data/doc/allison/LICENSE +0 -184
- data/doc/allison/README +0 -37
- data/doc/allison/allison.css +0 -300
- data/doc/allison/allison.gif +0 -0
- data/doc/allison/allison.js +0 -307
- data/doc/allison/allison.rb +0 -287
- data/doc/allison/cache/BODY +0 -588
- data/doc/allison/cache/CLASS_INDEX +0 -4
- data/doc/allison/cache/CLASS_PAGE +0 -1
- data/doc/allison/cache/FILE_INDEX +0 -4
- data/doc/allison/cache/FILE_PAGE +0 -1
- data/doc/allison/cache/FONTS +0 -1
- data/doc/allison/cache/FR_INDEX_BODY +0 -1
- data/doc/allison/cache/IMGPATH +0 -1
- data/doc/allison/cache/INDEX +0 -1
- data/doc/allison/cache/JAVASCRIPT +0 -307
- data/doc/allison/cache/METHOD_INDEX +0 -4
- data/doc/allison/cache/METHOD_LIST +0 -1
- data/doc/allison/cache/SRC_PAGE +0 -1
- data/doc/allison/cache/STYLE +0 -322
- data/doc/allison/cache/URL +0 -1
- data/doc/changes.txt +0 -2021
- data/doc/changes.xml +0 -2024
- data/lib/ramaze/snippets/kernel/silently.rb +0 -13
- data/lib/ramaze/snippets/thread/deadQUESTIONMARK.rb +0 -11
- data/lib/ramaze/template/haml/actionview_stub.rb +0 -20
- data/lib/ramaze/template/ramaze.rb +0 -177
- data/lib/ramaze/template/ramaze/element.rb +0 -166
- data/lib/ramaze/template/ramaze/morpher.rb +0 -156
- data/spec/tc_test.rb +0 -17
data/spec/tc_adapter_mongrel.rb
CHANGED
|
@@ -5,20 +5,8 @@ require 'spec/spec_helper'
|
|
|
5
5
|
|
|
6
6
|
testcase_requires 'mongrel'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class TCAdapterController < Template::Ramaze
|
|
11
|
-
def index
|
|
12
|
-
"The index"
|
|
13
|
-
end
|
|
8
|
+
def ramaze_options
|
|
9
|
+
{ :adapter => :mongrel }
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
context "multiple" do
|
|
18
|
-
ramaze :mapping => {'/' => TCAdapterController}, :port => '7001..7003', :adapter => :mongrel
|
|
19
|
-
|
|
20
|
-
specify "simple request" do
|
|
21
|
-
get('/').should == "The index"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
12
|
+
require 'spec/adapter_spec'
|
data/spec/tc_adapter_webrick.rb
CHANGED
|
@@ -3,20 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
testcase_requires 'webrick'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"The index"
|
|
11
|
-
end
|
|
8
|
+
def ramaze_options
|
|
9
|
+
{ :adapter => :webrick }
|
|
12
10
|
end
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
context "multiple" do
|
|
16
|
-
ramaze :mapping => {'/' => TCAdapterController}, :port => '7001..7003', :adapter => :webrick
|
|
17
|
-
|
|
18
|
-
specify "simple request" do
|
|
19
|
-
get('/').should == "The index"
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
12
|
+
require 'spec/adapter_spec'
|
data/spec/tc_cache.rb
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
include Ramaze
|
|
7
|
-
|
|
8
6
|
context "MemoryCache" do
|
|
9
|
-
cache = MemoryCache.new
|
|
7
|
+
cache = Ramaze::MemoryCache.new
|
|
10
8
|
|
|
11
9
|
specify "delete" do
|
|
12
10
|
cache.delete(:one)
|
|
@@ -29,7 +27,7 @@ context "MemoryCache" do
|
|
|
29
27
|
end
|
|
30
28
|
|
|
31
29
|
context "YAMLStoreCache" do
|
|
32
|
-
cache = YAMLStoreCache.new
|
|
30
|
+
cache = Ramaze::YAMLStoreCache.new
|
|
33
31
|
|
|
34
32
|
specify "delete" do
|
|
35
33
|
cache.delete(:one)
|
|
@@ -53,7 +51,7 @@ end
|
|
|
53
51
|
|
|
54
52
|
begin
|
|
55
53
|
context "MemcachedCache" do
|
|
56
|
-
cache = MemcachedCache.new
|
|
54
|
+
cache = Ramaze::MemcachedCache.new
|
|
57
55
|
|
|
58
56
|
specify "delete" do
|
|
59
57
|
cache.delete(:one)
|
data/spec/tc_controller.rb
CHANGED
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TCControllerRamazeController < Template::Ramaze
|
|
6
|
+
class TCControllerEzamarController < Ramaze::Controller
|
|
7
|
+
trait :template_root => 'spec/template/ezamar'
|
|
9
8
|
def index
|
|
10
|
-
|
|
9
|
+
@text = "World"
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
def sum first, second
|
|
14
|
-
first.to_i
|
|
13
|
+
@num1, @num2 = first.to_i, second.to_i
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def some__long__action
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def another__long__action
|
|
15
20
|
end
|
|
16
21
|
|
|
17
22
|
private
|
|
@@ -20,20 +25,25 @@ class TCControllerRamazeController < Template::Ramaze
|
|
|
20
25
|
end
|
|
21
26
|
end
|
|
22
27
|
|
|
23
|
-
context "Testing
|
|
24
|
-
ramaze(:mapping => {'/
|
|
28
|
+
context "Testing Ezamar" do
|
|
29
|
+
ramaze(:mapping => {'/ezamar' => TCControllerEzamarController})
|
|
25
30
|
|
|
26
31
|
specify "simple request to index" do
|
|
27
|
-
get('/
|
|
32
|
+
get('/ezamar').should == 'Hello, World!'
|
|
28
33
|
end
|
|
29
34
|
|
|
30
35
|
specify "summing two values" do
|
|
31
|
-
get('/
|
|
36
|
+
get('/ezamar/sum/1/2').should == '3'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
specify "double underscore in templates" do
|
|
40
|
+
get('/ezamar/some/long/action').should == 'some long action'
|
|
41
|
+
get('/ezamar/another/long/action').should == 'another long action'
|
|
32
42
|
end
|
|
33
43
|
|
|
34
44
|
specify "should not respond to private methods" do
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
%w[ session request response find_template handle_request trait test_private ].each do |action|
|
|
46
|
+
lambda{get("/ramaze/#{action}")}.should_raise
|
|
47
|
+
end
|
|
38
48
|
end
|
|
39
49
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
require 'spec/spec_helper'
|
|
5
|
+
|
|
6
|
+
testcase_requires 'rubygems'
|
|
7
|
+
|
|
8
|
+
context "dependencies" do
|
|
9
|
+
specify "no gems" do
|
|
10
|
+
gems = $:.grep(/gems/).reject{|g| g =~ /rspec|rack/}
|
|
11
|
+
gems.should == []
|
|
12
|
+
end
|
|
13
|
+
end
|
data/spec/tc_element.rb
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
class TCElementController < Ramaze::Controller
|
|
7
|
+
trait :engine => Ramaze::Template::Ezamar
|
|
7
8
|
|
|
8
|
-
class TCElementController < Template::Ramaze
|
|
9
9
|
def index
|
|
10
10
|
"The index"
|
|
11
11
|
end
|
|
@@ -37,31 +37,32 @@ class TCElementController < Template::Ramaze
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
class Page < Element
|
|
40
|
+
class Page < Ezamar::Element
|
|
41
41
|
def render
|
|
42
42
|
%{ <wrap> #{content} </wrap> }
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
class PageWithParams < Ezamar::Element
|
|
47
48
|
def render
|
|
48
49
|
@hash.inspect
|
|
49
50
|
end
|
|
50
51
|
end
|
|
51
52
|
|
|
52
|
-
class PageLittle < Element
|
|
53
|
+
class PageLittle < Ezamar::Element
|
|
53
54
|
def render
|
|
54
55
|
"little"
|
|
55
56
|
end
|
|
56
57
|
end
|
|
57
58
|
|
|
58
|
-
class PageLittleWithParams < Element
|
|
59
|
+
class PageLittleWithParams < Ezamar::Element
|
|
59
60
|
def render
|
|
60
61
|
@hash.inspect
|
|
61
62
|
end
|
|
62
63
|
end
|
|
63
64
|
|
|
64
|
-
class PageWithTemplating < Element
|
|
65
|
+
class PageWithTemplating < Ezamar::Element
|
|
65
66
|
def render
|
|
66
67
|
(1..@hash['times']).to_a.join(', ')
|
|
67
68
|
end
|
data/spec/tc_error.rb
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
|
+
require 'open-uri'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TCErrorController < Template::Ramaze
|
|
7
|
+
class TCErrorController < Ramaze::Controller
|
|
9
8
|
def index
|
|
10
9
|
self.class.name
|
|
11
10
|
end
|
|
@@ -13,11 +12,18 @@ end
|
|
|
13
12
|
|
|
14
13
|
context "Error" do
|
|
15
14
|
context "in dispatcher" do
|
|
16
|
-
ramaze :mapping => {'/' => TCErrorController}, :error_page => true
|
|
15
|
+
ramaze :mapping => {'/' => TCErrorController }, :error_page => true
|
|
16
|
+
|
|
17
|
+
specify "your illegal stuff" do
|
|
18
|
+
lambda{ get('/def/illegal') }.should_raise RuntimeError, /Net::HTTPNotFound/
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context "no controller" do
|
|
23
|
+
Ramaze::Global.mapping = {}
|
|
17
24
|
|
|
18
|
-
specify "
|
|
19
|
-
get('/').
|
|
20
|
-
get('/1').should =~ /NoAction/
|
|
25
|
+
specify "your illegal stuff" do
|
|
26
|
+
lambda{ get('/def/illegal') }.should_raise RuntimeError, /Net::HTTPNotFound/
|
|
21
27
|
end
|
|
22
28
|
end
|
|
23
29
|
end
|
data/spec/tc_global.rb
CHANGED
|
@@ -3,44 +3,42 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
context "Global" do
|
|
6
|
+
context "Ramaze::Global" do
|
|
9
7
|
specify "just simple assignment and retrive" do
|
|
10
|
-
Global.some = :xxx
|
|
11
|
-
Global.some.should == :xxx
|
|
8
|
+
Ramaze::Global.some = :xxx
|
|
9
|
+
Ramaze::Global.some.should == :xxx
|
|
12
10
|
end
|
|
13
11
|
|
|
14
12
|
specify "setup" do
|
|
15
|
-
Global.setup :a => :b
|
|
16
|
-
Global.a.should == :b
|
|
17
|
-
Global.some.should == :xxx
|
|
18
|
-
Global.setup :a => :c
|
|
19
|
-
Global.a.should == :c
|
|
13
|
+
Ramaze::Global.setup :a => :b
|
|
14
|
+
Ramaze::Global.a.should == :b
|
|
15
|
+
Ramaze::Global.some.should == :xxx
|
|
16
|
+
Ramaze::Global.setup :a => :c
|
|
17
|
+
Ramaze::Global.a.should == :c
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
specify "more neat stuff" do
|
|
23
|
-
Global.update :a => :d, :foo => :bar
|
|
24
|
-
Global.a.should == :c
|
|
25
|
-
Global.foo.should == :bar
|
|
21
|
+
Ramaze::Global.update :a => :d, :foo => :bar
|
|
22
|
+
Ramaze::Global.a.should == :c
|
|
23
|
+
Ramaze::Global.foo.should == :bar
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
specify "values_at" do
|
|
29
|
-
Global.values_at(:a, :foo).should == [:c, :bar]
|
|
27
|
+
Ramaze::Global.values_at(:a, :foo).should == [:c, :bar]
|
|
30
28
|
end
|
|
31
29
|
|
|
32
30
|
specify "getting thready" do
|
|
33
|
-
Global[:i] = 0
|
|
31
|
+
Ramaze::Global[:i] = 0
|
|
34
32
|
Thread.main[:i] = 0
|
|
35
33
|
|
|
36
34
|
(1..10).each do |i|
|
|
37
35
|
Thread.new do
|
|
38
|
-
Global[:i] += i
|
|
36
|
+
Ramaze::Global[:i] += i
|
|
39
37
|
Thread.main[:i] += i
|
|
40
38
|
end
|
|
41
39
|
end
|
|
42
40
|
|
|
43
|
-
Global[:i].should == Thread.main[:i]
|
|
44
|
-
Global[:i].should == 55
|
|
41
|
+
Ramaze::Global[:i].should == Thread.main[:i]
|
|
42
|
+
Ramaze::Global[:i].should == 55
|
|
45
43
|
end
|
|
46
44
|
end
|
data/spec/tc_helper_aspect.rb
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TCAspectController < Template::Ramaze
|
|
6
|
+
class TCAspectController < Ramaze::Controller
|
|
9
7
|
helper :aspect
|
|
10
8
|
|
|
11
9
|
def pre_aspect() '<aspect>' end
|
|
@@ -26,7 +24,7 @@ class TCAspectController < Template::Ramaze
|
|
|
26
24
|
wrap :test_wrap, :wrap_aspect
|
|
27
25
|
end
|
|
28
26
|
|
|
29
|
-
class TCAspectAllController <
|
|
27
|
+
class TCAspectAllController < Ramaze::Controller
|
|
30
28
|
helper :aspect
|
|
31
29
|
|
|
32
30
|
def pre_aspect() '<pre>' end
|
data/spec/tc_helper_auth.rb
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TCAuthHelperController < Template::Ramaze
|
|
6
|
+
class TCAuthHelperController < Ramaze::Controller
|
|
9
7
|
helper :auth
|
|
10
8
|
|
|
9
|
+
def index
|
|
10
|
+
self.class.name
|
|
11
|
+
end
|
|
12
|
+
|
|
11
13
|
def session_inspect
|
|
12
14
|
session.inspect
|
|
13
15
|
end
|
|
@@ -45,17 +47,16 @@ context "StackHelper" do
|
|
|
45
47
|
TCAuthMethodHelperController,
|
|
46
48
|
TCAuthLambdaHelperController
|
|
47
49
|
].each do |controller|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
ctx.get('secured').should == ''
|
|
50
|
+
ctx = Context.new('/', Ramaze::Global.mapping.invert[controller])
|
|
51
|
+
|
|
52
|
+
specify controller.to_s do
|
|
53
|
+
Context.new('/', Ramaze::Global.mapping.invert[controller]) do
|
|
54
|
+
get('/secured').should == ''
|
|
55
|
+
post('/login', 'username' => 'manveru', 'password' => 'password')
|
|
56
|
+
get('/secured').should == 'Secret content'
|
|
57
|
+
get('/logout')
|
|
58
|
+
get('/secured').should == ''
|
|
59
|
+
end
|
|
59
60
|
end
|
|
60
61
|
end
|
|
61
62
|
end
|
data/spec/tc_helper_cache.rb
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
require 'spec/spec_helper'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TCCacheHelperController < Template::Ramaze
|
|
6
|
+
class TCCacheHelperController < Ramaze::Controller
|
|
9
7
|
helper :cache
|
|
10
8
|
|
|
9
|
+
trait :actions_cached => [:cached_action]
|
|
10
|
+
|
|
11
11
|
def index
|
|
12
12
|
self.class.name
|
|
13
13
|
end
|
|
@@ -17,7 +17,7 @@ class TCCacheHelperController < Template::Ramaze
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def uncache_value
|
|
20
|
-
value_cache.delete
|
|
20
|
+
value_cache.delete :time
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def cached_action
|
|
@@ -25,11 +25,9 @@ class TCCacheHelperController < Template::Ramaze
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def uncache_actions
|
|
28
|
-
|
|
28
|
+
action_cache.clear
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
cache_actions :cached_action
|
|
32
|
-
|
|
33
31
|
private
|
|
34
32
|
|
|
35
33
|
def random
|
data/spec/tc_helper_feed.rb
CHANGED
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
require 'spec/spec_helper'
|
|
5
|
+
|
|
6
|
+
class TCFlashHelperFirstController < Ramaze::Controller
|
|
7
|
+
helper :flash
|
|
8
|
+
|
|
9
|
+
def index
|
|
10
|
+
self.class.name
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def first_here
|
|
14
|
+
flash[:first] = 'hey'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def then_here
|
|
18
|
+
flash[:first].to_s
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class TCFlashHelperSecondController < Ramaze::Controller
|
|
23
|
+
helper :flash
|
|
24
|
+
|
|
25
|
+
def index
|
|
26
|
+
self.class.name
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def first_here
|
|
30
|
+
flash[:first] = 'hey'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def then_here
|
|
34
|
+
flash[:first].to_s
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class TCFlashHelperThirdController < Ramaze::Controller
|
|
39
|
+
helper :flash
|
|
40
|
+
|
|
41
|
+
def index
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def noop
|
|
45
|
+
'noop'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def set par
|
|
49
|
+
flash[:e] = par
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def retrieve
|
|
53
|
+
flash[:e]
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context "FlashHelper" do
|
|
58
|
+
ramaze :adapter => :mongrel,
|
|
59
|
+
:mapping => {
|
|
60
|
+
'/' => TCFlashHelperFirstController,
|
|
61
|
+
'/second' => TCFlashHelperSecondController,
|
|
62
|
+
'/third' => TCFlashHelperThirdController
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
specify "twice" do
|
|
66
|
+
Context.new('/') do
|
|
67
|
+
get('/first_here')
|
|
68
|
+
get('/then_here').should == 'hey'
|
|
69
|
+
get('/then_here').should == ''
|
|
70
|
+
get('/then_here').should == ''
|
|
71
|
+
get('/first_here')
|
|
72
|
+
get('/then_here').should == 'hey'
|
|
73
|
+
get('/then_here').should == ''
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
specify "over seperate controllers" do
|
|
78
|
+
Context.new do
|
|
79
|
+
get('/first_here')
|
|
80
|
+
get('/second/then_here').should == 'hey'
|
|
81
|
+
get('/then_here').should == ''
|
|
82
|
+
get('/second/then_here').should == ''
|
|
83
|
+
get('/second/first_here')
|
|
84
|
+
get('/then_here').should == 'hey'
|
|
85
|
+
get('/second/then_here').should == ''
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
specify "single" do
|
|
90
|
+
Context.new do
|
|
91
|
+
get('/third/set/foo').should == 'foo'
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
specify "single" do
|
|
96
|
+
Context.new do
|
|
97
|
+
get('/third/set/foo').should == 'foo'
|
|
98
|
+
get('/third/retrieve').should == 'foo'
|
|
99
|
+
get('/third/retrieve').should == ''
|
|
100
|
+
get('/third/retrieve').should == ''
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|