ramaze 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. data/Rakefile +360 -0
  2. data/bin/ramaze +152 -0
  3. data/doc/CHANGELOG +2021 -0
  4. data/doc/COPYING +56 -0
  5. data/doc/COPYING.ja +51 -0
  6. data/doc/README +275 -0
  7. data/doc/TODO +33 -0
  8. data/doc/allison/LICENSE +184 -0
  9. data/doc/allison/README +37 -0
  10. data/doc/allison/allison.css +300 -0
  11. data/doc/allison/allison.gif +0 -0
  12. data/doc/allison/allison.js +307 -0
  13. data/doc/allison/allison.rb +287 -0
  14. data/doc/allison/cache/BODY +588 -0
  15. data/doc/allison/cache/CLASS_INDEX +4 -0
  16. data/doc/allison/cache/CLASS_PAGE +1 -0
  17. data/doc/allison/cache/FILE_INDEX +4 -0
  18. data/doc/allison/cache/FILE_PAGE +1 -0
  19. data/doc/allison/cache/FONTS +1 -0
  20. data/doc/allison/cache/FR_INDEX_BODY +1 -0
  21. data/doc/allison/cache/IMGPATH +1 -0
  22. data/doc/allison/cache/INDEX +1 -0
  23. data/doc/allison/cache/JAVASCRIPT +307 -0
  24. data/doc/allison/cache/METHOD_INDEX +4 -0
  25. data/doc/allison/cache/METHOD_LIST +1 -0
  26. data/doc/allison/cache/SRC_PAGE +1 -0
  27. data/doc/allison/cache/STYLE +322 -0
  28. data/doc/allison/cache/URL +1 -0
  29. data/examples/blog/main.rb +16 -0
  30. data/examples/blog/public/screen.css +106 -0
  31. data/examples/blog/src/controller.rb +50 -0
  32. data/examples/blog/src/element.rb +53 -0
  33. data/examples/blog/src/model.rb +29 -0
  34. data/examples/blog/template/edit.xhtml +6 -0
  35. data/examples/blog/template/index.xhtml +24 -0
  36. data/examples/blog/template/new.xhtml +5 -0
  37. data/examples/blog/template/view.xhtml +15 -0
  38. data/examples/blog/test/tc_entry.rb +18 -0
  39. data/examples/caching.rb +23 -0
  40. data/examples/element.rb +40 -0
  41. data/examples/hello.rb +23 -0
  42. data/examples/simple.rb +60 -0
  43. data/examples/templates/template/external.haml +21 -0
  44. data/examples/templates/template/external.liquid +28 -0
  45. data/examples/templates/template/external.mab +27 -0
  46. data/examples/templates/template/external.rhtml +29 -0
  47. data/examples/templates/template/external.rmze +24 -0
  48. data/examples/templates/template_erubis.rb +50 -0
  49. data/examples/templates/template_haml.rb +48 -0
  50. data/examples/templates/template_liquid.rb +64 -0
  51. data/examples/templates/template_markaby.rb +52 -0
  52. data/examples/templates/template_ramaze.rb +49 -0
  53. data/examples/whywiki/main.rb +56 -0
  54. data/examples/whywiki/template/edit.xhtml +14 -0
  55. data/examples/whywiki/template/show.xhtml +17 -0
  56. data/lib/proto/conf/benchmark.yaml +35 -0
  57. data/lib/proto/conf/debug.yaml +34 -0
  58. data/lib/proto/conf/live.yaml +33 -0
  59. data/lib/proto/conf/silent.yaml +31 -0
  60. data/lib/proto/conf/stage.yaml +33 -0
  61. data/lib/proto/main.rb +18 -0
  62. data/lib/proto/public/404.jpg +0 -0
  63. data/lib/proto/public/css/coderay.css +105 -0
  64. data/lib/proto/public/css/ramaze_error.css +42 -0
  65. data/lib/proto/public/error.xhtml +74 -0
  66. data/lib/proto/public/favicon.ico +0 -0
  67. data/lib/proto/public/js/jquery.js +1923 -0
  68. data/lib/proto/public/ramaze.png +0 -0
  69. data/lib/proto/src/controller/main.rb +7 -0
  70. data/lib/proto/src/element/page.rb +16 -0
  71. data/lib/proto/src/model.rb +5 -0
  72. data/lib/proto/template/index.xhtml +6 -0
  73. data/lib/ramaze.rb +317 -0
  74. data/lib/ramaze/adapter/mongrel.rb +111 -0
  75. data/lib/ramaze/adapter/webrick.rb +161 -0
  76. data/lib/ramaze/cache.rb +11 -0
  77. data/lib/ramaze/cache/memcached.rb +52 -0
  78. data/lib/ramaze/cache/memory.rb +6 -0
  79. data/lib/ramaze/cache/yaml_store.rb +37 -0
  80. data/lib/ramaze/controller.rb +10 -0
  81. data/lib/ramaze/dispatcher.rb +315 -0
  82. data/lib/ramaze/error.rb +11 -0
  83. data/lib/ramaze/gestalt.rb +108 -0
  84. data/lib/ramaze/global.rb +120 -0
  85. data/lib/ramaze/helper.rb +32 -0
  86. data/lib/ramaze/helper/aspect.rb +189 -0
  87. data/lib/ramaze/helper/auth.rb +120 -0
  88. data/lib/ramaze/helper/cache.rb +52 -0
  89. data/lib/ramaze/helper/feed.rb +135 -0
  90. data/lib/ramaze/helper/form.rb +204 -0
  91. data/lib/ramaze/helper/link.rb +80 -0
  92. data/lib/ramaze/helper/redirect.rb +48 -0
  93. data/lib/ramaze/helper/stack.rb +67 -0
  94. data/lib/ramaze/http_status.rb +66 -0
  95. data/lib/ramaze/inform.rb +166 -0
  96. data/lib/ramaze/snippets.rb +5 -0
  97. data/lib/ramaze/snippets/hash/keys_to_sym.rb +19 -0
  98. data/lib/ramaze/snippets/kernel/aquire.rb +22 -0
  99. data/lib/ramaze/snippets/kernel/autoreload.rb +79 -0
  100. data/lib/ramaze/snippets/kernel/caller_lines.rb +58 -0
  101. data/lib/ramaze/snippets/kernel/constant.rb +24 -0
  102. data/lib/ramaze/snippets/kernel/rescue_require.rb +12 -0
  103. data/lib/ramaze/snippets/kernel/self_method.rb +41 -0
  104. data/lib/ramaze/snippets/kernel/silently.rb +13 -0
  105. data/lib/ramaze/snippets/object/traits.rb +60 -0
  106. data/lib/ramaze/snippets/openstruct/temp.rb +10 -0
  107. data/lib/ramaze/snippets/string/DIVIDE.rb +16 -0
  108. data/lib/ramaze/snippets/string/camel_case.rb +14 -0
  109. data/lib/ramaze/snippets/string/snake_case.rb +12 -0
  110. data/lib/ramaze/snippets/symbol/to_proc.rb +14 -0
  111. data/lib/ramaze/snippets/thread/deadQUESTIONMARK.rb +11 -0
  112. data/lib/ramaze/store/default.rb +48 -0
  113. data/lib/ramaze/template.rb +102 -0
  114. data/lib/ramaze/template/amrita2.rb +40 -0
  115. data/lib/ramaze/template/erubis.rb +58 -0
  116. data/lib/ramaze/template/haml.rb +65 -0
  117. data/lib/ramaze/template/haml/actionview_stub.rb +20 -0
  118. data/lib/ramaze/template/liquid.rb +74 -0
  119. data/lib/ramaze/template/markaby.rb +68 -0
  120. data/lib/ramaze/template/ramaze.rb +177 -0
  121. data/lib/ramaze/template/ramaze/element.rb +166 -0
  122. data/lib/ramaze/template/ramaze/morpher.rb +156 -0
  123. data/lib/ramaze/tool/create.rb +70 -0
  124. data/lib/ramaze/tool/tidy.rb +71 -0
  125. data/lib/ramaze/trinity.rb +38 -0
  126. data/lib/ramaze/trinity/request.rb +244 -0
  127. data/lib/ramaze/trinity/response.rb +41 -0
  128. data/lib/ramaze/trinity/session.rb +129 -0
  129. data/lib/ramaze/version.rb +14 -0
  130. data/spec/spec_all.rb +73 -0
  131. data/spec/spec_helper.rb +215 -0
  132. data/spec/tc_adapter_mongrel.rb +24 -0
  133. data/spec/tc_adapter_webrick.rb +22 -0
  134. data/spec/tc_cache.rb +79 -0
  135. data/spec/tc_controller.rb +39 -0
  136. data/spec/tc_element.rb +100 -0
  137. data/spec/tc_error.rb +23 -0
  138. data/spec/tc_gestalt.rb +90 -0
  139. data/spec/tc_global.rb +46 -0
  140. data/spec/tc_helper_aspect.rb +65 -0
  141. data/spec/tc_helper_auth.rb +61 -0
  142. data/spec/tc_helper_cache.rb +81 -0
  143. data/spec/tc_helper_feed.rb +129 -0
  144. data/spec/tc_helper_form.rb +146 -0
  145. data/spec/tc_helper_link.rb +58 -0
  146. data/spec/tc_helper_redirect.rb +51 -0
  147. data/spec/tc_helper_stack.rb +55 -0
  148. data/spec/tc_morpher.rb +90 -0
  149. data/spec/tc_params.rb +84 -0
  150. data/spec/tc_request.rb +111 -0
  151. data/spec/tc_session.rb +56 -0
  152. data/spec/tc_store.rb +25 -0
  153. data/spec/tc_template_amrita2.rb +34 -0
  154. data/spec/tc_template_erubis.rb +41 -0
  155. data/spec/tc_template_haml.rb +44 -0
  156. data/spec/tc_template_liquid.rb +98 -0
  157. data/spec/tc_template_markaby.rb +74 -0
  158. data/spec/tc_template_ramaze.rb +54 -0
  159. data/spec/tc_tidy.rb +14 -0
  160. data/spec/template/amrita2/data.html +6 -0
  161. data/spec/template/amrita2/index.html +1 -0
  162. data/spec/template/amrita2/sum.html +1 -0
  163. data/spec/template/erubis/sum.rhtml +1 -0
  164. data/spec/template/haml/index.haml +5 -0
  165. data/spec/template/haml/with_vars.haml +4 -0
  166. data/spec/template/liquid/index.liquid +1 -0
  167. data/spec/template/liquid/products.liquid +45 -0
  168. data/spec/template/markaby/external.mab +8 -0
  169. data/spec/template/markaby/sum.mab +1 -0
  170. data/spec/template/ramaze/file_only.rmze +1 -0
  171. data/spec/template/ramaze/index.rmze +1 -0
  172. data/spec/template/ramaze/nested.rmze +1 -0
  173. data/spec/template/ramaze/sum.rmze +1 -0
  174. metadata +317 -0
