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
@@ -1,8 +1,6 @@
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
- require 'yaml'
5
-
6
4
  module Ramaze
7
5
  module Tool
8
6
 
@@ -1,10 +1,6 @@
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
- require 'ramaze/trinity/request'
5
- require 'ramaze/trinity/response'
6
- require 'ramaze/trinity/session'
7
-
8
4
  module Ramaze
9
5
 
10
6
  # The module to be included into the Controller it basically just provides
@@ -12,27 +8,6 @@ module Ramaze
12
8
  # retrieve the demanded object
13
9
 
14
10
  module Trinity
15
- private
16
-
17
- # same as
18
- # Thread.current[:request]
19
-
20
- def request
21
- Request.current
22
- end
23
-
24
- # same as
25
- # Thread.current[:response]
26
-
27
- def response
28
- Response.current
29
- end
30
-
31
- # same as
32
- # Thread.current[:session]
33
-
34
- def session
35
- Session.current
36
- end
11
+ thread_accessor :request, :response, :session
37
12
  end
38
13
  end
@@ -5,7 +5,7 @@ module Ramaze #:nodoc:
5
5
  module Version #:nodoc:
6
6
  MAJOR = 0
7
7
  MINOR = 3
8
- TINY = 5
8
+ TINY = 9
9
9
 
10
10
  STRING = [MAJOR, MINOR, TINY].join('.')
11
11
  end
@@ -2,13 +2,13 @@
2
2
  #
3
3
  # "Truth will sooner come out from error than from confusion." ---Francis Bacon
4
4
 
5
- # Copyright (C) 2007 Christian Neukirchen <purl.org/net/chneukirchen>
5
+ # Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
6
6
  #
7
7
  # Bacon is freely distributable under the terms of an MIT-style license.
8
8
  # See COPYING or http://www.opensource.org/licenses/mit-license.php.
9
9
 
10
10
  module Bacon
11
- VERSION = "0.2"
11
+ VERSION = "0.9"
12
12
 
13
13
  Counter = Hash.new(0)
14
14
  ErrorLog = ""
@@ -53,9 +53,7 @@ module Bacon
53
53
  end
54
54
 
55
55
  module TestUnitOutput
56
- def handle_specification(name)
57
- yield
58
- end
56
+ def handle_specification(name) yield end
59
57
 
60
58
  def handle_requirement(description)
61
59
  error = yield
@@ -74,17 +72,15 @@ module Bacon
74
72
  end
75
73
 
76
74
  module TapOutput
77
- def handle_specification(name)
78
- yield
79
- end
75
+ def handle_specification(name) yield end
80
76
 
81
77
  def handle_requirement(description)
82
78
  ErrorLog.replace ""
83
79
  error = yield
84
80
  if error.empty?
85
- printf "ok %-8d # %s\n" % [Counter[:specifications], description]
81
+ printf "ok %-3d - %s\n" % [Counter[:specifications], description]
86
82
  else
87
- printf "not ok %-4d # %s: %s\n" %
83
+ printf "not ok %d - %s: %s\n" %
88
84
  [Counter[:specifications], description, error]
89
85
  puts ErrorLog.strip.gsub(/^/, '# ')
90
86
  end
@@ -110,38 +106,58 @@ module Bacon
110
106
 
111
107
  class Context
112
108
  def initialize(name, &block)
113
- @before = []
114
- @after = []
115
109
  @name = name
110
+ @before, @after = [], []
116
111
 
117
112
  return unless name =~ RestrictContext
118
- Bacon.handle_specification(name) do
119
- instance_eval(&block)
120
- end
113
+ Bacon.handle_specification(name) { instance_eval(&block) }
121
114
  end
122
115
 
123
116
  def before(&block); @before << block; end
124
117
  def after(&block); @after << block; end
125
118
 
126
119
  def behaves_like(*names)
127
- names.each do |name|
128
- instance_eval(&Shared[name])
129
- end
120
+ names.each { |name| instance_eval(&Shared[name]) }
130
121
  end
131
122
 
132
123
  def it(description, &block)
133
124
  return unless description =~ RestrictName
125
+ block ||= lambda { should.flunk "not implemented" }
134
126
  Counter[:specifications] += 1
135
127
  run_requirement description, block
136
128
  end
