ramaze 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. data/Rakefile +4 -12
  2. data/bin/ramaze +95 -171
  3. data/doc/CHANGELOG +387 -4
  4. data/doc/README +81 -13
  5. data/doc/meta/announcement.txt +51 -8
  6. data/doc/meta/configuration.txt +17 -34
  7. data/doc/meta/internals.txt +34 -4
  8. data/doc/migrate/1110_to_1111.txt +131 -0
  9. data/doc/readme_chunks/features.txt +81 -12
  10. data/doc/readme_chunks/installing.txt +0 -1
  11. data/doc/tutorial/todolist.html +293 -65
  12. data/doc/tutorial/{todolist.txt → todolist.mkd} +251 -51
  13. data/examples/blog/main.rb +1 -1
  14. data/examples/blog/src/model.rb +0 -1
  15. data/examples/hello.rb +2 -5
  16. data/examples/templates/template/external.haml +5 -5
  17. data/examples/templates/template/external.liquid +1 -1
  18. data/examples/templates/template/external.mab +8 -8
  19. data/examples/templates/template/external.rem +30 -0
  20. data/examples/templates/template/external.rhtml +6 -7
  21. data/examples/templates/template/external.zmr +13 -9
  22. data/examples/templates/template_amrita2.rb +8 -8
  23. data/examples/templates/template_erubis.rb +11 -11
  24. data/examples/templates/template_ezamar.rb +9 -11
  25. data/examples/templates/template_haml.rb +13 -13
  26. data/examples/templates/template_liquid.rb +10 -10
  27. data/examples/templates/template_markaby.rb +13 -10
  28. data/examples/templates/template_remarkably.rb +59 -0
  29. data/examples/todolist/main.rb +1 -7
  30. data/examples/todolist/src/controller/main.rb +26 -13
  31. data/examples/todolist/src/element/page.rb +5 -0
  32. data/examples/whywiki/main.rb +1 -1
  33. data/lib/proto/main.rb +0 -8
  34. data/lib/proto/public/css/ramaze_error.css +12 -4
  35. data/lib/proto/public/error.zmr +6 -25
  36. data/lib/ramaze.rb +35 -245
  37. data/lib/ramaze/action.rb +21 -0
  38. data/lib/ramaze/adapter.rb +94 -29
  39. data/lib/ramaze/adapter/base.rb +57 -0
  40. data/lib/ramaze/adapter/mongrel.rb +12 -19
  41. data/lib/ramaze/adapter/webrick.rb +21 -20
  42. data/lib/ramaze/cache.rb +47 -3
  43. data/lib/ramaze/cache/memcached.rb +22 -0
  44. data/lib/ramaze/cache/yaml_store.rb +19 -0
  45. data/lib/ramaze/controller.rb +47 -271
  46. data/lib/ramaze/controller/error.rb +43 -0
  47. data/lib/ramaze/controller/render.rb +90 -0
  48. data/lib/ramaze/controller/resolve.rb +147 -0
  49. data/lib/ramaze/dispatcher.rb +41 -9
  50. data/lib/ramaze/dispatcher/file.rb +1 -1
  51. data/lib/ramaze/global.rb +73 -158
  52. data/lib/ramaze/global/dsl.rb +29 -0
  53. data/lib/ramaze/global/globalstruct.rb +90 -0
  54. data/lib/ramaze/helper.rb +1 -1
  55. data/lib/ramaze/helper/aspect.rb +39 -179
  56. data/lib/ramaze/helper/cache.rb +8 -9
  57. data/lib/ramaze/helper/cgi.rb +23 -0
  58. data/lib/ramaze/helper/file.rb +3 -0
  59. data/lib/ramaze/helper/inform.rb +3 -0
  60. data/lib/ramaze/helper/link.rb +56 -63
  61. data/lib/ramaze/helper/nitroform.rb +4 -0
  62. data/lib/ramaze/helper/redirect.rb +1 -1
  63. data/lib/ramaze/inform.rb +6 -2
  64. data/lib/ramaze/inform/analogger.rb +5 -1
  65. data/lib/ramaze/inform/hub.rb +1 -1
  66. data/lib/ramaze/inform/informing.rb +7 -0
  67. data/lib/ramaze/snippets/kernel/aquire.rb +2 -0
  68. data/lib/ramaze/snippets/kernel/constant.rb +2 -0
  69. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +2 -0
  70. data/lib/ramaze/snippets/object/traits.rb +4 -0
  71. data/lib/ramaze/snippets/openstruct/temp.rb +3 -0
  72. data/lib/ramaze/snippets/string/DIVIDE.rb +2 -0
  73. data/lib/ramaze/snippets/string/camel_case.rb +2 -0
  74. data/lib/ramaze/snippets/string/color.rb +2 -0
  75. data/lib/ramaze/snippets/string/each.rb +2 -0
  76. data/lib/ramaze/snippets/string/snake_case.rb +3 -0
  77. data/lib/ramaze/snippets/struct/fill.rb +8 -2
  78. data/lib/ramaze/snippets/struct/values_at.rb +16 -0
  79. data/lib/ramaze/snippets/symbol/to_proc.rb +3 -0
  80. data/lib/ramaze/sourcereload.rb +89 -0
  81. data/lib/ramaze/template.rb +21 -12
  82. data/lib/ramaze/template/amrita2.rb +6 -6
  83. data/lib/ramaze/template/erubis.rb +4 -9
  84. data/lib/ramaze/template/ezamar.rb +13 -57
  85. data/lib/ramaze/template/ezamar/element.rb +10 -12
  86. data/lib/ramaze/template/ezamar/engine.rb +40 -101
  87. data/lib/ramaze/template/ezamar/morpher.rb +3 -3
  88. data/lib/ramaze/template/haml.rb +3 -6
  89. data/lib/ramaze/template/liquid.rb +4 -9
  90. data/lib/ramaze/template/markaby.rb +16 -22
  91. data/lib/ramaze/template/remarkably.rb +28 -0
  92. data/lib/ramaze/tool/mime.rb +2 -0
  93. data/lib/ramaze/tool/record.rb +6 -0
  94. data/lib/ramaze/trinity/request.rb +44 -54
  95. data/lib/ramaze/trinity/response.rb +1 -1
  96. data/lib/ramaze/trinity/session.rb +15 -37
  97. data/lib/ramaze/version.rb +1 -1
  98. data/rake_tasks/gem.rake +2 -2
  99. data/rake_tasks/maintaince.rake +42 -1
  100. data/rake_tasks/spec.rake +45 -0
  101. data/spec/examples/caching.rb +1 -1
  102. data/spec/examples/simple.rb +1 -1
  103. data/spec/examples/templates/template_amrita2.rb +1 -0
  104. data/spec/examples/templates/template_erubis.rb +2 -1
  105. data/spec/examples/templates/template_ezamar.rb +1 -1
  106. data/spec/examples/templates/template_haml.rb +2 -1
  107. data/spec/examples/templates/template_liquid.rb +2 -1
  108. data/spec/examples/templates/template_markaby.rb +2 -1
  109. data/spec/examples/templates/template_remarkably.rb +22 -0
  110. data/spec/examples/todolist.rb +125 -0
  111. data/spec/helper.rb +2 -23
  112. data/spec/helper/minimal.rb +20 -0
  113. data/spec/helper/mock_http.rb +24 -30
  114. data/spec/helper/simple_http.rb +2 -2
  115. data/spec/helper/wrap.rb +6 -9
  116. data/spec/ramaze/adapter.rb +1 -1
  117. data/spec/ramaze/adapter/record.rb +31 -0
  118. data/spec/ramaze/cache.rb +41 -54
  119. data/spec/ramaze/controller.rb +121 -137
  120. data/spec/ramaze/controller/template/list.xhtml +1 -0
  121. data/spec/ramaze/controller/template/other/greet/other.xhtml +1 -0
  122. data/spec/ramaze/controller/template_resolving.rb +27 -3
  123. data/spec/ramaze/element.rb +11 -7
  124. data/spec/ramaze/error.rb +1 -1
  125. data/spec/ramaze/gestalt.rb +2 -0
  126. data/spec/ramaze/helper/aspect.rb +30 -21
  127. data/spec/ramaze/helper/auth.rb +1 -1
  128. data/spec/ramaze/helper/cache.rb +2 -1
  129. data/spec/ramaze/helper/form.rb +14 -11
  130. data/spec/ramaze/helper/link.rb +18 -41
  131. data/spec/ramaze/localize.rb +29 -2
  132. data/spec/ramaze/morpher.rb +23 -12
  133. data/spec/ramaze/params.rb +46 -24
  134. data/spec/ramaze/request.rb +6 -2
  135. data/spec/ramaze/store/yaml.rb +5 -0
  136. data/spec/ramaze/template.rb +22 -27
  137. data/spec/ramaze/template/amrita2.rb +1 -2
  138. data/spec/ramaze/template/erubis.rb +1 -1
  139. data/spec/ramaze/template/ezamar.rb +1 -2
  140. data/spec/ramaze/template/haml.rb +2 -2
  141. data/spec/ramaze/template/haml/with_vars.haml +1 -1
  142. data/spec/ramaze/template/liquid.rb +1 -1
  143. data/spec/ramaze/template/markaby.rb +1 -1
  144. data/spec/ramaze/template/remarkably.rb +56 -0
  145. data/spec/ramaze/template/remarkably/external.rem +8 -0
  146. data/spec/ramaze/template/remarkably/sum.rem +1 -0
  147. metadata +38 -63
  148. data/doc/README.html +0 -637
  149. data/doc/allison/LICENSE +0 -184
  150. data/doc/allison/README +0 -37
  151. data/doc/allison/allison.css +0 -299
  152. data/doc/allison/allison.gif +0 -0
  153. data/doc/allison/allison.js +0 -307
  154. data/doc/allison/allison.rb +0 -287
  155. data/doc/allison/cache/BODY +0 -588
  156. data/doc/allison/cache/CLASS_INDEX +0 -4
  157. data/doc/allison/cache/CLASS_PAGE +0 -1
  158. data/doc/allison/cache/FILE_INDEX +0 -4
  159. data/doc/allison/cache/FILE_PAGE +0 -1
  160. data/doc/allison/cache/FONTS +0 -1
  161. data/doc/allison/cache/FR_INDEX_BODY +0 -1
  162. data/doc/allison/cache/IMGPATH +0 -1
  163. data/doc/allison/cache/INDEX +0 -1
  164. data/doc/allison/cache/JAVASCRIPT +0 -307
  165. data/doc/allison/cache/METHOD_INDEX +0 -4
  166. data/doc/allison/cache/METHOD_LIST +0 -1
  167. data/doc/allison/cache/SRC_PAGE +0 -1
  168. data/doc/allison/cache/STYLE +0 -321
  169. data/doc/allison/cache/URL +0 -1
  170. data/doc/changes.txt +0 -3375
  171. data/doc/changes.xml +0 -3378
  172. data/examples/todolist/conf/benchmark.yaml +0 -35
  173. data/examples/todolist/conf/debug.yaml +0 -34
  174. data/examples/todolist/conf/live.yaml +0 -33
  175. data/examples/todolist/conf/silent.yaml +0 -31
  176. data/examples/todolist/conf/stage.yaml +0 -33
  177. data/examples/todolist/public/css/coderay.css +0 -105
  178. data/examples/todolist/public/css/ramaze_error.css +0 -42
  179. data/lib/proto/conf/benchmark.yaml +0 -21
  180. data/lib/proto/conf/debug.yaml +0 -21
  181. data/lib/proto/conf/live.yaml +0 -21
  182. data/lib/proto/conf/silent.yaml +0 -21
  183. data/lib/proto/conf/stage.yaml +0 -21
  184. data/lib/proto/public/css/coderay.css +0 -105
  185. data/lib/ramaze/http_status.rb +0 -66
  186. data/lib/ramaze/snippets/hash/keys_to_sym.rb +0 -19
  187. data/lib/ramaze/snippets/kernel/method.rb +0 -26
  188. data/lib/ramaze/snippets/method/name.rb +0 -22
  189. data/lib/ramaze/snippets/ramaze/autoreload.rb +0 -135
  190. data/lib/ramaze/snippets/rdoc/usage_no_exit.rb +0 -65
  191. data/spec/all.rb +0 -32
  192. data/spec/ramaze/conf/locale_de.yaml +0 -6
  193. data/spec/ramaze/conf/locale_en.yaml +0 -6
  194. data/spec/ramaze/dependencies.rb +0 -16
  195. data/spec/ramaze/global.rb +0 -44
