ramaze 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/Rakefile +14 -259
  2. data/bin/ramaze +52 -25
  3. data/doc/AUTHORS +6 -0
  4. data/doc/CHANGELOG +1363 -42
  5. data/doc/INSTALL +1 -1
  6. data/doc/README +48 -35
  7. data/doc/README.html +637 -0
  8. data/doc/TODO +7 -16
  9. data/doc/allison/allison.css +6 -7
  10. data/doc/allison/allison.gif +0 -0
  11. data/doc/allison/cache/STYLE +1 -2
  12. data/doc/changes.txt +3375 -0
  13. data/doc/changes.xml +3378 -0
  14. data/doc/meta/announcement.txt +47 -0
  15. data/doc/meta/configuration.txt +179 -0
  16. data/doc/meta/internals.txt +111 -0
  17. data/doc/readme_chunks/features.txt +8 -16
  18. data/doc/readme_chunks/installing.txt +7 -1
  19. data/doc/tutorial/todolist.txt +2 -3
  20. data/examples/blog/main.rb +9 -8
  21. data/examples/blog/public/styles/blog.css +132 -0
  22. data/examples/blog/src/controller.rb +14 -41
  23. data/examples/blog/src/model.rb +12 -13
  24. data/examples/blog/src/view.rb +16 -0
  25. data/examples/blog/template/edit.xhtml +19 -8
  26. data/examples/blog/template/index.xhtml +14 -22
  27. data/examples/blog/template/new.xhtml +18 -5
  28. data/examples/caching.rb +5 -8
  29. data/examples/element.rb +3 -3
  30. data/examples/hello.rb +3 -5
  31. data/examples/simple.rb +4 -7
  32. data/examples/templates/template/external.haml +8 -7
  33. data/examples/templates/template/external.mab +11 -8
  34. data/examples/templates/template_amrita2.rb +4 -4
  35. data/examples/templates/template_erubis.rb +3 -3
  36. data/examples/templates/template_ezamar.rb +1 -2
  37. data/examples/templates/template_haml.rb +24 -23
  38. data/examples/templates/template_liquid.rb +3 -1
  39. data/examples/templates/template_markaby.rb +15 -9
  40. data/examples/todolist/src/element/page.rb +1 -1
  41. data/lib/proto/conf/benchmark.yaml +6 -20
  42. data/lib/proto/conf/debug.yaml +6 -19
  43. data/lib/proto/conf/live.yaml +7 -19
  44. data/lib/proto/conf/silent.yaml +6 -16
  45. data/lib/proto/conf/stage.yaml +6 -18
  46. data/lib/proto/public/error.zmr +2 -2
  47. data/lib/ramaze.rb +34 -72
  48. data/lib/ramaze/adapter.rb +21 -18
  49. data/lib/ramaze/adapter/mongrel.rb +0 -3
  50. data/lib/ramaze/adapter/webrick.rb +6 -6
  51. data/lib/ramaze/cache/memcached.rb +3 -0
  52. data/lib/ramaze/controller.rb +227 -183
  53. data/lib/ramaze/dispatcher.rb +34 -129
  54. data/lib/ramaze/dispatcher/action.rb +28 -0
  55. data/lib/ramaze/dispatcher/error.rb +43 -0
  56. data/lib/ramaze/dispatcher/file.rb +34 -0
  57. data/lib/ramaze/global.rb +89 -48
  58. data/lib/ramaze/helper/aspect.rb +8 -6
  59. data/lib/ramaze/helper/auth.rb +3 -3
  60. data/lib/ramaze/helper/cache.rb +2 -2
  61. data/lib/ramaze/helper/file.rb +14 -0
  62. data/lib/ramaze/helper/inform.rb +36 -0
  63. data/lib/ramaze/helper/link.rb +7 -3
  64. data/lib/ramaze/helper/markaby.rb +30 -0
  65. data/lib/ramaze/helper/redirect.rb +2 -0
  66. data/lib/ramaze/inform.rb +8 -182
  67. data/lib/ramaze/inform/analogger.rb +19 -0
  68. data/lib/ramaze/inform/growl.rb +28 -0
  69. data/lib/ramaze/inform/hub.rb +26 -0
  70. data/lib/ramaze/inform/informer.rb +92 -0
  71. data/lib/ramaze/inform/informing.rb +44 -0
  72. data/lib/ramaze/inform/syslog.rb +27 -0
  73. data/lib/ramaze/inform/xosd.rb +42 -0
  74. data/lib/ramaze/snippets.rb +6 -2
  75. data/lib/ramaze/snippets/object/traits.rb +13 -1
  76. data/lib/ramaze/snippets/ramaze/autoreload.rb +58 -2
  77. data/lib/ramaze/snippets/string/color.rb +27 -0
  78. data/lib/ramaze/snippets/string/each.rb +6 -0
  79. data/lib/ramaze/snippets/struct/fill.rb +15 -0
  80. data/lib/ramaze/template/ezamar.rb +13 -22
  81. data/lib/ramaze/template/ezamar/element.rb +12 -12
  82. data/lib/ramaze/template/liquid.rb +19 -18
  83. data/lib/ramaze/template/markaby.rb +37 -58
  84. data/lib/ramaze/tool/localize.rb +128 -0
  85. data/lib/ramaze/tool/tidy.rb +51 -21
  86. data/lib/ramaze/trinity.rb +3 -3
  87. data/lib/ramaze/trinity/request.rb +41 -23
  88. data/lib/ramaze/trinity/response.rb +10 -5
  89. data/lib/ramaze/trinity/session.rb +17 -3
  90. data/lib/ramaze/version.rb +2 -2
  91. data/rake_tasks/conf.rake +56 -0
  92. data/rake_tasks/gem.rake +44 -0
  93. data/rake_tasks/maintaince.rake +187 -0
  94. data/spec/all.rb +32 -0
  95. data/spec/examples/caching.rb +19 -0
  96. data/spec/examples/element.rb +15 -0
  97. data/spec/examples/hello.rb +11 -0
  98. data/spec/examples/simple.rb +51 -0
  99. data/spec/examples/templates/template_amrita2.rb +14 -0
  100. data/spec/examples/templates/template_erubis.rb +21 -0
  101. data/spec/examples/templates/template_ezamar.rb +22 -0
  102. data/spec/examples/templates/template_haml.rb +23 -0
  103. data/spec/examples/templates/template_liquid.rb +24 -0
  104. data/spec/examples/templates/template_markaby.rb +21 -0
  105. data/spec/helper.rb +81 -0
  106. data/spec/{spec_helper_context.rb → helper/context.rb} +1 -1
  107. data/spec/helper/layout.rb +55 -0
  108. data/spec/helper/mock_http.rb +66 -0
  109. data/spec/{spec_helper_requester.rb → helper/requester.rb} +0 -6
  110. data/spec/{spec_helper_simple_http.rb → helper/simple_http.rb} +57 -57
  111. data/spec/helper/wrap.rb +193 -0
  112. data/spec/{adapter_spec.rb → ramaze/adapter.rb} +7 -5
  113. data/spec/{tc_adapter_mongrel.rb → ramaze/adapter/mongrel.rb} +2 -2
  114. data/spec/{tc_adapter_webrick.rb → ramaze/adapter/webrick.rb} +2 -2
  115. data/spec/{tc_cache.rb → ramaze/cache.rb} +16 -16
  116. data/spec/ramaze/conf/locale_de.yaml +6 -0
  117. data/spec/ramaze/conf/locale_en.yaml +6 -0
  118. data/spec/ramaze/controller.rb +184 -0
  119. data/spec/ramaze/controller/template/greet.xhtml +1 -0
  120. data/spec/ramaze/controller/template_resolving.rb +54 -0
  121. data/spec/ramaze/dependencies.rb +16 -0
  122. data/spec/{tc_element.rb → ramaze/element.rb} +21 -19
  123. data/spec/ramaze/error.rb +64 -0
  124. data/spec/{tc_gestalt.rb → ramaze/gestalt.rb} +10 -10
  125. data/spec/{tc_global.rb → ramaze/global.rb} +7 -7
  126. data/spec/{tc_helper_aspect.rb → ramaze/helper/aspect.rb} +22 -14
  127. data/spec/{tc_helper_auth.rb → ramaze/helper/auth.rb} +9 -7
  128. data/spec/{tc_helper_cache.rb → ramaze/helper/cache.rb} +14 -24
  129. data/spec/{tc_helper_feed.rb → ramaze/helper/feed.rb} +12 -12
  130. data/spec/ramaze/helper/file.rb +17 -0
  131. data/spec/{tc_helper_flash.rb → ramaze/helper/flash.rb} +16 -17
  132. data/spec/{tc_helper_form.rb → ramaze/helper/form.rb} +25 -26
  133. data/spec/{tc_helper_link.rb → ramaze/helper/link.rb} +9 -9
  134. data/spec/{tc_helper_redirect.rb → ramaze/helper/redirect.rb} +11 -10
  135. data/spec/{tc_helper_stack.rb → ramaze/helper/stack.rb} +10 -11
  136. data/spec/ramaze/inform/informer.rb +40 -0
  137. data/spec/ramaze/inform/syslog.rb +10 -0
  138. data/spec/ramaze/localize.rb +40 -0
  139. data/spec/ramaze/morpher.rb +82 -0
  140. data/spec/ramaze/params.rb +124 -0
  141. data/spec/{public → ramaze/public}/error404.xhtml +0 -0
  142. data/spec/{public → ramaze/public}/favicon.ico +0 -0
  143. data/spec/{public → ramaze/public}/ramaze.png +0 -0
  144. data/spec/{public → ramaze/public}/test_download.css +0 -0
  145. data/spec/ramaze/request.rb +129 -0
  146. data/spec/{tc_request_mongrel.rb → ramaze/request/mongrel.rb} +2 -2
  147. data/spec/{tc_request_webrick.rb → ramaze/request/webrick.rb} +1 -1
  148. data/spec/{tc_session.rb → ramaze/session.rb} +18 -18
  149. data/spec/{tc_store.rb → ramaze/store/default.rb} +10 -10
  150. data/spec/{tc_store_yaml.rb → ramaze/store/yaml.rb} +9 -9
  151. data/spec/ramaze/template.rb +86 -0
  152. data/spec/{tc_template_amrita2.rb → ramaze/template/amrita2.rb} +5 -5
  153. data/spec/{template → ramaze/template}/amrita2/data.amrita +0 -0
  154. data/spec/{template → ramaze/template}/amrita2/index.amrita +0 -0
  155. data/spec/{template → ramaze/template}/amrita2/sum.amrita +0 -0
  156. data/spec/{tc_template_erubis.rb → ramaze/template/erubis.rb} +9 -9
  157. data/spec/{template → ramaze/template}/erubis/sum.rhtml +0 -0
  158. data/spec/ramaze/template/ezamar.rb +62 -0
  159. data/spec/{template → ramaze/template}/ezamar/another/long/action.zmr +0 -0
  160. data/spec/{template → ramaze/template}/ezamar/combined.zmr +0 -0
  161. data/spec/{template → ramaze/template}/ezamar/file_only.zmr +0 -0
  162. data/spec/{template → ramaze/template}/ezamar/index.zmr +0 -0
  163. data/spec/ramaze/template/ezamar/nested.zmr +1 -0
  164. data/spec/{template → ramaze/template}/ezamar/some__long__action.zmr +0 -0
  165. data/spec/{template → ramaze/template}/ezamar/sum.zmr +0 -0
  166. data/spec/{tc_template_haml.rb → ramaze/template/haml.rb} +7 -7
  167. data/spec/{template → ramaze/template}/haml/index.haml +0 -0
  168. data/spec/{template → ramaze/template}/haml/with_vars.haml +0 -0
  169. data/spec/{tc_template_liquid.rb → ramaze/template/liquid.rb} +7 -7
  170. data/spec/{template → ramaze/template}/liquid/index.liquid +0 -0
  171. data/spec/{template → ramaze/template}/liquid/products.liquid +0 -0
  172. data/spec/ramaze/template/markaby.rb +59 -0
  173. data/spec/{template → ramaze/template}/markaby/external.mab +0 -0
  174. data/spec/{template → ramaze/template}/markaby/sum.mab +0 -0
  175. data/spec/ramaze/template/ramaze/external.test +1 -0
  176. data/spec/{tc_tidy.rb → ramaze/tidy.rb} +3 -3
  177. metadata +145 -81
  178. data/examples/blog/public/screen.css +0 -106
  179. data/examples/blog/src/element.rb +0 -58
  180. data/examples/blog/template/view.xhtml +0 -15
  181. data/examples/blog/test/tc_entry.rb +0 -18
  182. data/lib/proto/public/404.jpg +0 -0
  183. data/spec/request_tc_helper.rb +0 -135
  184. data/spec/spec_all.rb +0 -118
  185. data/spec/spec_helper.rb +0 -66
  186. data/spec/tc_controller.rb +0 -49
  187. data/spec/tc_dependencies.rb +0 -13
  188. data/spec/tc_error.rb +0 -43
  189. data/spec/tc_morpher.rb +0 -88
  190. data/spec/tc_params.rb +0 -125
  191. data/spec/tc_template_ezamar.rb +0 -64
  192. data/spec/tc_template_markaby.rb +0 -72
  193. data/spec/template/ezamar/nested.zmr +0 -1
