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
data/spec/ramaze/template.rb
CHANGED
@@ -31,9 +31,7 @@ class TCTemplateController < Ramaze::Controller
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "testing ramaze template" do
|
34
|
-
|
35
|
-
ramaze
|
36
|
-
end
|
34
|
+
ramaze
|
37
35
|
|
38
36
|
def getpage page
|
39
37
|
content = Ramaze::Controller.handle(page)
|
@@ -45,7 +43,7 @@ describe "testing ramaze template" do
|
|
45
43
|
|
46
44
|
@action.should == "index"
|
47
45
|
@params.should == []
|
48
|
-
@file.should
|
46
|
+
@file.should == nil
|
49
47
|
end
|
50
48
|
|
51
49
|
it "Maps the index" do
|
@@ -53,7 +51,7 @@ describe "testing ramaze template" do
|
|
53
51
|
|
54
52
|
@action.should == "index"
|
55
53
|
@params.should == []
|
56
|
-
@file.should
|
54
|
+
@file.should == nil
|
57
55
|
end
|
58
56
|
|
59
57
|
it "Parses parameters" do
|
@@ -61,7 +59,7 @@ describe "testing ramaze template" do
|
|
61
59
|
|
62
60
|
@action.should == "index"
|
63
61
|
@params.should == %w{one two three}
|
64
|
-
@file.should
|
62
|
+
@file.should == nil
|
65
63
|
end
|
66
64
|
|
67
65
|
it "Knows about other methods" do
|
@@ -69,7 +67,7 @@ describe "testing ramaze template" do
|
|
69
67
|
|
70
68
|
@action.should == "some_other_method"
|
71
69
|
@params.should == []
|
72
|
-
@file.should
|
70
|
+
@file.should == nil
|
73
71
|
end
|
74
72
|
|
75
73
|
it "Uses external template files" do
|
@@ -3,12 +3,14 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'amrita2'
|
7
7
|
|
8
8
|
class TCTemplateAmritaController < Ramaze::Controller
|
9
9
|
template_root __DIR__/:amrita2
|
10
10
|
engine :Amrita2
|
11
11
|
|
12
|
+
private
|
13
|
+
|
12
14
|
def title
|
13
15
|
"hello world"
|
14
16
|
end
|
@@ -19,6 +21,7 @@ class TCTemplateAmritaController < Ramaze::Controller
|
|
19
21
|
end
|
20
22
|
|
21
23
|
describe "Simply calling" do
|
24
|
+
behaves_like 'http'
|
22
25
|
ramaze(:mapping => {'/' => TCTemplateAmritaController})
|
23
26
|
|
24
27
|
it "should respond to /data" do
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'erubis'
|
7
7
|
|
8
8
|
class TCTemplateErubisController < Ramaze::Controller
|
9
9
|
template_root __DIR__/:erubis
|
@@ -24,6 +24,7 @@ class TCTemplateErubisController < Ramaze::Controller
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "Erubis" do
|
27
|
+
behaves_like 'http'
|
27
28
|
ramaze(:mapping => {'/' => TCTemplateErubisController})
|
28
29
|
|
29
30
|
it "index" do
|
@@ -0,0 +1 @@
|
|
1
|
+
This is the index of /other
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'ramaze/template/haml'
|
7
7
|
|
8
8
|
class TCTemplateHamlController < Ramaze::Controller
|
9
9
|
map :/
|
@@ -31,6 +31,7 @@ class TCTemplateHamlLocalsController < Ramaze::Controller
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "Haml templates" do
|
34
|
+
behaves_like 'http'
|
34
35
|
ramaze(:compile => true)
|
35
36
|
|
36
37
|
it "should render" do
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'liquid'
|
7
7
|
|
8
8
|
module ProductsFilter
|
9
9
|
def price(integer)
|
@@ -25,6 +25,7 @@ end
|
|
25
25
|
|
26
26
|
|
27
27
|
class TCTemplateLiquidController < Ramaze::Controller
|
28
|
+
map '/'
|
28
29
|
template_root 'spec/ramaze/template/liquid/'
|
29
30
|
engine :Liquid
|
30
31
|
trait :liquid_options => { :filters => ProductsFilter }
|
@@ -48,7 +49,8 @@ class TCTemplateLiquidController < Ramaze::Controller
|
|
48
49
|
end
|
49
50
|
|
50
51
|
describe "Liquid" do
|
51
|
-
|
52
|
+
behaves_like 'http'
|
53
|
+
ramaze
|
52
54
|
|
53
55
|
it "index" do
|
54
56
|
get('/').body.strip.should == "hi tobi"
|
@@ -3,9 +3,10 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'markaby'
|
7
7
|
|
8
8
|
class TCTemplateMarkabyController < Ramaze::Controller
|
9
|
+
map '/'
|
9
10
|
template_root 'spec/ramaze/template/markaby/'
|
10
11
|
engine :Markaby
|
11
12
|
|
@@ -34,7 +35,8 @@ class TCTemplateMarkabyController < Ramaze::Controller
|
|
34
35
|
end
|
35
36
|
|
36
37
|
describe "Markaby" do
|
37
|
-
|
38
|
+
behaves_like 'http'
|
39
|
+
ramaze
|
38
40
|
|
39
41
|
it "index" do
|
40
42
|
get('/').body.should == '<h1>Markaby Index</h1>'
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
|
-
|
5
|
+
spec_require 'nagoro'
|
6
6
|
|
7
7
|
class TCTemplateNagoroController < Ramaze::Controller
|
8
8
|
map :/
|
@@ -33,9 +33,8 @@ end
|
|
33
33
|
|
34
34
|
|
35
35
|
describe "Nagoro" do
|
36
|
-
|
37
|
-
|
38
|
-
end
|
36
|
+
behaves_like 'http'
|
37
|
+
ramaze
|
39
38
|
|
40
39
|
it "hello world" do
|
41
40
|
get('/World').body.should == 'Hello, World!'
|
@@ -2,9 +2,10 @@
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
|
-
|
5
|
+
spec_require 'remarkably/engines/html'
|
6
6
|
|
7
7
|
class TCTemplateRemarkablyController < Ramaze::Controller
|
8
|
+
map '/'
|
8
9
|
template_root 'spec/ramaze/template/remarkably/'
|
9
10
|
engine :Remarkably
|
10
11
|
|
@@ -31,7 +32,8 @@ class TCTemplateRemarkablyController < Ramaze::Controller
|
|
31
32
|
end
|
32
33
|
|
33
34
|
describe "Remarkably" do
|
34
|
-
|
35
|
+
behaves_like 'http'
|
36
|
+
ramaze
|
35
37
|
|
36
38
|
def retrieve(*url)
|
37
39
|
Ramaze::Controller.handle(*url)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'sass/engine'
|
7
7
|
|
8
8
|
class TCTemplateSassController < Ramaze::Controller
|
9
9
|
map '/'
|
@@ -40,6 +40,7 @@ body
|
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "Sass templates" do
|
43
|
+
behaves_like 'http'
|
43
44
|
ramaze(:compile => true)
|
44
45
|
|
45
46
|
it "should render inline" do
|
@@ -63,6 +64,6 @@ describe "Sass templates" do
|
|
63
64
|
end
|
64
65
|
|
65
66
|
it "should use sass options" do
|
66
|
-
get('/options/test').body.
|
67
|
+
get('/options/test').body.should.not =~ /^ +/
|
67
68
|
end
|
68
69
|
end
|
@@ -3,15 +3,13 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
7
|
-
testcase_requires 'xml/xslt'
|
8
|
-
testcase_requires 'ramaze/gestalt'
|
9
|
-
testcase_requires 'rexml/document'
|
6
|
+
spec_require 'xml/libxml', 'xml/xslt', 'ramaze/gestalt', 'rexml/document'
|
10
7
|
|
11
8
|
class TCTemplateXSLTController < Ramaze::Controller
|
12
9
|
template_root 'spec/ramaze/template/xslt/'
|
13
10
|
engine :XSLT
|
14
11
|
trait :xslt_options => { :fun_xmlns => 'urn:test' }
|
12
|
+
map '/'
|
15
13
|
|
16
14
|
def index
|
17
15
|
gestalt {
|
@@ -66,11 +64,11 @@ class TCTemplateXSLTController < Ramaze::Controller
|
|
66
64
|
def gestalt &block
|
67
65
|
Ramaze::Gestalt.new(&block).to_s
|
68
66
|
end
|
69
|
-
|
70
67
|
end
|
71
68
|
|
72
69
|
describe "XSLT" do
|
73
|
-
|
70
|
+
behaves_like 'http'
|
71
|
+
ramaze
|
74
72
|
|
75
73
|
it "index" do
|
76
74
|
get('/').body.should == "hi tobi"
|
@@ -90,4 +88,3 @@ describe "XSLT" do
|
|
90
88
|
get('/concat_words').body.should == 'oneonetwoonetwothree'
|
91
89
|
end
|
92
90
|
end
|
93
|
-
|
@@ -12,8 +12,9 @@ describe 'Ramaze::Request' do
|
|
12
12
|
|
13
13
|
it 'should show local_net?' do
|
14
14
|
request.local_net?('192.168.0.1').to_s.should == '192.168.0.0'
|
15
|
-
request.local_net?('252.168.0.1').should
|
16
|
-
request('
|
17
|
-
request('REMOTE_ADDR' => '211.3.129.47').local_net?.should
|
15
|
+
request.local_net?('252.168.0.1').should == nil
|
16
|
+
request.local_net?('unknown').should == nil
|
17
|
+
request('REMOTE_ADDR' => '211.3.129.47, 66.249.85.131').local_net?.should == nil
|
18
|
+
request('REMOTE_ADDR' => '211.3.129.47').local_net?.should == nil
|
18
19
|
end
|
19
20
|
end
|
@@ -12,12 +12,14 @@ class TrinitySessionController < Ramaze::Controller
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "Session" do
|
15
|
-
|
16
|
-
|
17
|
-
ramaze
|
18
|
-
}
|
15
|
+
behaves_like 'http'
|
16
|
+
ramaze :sessions => false
|
19
17
|
|
20
18
|
it 'should work without sessions' do
|
19
|
+
class Ramaze::Session
|
20
|
+
remove_const :IP_COUNT_LIMIT
|
21
|
+
const_set(:IP_COUNT_LIMIT, 2)
|
22
|
+
end
|
21
23
|
(Ramaze::Session::IP_COUNT_LIMIT + 2).times do
|
22
24
|
r = get('/')
|
23
25
|
r.body.should == "nothing"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'spec/helper'
|
1
|
+
require 'lib/ramaze/spec/helper/snippets'
|
2
2
|
|
3
3
|
describe 'Array#put_within' do
|
4
4
|
it 'should put a given object at a well-described position' do
|
@@ -11,7 +11,8 @@ describe 'Array#put_within' do
|
|
11
11
|
array = [:foo, :bar, :baz]
|
12
12
|
lambda{
|
13
13
|
array.put_within(:foobar, :after => :foo, :before => :baz)
|
14
|
-
}.should
|
14
|
+
}.should.raise(ArgumentError).
|
15
|
+
message.should == "Too many elements within constrain"
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
data/spec/snippets/divide.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'spec/helper'
|
1
|
+
require 'lib/ramaze/spec/helper/snippets'
|
2
2
|
|
3
3
|
describe 'String#/ and Symbol#/' do
|
4
|
-
|
5
|
-
# check if this is ok in win32
|
6
4
|
it 'should join two strings' do
|
7
5
|
('a' / 'b').should == 'a/b'
|
8
6
|
end
|
@@ -18,5 +16,4 @@ describe 'String#/ and Symbol#/' do
|
|
18
16
|
it 'should be usable in concatenation' do
|
19
17
|
('a' / :b / :c).should == 'a/b/c'
|
20
18
|
end
|
21
|
-
|
22
19
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'lib/ramaze/spec/helper/snippets'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
describe 'acquire' do
|
5
|
+
def require(name)
|
6
|
+
@required << name
|
7
|
+
end
|
8
|
+
|
9
|
+
before do
|
10
|
+
dir = 'tmp_dir_for_acquire'
|
11
|
+
FileUtils.mkdir_p(dir + '/sub')
|
12
|
+
|
13
|
+
%w[ foo.rb bar.rb baz.so baz.yml sub/baz.rb ].
|
14
|
+
each do |path|
|
15
|
+
FileUtils.touch("#{dir}/#{path}")
|
16
|
+
end
|
17
|
+
|
18
|
+
@required = []
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should not load a single file' do
|
22
|
+
acquire 'tmp_dir_for_acquire/foo'
|
23
|
+
@required.should == []
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should load dir' do
|
27
|
+
acquire 'tmp_dir_for_acquire/sub/*'
|
28
|
+
@required.should == %w[
|
29
|
+
tmp_dir_for_acquire/sub/baz.rb]
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should be aliased to acquire' do
|
33
|
+
acquire 'tmp_dir_for_acquire/sub/*'
|
34
|
+
@required.should.not.be.empty
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should load {so,rb}, not others' do
|
38
|
+
acquire 'tmp_dir_for_acquire/*'
|
39
|
+
@required.sort.should == %w[
|
40
|
+
tmp_dir_for_acquire/bar.rb
|
41
|
+
tmp_dir_for_acquire/baz.so
|
42
|
+
tmp_dir_for_acquire/foo.rb]
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should use globbing' do
|
46
|
+
acquire 'tmp_dir_for_acquire/ba*'
|
47
|
+
@required.sort.should == %w[
|
48
|
+
tmp_dir_for_acquire/bar.rb
|
49
|
+
tmp_dir_for_acquire/baz.so]
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should use recursive globbing' do
|
53
|
+
acquire 'tmp_dir_for_acquire/**/*'
|
54
|
+
@required.sort.should == %w[
|
55
|
+
tmp_dir_for_acquire/bar.rb
|
56
|
+
tmp_dir_for_acquire/baz.so
|
57
|
+
tmp_dir_for_acquire/foo.rb
|
58
|
+
tmp_dir_for_acquire/sub/baz.rb]
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should accept multiple arguments' do
|
62
|
+
acquire 'tmp_dir_for_acquire/*', 'tmp_dir_for_acquire/sub/*'
|
63
|
+
@required.sort.should == %w[
|
64
|
+
tmp_dir_for_acquire/bar.rb
|
65
|
+
tmp_dir_for_acquire/baz.so
|
66
|
+
tmp_dir_for_acquire/foo.rb
|
67
|
+
tmp_dir_for_acquire/sub/baz.rb]
|
68
|
+
end
|
69
|
+
|
70
|
+
FileUtils.rm_rf('tmp_dir_for_acquire')
|
71
|
+
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'spec/helper'
|
1
|
+
require 'lib/ramaze/spec/helper/snippets'
|
2
2
|
|
3
3
|
describe 'constant' do
|
4
|
-
|
5
|
-
|
6
4
|
it 'should load from string' do
|
7
5
|
constant('Fixnum').should == Fixnum
|
8
6
|
end
|
@@ -12,16 +10,14 @@ describe 'constant' do
|
|
12
10
|
end
|
13
11
|
|
14
12
|
it 'should handle hierarchy' do
|
15
|
-
constant('
|
13
|
+
constant('Math::PI').should == Math::PI
|
16
14
|
end
|
17
15
|
|
18
16
|
it 'should be callable with explicit self' do
|
19
|
-
|
17
|
+
Math.constant('PI').should == Math::PI
|
20
18
|
end
|
21
19
|
|
22
20
|
it 'should be callable with explicit self' do
|
23
|
-
|
21
|
+
Math.constant('::Math').should == Math
|
24
22
|
end
|
25
|
-
|
26
23
|
end
|
27
|
-
|