@@ -14,4 +14,4 @@ Og.setup :evolve_schema => :full
14
14
  Entry.create "Blog created", "Exciting news today, this blog was created!" if
15
15
  Entry.count == 0
16
16
 
17
- start
17
+ Ramaze.start
@@ -3,7 +3,6 @@ class Entry
3
3
  property :updated, Time
4
4
  property :title, String
5
5
  property :content, String
6
- property :craig, String
7
6
  def initialize title, content
8
7
  @created=Time.now
9
8
  @updated=Time.now
@@ -3,18 +3,15 @@
3
3
 
4
4
  require 'ramaze'
5
5
 
6
- # This is named MainController to automagically map it to '/'
7
- # Global.mapping['/'] = MainController
8
- # would do the same thing.
9
6
  # you can access it now with http://localhost:7000/
10
7
  # This should output
11
8
  # Hello, World!
12
9
  # in your browser
13
10
 
14
11
  class MainController < Ramaze::Controller
15
- map '/'
16
-
17
12
  def index
18
13
  "Hello, World!"
19
14
  end
20
15
  end
16
+
17
+ Ramaze.start
@@ -1,17 +1,17 @@
1
1
  %html
2
2
  %head
3
- %title Template::Haml internal
3
+ %title= "Template::Haml #@place"
4
4
  %body