@@ -0,0 +1,132 @@
1
+ body {
2
+ margin: 0;
3
+ padding: 0;
4
+ }
5
+
6
+ h1 {
7
+ background: #FFC;
8
+ margin: 0;
9
+ padding: 0.25em 3em 0.25em 0.25em;
10
+ font-size: 32pt;
11
+ text-align: right;
12
+ color: #884;
13
+ border-bottom: 1px solid #004;
14
+ }
15
+
16
+ h2 {
17
+ margin: 8pt 0 0 0;
18
+ padding: 0 8pt 4pt 8pt;
19
+ font-size: 24pt;
20
+ color: #884;
21
+ }
22
+
23
+ div#actions {
24
+ margin: -1px 8pt 0 0;
25
+ padding: 2pt 8pt 4pt 8pt;
26
+ float: right;
27
+ background: #FFC;
28
+ border-style: solid;
29
+ border-width: 0 2px 2px 1px;
30
+ border-color: 0 #004 #004 #448;
31
+ font-size: 10pt;
32
+ color: #884;
33
+ }
34
+
35
+ div#actions a {
36
+ color: inherit;
37
+ text-decoration: none;
38
+ }
39
+
40
+ div#actions a:hover {
41
+ color: black;
42
+ }
43
+
44
+ div#entries {
45
+ margin: 0pt 20pt 10pt 12pt;
46
+ }
47
+
48
+ div.entry {
49
+ margin: 10pt 0 0 0;
50
+ padding: 0;
51
+ background-color: #FFD;
52
+ border-left: 8pt solid #CC8;
53
+ border-top: 1px solid #CC8;
54
+ }
55
+
56
+ div.entry div.header {
57
+ background-color: #EEA;
58
+ border-bottom: 1px solid #CC8;
59
+ }
60
+
61
+ div.entry div.header div.title {
62
+ font-size: 18pt;
63
+ color: black;
64
+ padding: 2pt 4pt 2pt 4pt;
65
+ }
66
+
67
+ div.entry div.header div.title input {
68
+ width: 100%;
69
+ border: none;
70
+ font-size: inherit;
71
+ }
72
+
73
+ div.entry div.header ul {
74
+ float: left;
75
+ margin: 0;
76
+ padding: 0;
77
+ }
78
+
79
+ div.entry div.header ul li {
80
+ background-color: #EEA;
81
+ margin: 0 0 0 4pt;
82
+ padding: 0 4pt 0 4pt;
83
+ display: inline;
84
+ border-style: none solid solid solid;
85
+ border-width: 1px;
86
+ border-color: #CC8;
87
+ font-size: 9pt;
88
+ color: #884;
89
+ }
90
+
91
+ div.entry div.header ul li:hover {
92
+ color: black;
93
+ }
94
+
95
+ div.entry div.header ul li a {
96
+ text-decoration: none;
97
+ color: inherit;
98
+ }
99
+
100
+ div.entry div.header div.created {
101
+ float: right;
102
+ font-size: 8pt;
103
+ color: #888;
104
+ margin: 0.25em 0.5em 0 0;
105
+ }
106
+
107
+ div.entry div.content {
108
+ padding: 24pt 16pt 16pt 16pt;
109
+ border-bottom: 1px solid #CC8;
110
+ }
111
+
112
+ div.entry div.content textarea {
113
+ width: 100%;
114
+ border: none;
115
+ font-size: inherit;
116
+ height: 12em;
117
+ margin: -16pt -8pt -8pt -8pt;
118
+ padding: 8pt;
119
+ }
120
+
121
+ div.entry input[type=submit] {
122
+ margin: 4pt 16pt 4pt 4pt;
123
+ border: 1px solid #CC8;
124
+ background-color: #EEC;
125
+ }
126
+
127
+ div.entry div.updated {
128
+ float: right;
129
+ font-size: 8pt;
130
+ color: #888;
131
+ margin: -1.25em 0.5em 0 0;
132
+ }
@@ -1,52 +1,25 @@
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
1
  class MainController < Controller
