ramaze 2008.06 → 2008.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/README.markdown +6 -6
  2. data/Rakefile +33 -3
  3. data/bin/ramaze +18 -0
  4. data/doc/CHANGELOG +960 -0
  5. data/doc/LEGAL +5 -1
  6. data/doc/meta/announcement.txt +20 -36
  7. data/doc/tutorial/todolist.html +421 -313
  8. data/doc/tutorial/todolist.mkd +33 -16
  9. data/examples/app/blog/spec/blog.rb +3 -3
  10. data/examples/app/rapaste/controller/paste.rb +8 -1
  11. data/examples/app/rapaste/model/paste.rb +3 -0
  12. data/examples/app/rapaste/spec/rapaste.rb +3 -1
  13. data/examples/app/rapaste/start.rb +3 -2
  14. data/examples/app/sourceview/public/sourceview.js +2 -2
  15. data/examples/app/todolist/spec/todolist.rb +6 -6
  16. data/examples/app/todolist/template/index.xhtml +1 -1
  17. data/examples/app/whywiki/spec/whywiki.rb +2 -2
  18. data/examples/app/wikore/spec/wikore.rb +2 -2
  19. data/examples/app/wikore/src/model.rb +4 -3
  20. data/examples/app/wiktacular/spec/wiktacular.rb +7 -7
  21. data/examples/basic/simple.rb +2 -2
  22. data/examples/helpers/paginate.rb +71 -0
  23. data/examples/misc/simple_auth.rb +20 -8
  24. data/lib/proto/controller/init.rb +10 -0
  25. data/lib/proto/controller/main.rb +1 -3
  26. data/lib/proto/model/init.rb +4 -0
  27. data/lib/proto/public/dispatch.fcgi +1 -1
  28. data/lib/proto/spec/main.rb +2 -1
  29. data/lib/proto/start.rb +3 -3
  30. data/lib/proto/start.ru +1 -1
  31. data/lib/proto/view/error.xhtml +4 -4
  32. data/lib/ramaze.rb +8 -3
  33. data/lib/ramaze/action.rb +6 -6
  34. data/lib/ramaze/adapter.rb +1 -6
  35. data/lib/ramaze/adapter/base.rb +30 -27
  36. data/lib/ramaze/adapter/cgi.rb +1 -0
  37. data/lib/ramaze/cache.rb +1 -3
  38. data/lib/ramaze/cache/memcached.rb +3 -5
  39. data/lib/ramaze/contrib/auto_params.rb +2 -2
  40. data/lib/ramaze/contrib/auto_params/get_args.rb +2 -1
  41. data/lib/ramaze/contrib/gems.rb +17 -18
  42. data/lib/ramaze/contrib/gzip_filter.rb +22 -9
  43. data/lib/ramaze/contrib/maruku_uv.rb +59 -0
  44. data/lib/ramaze/contrib/profiling.rb +1 -1
  45. data/lib/ramaze/contrib/rest.rb +16 -13
  46. data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
  47. data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
  48. data/lib/ramaze/contrib/sequel/image.rb +198 -0
  49. data/lib/ramaze/contrib/sequel/relation.rb +82 -0
  50. data/lib/ramaze/controller.rb +33 -34
  51. data/lib/ramaze/controller/resolve.rb +29 -9
  52. data/lib/ramaze/current.rb +60 -20
  53. data/lib/ramaze/current/request.rb +8 -7
  54. data/lib/ramaze/current/response.rb +15 -3
  55. data/lib/ramaze/current/session/flash.rb +8 -0
  56. data/lib/ramaze/dispatcher.rb +17 -9
  57. data/lib/ramaze/dispatcher/action.rb +4 -5
  58. data/lib/ramaze/dispatcher/directory.rb +1 -1
  59. data/lib/ramaze/dispatcher/error.rb +4 -4
  60. data/lib/ramaze/dispatcher/file.rb +4 -4
  61. data/lib/ramaze/gestalt.rb +15 -20
  62. data/lib/ramaze/helper/cgi.rb +7 -15
  63. data/lib/ramaze/helper/formatting.rb +41 -1
  64. data/lib/ramaze/helper/httpdigest.rb +20 -7
  65. data/lib/ramaze/helper/link.rb +4 -6
  66. data/lib/ramaze/helper/paginate.rb +233 -0
  67. data/lib/ramaze/helper/redirect.rb +1 -1
  68. data/lib/ramaze/helper/rest.rb +1 -1
  69. data/lib/ramaze/helper/thread.rb +17 -0
  70. data/lib/ramaze/helper/ultraviolet.rb +44 -0
  71. data/lib/ramaze/helper/user.rb +4 -9
  72. data/lib/ramaze/log.rb +2 -2
  73. data/lib/ramaze/log/analogger.rb +21 -23
  74. data/lib/ramaze/log/growl.rb +21 -23
  75. data/lib/ramaze/log/hub.rb +1 -1
  76. data/lib/ramaze/log/informer.rb +97 -99
  77. data/lib/ramaze/log/knotify.rb +14 -16
  78. data/lib/ramaze/log/logger.rb +11 -13
  79. data/lib/ramaze/log/logging.rb +61 -63
  80. data/lib/ramaze/log/rotatinginformer.rb +168 -0
  81. data/lib/ramaze/log/syslog.rb +41 -31
  82. data/lib/ramaze/log/xosd.rb +70 -72
  83. data/lib/ramaze/option.rb +9 -6
  84. data/lib/ramaze/option/holder.rb +5 -27
  85. data/lib/ramaze/reloader.rb +186 -0
  86. data/lib/ramaze/setup.rb +1 -1
  87. data/lib/ramaze/snippets.rb +13 -0
  88. data/lib/ramaze/snippets/array/put_within.rb +31 -24
  89. data/lib/ramaze/snippets/binding/locals.rb +23 -11
  90. data/lib/ramaze/snippets/dictionary.rb +2 -2
  91. data/lib/ramaze/snippets/fiber.rb +63 -0
  92. data/lib/ramaze/snippets/kernel/constant.rb +36 -21
  93. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +12 -6
  94. data/lib/ramaze/snippets/numeric/filesize_format.rb +24 -17
  95. data/lib/ramaze/snippets/numeric/time.rb +63 -0
  96. data/lib/ramaze/snippets/object/__dir__.rb +29 -0
  97. data/lib/ramaze/snippets/object/acquire.rb +40 -0
  98. data/lib/ramaze/snippets/object/instance_variable_defined.rb +16 -5
  99. data/lib/ramaze/snippets/object/pretty.rb +14 -4
  100. data/lib/ramaze/snippets/object/scope.rb +14 -7
  101. data/lib/ramaze/snippets/ordered_set.rb +25 -14
  102. data/lib/ramaze/snippets/proc/locals.rb +17 -9
  103. data/lib/ramaze/snippets/ramaze/deprecated.rb +13 -0
  104. data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
  105. data/lib/ramaze/snippets/ramaze/state.rb +86 -0
  106. data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
  107. data/lib/ramaze/snippets/string/camel_case.rb +13 -8
  108. data/lib/ramaze/snippets/string/color.rb +24 -20
  109. data/lib/ramaze/snippets/string/each.rb +14 -3
  110. data/lib/ramaze/snippets/string/end_with.rb +20 -0
  111. data/lib/ramaze/snippets/string/esc.rb +26 -21
  112. data/lib/ramaze/snippets/string/ord.rb +12 -6
  113. data/lib/ramaze/snippets/string/snake_case.rb +13 -7
  114. data/lib/ramaze/snippets/string/start_with.rb +16 -5
  115. data/lib/ramaze/snippets/string/unindent.rb +23 -15
  116. data/lib/ramaze/snippets/thread/into.rb +3 -3
  117. data/lib/ramaze/spec/helper/bacon.rb +5 -5
  118. data/lib/ramaze/spec/helper/mock_http.rb +1 -1
  119. data/lib/ramaze/spec/helper/pretty_output.rb +2 -2
  120. data/lib/ramaze/spec/helper/snippets.rb +8 -0
  121. data/lib/ramaze/template.rb +4 -1
  122. data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
  123. data/lib/ramaze/template/maruku.rb +34 -0
  124. data/lib/ramaze/template/tagz.rb +2 -2
  125. data/lib/ramaze/template/xslt.rb +2 -2
  126. data/lib/ramaze/tool/create.rb +27 -53
  127. data/lib/ramaze/tool/localize.rb +8 -4
  128. data/lib/ramaze/tool/mime.rb +11 -1
  129. data/lib/ramaze/tool/project_creator.rb +110 -0
  130. data/lib/ramaze/trinity.rb +4 -1
  131. data/lib/ramaze/version.rb +1 -1
  132. data/lib/vendor/bacon.rb +323 -0
  133. data/rake_tasks/gem.rake +10 -1
  134. data/rake_tasks/maintenance.rake +40 -2
  135. data/rake_tasks/metric.rake +24 -0
  136. data/rake_tasks/release.rake +17 -4
  137. data/rake_tasks/spec.rake +1 -2
  138. data/ramaze.gemspec +549 -495
  139. data/spec/contrib/auto_params.rb +3 -3
  140. data/spec/contrib/profiling.rb +2 -2
  141. data/spec/examples/simple_auth.rb +2 -2
  142. data/spec/examples/templates/template_haml.rb +0 -2
  143. data/spec/ramaze/action/file_cache.rb +22 -0
  144. data/spec/ramaze/adapter.rb +2 -2
  145. data/spec/ramaze/controller/actionless_templates.rb +1 -1
  146. data/spec/ramaze/controller/subclass.rb +15 -0
  147. data/spec/ramaze/controller/template_resolving.rb +1 -1
  148. data/spec/ramaze/controller/view/bar.xhtml +1 -0
  149. data/spec/ramaze/controller/view/base/another.xhtml +1 -0
  150. data/spec/ramaze/current/session.rb +1 -1
  151. data/spec/ramaze/dispatcher/file.rb +2 -2
  152. data/spec/ramaze/helper/aspect.rb +26 -17
  153. data/spec/ramaze/helper/formatting.rb +13 -0
  154. data/spec/ramaze/log/informer.rb +10 -10
  155. data/spec/ramaze/log/syslog.rb +67 -4
  156. data/spec/ramaze/rewrite.rb +1 -1
  157. data/spec/ramaze/route.rb +1 -1
  158. data/spec/ramaze/struct.rb +47 -0
  159. data/spec/ramaze/template/markaby.rb +1 -1
  160. data/spec/ramaze/template/tagz.rb +1 -1
  161. data/spec/snippets/binding/locals.rb +9 -0
  162. data/spec/snippets/numeric/time.rb +12 -0
  163. data/spec/snippets/{kernel → object}/__dir__.rb +0 -0
  164. data/spec/snippets/{kernel → object}/acquire.rb +0 -0
  165. metadata +90 -81
  166. data/cache.yaml +0 -7
  167. data/examples/app/rammit/spec/rammit.rb +0 -31
  168. data/examples/app/rammit/src/controller/main.rb +0 -3
  169. data/examples/app/rammit/src/controller/page.rb +0 -16
  170. data/examples/app/rammit/src/model.rb +0 -33
  171. data/examples/app/rammit/start.rb +0 -8
  172. data/examples/app/rammit/template/index.xhtml +0 -14
  173. data/examples/app/rammit/template/page/view.xhtml +0 -4
  174. data/lib/ramaze/snippets/kernel/__dir__.rb +0 -23
  175. data/lib/ramaze/snippets/kernel/acquire.rb +0 -34
  176. data/lib/ramaze/snippets/object/thread_accessor.rb +0 -5
  177. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +0 -58
  178. data/lib/ramaze/snippets/struct/fill.rb +0 -23
  179. data/lib/ramaze/snippets/struct/values_at.rb +0 -39
  180. data/lib/ramaze/snippets/symbol/to_proc.rb +0 -24
  181. data/lib/ramaze/sourcereload.rb +0 -176
  182. data/spec/snippets/struct/fill.rb +0 -26
  183. data/spec/snippets/struct/values_at.rb +0 -52
  184. data/spec/snippets/symbol/to_proc.rb +0 -13
