ramaze 0.3.5 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. data/Rakefile +5 -20
  2. data/bin/ramaze +0 -4
  3. data/doc/AUTHORS +5 -0
  4. data/doc/meta/announcement.txt +2 -1
  5. data/doc/tutorial/todolist.html +20 -21
  6. data/doc/tutorial/todolist.mkd +10 -9
  7. data/examples/blog/{src/controller.rb → controller/main.rb} +2 -0
  8. data/examples/blog/{src/model.rb → model/entry.rb} +0 -0
  9. data/examples/blog/spec/blog.rb +3 -3
  10. data/examples/blog/start.rb +2 -3
  11. data/examples/blog/view/edit.xhtml +17 -0
  12. data/examples/blog/view/index.xhtml +17 -0
  13. data/examples/blog/view/layout.xhtml +11 -0
  14. data/examples/blog/view/new.xhtml +16 -0
  15. data/examples/facebook.rb +15 -8
  16. data/examples/identity.rb +1 -1
  17. data/examples/memleak_detector.rb +1 -1
  18. data/examples/rammit/src/model.rb +1 -1
  19. data/examples/rapaste/controller/paste.rb +7 -7
  20. data/examples/rapaste/model/paste.rb +1 -3
  21. data/examples/rapaste/public/css/display.css +2 -1
  22. data/examples/rapaste/start.rb +2 -3
  23. data/examples/sourceview/sourceview.rb +1 -1
  24. data/examples/templates/template/external.tenjin +28 -0
  25. data/examples/templates/template_amrita2.rb +0 -3
  26. data/examples/templates/template_tenjin.rb +57 -0
  27. data/examples/todolist/spec/todolist.rb +13 -2
  28. data/examples/todolist/src/controller/main.rb +1 -1
  29. data/examples/todolist/template/index.xhtml +1 -1
  30. data/examples/wiktacular/spec/wiktacular.rb +18 -0
  31. data/examples/wiktacular/src/controller.rb +2 -2
  32. data/examples/wiktacular/src/model.rb +8 -2
  33. data/lib/proto/public/css/ramaze_error.css +4 -0
  34. data/lib/proto/public/dispatch.fcgi +11 -0
  35. data/lib/proto/spec/main.rb +1 -1
  36. data/lib/proto/start.ru +8 -0
  37. data/lib/proto/view/error.xhtml +2 -0
  38. data/lib/ramaze.rb +28 -5
  39. data/lib/ramaze/action.rb +9 -2
  40. data/lib/ramaze/action/render.rb +40 -24
  41. data/lib/ramaze/adapter.rb +10 -17
  42. data/lib/ramaze/adapter/base.rb +8 -12
  43. data/lib/ramaze/adapter/cgi.rb +14 -13
  44. data/lib/ramaze/adapter/ebb.rb +34 -0
  45. data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
  46. data/lib/ramaze/adapter/fcgi.rb +14 -14
  47. data/lib/ramaze/adapter/lsws.rb +15 -11
  48. data/lib/ramaze/adapter/mongrel.rb +2 -1
  49. data/lib/ramaze/adapter/scgi.rb +24 -0
  50. data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
  51. data/lib/ramaze/adapter/thin.rb +4 -5
  52. data/lib/ramaze/adapter/webrick.rb +5 -5
  53. data/lib/ramaze/cache.rb +1 -1
  54. data/lib/ramaze/cache/memcached.rb +1 -1
  55. data/lib/ramaze/contrib.rb +70 -10
  56. data/lib/ramaze/contrib/auto_params.rb +1 -1
  57. data/lib/ramaze/contrib/email.rb +15 -15
  58. data/lib/ramaze/contrib/facebook.rb +2 -2
  59. data/lib/ramaze/contrib/facebook/facebook.rb +7 -4
  60. data/lib/ramaze/contrib/file_cache.rb +65 -0
  61. data/lib/ramaze/contrib/gettext.rb +56 -55
  62. data/lib/ramaze/contrib/profiling.rb +36 -0
  63. data/lib/ramaze/contrib/sequel_cache.rb +92 -0
  64. data/lib/ramaze/controller.rb +80 -47
  65. data/lib/ramaze/controller/error.rb +10 -5
  66. data/lib/ramaze/controller/resolve.rb +36 -48
  67. data/lib/ramaze/current.rb +70 -0
  68. data/lib/ramaze/{trinity → current}/request.rb +62 -15
  69. data/lib/ramaze/current/response.rb +19 -0
  70. data/lib/ramaze/{trinity → current}/session.rb +32 -110
  71. data/lib/ramaze/current/session/flash.rb +67 -0
  72. data/lib/ramaze/current/session/hash.rb +65 -0
  73. data/lib/ramaze/dispatcher.rb +1 -28
  74. data/lib/ramaze/dispatcher/action.rb +6 -3
  75. data/lib/ramaze/dispatcher/directory.rb +1 -1
  76. data/lib/ramaze/dispatcher/error.rb +26 -5
  77. data/lib/ramaze/dispatcher/file.rb +13 -2
  78. data/lib/ramaze/gestalt.rb +3 -1
  79. data/lib/ramaze/global.rb +6 -3
  80. data/lib/ramaze/global/globalstruct.rb +3 -1
  81. data/lib/ramaze/helper.rb +66 -20
  82. data/lib/ramaze/helper/aspect.rb +25 -17
  83. data/lib/ramaze/helper/auth.rb +4 -3
  84. data/lib/ramaze/helper/cache.rb +5 -4
  85. data/lib/ramaze/helper/cgi.rb +11 -9
  86. data/lib/ramaze/helper/flash.rb +28 -3
  87. data/lib/ramaze/helper/formatting.rb +1 -3
  88. data/lib/ramaze/helper/identity.rb +2 -3
  89. data/lib/ramaze/helper/inform.rb +7 -6
  90. data/lib/ramaze/helper/link.rb +15 -17
  91. data/lib/ramaze/helper/markaby.rb +2 -4
  92. data/lib/ramaze/helper/maruku.rb +1 -1
  93. data/lib/ramaze/helper/nitroform.rb +4 -4
  94. data/lib/ramaze/helper/pager.rb +4 -6
  95. data/lib/ramaze/helper/partial.rb +24 -21
  96. data/lib/ramaze/helper/redirect.rb +8 -5
  97. data/lib/ramaze/helper/{file.rb → sendfile.rb} +1 -3
  98. data/lib/ramaze/helper/sequel.rb +1 -3
  99. data/lib/ramaze/helper/stack.rb +1 -3
  100. data/lib/ramaze/helper/tagz.rb +19 -0
  101. data/lib/ramaze/helper/user.rb +63 -0
  102. data/lib/ramaze/inform.rb +2 -24
  103. data/lib/ramaze/log.rb +28 -0
  104. data/lib/ramaze/{inform → log}/analogger.rb +3 -3
  105. data/lib/ramaze/{inform → log}/growl.rb +2 -2
  106. data/lib/ramaze/{inform → log}/hub.rb +4 -6
  107. data/lib/ramaze/{inform → log}/informer.rb +4 -4
  108. data/lib/ramaze/{inform → log}/knotify.rb +2 -2
  109. data/lib/ramaze/log/logger.rb +22 -0
  110. data/lib/ramaze/{inform/informing.rb → log/logging.rb} +16 -16
  111. data/lib/ramaze/{inform → log}/syslog.rb +0 -0
  112. data/lib/ramaze/{inform → log}/xosd.rb +2 -2
  113. data/lib/ramaze/route.rb +64 -36
  114. data/lib/ramaze/snippets/array/put_within.rb +13 -0
  115. data/lib/ramaze/snippets/binding/locals.rb +13 -0
  116. data/lib/ramaze/snippets/kernel/__dir__.rb +10 -8
  117. data/lib/ramaze/snippets/kernel/aquire.rb +1 -1
  118. data/lib/ramaze/snippets/kernel/constant.rb +1 -1
  119. data/lib/ramaze/snippets/object/pretty.rb +6 -0
  120. data/lib/ramaze/snippets/object/scope.rb +11 -0
  121. data/lib/ramaze/snippets/object/thread_accessor.rb +5 -0
  122. data/lib/ramaze/snippets/ordered_set.rb +1 -1
  123. data/lib/ramaze/snippets/proc/locals.rb +11 -0
  124. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +44 -0
  125. data/lib/ramaze/snippets/string/esc.rb +29 -0
  126. data/lib/ramaze/snippets/string/start_with.rb +7 -0
  127. data/lib/ramaze/snippets/string/unindent.rb +6 -1
  128. data/lib/ramaze/snippets/struct/values_at.rb +1 -5
  129. data/lib/ramaze/sourcereload.rb +16 -14
  130. data/lib/ramaze/spec.rb +1 -0
  131. data/lib/ramaze/spec/helper.rb +11 -3
  132. data/lib/ramaze/spec/helper/browser.rb +25 -1
  133. data/lib/ramaze/spec/helper/pretty_output.rb +11 -11
  134. data/lib/ramaze/template.rb +5 -4
  135. data/lib/ramaze/template/amrita2.rb +2 -3
  136. data/lib/ramaze/template/ezamar/element.rb +2 -3
  137. data/lib/ramaze/template/ezamar/morpher.rb +1 -2
  138. data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
  139. data/lib/ramaze/template/haml.rb +5 -2
  140. data/lib/ramaze/template/markaby.rb +2 -0
  141. data/lib/ramaze/template/tagz.rb +79 -0
  142. data/lib/ramaze/template/tenjin.rb +34 -0
  143. data/lib/ramaze/tool/create.rb +0 -3
  144. data/lib/ramaze/tool/localize.rb +107 -105
  145. data/lib/ramaze/tool/mime.rb +0 -2
  146. data/lib/ramaze/trinity.rb +1 -26
  147. data/lib/ramaze/version.rb +1 -1
  148. data/lib/vendor/bacon.rb +47 -41
  149. data/rake_tasks/conf.rake +18 -0
  150. data/rake_tasks/darcs.rake +5 -0
  151. data/rake_tasks/maintenance.rake +37 -24
  152. data/rake_tasks/spec.rake +1 -1
  153. data/spec/contrib/auto_params.rb +3 -1
  154. data/spec/contrib/profiling.rb +26 -0
  155. data/spec/examples/templates/template_redcloth.rb +1 -1
  156. data/spec/examples/templates/template_tenjin.rb +28 -0
  157. data/spec/helper.rb +0 -1
  158. data/spec/ramaze/action/layout.rb +28 -0
  159. data/spec/ramaze/controller/actionless_templates.rb +32 -0
  160. data/spec/ramaze/controller/template/other_wrapper.xhtml +1 -0
  161. data/spec/ramaze/controller/template_resolving.rb +37 -0
  162. data/spec/ramaze/{trinity → current}/request.rb +12 -2
  163. data/spec/ramaze/current/session.rb +97 -0
  164. data/spec/ramaze/dispatcher/directory.rb +2 -1
  165. data/spec/ramaze/dispatcher/file.rb +8 -3
  166. data/spec/ramaze/dispatcher/public/file name.txt +1 -0
  167. data/spec/ramaze/gestalt.rb +11 -0
  168. data/spec/ramaze/helper/aspect.rb +28 -22
  169. data/spec/ramaze/helper/cgi.rb +2 -2
  170. data/spec/ramaze/helper/flash.rb +33 -15
  171. data/spec/ramaze/helper/formatting.rb +2 -2
  172. data/spec/ramaze/helper/link.rb +46 -18
  173. data/spec/ramaze/helper/pager.rb +8 -5
  174. data/spec/ramaze/helper/partial.rb +8 -1
  175. data/spec/ramaze/helper/template/recursive_local_ivars.xhtml +7 -0
  176. data/spec/ramaze/helper/user.rb +46 -0
  177. data/spec/ramaze/{inform → log}/informer.rb +0 -0
  178. data/spec/ramaze/{inform → log}/syslog.rb +1 -1
  179. data/spec/ramaze/request.rb +14 -10
  180. data/spec/ramaze/route.rb +23 -0
  181. data/spec/ramaze/template.rb +48 -1
  182. data/spec/ramaze/template/haml.rb +6 -16
  183. data/spec/ramaze/template/haml/locals.haml +2 -1
  184. data/spec/ramaze/template/tagz.rb +62 -0
  185. data/spec/ramaze/template/tagz/external.tagz +8 -0
  186. data/spec/ramaze/template/tagz/sum.tagz +1 -0
  187. data/spec/ramaze/template/tenjin.rb +49 -0
  188. data/spec/ramaze/template/tenjin/external.tenjin +1 -0
  189. data/spec/snippets/string/unindent.rb +15 -0
  190. metadata +509 -475
  191. data/doc/README.html +0 -729
  192. data/doc/changes.txt +0 -5757
  193. data/doc/changes.xml +0 -5759
  194. data/examples/blog/src/view.rb +0 -16
  195. data/examples/blog/template/edit.xhtml +0 -19
  196. data/examples/blog/template/index.xhtml +0 -19
  197. data/examples/blog/template/new.xhtml +0 -18
  198. data/examples/wiktacular/mkd/newpagename/current.mkd +0 -1
  199. data/examples/wiktacular/mkd/newpagename/current.mkd.bak +0 -1
  200. data/lib/ramaze/contrib/email.rb-darcs-backup0 +0 -81
  201. data/lib/ramaze/template/bijou.rb +0 -39
  202. data/lib/ramaze/trinity/response.rb +0 -32
  203. data/spec/ramaze/template/bijou.rb +0 -25
  204. data/spec/ramaze/trinity/session.rb +0 -29