5
- helper :form, :auth, :aspect
6
-
7
- trait :auth_table => {'manveru' => Digest::SHA1.hexdigest('password')}
8
-
9
2
  def index
10
- @title = 'Ramaze Blog'
11
- @entries = Entry.keys.reverse.map{|k| Entry[k]}
3
+ @entries = Entry.all :order => 'created DESC'
12
4
  end
13
-
14
- def view eid
15
- @entry = Entry[eid]
5
+ def delete oid
6
+ Entry.delete oid
7
+ redirect :/
16
8
  end
17
-
18
- def new
19
- @title = "Add Entry"
9
+ def edit oid
10
+ @entry = Entry[oid]
20
11
  end
21
-
22
- def add
23
- entry = Entry.new.merge!(request.params)
24
- entry.time = Time.now
25
- session[:result] = "#{entry.title} added successfully" if entry.save
12
+ def create
13
+ Entry.create request['title'], request['content']
26
14
  redirect :/
27
15
  end
28
-
29
- def edit eid
30
- @entry = Entry[eid]
31
- end
32
-
33
16
  def save
34
- redirect_referer unless eid = request.params.delete('eid')
35
- entry = Entry[eid].merge!(request.params)
36
- session[:result] = "#{entry.title} saved successfully" if entry.save
17
+ redirect_referer unless oid = request['oid']
18
+ entry = Entry[oid]
19
+ entry.title = request['title']
20
+ entry.content = request['content']
21
+ entry.updated = Time.now
22
+ entry.save
37
23
  redirect :/