@@ -1,6 +1,6 @@
1
1
  Title: The official Ramaze todolist tutorial
2
- HTML use syntax: true
3
-
2
+ html_use_syntax: true
3
+ uv_style: iplastic
4
4
 
5
5
  # To-do List Tutorial
6
6
 
@@ -46,7 +46,8 @@ to-do list.
46
46
 
47
47
  So run:
48
48
 
49
- $ ramaze --create todolist
49
+ ramaze --create todolist
50
+ {:lang=shell-unix-generic}
50
51
 
51
52
  done.
52
53
 
@@ -59,7 +60,7 @@ with your ORM or database-library of choice.
59
60
 
60
61
  So first, create a `model/todolist.rb` for our application:
61
62
 
62
- require 'ramaze/store/default'
63
+ require 'ramaze/store/default'
63
64
  TodoList = Ramaze::Store::Default.new('todolist.yaml')
64
65
  {:lang=ruby}
65
66
 
@@ -95,12 +96,12 @@ simple.
95
96
  TodoList.each do |title, value|
96
97
  status = value[:done] ? 'done' : 'not done'
97
98
  ?>
98
- <li>#{c title}: #{status}</li>
99
+ <li>#{h title}: #{status}</li>
99
100
  <?r end ?>
100
101
  </ul>