@@ -14,5 +14,5 @@ class MainController < Ramaze::Controller
14
14
  end
15
15
  end
16
16
 
17
- Ramaze::Inform.loggers.each{|l| l.log_levels << :dev }
17
+ Ramaze::Log.loggers.each{|l| l.log_levels << :dev }
18
18
  Ramaze.start :adapter => :mongrel
@@ -28,5 +28,5 @@ Thread.new do
28
28
  end
29
29
  end
30
30
 
31
- Ramaze::Inform.loggers.clear
31
+ Ramaze::Log.loggers.clear
32
32
  Ramaze.start :adapter => :mongrel, :sourcereload => false
@@ -14,7 +14,7 @@ class User < Sequel::Model(:user)
14
14
  end
15
15
 
16
16
  class Page < Sequel::Model(:page)
17
- include Ramaze::LinkHelper
17
+ include Ramaze::Helper::Link
18
18
 
19
19
  set_schema do
20
20
  primary_key :id
@@ -1,9 +1,9 @@
1
- Ramaze::Contrib::Route[%r!^/(\d+)\.(?:te?xt|plain)$!] = '/plain/%d'
2
- Ramaze::Contrib::Route[%r!^/(?:te?xt|plain)/(\d+)$!] = '/plain/%d'
3
- Ramaze::Contrib::Route[%r!^/(\d+)\.(\w+)$!] = '/view/%d/%s'
4
- Ramaze::Contrib::Route[%r!^/(\d+)$!] = '/view/%d/html'
5
- Ramaze::Contrib::Route[%r!^/list/page/(\d+)$!] = '/list/%d'
6
- # Ramaze::Contrib::Route[%r!^/list/?(.*)!] = '/%s'
1
+ Ramaze::Route[%r!^/(\d+)\.(?:te?xt|plain|rb|css|js)$!] = '/plain/%d'
2
+ Ramaze::Route[%r!^/(?:te?xt|plain|rb|css|js)/(\d+)$!] = '/plain/%d'
3
+ Ramaze::Route[%r!^/(\d+)\.(\w+)$!] = '/view/%d/%s'
4
+ Ramaze::Route[%r!^/(\d+)$!] = '/view/%d/html'
5
+ Ramaze::Route[%r!^/list/page/(\d+)$!] = '/list/%d'
6
+ # Ramaze::Route[%r!^/list/?(.*)!] = '/%s'
7
7
 