5
5
  %h1= @title
6
- = Rs(:/, :title => 'Home')
6
+ = A('Home', :href => :/)
7
7
  %p
8
8
  Here you can pass some stuff if you like, parameters are just passed like this:
9
9
  %br/
10
- = link( R(self, @action, :one), :title => "#@action/one")
10
+ = A("#@place/one")
11
11
  %br/
12
- = link( R(self, @action, :one, :two, :three), :title => "#@action/one/two/three")
12
+ = A("#@place/one/two/three")
13
13
  %br/
14
- = link( R(self, @action, :one, :foo => :bar), :title => "#@action/one?foo=bar")
14
+ = A("#@place/one?foo=bar")
15
15
  %div
16
16
  The arguments you have passed to this action are:
17
17
  - if @args.empty?
@@ -1,6 +1,6 @@
1
1
  <html>
2
2
  <head>
3
- <title>Template::Liquid internal</title>
3
+ <title>Template::Liquid external</title>
4
4
  </head>
5
5
  <body>
6
6
  <h1>{{header}}</h1>
@@ -1,24 +1,24 @@
1
1
  html do
2
2
  head do
3
- title "Template::Markaby external"
3
+ title "Template::Markaby #@place"
4
4
  end
5
5
  body do
6
- h1 "The #{@action} Template for Markaby"
7
- a("Home", :href => R(:/))
6
+ h1 "The #@place Template for Markaby"
7
+ a("Home", :href => R(@this))
8
8
  p do