101
102
  </body>
102
103
  </html>
103
- {:lang=nagoro}
104
+ {:lang=html}
104
105
 
105
106
  I will assume that you are familiar with basic Ruby already, so we will
106
107
  concentrate on the things new here.
@@ -118,7 +119,7 @@ interesting part)
118
119
  <li>Laundry: not done</li>
119
120
  <li>Wash dishes: not done</li>
120
121
  </ul>
121
- {:lang=nagoro}
122
+ {:lang=html}
122
123
 
123
124
  That wasn't too bad, huh?
124
125
 
@@ -196,13 +197,13 @@ changed to do following:
196
197
  <?r else ?>
197
198
  <ul>
198
199
  <?r @tasks.each do |title, status| ?>
199
- <li>#{c title}: #{status}</li>
200
+ <li>#{h title}: #{status}</li>
200
201
  <?r end ?>
201
202
  </ul>
202
203
  <?r end ?>
203
204
  </body>
204
205
  </html>
205
- {:lang=ruby}
206
+ {:lang=ezamar}
206
207
 
207
208
  The rest of the template can stay the same.
208
209
 
@@ -224,6 +225,7 @@ Add a link on the `view/index.xhtml` like this:
224
225
 
225
226
  <h1>TodoList</h1>
226
227
  <a href="/new">New Task</a>