8
8
  class PasteController < Ramaze::Controller
9
9
  map :/
@@ -15,7 +15,7 @@ class PasteController < Ramaze::Controller
15
15
  def list(start = 1)
16
16
  ordered = Paste.order(:created.DESC)
17
17
  @paginated = ordered.paginate(start.to_i, 10)
18
- @pager = paginator(@paginated, '/list/page')
18
+ @pager = paginator(@paginated, '/list')
19
19
  @pastes = @paginated
20
20
  @style = style
21
21
  end
@@ -20,10 +20,8 @@ class Paste < Sequel::Model(:paste)
20
20
  case format.downcase
21
21
  when /x?html/
22
22
  uv(text, style)
23
- when /txt/, /plain/
24
- text
25
23
  else
26
- raise "No such format: #{format}"
24
+ text
27
25
  end
28
26
  end
29
27
 
@@ -136,7 +136,8 @@ div#paste_head {
136
136
  background: #ccf;
137
137
  border: 1px solid #ccf;
138
138
  width: 14em;
139
- right: 1em;
139
+ right: 0.2em;
140
+ top: 1.5em;
140
141
  position: absolute;
141
142
  }
142
143
 
@@ -5,7 +5,7 @@ require 'ramaze'
5
5
  require 'sequel'
6
6
  require 'uv'