38
24
  end
39
-
40
- def delete eid
41
- if entry = Entry[eid]
42
- if entry.delete
43
- session[:result] = "#{entry.title} deleted successfully"
44
- else
45
- session[:result] = "Couldn't delete #{entry.title}"
46
- end
47
- end
48
- redirect_referer
49
- end
50
-
51
- pre :all, :logged_in?, :except => [:index, :view]
52
25
  end
@@ -1,14 +1,13 @@
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/store/yaml'
5
-
6
- Entry = Ramaze::Store::YAML.new :entry
7
-
8
- if Entry.empty?
9
- entry = Entry.new
10
- entry.time = Time.now
11
- entry.title = 'Nothing special'
12
- entry.text = 'even less special'
13
- entry.save
1
+ class Entry
2
+ property :created, Time
3
+ property :updated, Time
4
+ property :title, String
5
+ property :content, String
6
+ property :craig, String
7
+ def initialize title, content
8
+ @created=Time.now
9
+ @updated=Time.now
10
+ @title=title
11
+ @content=content
12
+ end
14
13
  end
@@ -0,0 +1,16 @@
1
+ class Blog < Ezamar::Element
2
+ def render
3
+ %(
4
+ <html>
5
+ <head>
6
+ <title>bl_Og</title>
7
+ <link rel="stylesheet" href="/styles/blog.css" type="text/css"/>
8
+ </head>
9
+ <body>
10
+ <h1>#{@title}</h1>
11
+ #{content}
12
+ </body>
13
+ </html>
14
+ )
15
+ end
16
+ end
@@ -1,8 +1,19 @@
1
- <Page>
2
- <form method="POST" action="#{R self, :save}">
3
- <input type="hidden" name="oid" value="#{@entry.oid}" />
4
- <input type="text" name="title" value="#{@entry.title}" />
5
- <textarea name="text">#{@entry.text}</textarea>
6
- <input type="submit" />
7
- </form>
8
- </Page>
1
+ <Blog title="bl_Og">
2
+ <h2>Editing entry</h2>
3
+ <div id="entries">
4
+ <div class="entry">
5
+ <form method="post" action="#{R self,:save}">
6
+ <input name="oid" type="hidden" value="#{@entry.oid}"/>
7
+ <div class="header">
8
+ <div class="title">
9
+ <input name="title" type="text" value="#{@entry.title}"/>
10
+ </div>
11
+ </div>
12
+ <div class="content">
13
+ <textarea name="content">#{@entry.content}</textarea>
14
+ </div>
15
+ <input type="submit" value="Update Entry"/>
16
+ </form>
17
+ </div>
18
+ </div>
19
+ </Blog>
@@ -1,24 +1,16 @@
1
- <Page title="Ramaze Blog">
2
- <?r if @entries.empty? ?>
3
- <p>No Entries</p>
4
- <?r end ?>
5
- <?r @entries.each_with_index do |entry, i| ?>
6
- <div class="blog_entry">
7
- <div class="title">
8
- <div class="title">#{link self, :view, entry.oid, :title => entry.title}</div>
9
- <div class="date">#{entry.time}</div>
10
- </div>
11
- <div class="text">
12
- #{BlueCloth.new(entry.text.to_s).to_html}
13
- </div>
14
- <div class="menu">
15
- <?r if logged_in? ?>
16
- #{link self, :delete, entry.eid, :title => 'Delete'}
17
- #{link self, :edit, entry.eid, :title => 'Edit'}<br />
18
- <?r end ?>
19
- Entry #{@entries.size - i}/#{@entries.size}
1
+ <Blog title="bl_Og">
2
+ <div id="actions">#{link self, :new, :title => 'new entry'}</div>
3
+ <div id="entries">
4
+ <?r @entries.each do |entry| ?>
5
+ <div class="entry">
6
+ <div class="header">
7
+ <div class="title">#{entry.title}</div>
8
+ <div class="created">Created: #{entry.created}</div>
9
+ <ul><li>#{link self, :edit, entry.oid, :title => 'edit'}</li><li>#{link self, :delete, entry.oid, :title => 'delete'}</li></ul>
20
10
  </div>