228
+ {:lang=ezamar}
227
229
 
228
230
  Open a new file `view/new.xhtml` with a form to add a new task.
229
231
 
@@ -240,6 +242,7 @@ Open a new file `view/new.xhtml` with a form to add a new task.
240
242
  </form>
241
243
  </body>
242
244
  </html>
245
+ {:lang=ezamar}
243
246
 
244
247
  We will not need a method for this on our controller, in fact, actions can
245
248
  consist of either method and template or only one of them. The Controller
@@ -285,10 +288,10 @@ Jump into `view/index.xhtml` and do the following:
285
288
 
286
289
  <?r @tasks.each do |title, status, toggle| ?>
287
290
  <li>
288
- #{c title}: #{status} - [ #{toggle} ]
291
+ #{h title}: #{status} - [ #{toggle} ]
289
292
  </li>
290
293
  <?r end
291
- {:lang=ruby}
294
+ {:lang=ezamar}
292
295
 
293
296
  We added a new element here, `toggle`, the Controller should give us
294
297
  a link to change the status corresponding to the status of the task, so off
@@ -317,6 +320,7 @@ toggle the status, A and Rs are both methods that help you do that.
317
320
  The result will be something like:
318
321
 
319
322
  <a href="/open/Wash+dishes">Close Task</a>