7
7
 
8
- Ramaze::Inform.debug "Initializing UltraViolet..."
8
+ Ramaze::Log.debug "Initializing UltraViolet..."
9
9
 
10
10
  Uv.copy_files "xhtml", __DIR__/"public"
11
11
  Uv.init_syntaxes
@@ -14,8 +14,7 @@ UV_PRIORITY_NAMES = %w[ ruby plain_text html css javascript yaml diff ]
14
14
 
15
15
  STYLE = 'iplastic'
16
16
 
17
- Ramaze::Inform.debug "done."
18
- Ramaze.contrib :route
17
+ Ramaze::Log.debug "done."
19
18
 
20
19
  DB = Sequel.sqlite
21
20
 
@@ -17,7 +17,7 @@ end
17
17
  class MainController < Ramaze::Controller
18
18
 
19
19
  include Remarkably::Common
20
- helper :partial, :inform, :cache, :aspect
20
+ helper :cache, :aspect
21
21
  engine :None
22
22
 
23
23
  def index *args
@@ -0,0 +1,28 @@
1
+ <html>
2
+ <head>
3
+ <title>Template::Tenjin #{@place}</title>
4
+ </head>
5
+ <body>
6
+ <h1>The #{@place} Template for Tenjin</h1>
7
+ <a href="#{Rs(:/)}">Home</a>
8
+ <p>
9
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
10
+ <a href="#{Rs(@place, :one)}">#{Rs(@place, :one)}</a><br />
11
+ <a href="#{Rs(@place, :two, :three)}">#{Rs(@place, :two, :three)}</a><br />
12
+ <a href="#{Rs(@place, :one, :foo => :bar)}">#{Rs(@place, :one, :foo => :bar)}</a>
13
+ </p>
14
+
15
+ <div>
16
+ The arguments you have passed to this action are:<br />
17
+ <?rb if @args.empty? ?>
18
+ none
19
+ <?rb else ?>
20
+ <?rb @args.each do |arg| ?>
21
+ <span>#{arg}</span>
22
+ <?rb end ?>
23
+ <?rb end ?>
24
+ </div>
25
+
26
+ <div>#{request.params.inspect}</div>
27
+ </body>
28
+ </html>
@@ -1,9 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'ramaze'
3
3
 
