ramaze 2009.05 → 2009.06
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/MANIFEST +11 -7
- data/README.md +3 -3
- data/Rakefile +17 -15
- data/bin/ramaze +7 -2
- data/doc/AUTHORS +6 -5
- data/doc/CHANGELOG +10057 -12259
- data/doc/meta/announcement.txt +93 -46
- data/doc/tutorial/todolist.html +22 -58
- data/doc/tutorial/todolist.txt +20 -39
- data/examples/app/wikore/src/model.rb +7 -1
- data/examples/app/wiktacular/template/html_layout.xhtml +1 -1
- data/lib/proto/config.ru +5 -1
- data/lib/ramaze/cache/localmemcache.rb +1 -1
- data/lib/ramaze/cache/memcache.rb +26 -1
- data/lib/ramaze/cache/sequel.rb +9 -6
- data/lib/ramaze/contrib/addressable_route.rb +55 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +4 -4
- data/lib/ramaze/controller.rb +28 -18
- data/lib/ramaze/gestalt.rb +1 -1
- data/lib/ramaze/helper/auth.rb +0 -5
- data/lib/ramaze/helper/cache.rb +0 -9
- data/lib/ramaze/helper/form.rb +14 -2
- data/lib/ramaze/helper/formatting.rb +1 -1
- data/lib/ramaze/helper/layout.rb +97 -0
- data/lib/ramaze/helper/link.rb +6 -25
- data/lib/ramaze/helper/paginate.rb +2 -2
- data/lib/ramaze/helper/user.rb +3 -3
- data/lib/ramaze/helper.rb +1 -0
- data/lib/ramaze/setup.rb +22 -9
- data/lib/ramaze/spec/bacon.rb +34 -0
- data/lib/ramaze/spec/helper/template_examples.rb +13 -23
- data/lib/ramaze/spec.rb +8 -9
- data/lib/ramaze/tool/bin.rb +16 -6
- data/lib/ramaze/tool/project_creator.rb +1 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/ramaze.rb +8 -8
- data/lib/vendor/etag.rb +4 -2
- data/lib/vendor/route_exceptions.rb +6 -11
- data/ramaze.gemspec +52 -8
- data/spec/contrib/addressable_route.rb +32 -0
- data/spec/contrib/rest.rb +1 -1
- data/spec/examples/caching.rb +1 -1
- data/spec/examples/css.rb +1 -1
- data/spec/examples/element.rb +1 -1
- data/spec/examples/hello.rb +1 -1
- data/spec/examples/helpers/httpdigest.rb +1 -1
- data/spec/examples/linking.rb +1 -1
- data/spec/examples/simple.rb +1 -1
- data/spec/examples/templates/template_erubis.rb +3 -2
- data/spec/examples/templates/template_ezamar.rb +3 -2
- 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 +5 -4
- data/spec/examples/templates/template_nagoro.rb +3 -3
- data/spec/examples/templates/template_redcloth.rb +3 -2
- data/spec/examples/templates/template_remarkably.rb +3 -2
- data/spec/examples/templates/template_tenjin.rb +3 -2
- data/spec/helper.rb +1 -2
- data/spec/ramaze/app.rb +1 -1
- data/spec/ramaze/bin/ramaze.rb +91 -0
- data/spec/ramaze/cache/memcache.rb +6 -0
- data/spec/ramaze/controller/actionless_templates.rb +1 -1
- data/spec/ramaze/controller/lonely_mapping.rb +16 -0
- data/spec/ramaze/controller/mapping.rb +0 -14
- data/spec/ramaze/controller/provide_inheritance.rb +1 -1
- data/spec/ramaze/controller/resolve.rb +1 -1
- data/spec/ramaze/controller/subclass.rb +1 -1
- data/spec/ramaze/controller/template_resolving.rb +1 -1
- data/spec/ramaze/dispatcher/directory.rb +1 -1
- data/spec/ramaze/dispatcher/file.rb +7 -7
- data/spec/ramaze/error.rb +2 -2
- data/spec/ramaze/files.rb +1 -1
- data/spec/ramaze/helper/auth.rb +1 -1
- data/spec/ramaze/helper/bench.rb +2 -1
- data/spec/ramaze/helper/cache.rb +1 -1
- data/spec/ramaze/helper/flash.rb +1 -1
- data/spec/ramaze/helper/form.rb +2 -2
- data/spec/ramaze/helper/httpdigest.rb +3 -3
- data/spec/ramaze/helper/layout/default.xhtml +5 -0
- data/spec/ramaze/helper/layout.rb +79 -0
- data/spec/ramaze/helper/link.rb +32 -11
- data/spec/ramaze/helper/localize.rb +1 -1
- data/spec/ramaze/helper/maruku.rb +1 -1
- data/spec/ramaze/helper/pager.rb +1 -1
- data/spec/ramaze/helper/paginate.rb +1 -1
- data/spec/ramaze/helper/request_accessor.rb +1 -1
- data/spec/ramaze/helper/sequel_form.rb +1 -1
- data/spec/ramaze/helper/simple_captcha.rb +1 -1
- data/spec/ramaze/helper/stack.rb +1 -1
- data/spec/ramaze/helper/user.rb +1 -1
- data/spec/ramaze/params.rb +4 -5
- data/spec/ramaze/session/memcache.rb +66 -0
- data/spec/ramaze/view/erubis.rb +1 -1
- data/spec/ramaze/view/ezamar.rb +1 -1
- data/spec/ramaze/view/gestalt.rb +1 -1
- data/spec/ramaze/view/haml.rb +1 -1
- data/spec/ramaze/view/liquid.rb +1 -1
- data/spec/ramaze/view/nagoro.rb +1 -1
- data/spec/ramaze/view/redcloth.rb +1 -1
- data/spec/ramaze/view/remarkably.rb +1 -1
- data/spec/ramaze/view/sass.rb +1 -1
- data/spec/ramaze/view/tagz.rb +1 -1
- data/spec/ramaze/view/tenjin.rb +1 -1
- data/spec/ramaze/view.rb +1 -1
- data/tasks/changelog.rake +3 -1
- data/tasks/{gem_installer.rake → gem_setup.rake} +45 -22
- data/tasks/release.rake +6 -4
- data/tasks/setup.rake +3 -21
- data/tasks/todo.rake +2 -4
- metadata +164 -10
- data/CHANGELOG +0 -16918
- data/doc/tutorial/todolist.mkd +0 -787
- data/lib/ramaze/snippets/divide.rb +0 -22
- data/lib/ramaze/snippets/object/acquire.rb +0 -37
- data/spec/snippets/kernel/constant.rb +0 -23
- data/tasks/install_dependencies.rake +0 -6
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
require 'ramaze/contrib/addressable_route'
|
3
|
+
|
4
|
+
class SpecAddressableRoute < Ramaze::Controller
|
5
|
+
map '/'
|
6
|
+
|
7
|
+
def order__show(*args)
|
8
|
+
[args, request.params].inspect
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'addressable routing' do
|
13
|
+
behaves_like :rack_test
|
14
|
+
|
15
|
+
RAR = Ramaze::AddressableRoute
|
16
|
+
RAR.map('/customer/{customer_id}/order/{order_id}', '/order/show')
|
17
|
+
|
18
|
+
Ramaze.middleware! :spec do |m|
|
19
|
+
m.use RAR
|
20
|
+
m.run Ramaze::AppMap
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should route based on URI template' do
|
24
|
+
body = eval(get('/customer/12/order/15').body)
|
25
|
+
body.should == [[], {'customer_id' => '12', 'order_id' => '15'}]
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should not route URIs that don't match" do
|
29
|
+
get('/order/nothing/15')
|
30
|
+
last_response.status.should == 404
|
31
|
+
end
|
32
|
+
end
|
data/spec/contrib/rest.rb
CHANGED
@@ -13,7 +13,7 @@ class Posts < Ramaze::Controller
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'Contrib REST rewrite' do
|
16
|
-
behaves_like :
|
16
|
+
behaves_like :rack_test
|
17
17
|
|
18
18
|
it('rewrites GET to show'){ get('/').body.should == 'Showing' }
|
19
19
|
it('rewrites POST to create'){ post('/').body.should == 'Creating' }
|
data/spec/examples/caching.rb
CHANGED
data/spec/examples/css.rb
CHANGED
data/spec/examples/element.rb
CHANGED
data/spec/examples/hello.rb
CHANGED
data/spec/examples/linking.rb
CHANGED
data/spec/examples/simple.rb
CHANGED
@@ -4,6 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'erubis'
|
5
5
|
require 'examples/templates/template_erubis'
|
6
6
|
|
7
|
-
describe 'Template Erubis' do
|
8
|
-
|
7
|
+
describe 'Template Erubis' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'Erubis'
|
9
10
|
end
|
@@ -4,6 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'ezamar'
|
5
5
|
require 'examples/templates/template_ezamar'
|
6
6
|
|
7
|
-
describe 'Template Ezamar' do
|
8
|
-
|
7
|
+
describe 'Template Ezamar' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'Ezamar'
|
9
10
|
end
|
@@ -4,6 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'haml'
|
5
5
|
require 'examples/templates/template_haml'
|
6
6
|
|
7
|
-
describe 'Template Haml' do
|
8
|
-
|
7
|
+
describe 'Template Haml' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'Haml'
|
9
10
|
end
|
@@ -4,6 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'liquid'
|
5
5
|
require 'examples/templates/template_liquid'
|
6
6
|
|
7
|
-
describe 'Template Liquid' do
|
8
|
-
|
7
|
+
describe 'Template Liquid' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'Liquid'
|
9
10
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'spec/helper'
|
2
2
|
require 'ramaze/spec/helper/template_examples'
|
3
3
|
|
4
|
-
#spec_require 'markaby'
|
5
|
-
#require 'examples/templates/template_markaby'
|
4
|
+
# spec_require 'markaby'
|
5
|
+
# require 'examples/templates/template_markaby'
|
6
6
|
|
7
|
-
describe 'Template Markaby' do
|
8
|
-
|
7
|
+
describe 'Template Markaby' do
|
8
|
+
# behaves_like :template_spec
|
9
|
+
# spec_template 'Markaby'
|
9
10
|
it("isn't yet implemented"){ should.flunk('needed Ramaze::View::Markaby') }
|
10
11
|
end
|
@@ -4,7 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'nagoro'
|
5
5
|
require 'examples/templates/template_nagoro'
|
6
6
|
|
7
|
-
describe 'Template Nagoro' do
|
8
|
-
|
7
|
+
describe 'Template Nagoro' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'Nagoro'
|
9
10
|
end
|
10
|
-
|
@@ -4,6 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'redcloth'
|
5
5
|
spec_require 'examples/templates/template_redcloth'
|
6
6
|
|
7
|
-
describe 'Template RedCloth' do
|
8
|
-
|
7
|
+
describe 'Template RedCloth' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'RedCloth'
|
9
10
|
end
|
@@ -4,6 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'remarkably/engines/html'
|
5
5
|
require 'examples/templates/template_remarkably'
|
6
6
|
|
7
|
-
describe 'Template Remarkably' do
|
8
|
-
|
7
|
+
describe 'Template Remarkably' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'Remarkably'
|
9
10
|
end
|
@@ -4,6 +4,7 @@ require 'ramaze/spec/helper/template_examples'
|
|
4
4
|
spec_require 'tenjin'
|
5
5
|
require 'examples/templates/template_tenjin'
|
6
6
|
|
7
|
-
describe 'Template Tenjin' do
|
8
|
-
|
7
|
+
describe 'Template Tenjin' do
|
8
|
+
behaves_like :template_spec
|
9
|
+
spec_template 'Tenjin'
|
9
10
|
end
|
data/spec/helper.rb
CHANGED
@@ -4,7 +4,6 @@ if caller_line = caller.grep(%r!spec/ramaze/!).first
|
|
4
4
|
$0 = caller_file
|
5
5
|
end
|
6
6
|
|
7
|
-
require File.expand_path(
|
8
|
-
require 'ramaze/spec'
|
7
|
+
require File.expand_path('../../lib/ramaze/spec/bacon', __FILE__)
|
9
8
|
|
10
9
|
Ramaze.options.roots = [caller_root] if caller_root
|
data/spec/ramaze/app.rb
CHANGED
@@ -0,0 +1,91 @@
|
|
1
|
+
require "spec/helper"
|
2
|
+
require "ramaze/tool/bin"
|
3
|
+
require "pathname"
|
4
|
+
module Ramaze
|
5
|
+
BINPATH = Pathname.new(Ramaze::ROOT).join("..", "bin", "ramaze").expand_path
|
6
|
+
end
|
7
|
+
|
8
|
+
USAGE = <<TXT
|
9
|
+
|
10
|
+
Usage:
|
11
|
+
ramaze <start [PIDFILE]|stop [PIDFILE]|restart [PIDFILE]|status [PIDFILE]|create PROJECT|console> [ruby/rack options]
|
12
|
+
|
13
|
+
Commands:
|
14
|
+
|
15
|
+
* All commands which take an optional PIDFILE (defaults to PROJECT.pid otherwise).
|
16
|
+
* All commands which start a ramaze instance will default to webrick on port 7000
|
17
|
+
unless you supply the rack options -p/--port PORT and/or * -s/--server SERVER.
|
18
|
+
|
19
|
+
start - Starts an instance of this application.
|
20
|
+
|
21
|
+
stop - Stops a running instance of this application.
|
22
|
+
|
23
|
+
restart - Stops running instance of this application, then starts it back up. Pidfile
|
24
|
+
(if supplied) is used for both stop and start.
|
25
|
+
|
26
|
+
status - Gives status of a running ramaze instance
|
27
|
+
|
28
|
+
create - Creates a new prototype Ramaze application in a directory named PROJECT in
|
29
|
+
the current directory. ramaze create foo would make ./foo containing an
|
30
|
+
application prototype. Rack options are ignored here.
|
31
|
+
|
32
|
+
console - Starts an irb console with app.rb (and irb completion) loaded. This command
|
33
|
+
ignores rack options, ARGV is passed on to IRB.
|
34
|
+
|
35
|
+
|
36
|
+
Ruby options:
|
37
|
+
-e, --eval LINE evaluate a LINE of code
|
38
|
+
-d, --debug set debugging flags (set $DEBUG to true)
|
39
|
+
-w, --warn turn warnings on for your script
|
40
|
+
-I, --include PATH specify $LOAD_PATH (may be used more than once)
|
41
|
+
-r, --require LIBRARY require the library, before executing your script
|
42
|
+
|
43
|
+
Rack options:
|
44
|
+
-s, --server SERVER serve using SERVER (webrick/mongrel)
|
45
|
+
-o, --host HOST listen on HOST (default: 0.0.0.0)
|
46
|
+
-p, --port PORT use PORT (default: 9292)
|
47
|
+
-E, --env ENVIRONMENT use ENVIRONMENT for defaults (default: development)
|
48
|
+
-D, --daemonize run daemonized in the background
|
49
|
+
-P, --pid FILE file to store PID (default: rack.pid)
|
50
|
+
|
51
|
+
Common options:
|
52
|
+
-h, --help Show this message
|
53
|
+
--version Show version
|
54
|
+
TXT
|
55
|
+
|
56
|
+
describe "bin/ramaze command" do
|
57
|
+
it "Can find the ramaze binary" do
|
58
|
+
Ramaze::BINPATH.file?.should == true
|
59
|
+
end
|
60
|
+
|
61
|
+
it "Shows command line help" do
|
62
|
+
output = `#{Ramaze::BINPATH} -h`
|
63
|
+
output.should == USAGE
|
64
|
+
end
|
65
|
+
|
66
|
+
it "Shows the correct version" do
|
67
|
+
output = %x{#{Ramaze::BINPATH} --version}
|
68
|
+
output.strip.should == Ramaze::VERSION
|
69
|
+
end
|
70
|
+
|
71
|
+
it "Can create a new tree from prototype" do
|
72
|
+
require "fileutils"
|
73
|
+
root = Pathname.new("/tmp/test_tree")
|
74
|
+
raise "#{root} already exists, please move it out of the way before running this test" if root.directory?
|
75
|
+
begin
|
76
|
+
output = %x{#{Ramaze::BINPATH} create #{root}}
|
77
|
+
root.directory?.should.be.true
|
78
|
+
root.join("config.ru").file?.should.be.true
|
79
|
+
root.join("start.rb").file?.should.be.true
|
80
|
+
root.join("controller").directory?.should.be.true
|
81
|
+
root.join("controller", "init.rb").file?.should.be.true
|
82
|
+
root.join("view").directory?.should.be.true
|
83
|
+
root.join("model").directory?.should.be.true
|
84
|
+
root.join("model", "init.rb").file?.should.be.true
|
85
|
+
ensure
|
86
|
+
FileUtils.rm_rf(root)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
@@ -45,6 +45,12 @@ describe Ramaze::Cache::MemCache do
|
|
45
45
|
cache.fetch(:hello).should == nil
|
46
46
|
end
|
47
47
|
|
48
|
+
should 'amend the ttl if it is too high' do
|
49
|
+
ttl = Ramaze::Cache::MemCache::MAX_TTL + 1
|
50
|
+
cache.store(:hello, @hello, :ttl => ttl)
|
51
|
+
cache.fetch(:hello).should == @hello
|
52
|
+
end
|
53
|
+
|
48
54
|
should 'clear' do
|
49
55
|
cache.store(:hello, @hello)
|
50
56
|
cache.fetch(:hello).should == @hello
|
@@ -23,7 +23,7 @@ class SpecActionlessTemplatesLayout < Ramaze::Controller
|
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "Testing Actionless Templates" do
|
26
|
-
behaves_like :
|
26
|
+
behaves_like :rack_test
|
27
27
|
|
28
28
|
it "should not find template file for non existant method" do
|
29
29
|
get('/list').status.should == 404
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
|
3
|
+
|
4
|
+
class SpecHello < Ramaze::Controller
|
5
|
+
def index
|
6
|
+
'automatically mapped'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'Lonely Controller automap' do
|
11
|
+
behaves_like :rack_test
|
12
|
+
|
13
|
+
it 'automatically creates an app and maps the controller into it' do
|
14
|
+
get('/').body.should == 'automatically mapped'
|
15
|
+
end
|
16
|
+
end
|
@@ -41,17 +41,3 @@ describe 'Controller::generate_mapping' do
|
|
41
41
|
gen(Class.new.name).should == nil
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
45
|
-
class SpecControllerMapping < Ramaze::Controller
|
46
|
-
def index
|
47
|
-
'automatically mapped'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'Controller automap' do
|
52
|
-
behaves_like :mock
|
53
|
-
|
54
|
-
it 'automatically creates an app and maps the controller into it' do
|
55
|
-
get('/spec_controller_mapping').body.should == 'automatically mapped'
|
56
|
-
end
|
57
|
-
end
|
@@ -25,7 +25,7 @@ class SpecControllerInheritedYetAnother < SpecControllerInheritedAnother
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe 'Ramaze::Controller#self.inherited' do
|
28
|
-
behaves_like :
|
28
|
+
behaves_like :rack_test
|
29
29
|
|
30
30
|
should 'default renders nagoro' do
|
31
31
|
get('/').body.should == "<p>Main is nagoro</p>"
|