323
+ {:lang=ezamar}
320
324
 
321
325
  Rs actually is responsible to build the links href, for more information please
322
326
  take a look at the RDoc for LinkHelper.
@@ -364,7 +368,10 @@ will translate into:
364
368
  open('Wash dishes')
365
369
  {:lang=ruby}
366
370
 
367
- Which in turn will call `task_status('Wash dishes', false)`
371
+ Which in turn will call
372
+
373
+ task_status('Wash dishes', false)
374
+ {:lang=ruby}
368
375
 
369
376
  That's it, go on and try it :)
370
377
 
@@ -393,9 +400,10 @@ Now jumping to `view/index.xhtml` again, change it so it shows the link:
393
400
 
394
401
  <?r @tasks.each do |title, status, toggle, delete| ?>
395
402
  <li>
396
- #{c title}: #{status} [ #{toggle} | #{delete} ]
403
+ #{h title}: #{status} [ #{toggle} | #{delete} ]
397
404
  </li>
398
405
  <?r end ?>
406
+ {:lang=ezamar}
399
407
 
400
408
  Voilà, you now have acquired the Certificate of Ramazeness.
401
409
 
@@ -406,6 +414,7 @@ explain some more advanced concepts of Ramaze and Ezamar.
406
414
  ## Eighth Step, Elements
407
415
 
408
416
  <Page></Page>
417
+ {:lang=ezamar}
409
418
 
410
419
  This is called an Element, Ramaze will go and search for a class that matches
411
420
  the name Page and responds to `#render`. Then it will go and hand the content in
@@ -423,12 +432,14 @@ Let us have a look at our templates, they got some repetitive stuff, like:
423
432
  <h1>some title</h1>
424
433
  </body>
425
434
  </html>
435
+ {:lang=ezamar}
426
436
 
427
437
  How about replacing that with something short and reusable:
428
438
 
429
439
  <Page title="TodoList">
430
440
  your other content
431
441
  </Page>
442
+ {:lang=html}
432
443
 
433
444
  Would be nice of course, and when you start having more templates it makes an
434
445
  awful lot of sense being able to change the enclosing stuff in one place.
@@ -491,12 +502,13 @@ First the `view/index.xhtml`
491
502
  <ul>
492
503
  <?r @tasks.each do |title, status, toggle, delete| ?>
493
504
  <li>
494
- #{c title}: #{status} [ #{toggle} | #{delete} ]
505
+ #{h title}: #{status} [ #{toggle} | #{delete} ]
495
506
  </li>
496
507
  <?r end ?>
497
508
  </ul>
498
509
  <?r end ?>
499
510
  </Page>
511
+ {:lang=ezamar}
500
512
 
501
513
  and the `view/new.xhtml`
502
514
 
@@ -507,6 +519,7 @@ and the `view/new.xhtml`
507
519
  <input type="submit" />
508
520
  </form>
509
521
  </Page>
522
+ {:lang=ezamar}
510
523
 
511
524
  Alright, now just go and look at the result in the browser, try changing
512
525
  the things inside the Element and look at how it behaves.
@@ -522,23 +535,25 @@ So, from what we have right now:
522
535
  <ul>
523
536
  <?r @tasks.each do |title, status, toggle, delete| ?>
524
537
  <li>
525
- #{c title}: #{status} [ #{toggle} | #{delete} ]
538
+ #{h title}: #{status} [ #{toggle} | #{delete} ]
526
539
  </li>
527
540
  <?r end ?>
528
541
  </ul>
542
+ {:lang=ezamar}
529
543
 
530
544
  To something like this:
531
545
 
532
546
  <table>
533
547
  <?r @tasks.each do |title, status, toggle, delete| ?>
534
548
  <tr>