4
- # TODO:
5
- # - implement the amrita2 example, man, this engine is awkward :P
6
-
7
4
  class MainController < Ramaze::Controller
8
5
  template_root __DIR__/:template
9
6
  engine :Amrita2
@@ -0,0 +1,57 @@
1
+ require "rubygems"
2
+ require "ramaze"
3
+
4
+ class MainController < Ramaze::Controller
5
+ template_root __DIR__/:template
6
+ engine :Tenjin
7
+
8
+ def index
9
+ %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
10
+ end
11
+
12
+ def internal(*args)
13
+ @context = {
14
+ :args => args,
15
+ :place => :internal
16
+ }
17
+ <<'__TENJIN__'
18
+ <html>
19
+ <head>
20
+ <title>Template::Tenjin #{@place}</title>
21
+ </head>
22
+ <body>
23
+ <h1>The #{@place} Template for Tenjin</h1>
24
+ <a href="#{Rs(:/)}">Home</a>
25
+ <p>
26
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
27
+ <a href="#{Rs(@place, :one)}">#{Rs(@place, :one)}</a><br />
28
+ <a href="#{Rs(@place, :two, :three)}">#{Rs(@place, :two, :three)}</a><br />
29
+ <a href="#{Rs(@place, :one, :foo => :bar)}">#{Rs(@place, :one, :foo => :bar)}</a>
30
+ </p>
31
+
32
+ <div>
33
+ The arguments you have passed to this action are:<br />
34
+ <?rb if @args.empty? ?>
35
+ none
36
+ <?rb else ?>
37
+ <?rb @args.each do |arg| ?>
38
+ <span>#{arg}</span>
39
+ <?rb end ?>
40
+ <?rb end ?>
41
+ </div>
42
+
43
+ <div>#{request.params.inspect}</div>
44
+ </body>
45
+ </html>
46
+ __TENJIN__
47
+ end
48
+
49
+ def external(*args)
50
+ @context = {
51
+ :args => args,
52
+ :place => :external
53
+ }
54
+ end
55
+ end
56
+
57
+ Ramaze.start
@@ -23,15 +23,19 @@ describe 'todolist' do
23
23
  (h_get('/')/:tr)
