ramaze 2010.06.18 → 2011.01
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/MANIFEST +9 -16
- data/README.md +37 -30
- data/Rakefile +5 -1
- data/TODO.md +19 -0
- data/doc/AUTHORS +5 -1
- data/doc/CHANGELOG +3553 -3272
- data/doc/tutorial/todolist.html +1512 -1512
- data/examples/app/blog/app.rb +2 -0
- data/examples/app/todolist/controller/init.rb +1 -2
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-21-12.mkd +1 -1
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-23-10.mkd +1 -1
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-45-07.mkd +1 -1
- data/examples/app/wiktacular/mkd/main/current.mkd +1 -1
- data/examples/app/wiktacular/mkd/testing/2007-07-20_16-43-46.mkd +1 -1
- data/examples/app/wiktacular/mkd/testing/2007-07-20_19-43-50.mkd +2 -2
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-08.mkd +16 -16
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-54.mkd +16 -16
- data/examples/app/wiktacular/mkd/testing/current.mkd +16 -16
- data/lib/proto/model/init.rb +1 -1
- data/lib/proto/public/js/jquery.js +2034 -1095
- data/lib/proto/start.rb +2 -0
- data/lib/proto/view/index.xhtml +3 -3
- data/lib/ramaze.rb +1 -2
- data/lib/ramaze/cache.rb +1 -0
- data/lib/ramaze/cache/sequel.rb +131 -37
- data/lib/ramaze/controller.rb +1 -0
- data/lib/ramaze/gestalt.rb +75 -46
- data/lib/ramaze/helper.rb +1 -0
- data/lib/ramaze/helper/auth.rb +38 -4
- data/lib/ramaze/helper/blue_form.rb +498 -78
- data/lib/ramaze/helper/cache.rb +2 -2
- data/lib/ramaze/helper/csrf.rb +225 -0
- data/lib/ramaze/helper/erector.rb +67 -9
- data/lib/ramaze/helper/flash.rb +4 -2
- data/lib/ramaze/helper/gestalt.rb +2 -0
- data/lib/ramaze/helper/gravatar.rb +1 -1
- data/lib/ramaze/helper/localize.rb +4 -0
- data/lib/ramaze/helper/send_file.rb +30 -0
- data/lib/ramaze/helper/thread.rb +5 -0
- data/lib/ramaze/helper/user.rb +4 -3
- data/lib/ramaze/helper/xhtml.rb +87 -8
- data/lib/ramaze/log.rb +13 -0
- data/lib/ramaze/log/analogger.rb +15 -5
- data/lib/ramaze/log/growl.rb +28 -13
- data/lib/ramaze/log/hub.rb +12 -4
- data/lib/ramaze/log/informer.rb +28 -11
- data/lib/ramaze/log/knotify.rb +7 -2
- data/lib/ramaze/log/logger.rb +12 -4
- data/lib/ramaze/log/logging.rb +40 -14
- data/lib/ramaze/log/rotatinginformer.rb +47 -23
- data/lib/ramaze/log/syslog.rb +37 -31
- data/lib/ramaze/log/xosd.rb +7 -4
- data/lib/ramaze/middleware_compiler.rb +2 -2
- data/lib/ramaze/snippets/fiber.rb +63 -63
- data/lib/ramaze/snippets/ramaze/lru_hash.rb +1 -1
- data/lib/ramaze/tool/bin.rb +1 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/ramaze/view.rb +4 -4
- data/lib/ramaze/view/erector.rb +88 -13
- data/ramaze.gemspec +65 -65
- data/spec/ramaze/bin/ramaze.rb +1 -1
- data/spec/ramaze/cache/localmemcache.rb +20 -12
- data/spec/ramaze/cache/sequel.rb +19 -19
- data/spec/ramaze/helper/blue_form.rb +549 -257
- data/spec/ramaze/helper/csrf.rb +109 -0
- data/spec/ramaze/helper/httpdigest.rb +31 -29
- data/spec/ramaze/helper/user.rb +1 -1
- data/spec/ramaze/helper/xhtml.rb +17 -0
- data/spec/ramaze/log/growl.rb +34 -0
- data/spec/ramaze/log/informer.rb +1 -0
- data/spec/ramaze/view/erector.rb +49 -71
- data/spec/ramaze/view/erector/external_view.erector +5 -0
- data/spec/ramaze/view/erector/index.erector +5 -0
- data/spec/ramaze/view/erector/layout.erector +13 -3
- data/spec/ramaze/view/erector/tables.erector +23 -0
- data/spec/ramaze/view/erector/view.erector +6 -0
- data/tasks/git.rake +2 -2
- metadata +133 -176
- data/examples/helpers/form_with_sequel.rb +0 -24
- data/examples/helpers/nitro_form.rb +0 -23
- data/lib/ramaze/helper/form.rb +0 -133
- data/lib/ramaze/helper/nitroform.rb +0 -14
- data/lib/ramaze/helper/pager.rb +0 -367
- data/lib/ramaze/helper/partial.rb +0 -100
- data/lib/ramaze/helper/sequel.rb +0 -55
- data/lib/ramaze/helper/sequel_form.rb +0 -284
- data/lib/vendor/etag.rb +0 -22
- data/spec/ramaze/helper/form.rb +0 -360
- data/spec/ramaze/helper/pager.rb +0 -96
- data/spec/ramaze/helper/sequel_form.rb +0 -94
- data/spec/ramaze/view/erector/external.erector +0 -1
- data/spec/ramaze/view/erector/invoke_helper_method.erector +0 -1
- data/spec/ramaze/view/erector/strict_xhtml.erector +0 -3
- data/spec/ramaze/view/erector/sum.erector +0 -1
@@ -1,94 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
require File.expand_path('../../../../spec/helper', __FILE__)
|
5
|
-
|
6
|
-
spec_requires 'hpricot', 'sequel'
|
7
|
-
|
8
|
-
DB = Sequel.sqlite
|
9
|
-
|
10
|
-
class User < Sequel::Model(:user)
|
11
|
-
plugin :schema
|
12
|
-
|
13
|
-
set_schema do
|
14
|
-
primary_key :id
|
15
|
-
|
16
|
-
boolean :online
|
17
|
-
varchar :name
|
18
|
-
integer :level
|
19
|
-
text :description
|
20
|
-
date :birthday
|
21
|
-
time :created
|
22
|
-
end
|
23
|
-
|
24
|
-
create_table unless table_exists?
|
25
|
-
end
|
26
|
-
|
27
|
-
class FormController < Ramaze::Controller
|
28
|
-
map '/'
|
29
|
-
helper :sequel_form
|
30
|
-
|
31
|
-
def new
|
32
|
-
sequel_form(User).to_s
|
33
|
-
end
|
34
|
-
|
35
|
-
def new_with_options
|
36
|
-
sequel_form(User, :method => :post, :action => r(:create)).to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
def edit(id)
|
40
|
-
sequel_form(User[id]).to_s
|
41
|
-
end
|
42
|
-
|
43
|
-
def edit_with_options(id)
|
44
|
-
sequel_form(User[id], :method => :post, :action => r(:create)).to_s
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe Ramaze::Helper::SequelForm do
|
49
|
-
behaves_like :rack_test
|
50
|
-
|
51
|
-
def hget(uri)
|
52
|
-
got = get(uri)
|
53
|
-
got.status.should == 200
|
54
|
-
Hpricot(got.body)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'provides forms for model class' do
|
58
|
-
form = hget('/new').at(:form)
|
59
|
-
(form/:input).size.should == 5
|
60
|
-
(form/:input).map{|i| i[:name] }.compact.sort.should == %w[level name online]
|
61
|
-
form.at(:textarea)[:name].should == 'description'
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'provides form for model class with options' do
|
65
|
-
form = hget('/new_with_options').at(:form)
|
66
|
-
form.raw_attributes.should == {'action' => '/create', 'method' => 'post'}
|
67
|
-
end
|
68
|
-
|
69
|
-
data = {
|
70
|
-
:name => 'manveru',
|
71
|
-
:description => 'Ramaze dev',
|
72
|
-
:online => true,
|
73
|
-
:level => 2,
|
74
|
-
:birthday => Time.now,
|
75
|
-
:created => Time.now,
|
76
|
-
}
|
77
|
-
User.create(data)
|
78
|
-
|
79
|
-
it 'provides form for instance of model' do
|
80
|
-
form = hget('/edit/1').at(:form)
|
81
|
-
form.at('input[@name=name]').raw_attributes.should ==
|
82
|
-
{ 'name' => 'name', 'type' => 'text', 'value' => data[:name] }
|
83
|
-
form.at('input[@name=online]').raw_attributes.should ==
|
84
|
-
{ "name" => "online", "type" => "checkbox", "checked" => "checked",
|
85
|
-
"value" => data[:online].to_s }
|
86
|
-
form.at('input[@name=level]').raw_attributes.should ==
|
87
|
-
{ "name" => "level", "type" => "text", "value" => data[:level].to_s }
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'provides form with options for instance of model' do
|
91
|
-
hget('/edit_with_options/1').at(:form).raw_attributes.should ==
|
92
|
-
{"action" => "/create", "method" => "post"}
|
93
|
-
end
|
94
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
h1 "External Erector View Template"
|
@@ -1 +0,0 @@
|
|
1
|
-
a(:href => r(:index)) { text "Index page" }
|
@@ -1 +0,0 @@
|
|
1
|
-
p @num1 + @num2
|