535
- <td class="title"> #{c title} </td>
549
+ <td class="title"> #{h title} </td>
536
550
  <td class="status"> #{status} </td>
537
551
  <td class="toggle"> #{toggle} </td>
538
552
  <td class="delete"> #{delete} </td>
539
553
  </tr>
540
554
  <?r end ?>
541
555
  </table>
556
+ {:lang=ezamar}
542
557
 
543
558
  And, since we have proper classes to address some style sheets, jump into the
544
559
  Page element and add some style sheet:
@@ -554,6 +569,7 @@ Page element and add some style sheet:
554
569
  a { color: #3a3; }
555
570
  </style>
556
571
  </head>
572
+ {:lang=ezamar}
557
573
 
558
574
  That looks quite a bit nicer, right? And yes, if you don't like tables (though
559
575
  this is an entirely legit use in my opinion) you can just do it like you want,
@@ -759,6 +775,7 @@ and add in the right place:
759
775
  <?r end ?>
760
776
  #{content}
761
777
  </body>
778
+ {:lang=ezamar}
762
779
 
763
780
  The only thing special about it is the `\\#{flash[:error]}`, we have to escape
764
781
  the `#` so it won't evaluate this immediately but wait until it is really
@@ -31,7 +31,7 @@ describe 'Blog' do
31
31
 
32
32
  def create_page(title,content)
33
33
  page = post('/create','title'=>title,'content'=>content)
34
- page.status.should == 303
34
+ page.status.should == 302
35
35
  page.location.should == '/'
36
36
  end
37
37
 
@@ -48,7 +48,7 @@ describe 'Blog' do
48
48
  form.at('textarea').inner_html.should == ''
49
49
  form.at('input[@type=submit]')['value'].should == 'Add Entry'
50
50
  end
51
-
51
+
52
52
  it 'should add new pages' do
53
53
  create_page('new page', 'cool! a new page')
54
54
  doc = check_page
@@ -78,7 +78,7 @@ describe 'Blog' do
78
78
  entries.size.should == 2
79
79
  delete_link = entries.last.at("a:contains('delete')")
80
80
  page = get(delete_link[:href])
81
- page.status.should == 303
81
+ page.status.should == 302
82
82
  page.location.should == '/'
83
83
  (check_page/'div.entry').size.should == 1
84
84
  end
@@ -1,4 +1,5 @@
1
1
  Ramaze::Route[%r!^/(\d+)\.(?:te?xt|plain|rb|css|js)$!] = '/plain/%d'
2
+ Ramaze::Route[%r!^/(\d+)\.(?:html)$!] = '/html/%d'
2
3
  Ramaze::Route[%r!^/(?:te?xt|plain|rb|css|js)/(\d+)$!] = '/plain/%d'
3
4
  Ramaze::Route[%r!^/(\d+)\.(\w+)$!] = '/view/%d/%s'
4
5
  Ramaze::Route[%r!^/(\d+)$!] = '/view/%d/html'
@@ -63,7 +64,13 @@ class PasteController < Ramaze::Controller
63
64
  response['Content-Type'] = 'text/plain'
64
65
  respond paste.text
65
66
  end
66
-
67
+
68
+ def html(id)
69
+ paste = paste_for(id)
70
+ response['Content-Type'] = 'text/html'
71
+ respond paste.text
72
+ end
73
+
67
74
  def save_theme( theme_name )
68
75
  session[ :theme ] = theme_name
69
76
  end
@@ -27,6 +27,9 @@ class Paste < Sequel::Model(:paste)
27
27
 
28
28
  def uv(text, style = STYLE, lines = true)
29
29
  Uv.parse(text, "xhtml", syntax, lines, style)
30
+ rescue ArgumentError => ex
31
+ Ramaze::Log::error(ex)
32
+ "<pre>#{text}</pre>"
30
33
  end
31
34
 
32
35
  def syntax_name
@@ -33,7 +33,7 @@ describe 'RaPaste' do
33
33
 
34
34
  it 'should create a new paste' do
35
35
  page = post('/save', 'syntax' => 'plain_text', 'text' => 'spec paste')