24
24
  end
25
25
 
26
- def spectask
26
+ def task(name)
27
27
  tasks.find do |task|
28
28
  (task/:td).find do |td|
29
29
  td['class'] == 'title' and
30
- td.inner_html.strip == 'spectask'
30
+ td.inner_html.strip == name
31
31
  end
32
32
  end
33
33
  end
34
34
 
35
+ def spectask
36
+ task('spectask')
37
+ end
38
+
35
39
  def spectask_status
36
40
  spectask.search("td[@class='status']").inner_html.strip
37
41
  end
@@ -117,5 +121,12 @@ describe 'todolist' do
117
121
  error_on_page('/new', response).should == 'Please enter a title'
118
122
  end
119
123
 
124
+ it 'should escape harmful titles' do
125
+ response = post('/create', 'title' => '#{puts "gotcha"}')
126
+
127
+ task('#{puts "gotcha"}').should.be.nil
128
+ task('&#35;{puts &quot;gotcha&quot;}').should.not.be.nil
129
+ end
130
+
120
131
  FileUtils.rm('todolist.db') rescue nil
121
132
  end
@@ -50,7 +50,7 @@ class MainController < Ramaze::Controller
50
50
  end
51
51
 
52
52
  helper :aspect
53
- after(:create, :open, :close, :delete){ redirect(Rs()) }
53
+ after(:create, :open, :close, :delete){ redirect(Rs()) unless redirected? }
54
54
 
55
55
  private
56
56
 
@@ -6,7 +6,7 @@
6
6
  <table>
7
7
  <?r @tasks.each do |title, status, toggle, delete| ?>
8
8
  <tr>
9
- <td class="title"> #{title} </td>
9
+ <td class="title"> #{c title} </td>
10
10
  <td class="status"> #{status} </td>