129
+
130
+ def should(*args, &block)
131
+ if Counter[:depth]==0
132
+ it('should '+args.first,&block)
133
+ else
134
+ super(*args,&block)
135
+ end
136
+ end
137
137
 
138
138
  def run_requirement(description, spec)
139
139
  Bacon.handle_requirement description do
140
140
  begin
141
141
  Counter[:depth] += 1
142
- @before.each { |block| instance_eval(&block) }
143
- instance_eval(&spec)
144
- @after.each { |block| instance_eval(&block) }
142
+ rescued = false
143
+ begin
144
+ @before.each { |block| instance_eval(&block) }
145
+ prev_req = Counter[:requirements]
146
+ instance_eval(&spec)
147
+ rescue Object => e
148
+ rescued = true
149
+ raise e
150
+ ensure
151
+ if Counter[:requirements] == prev_req
152
+ raise Error.new(:missing,
153
+ "empty specification: #{@name} #{description}")
154
+ end
155
+ begin
156
+ @after.each { |block| instance_eval(&block) }
157
+ rescue Object => e
158
+ raise e unless rescued
159
+ end
160
+ end
145
161
  rescue Object => e
146
162
  ErrorLog << "#{e.class}: #{e.message}\n"
147
163
  e.backtrace.find_all { |line| line !~ /bin\/bacon|\/bacon\.rb:\d+/ }.
@@ -187,10 +203,10 @@ end
187
203
 
188
204
  class Proc
189
205
  def raise?(*exceptions)
190
- exceptions << RuntimeError if exceptions.empty?
206
+ exceptions = [RuntimeError] if exceptions.empty?
191
207
  call
192
208
 
193
- # Only to work in 1.9.0, rescue with splat doesn't work there right now
209
+ # Only to work in 1.9.0, rescue with splat doesn't work there right now
194
210
  rescue Object => e
195
211
  case e
196
212
  when *exceptions
@@ -226,21 +242,14 @@ end
226
242
 
227
243
 
228
244
  class Object
229
- def should(*args, &block)
230
- Should.new(self).be(*args, &block)
231
- end
245
+ def should(*args, &block) Should.new(self).be(*args, &block) end
232
246
  end
233
247
 
234
248
  module Kernel
235
249
  private
236
250
 
237
- def describe(name, &block)
238
- Bacon::Context.new(name.to_s, &block)
239
- end
240
-
241
- def shared(name, &block)
242
- Bacon::Shared[name] = block
243
- end
251
+ def describe(*args, &block) Bacon::Context.new(args.join(' '), &block) end
252
+ def shared(name, &block) Bacon::Shared[name] = block end
244
253
  end
245
254
 
246
255
 
@@ -287,8 +296,8 @@ class Should
287
296
 
288
297
  r = yield(@object, *args)
289
298
  if Bacon::Counter[:depth] > 0
290
- raise Bacon::Error.new(:failed, description) unless @negated ^ r
291
299
  Bacon::Counter[:requirements] += 1
300
+ raise Bacon::Error.new(:failed, description) unless @negated ^ r
292
301
  end
293
302
  @negated ^ r ? r : false
294
303
  end
@@ -300,15 +309,12 @@ class Should
300
309
  desc << @object.inspect << "." << name.to_s
301
310
  desc << "(" << args.map{|x|x.inspect}.join(", ") << ") failed"
302
311
 
303
- satisfy(desc) { |x|
304
- x.__send__(name, *args, &block)
305
- }
312
+ satisfy(desc) { |x| x.__send__(name, *args, &block) }
306
313
  end
307
314
 
308
- def equal(value); self == value; end
309
- def match(value); self =~ value; end
310
-
311
- def identical_to(value); self.equal? value; end
315
+ def equal(value) self == value end
316
+ def match(value) self =~ value end
317
+ def identical_to(value) self.equal? value end
312
318
  alias same_as identical_to
313
319
 
314
320
  def flunk(reason="Flunked")
@@ -51,5 +51,23 @@ You can now do following:
51
51
  #{'=' * 60}
52
52
  }.strip
53
53
 