36
- page.status.should == 303
36
+ page.status.should == 302
37
37
  page.original_headers['Location'].should == '/1'
38
38
  end
39
39
 
@@ -46,4 +46,6 @@ describe 'RaPaste' do
46
46
  page = get('/1')
47
47
  (Hpricot(page.body)/'div#paste_body').inner_text.should =~ /spec paste/
48
48
  end
49
+
50
+ FileUtils.rm_f(DB_FILE)
49
51
  end
@@ -16,9 +16,10 @@ STYLE = 'iplastic'
16
16
 
17
17
  Ramaze::Log.debug "done."
18
18
 
19
- DB = Sequel.sqlite
19
+ DB_FILE = "#{__DIR__}/rapaste.sqlite" # for specs
20
+ DB = Sequel.connect("sqlite://#{DB_FILE}")
20
21
 
21
22
  require 'model/paste'
22
23
  require 'controller/paste'
23
24
 
24
- Ramaze.start
25
+ Ramaze.start :adapter => :mongrel, :port => 9952
@@ -22,7 +22,7 @@ function setup() {
22
22
 
23
23
  if (curfile) {
24
24
  $('#repourl').empty().append(
25
- $('<a/>').attr('href', 'http://darcs.ramaze.net/ramaze'+curfile)
25
+ $('<a/>').attr('href', 'http://github.com/manveru/ramaze/tree/master'+curfile)
26
26
  .text('download '+curfile.substr(1))
27
27
  );
28
28
  urchinTracker(curfile);
@@ -49,4 +49,4 @@ $(function(){
49
49
  } else {
50
50
  setup();
51
51
  }
52
- });
52
+ });
@@ -82,7 +82,7 @@ describe 'todolist' do
82
82
 
83
83
  it 'should POST new task and redirect to /' do
84
84
  result = post('/create', 'title' => 'spectask')
85
- result.status.should == 303
85
+ result.status.should == 302
86
86
  end
87
87
 
88
88
  it 'should show have the new task' do
@@ -90,10 +90,10 @@ describe 'todolist' do
90
90
  end
91
91
 
92
92
  it 'should toggle the spectask' do
93
- get('/close/spectask').status.should == 303
93
+ get('/close/spectask').status.should == 302
94
94
  spectask.should.not == nil
95
95
  spectask_status.should == 'done'
96
- get('/open/spectask').status.should == 303
96
+ get('/open/spectask').status.should == 302
97
97
  spectask.should.not == nil
98
98
  spectask_status.should == 'not done'
99
99
  end
@@ -101,21 +101,21 @@ describe 'todolist' do
101
101
  it 'should raise on modifying a not existing task' do
102
102
  %w[open close].each do |action|
103
103
  response = get("/#{action}/nothere", :referrer => "/")
104
- response.status.should == 303
104
+ response.status.should == 302
105
105
  response.original_headers['Location'].should == '/'
106
106
  error_on_page('/', response).should == "No such Task: `nothere'"
107
107
  end
108
108
  end
109
109
 
110
110
  it 'should delete the new task' do
111
- get('/delete/spectask').status.should == 303
111
+ get('/delete/spectask').status.should == 302
112
112
  task_titles.should.not.include('spectask')
113
113
  end
114
114
 
115
115
  it 'should not create empty tasks but show a subtle error message' do
116
116
  response = post('/create', 'title' => '', :referrer => "/new")
117
117
 
118
- response.status.should == 303
118
+ response.status.should == 302
119
119
  response.original_headers['Location'].should == '/new'
120
120
 
121
121
  error_on_page('/new', response).should == 'Please enter a title'
@@ -6,7 +6,7 @@
6
6
  <table>
7
7
  <?r @tasks.each do |title, status, toggle, delete| ?>
8
8
  <tr>
9
- <td class="title"> #{c title} </td>
9
+ <td class="title"> #{h title} </td>
10
10
  <td class="status"> #{status} </td>
11
11
  <td class="toggle"> #{toggle} </td>