11
+ <div class="content">#{entry.content}</div>
12
+ <div class="updated">Last updated: #{entry.updated}</div>
21
13
  </div>
22
- <?r end ?>
23
- #{link(self, :new, :title => 'New Entry') if logged_in?}
24
- </Page>
14
+ <?r end ?>
15
+ </div>
16
+ </Blog>
@@ -1,5 +1,18 @@
1
- <Page>
2
- <form method="POST" action="#{R :add}">
3
- #{form Entry, :deny => [/time/, /oid/]}
4
- </form>
5
- </Page>
1
+ <Blog title="bl_Og">
2
+ <h2>New entry</h2>
3
+ <div id="entries">
4
+ <div class="entry">
5
+ <form method="post" action="#{R self,:create}">
6
+ <div class="header">
7
+ <div class="title">
8
+ <input name="title" type="text" value=""/>
9
+ </div>
10
+ </div>
11
+ <div class="content">
12
+ <textarea name="content"></textarea>
13
+ </div>
14
+ <input type="submit" value="Add Entry"/>
15
+ </form>
16
+ </div>
17
+ </div>
18
+ </Blog>
@@ -3,21 +3,18 @@ require 'ramaze'
3
3
  include Ramaze
4
4
 
5
5
  class MainController < Controller
6
+ map '/'
6
7
  helper :cache