54
+ AUTHOR_MAP = {
55
+ 'ahoward' => 'Ara T. Howard',
56
+ 'ara.t.howard@gmail.com' => 'Ara T. Howard',
57
+ 'blueonyx@dev-area.net' => 'Martin Hilbig',
58
+ 'clive@crous.co.za' => 'Clive Crous',
59
+ 'comp.lang.zenix+ramaze@gmail.com' => 'zenix',
60
+ 'jesusisramazing.10.pistos@geoshell.com' => 'Pistos',
61
+ 'jesuswasramazing.10.pistos@geoshell.com' => 'Pistos',
62
+ 'keita.yamaguchi@gmail.com' => 'Keita Yamaguchi',
63
+ 'leo.borisenko@gmail.com' => 'Leo Borisenko',
64
+ 'manveru@weez-int.com' => 'Michael Fellinger',
65
+ 'm.fellinger@gmail.com' => 'Michael Fellinger',
66
+ 'outtenr@gmail.com' => 'Richard Outten',
67
+ 'rff.rff@gmail.com' => 'Gabriele Renzi',
68
+ 'skaar@waste.org' => 'skaar',
69
+ 'stephan@spaceboyz.net' => 'Stephan Maka',
70
+ }
71
+
54
72
  # * Browse and try the Examples in
55
73
  # #{File.join(Gem.path, 'gems', 'ramaze-' + VERS, 'examples')}
@@ -0,0 +1,5 @@
1
+ desc 'Apply a patch bundle to darcs repo'
2
+ task :apply do
3
+ bundle = ENV['BUNDLE'] || ENV['bundle'] || 'bundle'
4
+ sh "darcs apply -v --reply=ramaze@googlegroups.com #{bundle}"
5
+ end
@@ -204,30 +204,21 @@ task 'tutorial' => ['tutorial2html'] do
204
204
  end
205
205
 
206
206
  def authors
207
- author_map = {
208
- 'blueonyx@dev-area.net' => 'Martin Hilbig',
209
- 'clive@crous.co.za' => 'Clive Crous',
210
- 'comp.lang.zenix+ramaze@gmail.com' => 'zenix',
211
- 'jesuswasramazing.10.pistos@geoshell.com' => 'Pistos',
212
- 'jesusisramazing.10.pistos@geoshell.com' => 'Pistos',
213
- 'manveru@weez-int.com' => 'Michael Fellinger',
214
- 'm.fellinger@gmail.com' => 'Michael Fellinger',
215
- 'outtenr@gmail.com' => 'Richard Outten',
216
- 'rff.rff@gmail.com' => 'Gabriele Renzi',
217
- 'skaar@waste.org' => 'skaar',
218
- 'stephan@spaceboyz.net' => 'Stephan Maka',
219
- 'keita.yamaguchi@gmail.com' => 'Keita Yamaguchi',
220
- }
221
-
222
207
  mapping = {}
223
- `darcs changes`.split("\n").grep(/^\w/).each do |line|
224
- author = line.split[6..-1]
225
- email = author.pop.gsub(/<(.*?)>/, '\1')
226
- name = author.join(' ')
227
- name = author_map[email] if name.empty?
228
- fail "#{email} doesn't have a name" unless name
229
- mapping[name] ||= { :email => email, :patches => 0 }
230
- mapping[name][:patches] += 1
208
+ `darcs show authors`.split("\n").each do |line|
209
+ atoms = line.split
210
+ patches = atoms.shift.to_i
211
+
212
+ if email = atoms.find{|a| a.gsub!(/(.*?@.*?)/, '\1') }
213
+ email.tr!('<>', '')
214
+ atoms.delete email
215
+ end
216
+
217
+ name = atoms.join(' ')
218
+ name = AUTHOR_MAP.fetch(email) if name.empty?
219
+ patches += mapping.fetch(name, {}).fetch(:patches, 0)
220
+
221
+ mapping[name] = { :email => email, :patches => patches }
231
222
  end
232
223
 
233
224
  max = mapping.map{|k,v| k.size }.max
@@ -246,10 +237,32 @@ task 'authors' do
246
237
  end
247
238
  end
248
239
 
240
+ desc "show how many patches we made so far"
241
+ task :patchsize do
242
+ patches = `darcs show repo`[/Num Patches: (\d+)/, 1].to_i
243
+ puts "currently we have #{patches} patches"
244
+ init = Time.parse("Sat Oct 14 04:22:49 JST 2006")
245
+ days = (Time.now - init) / (3600 * 24)
246
+ puts "%d days since init, avg %4.2f patches per day" % [days, patches/days]
247
+ end
248
+
249
+ desc "show who made how many patches"
250
+ task :patchstat do
251
+ total = 0.0
252
+
253
+ authors.map do |name, hash|
254
+ patches = hash[:patches]
255
+ total += patches
256
+ [patches, name]
257
+ end.sort.reverse_each do |patches, name|
258
+ puts "%s %4d [%6.2f%% ]" % [name, patches, patches/total * 100]
259
+ end
260
+ end
261
+
249
262
  desc "upload packages to rubyforge"