11
11
  <td class="toggle"> #{toggle} </td>
12
12
  <td class="delete"> #{delete} </td>
@@ -133,6 +133,24 @@ describe 'wiktacular' do
133
133
  doc.at('div#text').inner_html.strip.should == '<p>first text</p>'
134
134
  end
135
135
 
136
+ it "should convert [[#{NEWPAGE}]] to existing link" do
137
+ edit_page(NEWPAGE, "Link: [[#{NEWPAGE}]]")
138
+ doc = check_page(NEWPAGE)
139
+ a = doc.at('div#text>p>a')
140
+ a['class'].should == 'exists'
141
+ a['href'].should == NEWPAGE
142
+ a.inner_html.should == NEWPAGE
143
+ end
144
+
145
+ it "should convert [[chunky bacon]] to nonexisting link" do
146
+ edit_page(NEWPAGE, "Link: [[chunky bacon]]")
147
+ doc = check_page(NEWPAGE)
148
+ a = doc.at('div#text>p>a')
149
+ a['class'].should == 'nonexists'
150
+ a['href'].should == "chunky+bacon"
151
+ a.inner_html.should == "chunky bacon"
152
+ end
153
+
136
154
  after do
137
155
  WikiEntry.new(NEWPAGE).delete
138
156
  end
@@ -17,7 +17,7 @@ class MainController < Ramaze::Controller
17
17
 
18
18
  def edit handle
19
19
  @handle = handle
20
- @entry = WikiEntry[handle]
20
+ @entry = WikiEntry.new(handle)
21
21
  @text = @entry.content
22
22
  end
23
23
 
@@ -39,7 +39,7 @@ class MainController < Ramaze::Controller
39
39
  def save
40
40
  redirect_referer unless request.post?
41
41
  handle = request['handle']
42
- entry = WikiEntry[handle]
42
+ entry = WikiEntry.new(handle)
43
43
  entry.save(request['text'])
44
44
  redirect Rs(:index, handle)
45
45
  end
@@ -5,7 +5,9 @@ class WikiEntry
5
5
  ENTRIES_DIR = __DIR__/'../mkd'
6
6
  class << self
7
7
  def [](name)
8
- new(name)
8
+ if File.exist?(ENTRIES_DIR/File.basename(File.expand_path(name)))
9
+ new(name)
10
+ end
9
11
  end
10
12
  def titles
11
13
  Dir[ENTRIES_DIR/'*'].entries
@@ -79,7 +81,11 @@ class WikiEntry
79
81
  end
80
82
 
81
83
  class EntryView
84
+ include Ramaze::Helper::Methods
85
+ helper :cgi, :link
86
+
82
87
  class << self
88
+
83
89
  def render content
84
90
  mkd2html(content || "No Entry")
85
91
  end
@@ -88,7 +94,7 @@ class EntryView
88
94
  html = BlueCloth.new(text).to_html
89
95
  html.gsub!(/\[\[(.*?)\]\]/) do |m|
90
96
  exists = WikiEntry[$1] ? 'exists' : 'nonexists'