7
-
8
8
  trait :actions_cached => [:index]
9
9
 
10
- def index
11
- calc = "100_000 ** 100_00"
10
+ def index(n1 = 100_000, n2 = 100_00)
12
11
  %[
13
- Hello, i'm a little method with this calculation:
14
- #{calc} = #{eval(calc)}
15
- ]
12
+ Hello, i'm a little method with this calculation:
13
+ #{n1} ** #{n2} = #{n1.to_i ** n2.to_i}
14
+ ].strip
16
15
  end
17
16
 
18
17
  def invalidate
19
18
  action_cache.clear
20
19
  end
21
20
  end
22
-
23
- run
@@ -9,7 +9,7 @@ class Page < Ezamar::Element
9
9
  <title>examples/element</title>
10
10
  </head>
11
11
  <body>
12
- <h1>#{@hash['title']}</h1>
12
+ <h1>#{@title}</h1>
13
13
  #{content}
14
14
  </body>
15
15
  </html>
@@ -28,6 +28,8 @@ class SideBar < Ezamar::Element
28
28
  end
29
29
 
30
30
  class MainController < Controller
31
+ map '/'
32
+
31
33
  def index
32
34
  %{
33
35
  <Page title="Test">
@@ -39,5 +41,3 @@ class MainController < Controller
39
41
  }