250
263
  task 'release' => ['distribute'] do
251
264
  sh 'rubyforge login'
252
- #sh "rubyforge add_release ramaze ramaze #{VERS} pkg/ramaze-#{VERS}.gem"
265
+ sh "rubyforge add_release ramaze ramaze #{VERS} pkg/ramaze-#{VERS}.gem"
253
266
 
254
267
  require 'open-uri'
255
268
  require 'hpricot'
@@ -33,7 +33,7 @@ task 'spec' do
33
33
  total = names.size
34
34
 
35
35
  list.zip(names).each_with_index do |(spec, name), idx|
36
- print '%2d/%d: ' % [idx + 1, total]
36
+ print '%3d/%d: ' % [idx + 1, total]
37
37
  print name.ljust(width + 2)
38
38
 
39
39
  stdout = `#{bin} -I#{libpath} #{spec} 2>&1`
@@ -4,11 +4,13 @@ spec_require 'ruby2ruby'
4
4
  Ramaze.contrib :auto_params
5
5
 
6
6
  module AnotherController
7
+ Ramaze::Helper::LOOKUP << self
8
+
7
9
  def another_page
8
10
  'another page'
9
11
  end
10
12
 
11
- define_method(:css/'style.css') { 'style.css' }
13
+ define_method('css/style.css') { 'style.css' }
12
14
  end
13
15
 
14
16
  class MainController < Ramaze::Controller
@@ -0,0 +1,26 @@
1
+ require 'spec/helper'
2
+
3
+ spec_require 'ruby-prof'
4
+
5
+ Ramaze.contrib :profiling
6
+
7
+ class MainController < Ramaze::Controller
8
+ def index
9
+ 100.times {"h" + "e" + "l" + "l" + "o"}
10
+ end
11
+ end
12
+
13
+ output = StringIO.new
14
+ Ramaze::Inform.loggers << Ramaze::Informer.new(output)
15
+
16
+ describe 'Profiling' do
17
+ behaves_like "http"
18
+ ramaze
19
+
20
+ it "should profile" do
21
+ get('/')
22
+ output.string.should =~ /Thread ID:\s\d+/
23
+ output.string.should =~ /Total:/
24
+ output.string.should =~ /self\s+total\s+self\s+wait\s+child\s+call/
25
+ end
26
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec/helper'
2
2
 
3
3
  spec_require 'redcloth'
4
- require 'examples/templates/template_redcloth'
4
+ spec_require 'examples/templates/template_redcloth'
5
5
 
6
6
  describe 'Template RedCloth' do
7
7
  behaves_like 'http'
@@ -0,0 +1,28 @@
1
+ require 'spec/helper'
2
+
3
+ spec_require 'tenjin'
4
+ require 'examples/templates/template_tenjin'
5
+
6
+ describe 'Template Tenjin' do
7
+ behaves_like 'http'
8
+ ramaze
9
+
10
+ it '/' do
11
+ html = get('/').body.strip
12
+ html.should =~ %r(<a href=\"/\">Home</a>)
13
+ html.should =~ %r(<a href=\"/internal\">internal</a>)
14
+ html.should =~ %r(<a href=\"/external\">external</a>)
15
+ end
16
+
17
+ %w[/internal /external].each do |url|
18
+ it url do
19
+ name = url.gsub(/^\//, '')
20
+ response = get(url)
21
+ response.status.should == 200
22
+ html = response.body
23
+ html.should.not == nil
24
+ html.should =~ %r(<title>Template::Tenjin #{name}</title>)
25
+ html.should =~ %r(<h1>The #{name} Template for Tenjin</h1>)
26
+ end
27
+ end
28
+ end
@@ -1,4 +1,3 @@
1
1
  ramaze_dir = File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
2
2
  $LOAD_PATH.unshift(ramaze_dir)
3
- require "ramaze"
4
3
  require 'ramaze/spec/helper'