12
12
  <td class="delete"> #{delete} </td>
@@ -26,7 +26,7 @@ describe 'WikiController' do
26
26
  it 'should start' do
27
27
  ramaze :public_root => base/:public,
28
28
  :view_root => base/:template
29
- get('/').status.should == 303
29
+ get('/').status.should == 302
30
30
  end
31
31
 
32
32
  it 'should have main page' do
@@ -46,7 +46,7 @@ describe 'WikiController' do
46
46
  end
47
47
 
48
48
  it 'should create pages' do
49
- post('/save','text'=>'the text','page'=>'ThePage').status.should == 303
49
+ post('/save','text'=>'the text','page'=>'ThePage').status.should == 302
50
50
  page = Hpricot(get('/show/ThePage').body)
51
51
  body = page.at('body>div')
52
52
  body.should.not == nil
@@ -13,7 +13,7 @@ describe 'Wikore' do
13
13
 
14
14
  def check_redirect(to = '/')
15
15
  response = yield
16
- response.status.should == 303
16
+ response.status.should == 302
17
17
  response.body.should =~ /<a href="#{to}">/
18
18
  end
19
19
 
@@ -107,5 +107,5 @@ describe 'Wikore' do
107
107
  end
108
108
  end
109
109
 
110
- FileUtils.rm('wikore.db')
110
+ FileUtils.rm_f(DB_FILE)
111
111
  end
@@ -5,7 +5,8 @@ begin
5
5
  when :memory
6
6
  DB = Sequel.sqlite
7
7
  else
8
- DB = Sequel.sqlite 'wikore.db'
8
+ DB_FILE = __DIR__/'wikore.db'
9
+ DB = Sequel.connect("sqlite://#{DB_FILE}")
9
10
  end
10
11
  rescue NoMethodError
11
12
  raise LoadError, 'Install latest Sequel gem'
@@ -21,7 +22,7 @@ module Model
21
22
 
22
23
  class Page < Sequel::Model(:page)
23
24
  set_schema do
24
- instance_eval &PAGE_SCHEMA
25
+ instance_eval(&PAGE_SCHEMA)
25
26
  text :title, :unique => true, :null => false
26
27
  end
27
28
 
@@ -41,7 +42,7 @@ module Model
41
42
 
42
43
  class OldPage < Sequel::Model(:old_page)
43
44
  set_schema do
44
- instance_eval &PAGE_SCHEMA
45
+ instance_eval(&PAGE_SCHEMA)
45
46
  text :title, :unique => false, :null => false
46
47
  end
47
48
  end
@@ -60,7 +60,7 @@ describe 'wiktacular' do
60
60
  it 'should not have foobar page' do
61
61
  doc = check_page('/foobar')
62
62
  doc.at('div#text').inner_html.strip.should == 'No Entry'
63
- end
63
+ end
64
64
 
65
65
  it 'should allow page editing' do
66
66
  doc = check_page('/edit/main')
@@ -72,26 +72,26 @@ describe 'wiktacular' do
72
72
  end
73
73
 
74
74
  def edit_page(name, text='new text')
75
- page = post('/save','handle'=>name,'text'=>text)
76
- page.status.should == 303
75
+ page = post('/save','handle'=>name,'text'=>text)
76
+ page.status.should == 302
77
77
  page.location.should == '/index/'+name
78
78
  end
79
-
79
+
80
80
  def delete_page(name)
81
81
  page = get('/delete/'+name)
82
- page.status.should == 303
82
+ page.status.should == 302
83
83
  page.location.should == '/'
84
84
  end
85
85
 
86
86
  def revert_page(name)
87
87
  page = get('/revert/'+name)
88
- page.status.should == 303
88
+ page.status.should == 302
89
89
  page.location.should == '/'+name
90
90
  end
91
91
 
92
92
  def unrevert_page(name)
93
93
  page = get('/revert/'+name)
94
- page.status.should == 303
94
+ page.status.should == 302
95
95
  page.location.should == '/'+name
96
96
  end
97
97