91
- %{<a href="/#{CGI.escape($1)}" class="#{exists}">#{$1}</a>}
97
+ A(h($1), :href => $1, :class => exists)
92
98
  end
93
99
  html
94
100
  end
@@ -80,6 +80,10 @@ tr.source td.lineno, tr.line td.lineno {
80
80
  text-align: right;
81
81
  }
82
82
 
83
+ tr.line td {
84
+ cursor: pointer;
85
+ }
86
+
83
87
  tr.source td.code pre {
84
88
  margin: 0;
85
89
  font-family: monospace;
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'ramaze'
5
+
6
+ # FCGI doesn't like you writing to stdout
7
+ Ramaze::Log.loggers = [ Ramaze::Informer.new( File.join(__DIR__, '..', 'ramaze.fcgi.log') ) ]
8
+ Ramaze::Global.adapter = :fcgi
9
+
10
+ $0 = File.join(__DIR__, '..', 'start.rb')
11
+ require $0
@@ -18,7 +18,7 @@ describe MainController do
18
18
  it 'should show /notemplate' do
19
19
  got = get('/notemplate')
20
20
  got.status.should == 200
21
- got.at('//body').text.strip.should ==
21
+ got.at('//div').text.strip.should ==
22
22
  MainController.new.notemplate
23
23
  end
24
24
  end
@@ -0,0 +1,8 @@
1
+ # start.ru for ramaze apps
2
+ # use thin>=0.6.3
3
+ # thin start -r start.ru
4
+
5
+ require 'start'
6
+ Ramaze.trait[:essentials].delete Ramaze::Adapter
7
+ Ramaze.start :force => true
8
+ run Ramaze::Adapter::Base
@@ -4,6 +4,8 @@
4
4
  <p>The backtrace gives filenames and line numbers for all parts of the call stack.<br />
5
5
  Click on any of them to view the surrounding source code.</p>
6
6
 
7
+ <h3>#@title</h3>
8
+
7
9
  <table class="main">
8
10
  <tr class="head">
9
11
  <td>File</td><td>Line</td><td>Method</td>
@@ -1,13 +1,34 @@
1
1
  # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
+ # StdLib
5
+ require 'abbrev'
6
+ require 'benchmark'
7
+ require 'cgi'
8
+ require 'digest/md5'
4
9
  require 'fileutils'
10
+ require 'ipaddr'
11
+ require 'optparse'
12
+ require 'ostruct'
13
+ require 'pathname'
14
+ require 'pp'
15
+ require 'set'
16
+ require 'socket'
17
+ require 'timeout'
18
+ require 'tmpdir'
19
+ require 'yaml'
5
20
 
6
21
  begin
7
22
  require 'rubygems'
8
23
  rescue LoadError
9
24
  end
10
25
 
26
+ # Rack
27
+ require 'rack'
28
+ require 'rack/utils'
29
+ require 'rack/request'
30
+ require 'rack/response'
31
+
11
32
  # The main namespace for Ramaze
12
33
  module Ramaze
13
34
  SEEED = $0.dup
@@ -22,28 +43,30 @@ Thread.abort_on_exception = true
22
43
  # Bootstrap
23
44
  require 'ramaze/version'
24
45
  require 'ramaze/snippets'
25
- require 'ramaze/inform'
26
- require 'ramaze/route'
46
+ require 'ramaze/log'
47
+ require 'ramaze/trinity'
48
+ require 'ramaze/current'
49
+ require 'ramaze/adapter'
27
50
  require 'ramaze/global'
28
51
  require 'ramaze/cache'
29
52
  require 'ramaze/tool'
30
53
 
31
54
  # Startup
32
55
  require 'ramaze/controller'
33
- require 'ramaze/adapter'
34
56
  require 'ramaze/sourcereload'
35
57
 
36
58
  # Complete
37
59
  require 'ramaze/dispatcher'
38
60
  require 'ramaze/template/ezamar'
39
61
  require 'ramaze/contrib'
62
+ require 'ramaze/route'
40
63
 
41
64
  module Ramaze
42
65
 
43
66
  # Each of these classes will be called ::startup upon Ramaze.startup
44
67
 
45
68
  trait :essentials => [
46
- Global, Cache, Controller, Session, SourceReload, Adapter
69
+ Global, Cache, Contrib, Controller, Session, SourceReload, Adapter
47
70
  ]
48
71
 
49
72
  class << self
@@ -56,7 +79,7 @@ module Ramaze
56
79
  runner = options.delete(:runner) || runner_from_caller
57
80
 
58
81
  if $0 == runner or options.delete(:force)
59
- Inform.info("Starting up Ramaze (Version #{VERSION})")
82
+ Log.info("Starting up Ramaze (Version #{VERSION})")
60
83
  SEEED.replace(runner)
61
84
  APPDIR.replace(File.dirname(File.expand_path(runner)))
62
85