@@ -0,0 +1,21 @@
1
+ %html
2
+ %head
3
+ %title= "Template::Haml internal"
4
+ %body
5
+ %h1= @title
6
+ = link( R(:/), :title => 'Home')
7
+ %p
8
+ = "Here you can pass some stuff if you like, parameters are just passed like this:"
9
+ %br/
10
+ = link( R(self, @action, :one), :title => "#@action/one")
11
+ %br/
12
+ = link( R(self, @action, :one, :two, :three), :title => "#@action/one/two/three")
13
+ %br/
14
+ = link( R(self, @action, :one, :foo => :bar), :title => "#@action/one?foo=bar")
15
+ %div= "The arguments you have passed to this action are:"
16
+ - if @args.empty?
17
+ = "none"
18
+ - else
19
+ - @args.each do |arg|
20
+ %span= arg
21
+ %div= request.params.inspect
@@ -0,0 +1,28 @@
1
+ <html>
2
+ <head>
3
+ <title>Template::Liquid internal</title>
4
+ </head>
5
+ <body>
6
+ <h1>{{header}}</h1>
7
+ {{homelink}}
8
+ <p>
9
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
10
+ {{link_one}}<br />
11
+ {{link_two}}<br />
12
+ {{link_three}}
13
+ </p>
14
+ <div>
15
+ The arguments you have passed to this action are:
16
+ {% if args_empty %}
17
+ none
18
+ {% else %}
19
+ {% for arg in args %}
20
+ <span>{{arg}}</span>
21
+ {% endfor %}
22
+ {% endif %}
23
+ </div>
24
+ <div>
25
+ {{params}}
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,27 @@
1
+ html do
2
+ head do
3
+ title "Template::Markaby external"
4
+ end
5
+ body do
6
+ h1 "The #{@action} Template for Markaby"
7
+ a("Home", :href => R(:/))
8
+ p do
9
+ %{
10
+ Here you can pass some stuff if you like, parameters are just passed like this:#{br}
11
+ #{link self, @action, :one, :title => 'external/one'; br}
12
+ #{link self, @action, :one, :two, :three, :title => 'external/one/two/three'; br}
13
+ #{link self, @action, :one, :foo => :bar, :title => 'external?foo=bar'; br}
14
+ }
15
+ end
16
+ div "The arguments you have passed to this action are:" do
17
+ if @args.empty?
18
+ "none"
19
+ else
20
+ args.each do |arg|
21
+ span arg
22
+ end
23
+ end
24
+ end
25
+ div request.params.inspect
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ <html>
2
+ <head>
3
+ <title>Template::Erubis external</title>
4
+ </head>
5
+ <body>
6
+ <h1>The <%= @action %> Template for Erubis</h1>
7
+ <%= link :/, :title => 'Home' %>
8
+ <p>
9
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
10
+ <%= link self, @action, :one, :title => "#@action/one" %><br />
11
+ <%= link self, @action, :one, :two, :three, :title => "#@action/one/two/three" %><br />
12
+ <%= link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar" %><br />
13
+ </p>
14
+ <div>
15
+ The arguments you have passed to this action are:
16
+ <% if @args.empty? %>
17
+ none
18
+ <% else %>
19
+ <% @args.each do |arg| %>
20
+ <span><%= arg %></span>
21
+ <% end %>
22
+ <% end %>
23
+ </div>
24
+ <div>
25
+ <%= request.params.inspect %>
26
+ </div>
27
+ </body>
28
+ </html>
29
+
@@ -0,0 +1,24 @@
1
+ <html>
2
+ <head>
3
+ <title>Template::Ramaze external</title>
4
+ </head>
5
+ <body>
6
+ <h1>The #{@action} Template for Ramaze</h1>
7
+ #{link :/, :title => 'Home'}
8
+ <p>
9
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
10
+ #{link self, @action, :one, :title => "#@action/one"}<br />
11
+ #{link self, @action, :one, :two, :three, :title => "#@action/one/two/three"}<br />
12
+ #{link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar"}<br />
13
+ </p>
14
+ <div>
15
+ *args
16
+ <?r @args.each do |arg| ?>
17
+ <span>#{arg}</span>
18
+ <?r end ?>
19
+ </div>
20
+ <div>
21
+ #{request.params.inspect}
22
+ </div>
23
+ </body>
24
+ </html>
@@ -0,0 +1,50 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'ramaze'
5
+
6
+ include Ramaze
7
+
8
+ class MainController < Template::Erubis
9
+ def index
10
+ %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
11
+ end
12
+
13
+ def internal *args
14
+ @args = args
15
+ transform %q{
16
+ <html>
17
+ <head>
18
+ <title>Template::Ramaze internal</title>
19
+ </head>
20
+ <body>
21
+ <h1>The <%= @action %> Template</h1>
22
+ <%= link :/, :title => 'Home' %>
23
+ <p>
24
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
25
+ <%= link self, @action, :one, :title => "#@action/one" %><br />
26
+ <%= link self, @action, :one, :two, :three, :title => "#@action/one/two/three" %><br />
27
+ <%= link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar" %><br />
28
+ </p>
29
+ <div>
30
+ The arguments you have passed to this action are:
31
+ <% if @args.empty? %>
32
+ none
33
+ <% else %>
34
+ <% @args.each do |arg| %>
35
+ <span><%= arg %></span>
36
+ <% end %>
37
+ <% end %>
38
+ </div>
39
+ <div>
40
+ <%= request.params.inspect %>
41
+ </div>
42
+ </body>
43
+ </html>
44
+ }
45
+ end
46
+
47
+ def external *args
48
+ @args = args
49
+ end
50
+ end
@@ -0,0 +1,48 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'ramaze'
5
+
6
+ include Ramaze
7
+
8
+ class MainController < Template::Haml
9
+ def index
10
+ %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
11
+ end
12
+
13
+ def internal *args
14
+ @args = args
15
+ @title = "The #{@action} Template for Haml"
16
+
17
+ %q{
18
+ %html
19
+ %head
20
+ %title= "Template::Haml internal"
21
+ %body
22
+ %h1= @title
23
+ = link( R(:/), :title => 'Home')
24
+ %p
25
+ = "Here you can pass some stuff if you like, parameters are just passed like this:"
26
+ %br/
27
+ = link( R(self, @action, :one), :title => "#@action/one")
28
+ %br/
29
+ = link( R(self, @action, :one, :two, :three), :title => "#@action/one/two/three")
30
+ %br/
31
+ = link( R(self, @action, :one, :foo => :bar), :title => "#@action/one?foo=bar")
32
+ %div= "The arguments you have passed to this action are:"
33
+ - if @args.empty?
34
+ = "none"
35
+ - else
36
+ - @args.each do |arg|
37
+ %span= arg
38
+ %div= request.params.inspect
39
+ }
40
+ end
41
+
42
+ def external *args
43
+ @title = "The #{@action} Template for Haml"
44
+ @args = args
45
+ end
46
+ end
47
+
48
+ Ramaze.start
@@ -0,0 +1,64 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'ramaze'
5
+
6
+ include Ramaze
7
+
8
+ class MainController < Template::Liquid
9
+ def index
10
+ %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
11
+ end
12
+
13
+ def liquid_hash(*args)
14
+ {
15
+ 'header' => "The #{@action} Template",
16
+ 'link_home' => link( :/, :title => 'Home'),
17
+ 'link_one' => link(self, @action, :one, :title => "#@action/one"),
18
+ 'link_two' => link(self, @action, :one, :two, :three, :title => "#@action/one/two/three"),
19
+ 'link_three' => link(self, @action, :one, :foo => :bar, :title => "#@action?foo=Bar"),
20
+ 'args' => args,
21
+ 'args_empty' => args.empty?,
22
+ 'params' => request.params.inspect
23
+ }
24
+ end
25
+
26
+
27
+ def internal *args
28
+ @hash = liquid_hash(*args)
29
+ %q{
30
+ <html>
31
+ <head>
32
+ <title>Template::Liquid internal</title>
33
+ </head>
34
+ <body>
35
+ <h1>{{header}}</h1>
36
+ {{link_home}}
37
+ <p>
38
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
39
+ {{link_one}}<br />
40
+ {{link_two}}<br />
41
+ {{link_three}}
42
+ </p>
43
+ <div>
44
+ The arguments you have passed to this action are:
45
+ {% if args_empty %}
46
+ none
47
+ {% else %}
48
+ {% for arg in args %}
49
+ <span>{{arg}}</span>
50
+ {% endfor %}
51
+ {% endif %}
52
+ </div>
53
+ <div>
54
+ {{params}}
55
+ </div>
56
+ </body>
57
+ </html>
58
+ }
59
+ end
60
+
61
+ def external *args
62
+ @hash = liquid_hash(*args)
63
+ end
64
+ end
@@ -0,0 +1,52 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'ramaze'
5
+
6
+ include Ramaze
7
+
8
+ class MainController < Template::Markaby
9
+ def index
10
+ %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
11
+ end
12
+
13
+ def internal *args
14
+ @args = args
15
+ mab do
16
+ html do
17
+ head do
18
+ title "Template::Markaby internal"
19
+ end
20
+ body do
21
+ h1 "The #{@action} Template for Markaby"
22
+ a("Home", :href => R(:/))
23
+ p("Here you can pass some stuff if you like, parameters are just passed like this:") do
24
+ br
25
+ a("external/one", :href => R(self, @action, :one))
26
+ br
27
+ a("external/one/two/three", :href => R(self, @action, :one, :two, :three))
28
+ br
29
+ a("external/one?foo=bar", :href => R(self, @action, :one, :foo => :bar))
30
+ br
31
+ end
32
+ div "The arguments you have passed to this action are:" do
33
+ if @args.empty?
34
+ "none"
35
+ else
36
+ args.each do |arg|
37
+ span arg
38
+ end
39
+ end
40
+ end
41
+ div request.params.inspect
42
+ end
43
+ end
44
+ end.to_s
45
+ end
46
+
47
+ def external *args
48
+ @args = args
49
+ end
50
+ end
51
+
52
+ Ramaze.start
@@ -0,0 +1,49 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'ramaze'
5
+
6
+ include Ramaze
7
+
8
+ class MainController < Template::Ramaze
9
+ def index
10
+ %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
11
+ end
12
+
13
+ def internal *args
14
+ @args = args
15
+ transform %q{
16
+ <html>
17
+ <head>
18
+ <title>Template::Ramaze internal</title>
19
+ </head>
20
+ <body>
21
+ <h1>The #{@action} Template</h1>
22
+ <p>
23
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
24
+ #{link self, @action, :one, :title => 'external/one'}<br />
25
+ #{link self, @action, :one, :two, :three, :title => 'external/one/two/three'}<br />
26
+ #{link self, @action, :one, :foo => :bar, :title => 'external?foo=bar'}<br />
27
+ </p>
28
+ <div>
29
+ The arguments you have passed to this action are:
30
+ <?r if @args.empty? ?>
31
+ none
32
+ <?r else ?>
33
+ <?r @args.each do |arg| ?>
34
+ <span>#{arg}</span>
35
+ <?r end ?>
36
+ <?r end ?>
37
+ </div>
38
+ <div>
39
+ #{request.params.inspect}
40
+ </div>
41
+ </body>
42
+ </html>
43
+ }
44
+ end
45
+
46
+ def external *args
47
+ @args = args
48
+ end
49
+ end
@@ -0,0 +1,56 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ # written as an example of how to implement the minimal _why wiki
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ end
10
+
11
+ require 'ramaze'
12
+ require 'bluecloth'
13
+
14
+ include Ramaze
15
+
16
+ Db = YAMLStoreCache.new('wiki.yaml')
17
+
18
+ class WikiController < Template::Ramaze
19
+ def index
20
+ redirect(R(:show, 'Home'))
21
+ end
22
+
23
+ def show page = 'Home'
24
+ @page = page
25
+ @text = Db[page].to_s
26
+
27
+ @text.gsub!(/\[\[(.*?)\]\]/) do |m|
28
+ link( R(self, :show, CGI.escape($1)), :title => $1)
29
+ end
30
+
31
+ @text = BlueCloth.new(@text).to_html
32
+ end
33
+
34
+ def edit page = 'Home'
35
+ @page = page
36
+ @text = Db[page]
37
+ end
38
+
39
+ def save
40
+ redirect_referer unless request.post?
41
+
42
+ page = request['page'].to_s
43
+ text = request['text'].to_s
44
+
45
+ Db[page] = text
46
+
47
+ redirect R(self, :show, CGI.escape(page))
48
+ end
49
+ end
50
+
51
+ Global.adapter = :mongrel
52
+ #Global.tidy = true
53
+ #Global.mode = :benchmark
54
+ Global.mapping = {'/' => WikiController}
55
+
56
+ start