9
9
  text "Here you can pass some stuff if you like, parameters are just passed like this:"
10
10
  br
11
- a("external/one", :href => Rs(@action, :one))
11
+ a("#@place/one", :href => R(@this, @place, :one))
12
12
  br
13
- a("external/one/two/three", :href => Rs(@action, :one, :two, :three))
13
+ a("#@place/one/two/three", :href => R(@this, @place, :one, :two, :three))
14
14
  br
15
- a("external/one?foo=bar", :href => Rs(@action, :one, :foo => :bar))
15
+ a("#@place/one?foo=bar", :href => R(@this, @place, :one, :foo => :bar))
16
16
  br
17
17
  end
18
18
  div do
19
- text "The arguments you have passed to this action are:"
19
+ text "The arguments you have passed to this action are:"
20
20
  if @args.empty?
21
- "none"
21
+ text "none"
22
22
  else
23
23
  args.each do |arg|
24
24
  span arg
@@ -0,0 +1,30 @@
1
+ html do
2
+ head do
3
+ title "Template::Remarkably #@place"
4
+ end
5
+ body do
6
+ h1 "The #@place Template for Remarkably"
7
+ a("Home", :href => R(@place))
8
+ P do
9
+ text "Here you can pass some stuff if you like, parameters are just passed like this:"
10
+ br
11
+ a("#@place/one", :href => Rs( @place, :one))
12
+ br
13
+ a("#@place/one/two/three", :href => Rs( @place, :one, :two, :three))
14
+ br
15
+ a("#@place/one?foo=bar", :href => Rs( @place, :one, :foo => :bar))
16
+ br
17
+ end
18
+ div do
19
+ text "The arguments you have passed to this action are:"
20
+ if @args.empty?
21
+ text "none"
22
+ else
23
+ args.each do |arg|
24
+ span arg
25
+ end
26
+ end
27
+ end
28
+ div @request.params.inspect
29
+ end
30
+ end
@@ -1,15 +1,15 @@
1
1
  <html>
2
2
  <head>
3
- <title>Template::Erubis external</title>
3
+ <title>Template::Erubis internal</title>
4
4
  </head>