40
42
  end
41
43
  end
42
-
43
- start
@@ -3,8 +3,6 @@
3
3
 
4
4
  require 'ramaze'
5
5
 
6
- include Ramaze
7
-
8
6
  # This is named MainController to automagically map it to '/'
9
7
  # Global.mapping['/'] = MainController
10
8
  # would do the same thing.
@@ -13,10 +11,10 @@ include Ramaze
13
11
  # Hello, World!
14
12
  # in your browser
15
13
 
16
- class MainController < Controller
14
+ class MainController < Ramaze::Controller
15
+ map '/'
16
+
17
17
  def index
18
18
  "Hello, World!"
19
19
  end
20
20
  end
21
-
22
- start
@@ -23,6 +23,8 @@ require 'ramaze'
23
23
  include Ramaze
24
24
 
25
25
  class SimpleController < Controller
26
+ map '/'
27
+
26
28
  def index
27
29
  "simple"
28
30
  end
@@ -49,14 +51,9 @@ class SimpleController < Controller
49
51
  end
50
52
 
51
53
  class OtherController < Controller
54
+ map '/other'
55
+
52
56
  def index
53
57
  "Hello, World from #{self.class.name}"
54
58
  end
55
59
  end
56
-
57
- Global.mapping = {
58
- '/' => SimpleController,
59
- '/other' => OtherController
60
- }
61
-
62
- start
@@ -1,21 +1,22 @@
1
1
  %html
2
2
  %head
3
- %title= "Template::Haml internal"
3
+ %title Template::Haml internal
4
4
  %body
5
5
  %h1= @title
6
- = link( R(:/), :title => 'Home')
6
+ = Rs(:/, :title => 'Home')
7
7
  %p
8
- = "Here you can pass some stuff if you like, parameters are just passed like this:"
8
+ Here you can pass some stuff if you like, parameters are just passed like this:
9
9
  %br/
10
10
  = link( R(self, @action, :one), :title => "#@action/one")
11
11
  %br/
12
12
  = link( R(self, @action, :one, :two, :three), :title => "#@action/one/two/three")
13
13
  %br/
14
14
  = link( R(self, @action, :one, :foo => :bar), :title => "#@action/one?foo=bar")
15
- %div= "The arguments you have passed to this action are:"
15
+ %div
16
+ The arguments you have passed to this action are:
16
17
  - if @args.empty?
17
- = "none"
18
+ none
18
19
  - else
19
- - @args.each do |arg|
20
- %span= arg
20
+ - @args.each do |arg|
21
+ %span= arg
21
22
  %div= request.params.inspect