ramaze 0.3.5 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -20
- data/bin/ramaze +0 -4
- data/doc/AUTHORS +5 -0
- data/doc/meta/announcement.txt +2 -1
- data/doc/tutorial/todolist.html +20 -21
- data/doc/tutorial/todolist.mkd +10 -9
- data/examples/blog/{src/controller.rb → controller/main.rb} +2 -0
- data/examples/blog/{src/model.rb → model/entry.rb} +0 -0
- data/examples/blog/spec/blog.rb +3 -3
- data/examples/blog/start.rb +2 -3
- data/examples/blog/view/edit.xhtml +17 -0
- data/examples/blog/view/index.xhtml +17 -0
- data/examples/blog/view/layout.xhtml +11 -0
- data/examples/blog/view/new.xhtml +16 -0
- data/examples/facebook.rb +15 -8
- data/examples/identity.rb +1 -1
- data/examples/memleak_detector.rb +1 -1
- data/examples/rammit/src/model.rb +1 -1
- data/examples/rapaste/controller/paste.rb +7 -7
- data/examples/rapaste/model/paste.rb +1 -3
- data/examples/rapaste/public/css/display.css +2 -1
- data/examples/rapaste/start.rb +2 -3
- data/examples/sourceview/sourceview.rb +1 -1
- data/examples/templates/template/external.tenjin +28 -0
- data/examples/templates/template_amrita2.rb +0 -3
- data/examples/templates/template_tenjin.rb +57 -0
- data/examples/todolist/spec/todolist.rb +13 -2
- data/examples/todolist/src/controller/main.rb +1 -1
- data/examples/todolist/template/index.xhtml +1 -1
- data/examples/wiktacular/spec/wiktacular.rb +18 -0
- data/examples/wiktacular/src/controller.rb +2 -2
- data/examples/wiktacular/src/model.rb +8 -2
- data/lib/proto/public/css/ramaze_error.css +4 -0
- data/lib/proto/public/dispatch.fcgi +11 -0
- data/lib/proto/spec/main.rb +1 -1
- data/lib/proto/start.ru +8 -0
- data/lib/proto/view/error.xhtml +2 -0
- data/lib/ramaze.rb +28 -5
- data/lib/ramaze/action.rb +9 -2
- data/lib/ramaze/action/render.rb +40 -24
- data/lib/ramaze/adapter.rb +10 -17
- data/lib/ramaze/adapter/base.rb +8 -12
- data/lib/ramaze/adapter/cgi.rb +14 -13
- data/lib/ramaze/adapter/ebb.rb +34 -0
- data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
- data/lib/ramaze/adapter/fcgi.rb +14 -14
- data/lib/ramaze/adapter/lsws.rb +15 -11
- data/lib/ramaze/adapter/mongrel.rb +2 -1
- data/lib/ramaze/adapter/scgi.rb +24 -0
- data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
- data/lib/ramaze/adapter/thin.rb +4 -5
- data/lib/ramaze/adapter/webrick.rb +5 -5
- data/lib/ramaze/cache.rb +1 -1
- data/lib/ramaze/cache/memcached.rb +1 -1
- data/lib/ramaze/contrib.rb +70 -10
- data/lib/ramaze/contrib/auto_params.rb +1 -1
- data/lib/ramaze/contrib/email.rb +15 -15
- data/lib/ramaze/contrib/facebook.rb +2 -2
- data/lib/ramaze/contrib/facebook/facebook.rb +7 -4
- data/lib/ramaze/contrib/file_cache.rb +65 -0
- data/lib/ramaze/contrib/gettext.rb +56 -55
- data/lib/ramaze/contrib/profiling.rb +36 -0
- data/lib/ramaze/contrib/sequel_cache.rb +92 -0
- data/lib/ramaze/controller.rb +80 -47
- data/lib/ramaze/controller/error.rb +10 -5
- data/lib/ramaze/controller/resolve.rb +36 -48
- data/lib/ramaze/current.rb +70 -0
- data/lib/ramaze/{trinity → current}/request.rb +62 -15
- data/lib/ramaze/current/response.rb +19 -0
- data/lib/ramaze/{trinity → current}/session.rb +32 -110
- data/lib/ramaze/current/session/flash.rb +67 -0
- data/lib/ramaze/current/session/hash.rb +65 -0
- data/lib/ramaze/dispatcher.rb +1 -28
- data/lib/ramaze/dispatcher/action.rb +6 -3
- data/lib/ramaze/dispatcher/directory.rb +1 -1
- data/lib/ramaze/dispatcher/error.rb +26 -5
- data/lib/ramaze/dispatcher/file.rb +13 -2
- data/lib/ramaze/gestalt.rb +3 -1
- data/lib/ramaze/global.rb +6 -3
- data/lib/ramaze/global/globalstruct.rb +3 -1
- data/lib/ramaze/helper.rb +66 -20
- data/lib/ramaze/helper/aspect.rb +25 -17
- data/lib/ramaze/helper/auth.rb +4 -3
- data/lib/ramaze/helper/cache.rb +5 -4
- data/lib/ramaze/helper/cgi.rb +11 -9
- data/lib/ramaze/helper/flash.rb +28 -3
- data/lib/ramaze/helper/formatting.rb +1 -3
- data/lib/ramaze/helper/identity.rb +2 -3
- data/lib/ramaze/helper/inform.rb +7 -6
- data/lib/ramaze/helper/link.rb +15 -17
- data/lib/ramaze/helper/markaby.rb +2 -4
- data/lib/ramaze/helper/maruku.rb +1 -1
- data/lib/ramaze/helper/nitroform.rb +4 -4
- data/lib/ramaze/helper/pager.rb +4 -6
- data/lib/ramaze/helper/partial.rb +24 -21
- data/lib/ramaze/helper/redirect.rb +8 -5
- data/lib/ramaze/helper/{file.rb → sendfile.rb} +1 -3
- data/lib/ramaze/helper/sequel.rb +1 -3
- data/lib/ramaze/helper/stack.rb +1 -3
- data/lib/ramaze/helper/tagz.rb +19 -0
- data/lib/ramaze/helper/user.rb +63 -0
- data/lib/ramaze/inform.rb +2 -24
- data/lib/ramaze/log.rb +28 -0
- data/lib/ramaze/{inform → log}/analogger.rb +3 -3
- data/lib/ramaze/{inform → log}/growl.rb +2 -2
- data/lib/ramaze/{inform → log}/hub.rb +4 -6
- data/lib/ramaze/{inform → log}/informer.rb +4 -4
- data/lib/ramaze/{inform → log}/knotify.rb +2 -2
- data/lib/ramaze/log/logger.rb +22 -0
- data/lib/ramaze/{inform/informing.rb → log/logging.rb} +16 -16
- data/lib/ramaze/{inform → log}/syslog.rb +0 -0
- data/lib/ramaze/{inform → log}/xosd.rb +2 -2
- data/lib/ramaze/route.rb +64 -36
- data/lib/ramaze/snippets/array/put_within.rb +13 -0
- data/lib/ramaze/snippets/binding/locals.rb +13 -0
- data/lib/ramaze/snippets/kernel/__dir__.rb +10 -8
- data/lib/ramaze/snippets/kernel/aquire.rb +1 -1
- data/lib/ramaze/snippets/kernel/constant.rb +1 -1
- data/lib/ramaze/snippets/object/pretty.rb +6 -0
- data/lib/ramaze/snippets/object/scope.rb +11 -0
- data/lib/ramaze/snippets/object/thread_accessor.rb +5 -0
- data/lib/ramaze/snippets/ordered_set.rb +1 -1
- data/lib/ramaze/snippets/proc/locals.rb +11 -0
- data/lib/ramaze/snippets/ramaze/thread_accessor.rb +44 -0
- data/lib/ramaze/snippets/string/esc.rb +29 -0
- data/lib/ramaze/snippets/string/start_with.rb +7 -0
- data/lib/ramaze/snippets/string/unindent.rb +6 -1
- data/lib/ramaze/snippets/struct/values_at.rb +1 -5
- data/lib/ramaze/sourcereload.rb +16 -14
- data/lib/ramaze/spec.rb +1 -0
- data/lib/ramaze/spec/helper.rb +11 -3
- data/lib/ramaze/spec/helper/browser.rb +25 -1
- data/lib/ramaze/spec/helper/pretty_output.rb +11 -11
- data/lib/ramaze/template.rb +5 -4
- data/lib/ramaze/template/amrita2.rb +2 -3
- data/lib/ramaze/template/ezamar/element.rb +2 -3
- data/lib/ramaze/template/ezamar/morpher.rb +1 -2
- data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
- data/lib/ramaze/template/haml.rb +5 -2
- data/lib/ramaze/template/markaby.rb +2 -0
- data/lib/ramaze/template/tagz.rb +79 -0
- data/lib/ramaze/template/tenjin.rb +34 -0
- data/lib/ramaze/tool/create.rb +0 -3
- data/lib/ramaze/tool/localize.rb +107 -105
- data/lib/ramaze/tool/mime.rb +0 -2
- data/lib/ramaze/trinity.rb +1 -26
- data/lib/ramaze/version.rb +1 -1
- data/lib/vendor/bacon.rb +47 -41
- data/rake_tasks/conf.rake +18 -0
- data/rake_tasks/darcs.rake +5 -0
- data/rake_tasks/maintenance.rake +37 -24
- data/rake_tasks/spec.rake +1 -1
- data/spec/contrib/auto_params.rb +3 -1
- data/spec/contrib/profiling.rb +26 -0
- data/spec/examples/templates/template_redcloth.rb +1 -1
- data/spec/examples/templates/template_tenjin.rb +28 -0
- data/spec/helper.rb +0 -1
- data/spec/ramaze/action/layout.rb +28 -0
- data/spec/ramaze/controller/actionless_templates.rb +32 -0
- data/spec/ramaze/controller/template/other_wrapper.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +37 -0
- data/spec/ramaze/{trinity → current}/request.rb +12 -2
- data/spec/ramaze/current/session.rb +97 -0
- data/spec/ramaze/dispatcher/directory.rb +2 -1
- data/spec/ramaze/dispatcher/file.rb +8 -3
- data/spec/ramaze/dispatcher/public/file name.txt +1 -0
- data/spec/ramaze/gestalt.rb +11 -0
- data/spec/ramaze/helper/aspect.rb +28 -22
- data/spec/ramaze/helper/cgi.rb +2 -2
- data/spec/ramaze/helper/flash.rb +33 -15
- data/spec/ramaze/helper/formatting.rb +2 -2
- data/spec/ramaze/helper/link.rb +46 -18
- data/spec/ramaze/helper/pager.rb +8 -5
- data/spec/ramaze/helper/partial.rb +8 -1
- data/spec/ramaze/helper/template/recursive_local_ivars.xhtml +7 -0
- data/spec/ramaze/helper/user.rb +46 -0
- data/spec/ramaze/{inform → log}/informer.rb +0 -0
- data/spec/ramaze/{inform → log}/syslog.rb +1 -1
- data/spec/ramaze/request.rb +14 -10
- data/spec/ramaze/route.rb +23 -0
- data/spec/ramaze/template.rb +48 -1
- data/spec/ramaze/template/haml.rb +6 -16
- data/spec/ramaze/template/haml/locals.haml +2 -1
- data/spec/ramaze/template/tagz.rb +62 -0
- data/spec/ramaze/template/tagz/external.tagz +8 -0
- data/spec/ramaze/template/tagz/sum.tagz +1 -0
- data/spec/ramaze/template/tenjin.rb +49 -0
- data/spec/ramaze/template/tenjin/external.tenjin +1 -0
- data/spec/snippets/string/unindent.rb +15 -0
- metadata +509 -475
- data/doc/README.html +0 -729
- data/doc/changes.txt +0 -5757
- data/doc/changes.xml +0 -5759
- data/examples/blog/src/view.rb +0 -16
- data/examples/blog/template/edit.xhtml +0 -19
- data/examples/blog/template/index.xhtml +0 -19
- data/examples/blog/template/new.xhtml +0 -18
- data/examples/wiktacular/mkd/newpagename/current.mkd +0 -1
- data/examples/wiktacular/mkd/newpagename/current.mkd.bak +0 -1
- data/lib/ramaze/contrib/email.rb-darcs-backup0 +0 -81
- data/lib/ramaze/template/bijou.rb +0 -39
- data/lib/ramaze/trinity/response.rb +0 -32
- data/spec/ramaze/template/bijou.rb +0 -25
- data/spec/ramaze/trinity/session.rb +0 -29
data/Rakefile
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'rubygems'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
2
6
|
require 'rake'
|
3
7
|
require 'rake/clean'
|
4
8
|
require 'rake/packagetask'
|
@@ -137,25 +141,6 @@ task :todo do
|
|
137
141
|
end
|
138
142
|
end
|
139
143
|
|
140
|
-
desc "show how many patches we made so far"
|
141
|
-
task :patchsize do
|
142
|
-
patches = `darcs changes --reverse`.split("\n")
|
143
|
-
size = patches.reject{|l| l =~ /^\s/ or l.empty?}.size
|
144
|
-
puts "currently we have #{size} patches"
|
145
|
-
puts "shall i now play some Death-Metal for you?" if size == 666
|
146
|
-
days = (Time.now - Time.parse(patches[0])) / (3600*24)
|
147
|
-
puts "#{days.round} days since init, avg #{"%4.2f" % (size/days)} patches per day"
|
148
|
-
end
|
149
|
-
|
150
|
-
desc "show who made how many patches"
|
151
|
-
task :patchstat do
|
152
|
-
total = authors.inject(0.0){|s,(n,a)| s + a[:patches]}
|
153
|
-
authors.sort_by{|k,v| -v[:patches]}.each do |name, author|
|
154
|
-
patches = author[:patches]
|
155
|
-
puts("%s %4d [%6.2f%% ]" % [name, patches, patches/total * 100])
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
144
|
desc "opens a simple readline that makes making requests easier"
|
160
145
|
task 'request' do
|
161
146
|
ARGV.clear
|
data/bin/ramaze
CHANGED
@@ -15,10 +15,6 @@ end
|
|
15
15
|
|
16
16
|
RAMAZE_VERSION = "Ramaze Version #{Ramaze::VERSION}"
|
17
17
|
|
18
|
-
require 'optparse'
|
19
|
-
require 'ostruct'
|
20
|
-
require 'abbrev'
|
21
|
-
|
22
18
|
options = {:origin => :console, :create => false, :force => true}
|
23
19
|
cli_options = Ramaze::CLI_OPTIONS
|
24
20
|
cli_abbrevs = cli_options.map{|o| o.name.to_s}.abbrev
|
data/doc/AUTHORS
CHANGED
@@ -1,19 +1,24 @@
|
|
1
1
|
Following persons (in alphabetical order) have contributed to Ramaze:
|
2
2
|
|
3
3
|
Aman Gupta - aman@ramaze.net
|
4
|
+
Ara T. Howard - ahoward
|
4
5
|
Carlo Zottmann - carlo@zottmann.org
|
5
6
|
Chris Duncan - celldee@gmail.com
|
6
7
|
Christian Neukirchen - chneukirchen@gmail.com
|
7
8
|
Clive Crous - clive@crous.co.za
|
8
9
|
Fabian Buch - fabian.buch@fabian-buch.de
|
9
10
|
Gabriele Renzi - rff.rff@gmail.com
|
11
|
+
Jeremy Evans - code@jeremyevans.net
|
12
|
+
Joe Holt - joe07734@gmail.com
|
10
13
|
Jonathan Buch - john@oxyliquit.de
|
11
14
|
Keita Yamaguchi - keita.yamaguchi@gmail.com
|
12
15
|
Lars Olsson - lasso@lassoweb.se
|
16
|
+
Leo Borisenko - leo.borisenko@gmail.com
|
13
17
|
Martin Hilbig - blueonyx@dev-area.net
|
14
18
|
Michael Fellinger - m.fellinger@gmail.com
|
15
19
|
Pistos - jesuswasramazing.10.pistos@geoshell.com
|
16
20
|
Richard Outten - outtenr@gmail.com
|
21
|
+
Ryan Grove - ryan@wonko.com
|
17
22
|
Stephan Maka - stephan@spaceboyz.net
|
18
23
|
skaar - skaar@waste.org
|
19
24
|
zenix - comp.lang.zenix+ramaze@gmail.com
|
data/doc/meta/announcement.txt
CHANGED
@@ -48,7 +48,8 @@ Special (alphabetic) thanks go to:
|
|
48
48
|
Selected summary of the 62 patches from 0.3.0 to 0.3.5:
|
49
49
|
|
50
50
|
Core
|
51
|
-
- Ramaze::Contrib::Route made available by default as Ramaze::Route
|
51
|
+
- Ramaze::Contrib::Route made available by default as Ramaze::Route
|
52
|
+
(backwards compatibility retained)
|
52
53
|
- Support added for ETag and If-Modified-Since in Dispatcher::File
|
53
54
|
- Adapter for LiteSpeed webserver added
|
54
55
|
- Added ability to set default session cookie options using Session::COOKIE
|
data/doc/tutorial/todolist.html
CHANGED
@@ -70,7 +70,7 @@ RubyForge.</p>
|
|
70
70
|
<p>Additionally, we now have added tests for the resulting application that you
|
71
71
|
can find in spec/examples/todolist.rb</p>
|
72
72
|
|
73
|
-
<p>Date of last update: Thu
|
73
|
+
<p>Date of last update: Thu Jan 31 04:37:16 JST 2008</p>
|
74
74
|
|
75
75
|
<p>Thanks in advance.
|
76
76
|
The author of the tutorial, Michael 'manveru' Fellinger</p>
|
@@ -95,17 +95,16 @@ to-do list.</p>
|
|
95
95
|
So we are going to base this on the tools available, you can just do the same
|
96
96
|
with your ORM or database-library of choice.</p>
|
97
97
|
|
98
|
-
<p>So first,
|
98
|
+
<p>So first, create a <code>model/todolist.rb</code> for our application:</p>
|
99
99
|
|
100
|
-
<pre><code>
|
100
|
+
<pre><code>require 'ramaze/store/default'
|
101
|
+
TodoList = Ramaze::Store::Default.new('todolist.yaml')
|
101
102
|
</code></pre>
|
102
103
|
|
103
104
|
<p>Let's add some items as well to have a base to start from.</p>
|
104
105
|
|
105
|
-
<pre><code>{
|
106
|
-
'Laundry' => {:done => false},
|
106
|
+
<pre><code>{ 'Laundry' => {:done => false},
|
107
107
|
'Wash dishes' => {:done => false},
|
108
|
-
|
109
108
|
}.each do |title, value|
|
110
109
|
TodoList[title] = value
|
111
110
|
end
|
@@ -115,7 +114,7 @@ end
|
|
115
114
|
|
116
115
|
<p>Now let's get our hands dirty and just edit the templates for our to-do list.</p>
|
117
116
|
|
118
|
-
<p>Start with editing <code>
|
117
|
+
<p>Start with editing <code>view/index.xhtml</code>, it is using the default templating
|
119
118
|
of Ramaze, called Ezamar.</p>
|
120
119
|
|
121
120
|
<p>The index.xhtml currently contains a default welcome page, remove the contents.</p>
|
@@ -134,7 +133,7 @@ simple.</p>
|
|
134
133
|
TodoList.each do |title, value|
|
135
134
|
status = value[:done] ? 'done' : 'not done'
|
136
135
|
?>
|
137
|
-
<li>#{title}: #{status}</li>
|
136
|
+
<li>#{c title}: #{status}</li>
|
138
137
|
<?r end ?>
|
139
138
|
</ul>
|
140
139
|
</body>
|
@@ -189,7 +188,7 @@ application and secondly provides excellent ways of changing the complete
|
|
189
188
|
Structure of the Model or View independent from each other.</p>
|
190
189
|
|
191
190
|
<p>OK, enough of the theory, you will see the benefits in an instant. Go on and
|
192
|
-
edit the file <code>
|
191
|
+
edit the file <code>controller/main.rb</code>.</p>
|
193
192
|
|
194
193
|
<p>The contents of it are like following:</p>
|
195
194
|
|
@@ -234,7 +233,7 @@ changed to do following:</p>
|
|
234
233
|
<?r else ?>
|
235
234
|
<ul>
|
236
235
|
<?r @tasks.each do |title, status| ?>
|
237
|
-
<li>#{title}: #{status}</li>
|
236
|
+
<li>#{c title}: #{status}</li>
|
238
237
|
<?r end ?>
|
239
238
|
</ul>
|
240
239
|
<?r end ?>
|
@@ -260,13 +259,13 @@ Tasks it will say so.</p>
|
|
260
259
|
<p>We set out to build the ultimate to-do list, but there are still some things
|
261
260
|
missing. First off, we want to add new tasks, so let's get that done.</p>
|
262
261
|
|
263
|
-
<p>Add a link on the <code>
|
262
|
+
<p>Add a link on the <code>view/index.xhtml</code> like this:</p>
|
264
263
|
|
265
264
|
<pre><code><h1>TodoList</h1>
|
266
265
|
<a href="/new">New Task</a>
|
267
266
|
</code></pre>
|
268
267
|
|
269
|
-
<p>Open a new file <code>
|
268
|
+
<p>Open a new file <code>view/new.xhtml</code> with a form to add a new task.</p>
|
270
269
|
|
271
270
|
<pre><code><html>
|
272
271
|
<head>
|
@@ -321,11 +320,11 @@ and redirect back to the mapping of the current Controller ('/' in this case).</
|
|
321
320
|
<p>Since the nature of tasks is to be done eventually
|
322
321
|
we will need some way to mark it as done or open tasks again.</p>
|
323
322
|
|
324
|
-
<p>Jump into <code>
|
323
|
+
<p>Jump into <code>view/index.xhtml</code> and do the following:</p>
|
325
324
|
|
326
325
|
<pre><code><?r @tasks.each do |title, status, toggle| ?>
|
327
326
|
<li>
|
328
|
-
#{title}: #{status} - [ #{toggle} ]
|
327
|
+
#{c title}: #{status} - [ #{toggle} ]
|
329
328
|
</li>
|
330
329
|
<?r end ?>
|
331
330
|
</code></pre>
|
@@ -429,11 +428,11 @@ Controller:</p>
|
|
429
428
|
end
|
430
429
|
</code></pre>
|
431
430
|
|
432
|
-
<p>Now jumping to <code>
|
431
|
+
<p>Now jumping to <code>view/index.xhtml</code> again, change it so it shows the link:</p>
|
433
432
|
|
434
433
|
<pre><code><?r @tasks.each do |title, status, toggle, delete| ?>
|
435
434
|
<li>
|
436
|
-
#{title}: #{status} [ #{toggle} | #{delete} ]
|
435
|
+
#{c title}: #{status} [ #{toggle} | #{delete} ]
|
437
436
|
</li>
|
438
437
|
<?r end ?>
|
439
438
|
</code></pre>
|
@@ -524,7 +523,7 @@ end
|
|
524
523
|
|
525
524
|
<p>And let's change our templates as well.</p>
|
526
525
|
|
527
|
-
<p>First the <code>
|
526
|
+
<p>First the <code>view/index.xhtml</code></p>
|
528
527
|
|
529
528
|
<pre><code><Page title="TodoList">
|
530
529
|
<a href="/new">New Task</a>
|
@@ -534,7 +533,7 @@ end
|
|
534
533
|
<ul>
|
535
534
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
536
535
|
<li>
|
537
|
-
#{title}: #{status} [ #{toggle} | #{delete} ]
|
536
|
+
#{c title}: #{status} [ #{toggle} | #{delete} ]
|
538
537
|
</li>
|
539
538
|
<?r end ?>
|
540
539
|
</ul>
|
@@ -542,7 +541,7 @@ end
|
|
542
541
|
</Page>
|
543
542
|
</code></pre>
|
544
543
|
|
545
|
-
<p>and the <code>
|
544
|
+
<p>and the <code>view/new.xhtml</code></p>
|
546
545
|
|
547
546
|
<pre><code><Page title="New Task">
|
548
547
|
<a href="/">Back to TodoList</a>
|
@@ -566,7 +565,7 @@ to get it line up properly and look actually structured.</p>
|
|
566
565
|
<pre><code><ul>
|
567
566
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
568
567
|
<li>
|
569
|
-
#{title}: #{status} [ #{toggle} | #{delete} ]
|
568
|
+
#{c title}: #{status} [ #{toggle} | #{delete} ]
|
570
569
|
</li>
|
571
570
|
<?r end ?>
|
572
571
|
</ul>
|
@@ -577,7 +576,7 @@ to get it line up properly and look actually structured.</p>
|
|
577
576
|
<pre><code><table>
|
578
577
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
579
578
|
<tr>
|
580
|
-
<td class="title"> #{title} </td>
|
579
|
+
<td class="title"> #{c title} </td>
|
581
580
|
<td class="status"> #{status} </td>
|
582
581
|
<td class="toggle"> #{toggle} </td>
|
583
582
|
<td class="delete"> #{delete} </td>
|
data/doc/tutorial/todolist.mkd
CHANGED
@@ -25,7 +25,7 @@ RubyForge.
|
|
25
25
|
Additionally, we now have added tests for the resulting application that you
|
26
26
|
can find in spec/examples/todolist.rb
|
27
27
|
|
28
|
-
Date of last update: Thu
|
28
|
+
Date of last update: Thu Jan 31 04:37:16 JST 2008
|
29
29
|
|
30
30
|
Thanks in advance.
|
31
31
|
The author of the tutorial, Michael 'manveru' Fellinger
|
@@ -52,7 +52,8 @@ with your ORM or database-library of choice.
|
|
52
52
|
|
53
53
|
So first, create a `model/todolist.rb` for our application:
|
54
54
|
|
55
|
-
|
55
|
+
require 'ramaze/store/default'
|
56
|
+
TodoList = Ramaze::Store::Default.new('todolist.yaml')
|
56
57
|
|
57
58
|
Let's add some items as well to have a base to start from.
|
58
59
|
|
@@ -86,7 +87,7 @@ simple.
|
|
86
87
|
TodoList.each do |title, value|
|
87
88
|
status = value[:done] ? 'done' : 'not done'
|
88
89
|
?>
|
89
|
-
<li>#{title}: #{status}</li>
|
90
|
+
<li>#{c title}: #{status}</li>
|
90
91
|
<?r end ?>
|
91
92
|
</ul>
|
92
93
|
</body>
|
@@ -183,7 +184,7 @@ changed to do following:
|
|
183
184
|
<?r else ?>
|
184
185
|
<ul>
|
185
186
|
<?r @tasks.each do |title, status| ?>
|
186
|
-
<li>#{title}: #{status}</li>
|
187
|
+
<li>#{c title}: #{status}</li>
|
187
188
|
<?r end ?>
|
188
189
|
</ul>
|
189
190
|
<?r end ?>
|
@@ -270,7 +271,7 @@ Jump into `view/index.xhtml` and do the following:
|
|
270
271
|
|
271
272
|
<?r @tasks.each do |title, status, toggle| ?>
|
272
273
|
<li>
|
273
|
-
#{title}: #{status} - [ #{toggle} ]
|
274
|
+
#{c title}: #{status} - [ #{toggle} ]
|
274
275
|
</li>
|
275
276
|
<?r end ?>
|
276
277
|
|
@@ -371,7 +372,7 @@ Now jumping to `view/index.xhtml` again, change it so it shows the link:
|
|
371
372
|
|
372
373
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
373
374
|
<li>
|
374
|
-
#{title}: #{status} [ #{toggle} | #{delete} ]
|
375
|
+
#{c title}: #{status} [ #{toggle} | #{delete} ]
|
375
376
|
</li>
|
376
377
|
<?r end ?>
|
377
378
|
|
@@ -467,7 +468,7 @@ First the `view/index.xhtml`
|
|
467
468
|
<ul>
|
468
469
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
469
470
|
<li>
|
470
|
-
#{title}: #{status} [ #{toggle} | #{delete} ]
|
471
|
+
#{c title}: #{status} [ #{toggle} | #{delete} ]
|
471
472
|
</li>
|
472
473
|
<?r end ?>
|
473
474
|
</ul>
|
@@ -498,7 +499,7 @@ So, from what we have right now:
|
|
498
499
|
<ul>
|
499
500
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
500
501
|
<li>
|
501
|
-
#{title}: #{status} [ #{toggle} | #{delete} ]
|
502
|
+
#{c title}: #{status} [ #{toggle} | #{delete} ]
|
502
503
|
</li>
|
503
504
|
<?r end ?>
|
504
505
|
</ul>
|
@@ -508,7 +509,7 @@ To something like this:
|
|
508
509
|
<table>
|
509
510
|
<?r @tasks.each do |title, status, toggle, delete| ?>
|
510
511
|
<tr>
|
511
|
-
<td class="title"> #{title} </td>
|
512
|
+
<td class="title"> #{c title} </td>
|
512
513
|
<td class="status"> #{status} </td>
|
513
514
|
<td class="toggle"> #{toggle} </td>
|
514
515
|
<td class="delete"> #{delete} </td>
|
File without changes
|
data/examples/blog/spec/blog.rb
CHANGED
@@ -9,7 +9,7 @@ require 'start'
|
|
9
9
|
describe 'Blog' do
|
10
10
|
behaves_like 'http'
|
11
11
|
ramaze :public_root => base/:public,
|
12
|
-
:template_root => base/:
|
12
|
+
:template_root => base/:view
|
13
13
|
|
14
14
|
after do
|
15
15
|
Entry.each{|e| e.delete unless e.id == 1 }
|
@@ -21,8 +21,8 @@ describe 'Blog' do
|
|
21
21
|
page.body.should.not == nil
|
22
22
|
|
23
23
|
doc = Hpricot(page.body)
|
24
|
-
doc.at('title').inner_html.should == '
|
25
|
-
doc.at('h1').inner_html.should == '
|
24
|
+
doc.at('title').inner_html.should == 'Blog'
|
25
|
+
doc.at('h1').inner_html.should == 'Blog'
|
26
26
|
|
27
27
|
doc.search('div#entries').size.should == 1
|
28
28
|
|
data/examples/blog/start.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
<h2>Editing entry</h2>
|
2
|
+
<div id="entries">
|
3
|
+
<div class="entry">
|
4
|
+
<form method="post" action="#{R self,:save}">
|
5
|
+
<input name="id" type="hidden" value="#{@entry.id}"/>
|
6
|
+
<div class="header">
|
7
|
+
<div class="title">
|
8
|
+
<input name="title" type="text" value="#{@entry.title}"/>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<div class="content">
|
12
|
+
<textarea name="content">#{@entry.content}</textarea>
|
13
|
+
</div>
|
14
|
+
<input type="submit" value="Update Entry"/>
|
15
|
+
</form>
|
16
|
+
</div>
|
17
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div id="actions">#{A 'new entry', :href => Rs(:new)}</div>
|
2
|
+
<div id="entries">
|
3
|
+
<?r @entries.each do |entry| ?>
|
4
|
+
<div class="entry">
|
5
|
+
<div class="header">
|
6
|
+
<div class="title">#{entry.title}</div>
|
7
|
+
<div class="created">Created: #{entry.created}</div>
|
8
|
+
<ul>
|
9
|
+
<li>#{A 'edit', :href => Rs(:edit, entry.id)}</li>
|
10
|
+
<li>#{A 'delete', :href => Rs(:delete, entry.id)}</li>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
<div class="content">#{entry.content}</div>
|
14
|
+
<div class="updated">Last updated: #{entry.updated}</div>
|
15
|
+
</div>
|
16
|
+
<?r end ?>
|
17
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>New entry</h2>
|
2
|
+
<div id="entries">
|
3
|
+
<div class="entry">
|
4
|
+
<form method="post" action="#{R self,:create}">
|
5
|
+
<div class="header">
|
6
|
+
<div class="title">
|
7
|
+
<input name="title" type="text" value=""/>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<div class="content">
|
11
|
+
<textarea name="content"></textarea>
|
12
|
+
</div>
|
13
|
+
<input type="submit" value="Add Entry"/>
|
14
|
+
</form>
|
15
|
+
</div>
|
16
|
+
</div>
|
data/examples/facebook.rb
CHANGED
@@ -76,30 +76,37 @@ end unless defined? Facebook::ID
|
|
76
76
|
# facebook.addurl '/url' # add url for app that redirects to /url after successful install
|
77
77
|
|
78
78
|
class MainController < Ramaze::Controller
|
79
|
-
helper :formatting
|
79
|
+
helper :formatting
|
80
80
|
helper :facebook
|
81
81
|
|
82
|
-
|
82
|
+
before {
|
83
83
|
# show some information about current user in logs
|
84
84
|
# INFO Facebook {:user=>15601088, :in_canvas=>true, :added=>true}
|
85
|
-
|
85
|
+
if fb[:user]
|
86
|
+
# use facebook session_key as session cookie
|
87
|
+
session.session_id = fb[:session_key] if fb[:session_key]
|
88
|
+
|
89
|
+
Ramaze::Log.info "Facebook " + fb.params.reject{|k,v| k.to_s !~ /^(in|is|user|added|locale|request)/}.inspect
|
90
|
+
else
|
91
|
+
# require_add: redirect to add url
|
92
|
+
# fb.redirect fb.addurl
|
93
|
+
end
|
86
94
|
|
87
95
|
# suggest setting SESSION key if one is not set, and current user is an admin
|
88
96
|
# INFO Set a default session key: SESSION = 'b3638446fa02466210c49f42-15601088'
|
89
97
|
if Facebook::SESSION.empty? and Facebook::ADMINS.include? fb[:user]
|
90
|
-
|
98
|
+
Ramaze::Log.info "Set a default session key: SESSION = '#{fb[:session_key]}'"
|
91
99
|
end
|
92
|
-
nil
|
93
100
|
}
|
94
101
|
|
95
102
|
def install
|
96
|
-
|
103
|
+
Ramaze::Log.info "#{fb[:user]} installed app" if request['installed'] == '1'
|
97
104
|
facebook.profile.setFBML :uid => fb[:user], :markup => "Isn't this a great surprise!?"
|
98
105
|
facebook.redirect request['next'] || '/'
|
99
106
|
end
|
100
107
|
|
101
108
|
def uninstall
|
102
|
-
|
109
|
+
Ramaze::Log.info "#{fb[:user]} uninstalled app"
|
103
110
|
end
|
104
111
|
|
105
112
|
def main
|
@@ -149,4 +156,4 @@ class MainController < Ramaze::Controller
|
|
149
156
|
layout :layout
|
150
157
|
end
|
151
158
|
|
152
|
-
Ramaze.start :adapter => :mongrel
|
159
|
+
Ramaze.start :adapter => :mongrel
|