5
5
  <body>
6
- <h1>The <%= @action %> Template for Erubis</h1>
7
- <%= link :/, :title => 'Home' %>
6
+ <h1>The internal Template for Erubis</h1>
7
+ <%= A('Home', :href => :/) %>
8
8
  <p>
9
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 />
10
+ <%= A("/#@place/one") %><br />
11
+ <%= A("#@place/two/three") %><br />
12
+ <%= A("#@place/one?foo=bar") %><br />
13
13
  </p>
14
14
  <div>
15
15
  The arguments you have passed to this action are:
@@ -26,4 +26,3 @@
26
26
  </div>
27
27
  </body>
28
28
  </html>
29
-
@@ -1,20 +1,24 @@
1
1
  <html>
2
2
  <head>
3
- <title>Template::Ezamar external</title>
3
+ <title>Template::Ezamar internal</title>
4
4
  </head>
5
5
  <body>
6
- <h1>The #{@action} Template for Ezamar</h1>
7
- #{link :/, :title => 'Home'}
6
+ <h1>The internal Template for Ezamar</h1>
7
+ #{A 'Home', :href => :/}
8
8
  <p>
9
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 />
10
+ #{A("internal/one")}<br />
11
+ #{A("internal/one/two/three")}<br />
12
+ #{A("internal/one?foo=bar")}<br />
13
13
  </p>
14
14
  <div>
15
- *args
16
- <?r @args.each do |arg| ?>
17
- <span>#{arg}</span>
15
+ The arguments you have passed to this action are:
16
+ <?r if @args.empty? ?>
17
+ none
18
+ <?r else ?>
19
+ <?r @args.each do |arg| ?>
20
+ <span>#{arg}</span>
21
+ <?r end ?>
18
22
  <?r end ?>
19
23
  </div>
20
24
  <div>
@@ -6,34 +6,34 @@ require 'ramaze'
6
6
  include Ramaze
7
7
 
8
8
  # TODO:
9
- # implement the amrita2 example, man, this engine is awkward :P
9
+ # - implement the amrita2 example, man, this engine is awkward :P
10
10
 
11
11
  class MainController < Controller
12
- trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
12
+ template_root File.expand_path((File.dirname(__FILE__)/'template'))
13
13
  trait :engine => Template::Amrita2
14
14
 
15
15
  def index
16
- %{ #{Rs()} | #{Rs(:internal)} | #{Rs(:external)} }
16
+ %{ #{A(Rs())} | #{Rs(:internal)} | #{Rs(:external)} }
17
17
  end
18
18
 
19
19
  def title
20
- "The #@action Template for Amrita2"
20
+ "The external Template for Amrita2"
21
21
  end
22
22
 
23
23
  def link_home
24
- link :/, :title => 'Home'
24
+ A('Home', :href => '/')
25
25
  end
26
26
 
27
27
  def link_one
28
- link self, @action, :one, :title => "#@action/one"
28
+ A('/external/one', :href => Rs(:external, :one))
29
29
  end
30
30
 
31
31
  def link_two
32
- link self, @action, :one, :two, :three, :title => "#@action/one/two/three"
32
+ A("/external/one/two/three", :href => Rs(:external, :one, :two, :three))
33
33
  end
34
34
 
35
35
  def link_three
36
- link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar"
36
+ A("/external?foo=bar", :href => Rs(:external, :one, :foo => :bar))
37
37
  end
38
38
 
39
39
  def inspect_parameters
@@ -3,31 +3,30 @@
3
3
 
4
4
  require 'ramaze'
5
5
 
6
- include Ramaze
7
-
8
- class MainController < Controller
9
- trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
10
- trait :engine => Template::Erubis
6
+ class MainController < Ramaze::Controller
7
+ template_root File.expand_path((File.dirname(__FILE__)/'template'))
8
+ trait :engine => Ramaze::Template::Erubis
11
9
 
12
10
  def index
13
- %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
11
+ %{ #{A('Home', :href => :/)} | #{A(:internal)} | #{A(:external)} }
14
12
  end
15
13
 
16
14
  def internal *args
17
15
  @args = args
16
+ @place = :internal
18
17
  %q{
19
18
  <html>
20
19
  <head>
21
20
  <title>Template::Erubis internal</title>
22
21
  </head>
23
22
  <body>
24
- <h1>The <%= @action %> Template for Erubis</h1>
25
- <%= link :/, :title => 'Home' %>
23
+ <h1>The internal Template for Erubis</h1>
24
+ <%= A('Home', :href => :/) %>
26
25
  <p>
27
26
  Here you can pass some stuff if you like, parameters are just passed like this:<br />
28
- <%= link self, @action, :one, :title => "#@action/one" %><br />
29
- <%= link self, @action, :one, :two, :three, :title => "#@action/one/two/three" %><br />
30
- <%= link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar" %><br />
27
+ <%= A("/#@place/one") %><br />
28
+ <%= A("#@place/two/three") %><br />
29
+ <%= A("#@place/one?foo=bar") %><br />
31
30
  </p>
32
31
  <div>
33
32
  The arguments you have passed to this action are:
@@ -49,5 +48,6 @@ class MainController < Controller
49
48
 
50
49
  def external *args
51
50
  @args = args
51
+ @place = :external
52
52
  end
53
53
  end
@@ -3,13 +3,11 @@
3
3
 
4
4
  require 'ramaze'
5
5
 
6
- include Ramaze
7
-
8
- class MainController < Controller
9
- trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
6
+ class MainController < Ramaze::Controller
7
+ template_root File.expand_path((File.dirname(__FILE__)/'template'))
10
8
 
11
9
  def index
12
- %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
10
+ %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
13
11
  end
14
12
 
15
13
  def internal *args
@@ -20,13 +18,13 @@ class MainController < Controller
20
18
  <title>Template::Ezamar internal</title>
21
19
  </head>
22
20
  <body>
23
- <h1>The #{@action} Template for Ezamar</h1>
24
- #{link :/, :title => 'Home'}
21
+ <h1>The internal Template for Ezamar</h1>
22
+ #{A 'Home', :href => :/}
25
23
  <p>
26
24
  Here you can pass some stuff if you like, parameters are just passed like this:<br />
27
- #{link self, @action, :one, :title => "#@action/one"}<br />
28
- #{link self, @action, :one, :two, :three, :title => "#@action/one/two/three"}<br />
29
- #{link self, @action, :one, :foo => :bar, :title => "#@action?foo=bar"}<br />
25
+ #{A("internal/one")}<br />
26
+ #{A("internal/one/two/three")}<br />
27
+ #{A("internal/one?foo=bar")}<br />
30
28
  </p>
31
29
  <div>
32
30
  The arguments you have passed to this action are:
@@ -51,4 +49,4 @@ class MainController < Controller
51
49
  end
52
50
  end
53
51
 
54
- run
52
+ Ramaze.start
@@ -3,35 +3,34 @@
3
3
 
4
4
  require 'ramaze'
5
5
 
6
- include Ramaze
7
-
8
- class MainController < Controller
9
- trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
10
- trait :engine => Template::Haml
6
+ class MainController < Ramaze::Controller
7
+ template_root File.expand_path((File.dirname(__FILE__)/'template'))
8
+ trait :engine => Ramaze::Template::Haml
11
9
 
12
10
  def index
13
- %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
11
+ %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
14
12
  end
15
13
 
16
14
  def internal *args
17
15
  @args = args
18
- @title = "The #@action Template for Haml"
16
+ @place = :internal
17
+ @title = "The #@place Template for Haml"
19
18
 
20
19
  %q{
21
20
  %html
22
21
  %head
23
- %title Template::Haml internal
22
+ %title= "Template::Haml #@place"
24
23
  %body
25
24
  %h1= @title
26
- = Rs(:/, :title => 'Home')
25
+ = A('Home', :href => :/)
27
26
  %p
28
27
  Here you can pass some stuff if you like, parameters are just passed like this:
29
28
  %br/
30
- = link( R(self, @action, :one), :title => "#@action/one")
29
+ = A("#@place/one")
31
30
  %br/
32
- = link( R(self, @action, :one, :two, :three), :title => "#@action/one/two/three")
31
+ = A("#@place/one/two/three")
33
32
  %br/
34
- = link( R(self, @action, :one, :foo => :bar), :title => "#@action/one?foo=bar")
33
+ = A("#@place/one?foo=bar")
35
34
  %div
36
35
  The arguments you have passed to this action are:
37
36
  - if @args.empty?
@@ -44,8 +43,9 @@ class MainController < Controller
44
43
  end
45
44
 
46
45
  def external *args
47
- @title = "The #{@action} Template for Haml"
48
46
  @args = args
47
+ @place = :external
48
+ @title = "The #@place Template for Haml"
49
49
  end
50
50
  end
51
51
 
@@ -6,20 +6,20 @@ require 'ramaze'
6
6
  include Ramaze
7
7
 
8
8
  class MainController < Controller
9
- trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
9
+ template_root File.expand_path((File.dirname(__FILE__)/'template'))
10
10
  trait :engine => Template::Liquid
11
11
 
12
12
  def index
13
- %{ #{link self.class} | #{link self.class, :internal} | #{link self.class, :external} }
13
+ %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
14
14
  end
15
15
 
16
- def liquid_hash(*args)
16
+ def liquid_hash(place, *args)
17
17
  {
18
- 'header' => "The #{@action} Template for Liquid",
19
- 'link_home' => link( :/, :title => 'Home'),
20
- 'link_one' => link(self, @action, :one, :title => "#@action/one"),
21
- 'link_two' => link(self, @action, :one, :two, :three, :title => "#@action/one/two/three"),
22
- 'link_three' => link(self, @action, :one, :foo => :bar, :title => "#@action?foo=Bar"),
18
+ 'header' => "The #{place} Template for Liquid",
19
+ 'link_home' => A('Home', :href => :/),
20
+ 'link_one' => A("#{place}/one"),
21
+ 'link_two' => A("#{place}/one/two/three"),
22
+ 'link_three' => A("#{place}?foo=Bar"),
23
23
  'args' => args,
24
24
  'args_empty' => args.empty?,
25
25
  'params' => request.params.inspect
@@ -28,7 +28,7 @@ class MainController < Controller
28
28
 
29
29
 
30
30
  def internal *args
31
- @hash = liquid_hash(*args)
31
+ @hash = liquid_hash(:internal, *args)
32
32
  %q{
33
33
  <html>
34
34
  <head>
@@ -62,6 +62,6 @@ class MainController < Controller
62
62
  end
63
63
 
64
64
  def external *args
65
- @hash = liquid_hash(*args)
65
+ @hash = liquid_hash(:external, *args)
66
66
  end
67
67
  end
@@ -6,38 +6,40 @@ require 'ramaze'
6
6
  include Ramaze
7
7
 
8
8
  class MainController < Controller
9
- trait :template_root => File.expand_path((File.dirname(__FILE__)/'template'))
9
+ template_root File.expand_path((File.dirname(__FILE__)/'template'))
10
10
  trait :engine => Template::Markaby
11
11
 
12
12
  helper :markaby
13
13
 
14
14
  def index
15
- %{ #{Rlink self.class} | #{Rlink self.class, :internal} | #{Rlink self.class, :external} }
15
+ %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
16
16
  end
17
17
 
18
18
  def internal *args
19
- mab :action => @action, :args => args, :request => request, :this => self do
19
+ options = {:place => :internal, :action => 'internal',
20
+ :args => args, :request => request, :this => self}
21
+ mab options do
20
22
  html do
21
23
  head do
22
- title "Template::Markaby internal"
24
+ title "Template::Markaby #@place"
23
25
  end
24
26
  body do
25
- h1 "The #{@action} Template for Markaby"
26
- a("Home", :href => R(:/))
27
+ h1 "The #@place Template for Markaby"
28
+ a("Home", :href => R(@this))
27
29
  p do
28
30
  text "Here you can pass some stuff if you like, parameters are just passed like this:"
29
31
  br
30
- a("external/one", :href => R(@this, @action, :one))
32
+ a("#@place/one", :href => R(@this, @place, :one))
31
33
  br
32
- a("external/one/two/three", :href => R(@this, @action, :one, :two, :three))
34
+ a("#@place/one/two/three", :href => R(@this, @place, :one, :two, :three))
33
35
  br
34
- a("external/one?foo=bar", :href => R(@this, @action, :one, :foo => :bar))
36
+ a("#@place/one?foo=bar", :href => R(@this, @place, :one, :foo => :bar))
35
37
  br
36
38
  end
37
39
  div do
38
40
  text "The arguments you have passed to this action are:"
39
41
  if @args.empty?
40
- "none"
42
+ text "none"
41
43
  else
42
44
  args.each do |arg|
43
45
  span arg
@@ -53,6 +55,7 @@ class MainController < Controller
53
55
  def external *args
54
56
  @args = args
55
57
  @request = request
58
+ @place = :external
56
59
  end
57
60
  end
58
61