ramaze 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (304) hide show
  1. data/Rakefile +20 -3
  2. data/bin/ramaze +1 -4
  3. data/doc/AUTHORS +2 -1
  4. data/doc/CHANGELOG +539 -32
  5. data/doc/LEGAL +4 -0
  6. data/doc/meta/announcement.txt +79 -47
  7. data/examples/blog/README +2 -2
  8. data/examples/blog/spec/blog.rb +33 -48
  9. data/examples/blog/src/controller.rb +15 -13
  10. data/examples/blog/src/model.rb +28 -10
  11. data/examples/blog/start.rb +0 -10
  12. data/examples/blog/template/edit.xhtml +1 -1
  13. data/examples/blog/template/index.xhtml +2 -2
  14. data/examples/facebook.rb +152 -0
  15. data/examples/linking.rb +28 -0
  16. data/examples/ramaise.rb +4 -11
  17. data/examples/rammit/spec/rammit.rb +30 -0
  18. data/examples/rammit/src/controller/main.rb +3 -0
  19. data/examples/rammit/src/controller/page.rb +16 -0
  20. data/examples/rammit/src/model.rb +33 -0
  21. data/examples/rammit/start.rb +7 -0
  22. data/examples/rammit/template/index.xhtml +14 -0
  23. data/examples/rammit/template/page/view.xhtml +4 -0
  24. data/examples/rapaste/Rakefile +28 -0
  25. data/examples/rapaste/public/css/active4d.css +114 -0
  26. data/examples/rapaste/public/css/all_hallows_eve.css +72 -0
  27. data/examples/rapaste/public/css/amy.css +147 -0
  28. data/examples/rapaste/public/css/blackboard.css +88 -0
  29. data/examples/rapaste/public/css/brilliance_black.css +605 -0
  30. data/examples/rapaste/public/css/brilliance_dull.css +599 -0
  31. data/examples/rapaste/public/css/cobalt.css +149 -0
  32. data/examples/rapaste/public/css/dawn.css +121 -0
  33. data/examples/rapaste/public/css/display.css +179 -0
  34. data/examples/rapaste/public/css/eiffel.css +121 -0
  35. data/examples/rapaste/public/css/espresso_libre.css +109 -0
  36. data/examples/rapaste/public/css/idle.css +62 -0
  37. data/examples/rapaste/public/css/iplastic.css +80 -0
  38. data/examples/rapaste/public/css/lazy.css +73 -0
  39. data/examples/rapaste/public/css/mac_classic.css +123 -0
  40. data/examples/rapaste/public/css/magicwb_amiga.css +104 -0
  41. data/examples/rapaste/public/css/pastels_on_dark.css +188 -0
  42. data/examples/rapaste/public/css/slush_poppies.css +85 -0
  43. data/examples/rapaste/public/css/spacecadet.css +51 -0
  44. data/examples/rapaste/public/css/sunburst.css +180 -0
  45. data/examples/rapaste/public/css/twilight.css +137 -0
  46. data/examples/rapaste/public/css/zenburnesque.css +91 -0
  47. data/examples/rapaste/public/js/jquery.js +11 -0
  48. data/examples/rapaste/rapaste.sqlite +0 -0
  49. data/examples/rapaste/spec/rapaste.rb +49 -0
  50. data/examples/rapaste/src/controller.rb +69 -0
  51. data/examples/rapaste/src/model.rb +61 -0
  52. data/examples/rapaste/start.rb +20 -0
  53. data/examples/rapaste/template/copy.xhtml +10 -0
  54. data/examples/rapaste/template/index.xhtml +9 -0
  55. data/examples/rapaste/template/layout.xhtml +22 -0
  56. data/examples/rapaste/template/list.xhtml +28 -0
  57. data/examples/rapaste/template/view.xhtml +37 -0
  58. data/examples/sourceview/sourceview.rb +3 -3
  59. data/examples/templates/template_amrita2.rb +1 -3
  60. data/examples/todolist/spec/todolist.rb +15 -18
  61. data/examples/whywiki/spec/whywiki.rb +15 -20
  62. data/examples/whywiki/start.rb +0 -1
  63. data/examples/wikore/spec/wikore.rb +14 -19
  64. data/examples/wiktacular/spec/wiktacular.rb +8 -15
  65. data/lib/proto/{src/controller → controller}/main.rb +4 -4
  66. data/lib/proto/public/css/ramaze_error.css +39 -3
  67. data/lib/proto/public/js/jquery.js +2039 -1020
  68. data/lib/proto/spec/main.rb +27 -0
  69. data/lib/proto/start.rb +5 -5
  70. data/lib/proto/view/error.xhtml +62 -0
  71. data/lib/proto/view/index.xhtml +34 -0
  72. data/lib/proto/view/page.xhtml +15 -0
  73. data/lib/ramaze.rb +9 -7
  74. data/lib/ramaze/action.rb +7 -3
  75. data/lib/ramaze/action/render.rb +15 -5
  76. data/lib/ramaze/adapter.rb +5 -5
  77. data/lib/ramaze/adapter/base.rb +2 -2
  78. data/lib/ramaze/adapter/cgi.rb +1 -1
  79. data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
  80. data/lib/ramaze/adapter/fcgi.rb +2 -2
  81. data/lib/ramaze/adapter/mongrel.rb +1 -1
  82. data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
  83. data/lib/ramaze/adapter/thin.rb +25 -0
  84. data/lib/ramaze/adapter/webrick.rb +1 -1
  85. data/lib/ramaze/cache.rb +3 -2
  86. data/lib/ramaze/cache/memcached.rb +1 -1
  87. data/lib/ramaze/cache/memory.rb +1 -1
  88. data/lib/ramaze/cache/yaml_store.rb +1 -1
  89. data/lib/ramaze/contrib.rb +1 -1
  90. data/lib/ramaze/contrib/auto_params.rb +12 -5
  91. data/lib/ramaze/contrib/auto_params/get_args.rb +1 -0
  92. data/lib/ramaze/contrib/facebook.rb +23 -0
  93. data/lib/ramaze/contrib/facebook/facebook.rb +168 -0
  94. data/lib/ramaze/contrib/gettext.rb +111 -0
  95. data/lib/ramaze/contrib/gettext/mo.rb +155 -0
  96. data/lib/ramaze/contrib/gettext/po.rb +109 -0
  97. data/lib/ramaze/contrib/gzip_filter.rb +1 -1
  98. data/lib/ramaze/contrib/route.rb +15 -5
  99. data/lib/ramaze/contrib/sequel/fill.rb +1 -1
  100. data/lib/ramaze/controller.rb +10 -4
  101. data/lib/ramaze/controller/error.rb +5 -13
  102. data/lib/ramaze/controller/main.rb +2 -0
  103. data/lib/ramaze/controller/resolve.rb +18 -10
  104. data/lib/ramaze/dispatcher.rb +1 -1
  105. data/lib/ramaze/dispatcher/action.rb +1 -1
  106. data/lib/ramaze/dispatcher/directory.rb +3 -2
  107. data/lib/ramaze/dispatcher/error.rb +5 -5
  108. data/lib/ramaze/dispatcher/file.rb +13 -2
  109. data/lib/ramaze/error.rb +1 -1
  110. data/lib/ramaze/gestalt.rb +2 -2
  111. data/lib/ramaze/global.rb +5 -5
  112. data/lib/ramaze/global/dsl.rb +1 -1
  113. data/lib/ramaze/global/globalstruct.rb +11 -5
  114. data/lib/ramaze/helper.rb +1 -1
  115. data/lib/ramaze/helper/aspect.rb +1 -1
  116. data/lib/ramaze/helper/auth.rb +2 -2
  117. data/lib/ramaze/helper/cache.rb +1 -1
  118. data/lib/ramaze/helper/cgi.rb +1 -1
  119. data/lib/ramaze/helper/file.rb +1 -1
  120. data/lib/ramaze/helper/flash.rb +1 -1
  121. data/lib/ramaze/helper/formatting.rb +1 -1
  122. data/lib/ramaze/helper/identity.rb +1 -1
  123. data/lib/ramaze/helper/inform.rb +1 -1
  124. data/lib/ramaze/helper/link.rb +4 -4
  125. data/lib/ramaze/helper/markaby.rb +1 -1
  126. data/lib/ramaze/helper/nitroform.rb +1 -1
  127. data/lib/ramaze/helper/pager.rb +2 -1
  128. data/lib/ramaze/helper/partial.rb +1 -1
  129. data/lib/ramaze/helper/redirect.rb +6 -1
  130. data/lib/ramaze/helper/sequel.rb +54 -0
  131. data/lib/ramaze/helper/stack.rb +1 -1
  132. data/lib/ramaze/inform.rb +1 -1
  133. data/lib/ramaze/inform/analogger.rb +1 -1
  134. data/lib/ramaze/inform/growl.rb +1 -1
  135. data/lib/ramaze/inform/hub.rb +1 -1
  136. data/lib/ramaze/inform/informer.rb +1 -1
  137. data/lib/ramaze/inform/informing.rb +2 -2
  138. data/lib/ramaze/inform/knotify.rb +1 -1
  139. data/lib/ramaze/inform/syslog.rb +1 -1
  140. data/lib/ramaze/inform/xosd.rb +1 -1
  141. data/lib/ramaze/snippets.rb +1 -1
  142. data/lib/ramaze/snippets/array/put_within.rb +1 -1
  143. data/lib/ramaze/snippets/blankslate.rb +7 -0
  144. data/lib/ramaze/snippets/dictionary.rb +6 -1
  145. data/lib/ramaze/snippets/divide.rb +1 -1
  146. data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
  147. data/lib/ramaze/snippets/kernel/acquire.rb +39 -0
  148. data/lib/ramaze/snippets/kernel/aquire.rb +1 -34
  149. data/lib/ramaze/snippets/kernel/constant.rb +1 -1
  150. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +1 -1
  151. data/lib/ramaze/snippets/numeric/filesize_format.rb +1 -1
  152. data/lib/ramaze/snippets/object/traits.rb +1 -1
  153. data/lib/ramaze/snippets/ordered_set.rb +12 -7
  154. data/lib/ramaze/snippets/ramaze/caller_info.rb +1 -1
  155. data/lib/ramaze/snippets/ramaze/caller_lines.rb +1 -1
  156. data/lib/ramaze/snippets/string/camel_case.rb +1 -1
  157. data/lib/ramaze/snippets/string/color.rb +2 -4
  158. data/lib/ramaze/snippets/string/each.rb +1 -1
  159. data/lib/ramaze/snippets/string/ord.rb +15 -0
  160. data/lib/ramaze/snippets/string/snake_case.rb +1 -1
  161. data/lib/ramaze/snippets/struct/fill.rb +4 -2
  162. data/lib/ramaze/snippets/struct/values_at.rb +2 -2
  163. data/lib/ramaze/snippets/symbol/to_proc.rb +15 -8
  164. data/lib/ramaze/snippets/thread/into.rb +1 -1
  165. data/lib/ramaze/sourcereload.rb +4 -3
  166. data/lib/ramaze/spec/helper.rb +85 -32
  167. data/lib/ramaze/spec/helper/bacon.rb +7 -0
  168. data/lib/ramaze/spec/helper/browser.rb +1 -2
  169. data/lib/ramaze/spec/helper/mock_http.rb +1 -1
  170. data/lib/ramaze/spec/helper/pretty_output.rb +70 -0
  171. data/lib/ramaze/spec/helper/requester.rb +1 -1
  172. data/lib/ramaze/spec/helper/simple_http.rb +5 -4
  173. data/lib/ramaze/spec/helper/snippets.rb +6 -0
  174. data/lib/ramaze/store/default.rb +1 -1
  175. data/lib/ramaze/template.rb +1 -1
  176. data/lib/ramaze/template/amrita2.rb +6 -5
  177. data/lib/ramaze/template/erubis.rb +1 -1
  178. data/lib/ramaze/template/ezamar.rb +1 -1
  179. data/lib/ramaze/template/ezamar/element.rb +1 -1
  180. data/lib/ramaze/template/ezamar/engine.rb +1 -1
  181. data/lib/ramaze/template/ezamar/morpher.rb +1 -1
  182. data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
  183. data/lib/ramaze/template/haml.rb +1 -1
  184. data/lib/ramaze/template/liquid.rb +1 -1
  185. data/lib/ramaze/template/markaby.rb +1 -1
  186. data/lib/ramaze/template/nagoro.rb +4 -6
  187. data/lib/ramaze/template/none.rb +1 -1
  188. data/lib/ramaze/template/remarkably.rb +1 -1
  189. data/lib/ramaze/template/sass.rb +1 -1
  190. data/lib/ramaze/tool.rb +1 -1
  191. data/lib/ramaze/tool/create.rb +7 -1
  192. data/lib/ramaze/tool/localize.rb +7 -14
  193. data/lib/ramaze/tool/mime.rb +1 -1
  194. data/lib/ramaze/tool/record.rb +1 -1
  195. data/lib/ramaze/trinity.rb +1 -1
  196. data/lib/ramaze/trinity/request.rb +4 -2
  197. data/lib/ramaze/trinity/response.rb +1 -1
  198. data/lib/ramaze/trinity/session.rb +7 -1
  199. data/lib/ramaze/version.rb +3 -3
  200. data/lib/vendor/bacon.rb +317 -0
  201. data/rake_tasks/conf.rake +1 -1
  202. data/rake_tasks/maintenance.rake +7 -5
  203. data/rake_tasks/spec.rake +54 -40
  204. data/spec/contrib/auto_params.rb +21 -4
  205. data/spec/contrib/route.rb +31 -4
  206. data/spec/contrib/sequel/fill.rb +3 -4
  207. data/spec/examples/caching.rb +5 -2
  208. data/spec/examples/css.rb +5 -2
  209. data/spec/examples/element.rb +5 -4
  210. data/spec/examples/hello.rb +1 -0
  211. data/spec/examples/linking.rb +18 -0
  212. data/spec/examples/simple.rb +13 -18
  213. data/spec/examples/templates/template_amrita2.rb +3 -2
  214. data/spec/examples/templates/template_erubis.rb +3 -2
  215. data/spec/examples/templates/template_ezamar.rb +2 -1
  216. data/spec/examples/templates/template_haml.rb +3 -2
  217. data/spec/examples/templates/template_liquid.rb +3 -2
  218. data/spec/examples/templates/template_markaby.rb +3 -2
  219. data/spec/examples/templates/template_remarkably.rb +3 -2
  220. data/spec/ramaze/action/basics.rb +4 -4
  221. data/spec/ramaze/action/cache.rb +11 -13
  222. data/spec/ramaze/action/layout.rb +47 -3
  223. data/spec/ramaze/action/render.rb +3 -3
  224. data/spec/ramaze/action/template/instancevars/layout.xhtml +1 -0
  225. data/spec/ramaze/adapter.rb +7 -7
  226. data/spec/ramaze/adapter/mongrel.rb +1 -1
  227. data/spec/ramaze/adapter/record.rb +7 -7
  228. data/spec/ramaze/adapter/webrick.rb +1 -1
  229. data/spec/ramaze/cache.rb +6 -8
  230. data/spec/ramaze/controller.rb +77 -65
  231. data/spec/ramaze/controller/resolve.rb +2 -1
  232. data/spec/ramaze/controller/template_resolving.rb +3 -4
  233. data/spec/ramaze/dispatcher.rb +3 -4
  234. data/spec/ramaze/dispatcher/directory.rb +35 -35
  235. data/spec/ramaze/dispatcher/file.rb +8 -5
  236. data/spec/ramaze/element.rb +4 -4
  237. data/spec/ramaze/error.rb +13 -11
  238. data/spec/ramaze/gestalt.rb +1 -1
  239. data/spec/ramaze/helper/aspect.rb +2 -1
  240. data/spec/ramaze/helper/auth.rb +4 -2
  241. data/spec/ramaze/helper/cache.rb +10 -9
  242. data/spec/ramaze/helper/cgi.rb +2 -2
  243. data/spec/ramaze/helper/file.rb +1 -0
  244. data/spec/ramaze/helper/flash.rb +5 -4
  245. data/spec/ramaze/helper/formatting.rb +1 -1
  246. data/spec/ramaze/helper/link.rb +3 -3
  247. data/spec/ramaze/helper/pager.rb +44 -80
  248. data/spec/ramaze/helper/partial.rb +2 -3
  249. data/spec/ramaze/helper/redirect.rb +10 -1
  250. data/spec/ramaze/helper/stack.rb +4 -3
  251. data/spec/ramaze/helper/template/loop.xhtml +2 -1
  252. data/spec/ramaze/inform/informer.rb +2 -2
  253. data/spec/ramaze/inform/syslog.rb +1 -1
  254. data/spec/ramaze/localize.rb +26 -26
  255. data/spec/ramaze/morpher.rb +6 -7
  256. data/spec/ramaze/params.rb +7 -8
  257. data/spec/ramaze/request.rb +27 -6
  258. data/spec/ramaze/request/mongrel.rb +1 -1
  259. data/spec/ramaze/request/thin.rb +9 -0
  260. data/spec/ramaze/session.rb +2 -1
  261. data/spec/ramaze/store/default.rb +14 -17
  262. data/spec/ramaze/template.rb +5 -7
  263. data/spec/ramaze/template/amrita2.rb +4 -1
  264. data/spec/ramaze/template/erubis.rb +2 -1
  265. data/spec/ramaze/template/ezamar.rb +2 -3
  266. data/spec/ramaze/template/ezamar/other__index.xhtml +1 -0
  267. data/spec/ramaze/template/haml.rb +2 -1
  268. data/spec/ramaze/template/liquid.rb +4 -2
  269. data/spec/ramaze/template/markaby.rb +4 -2
  270. data/spec/ramaze/template/nagoro.rb +3 -4
  271. data/spec/ramaze/template/remarkably.rb +4 -2
  272. data/spec/ramaze/template/sass.rb +3 -2
  273. data/spec/ramaze/template/xslt.rb +4 -7
  274. data/spec/ramaze/trinity/request.rb +4 -3
  275. data/spec/ramaze/trinity/session.rb +6 -4
  276. data/spec/snippets/array/put_within.rb +3 -2
  277. data/spec/snippets/divide.rb +1 -4
  278. data/spec/snippets/kernel/__dir__.rb +1 -1
  279. data/spec/snippets/kernel/acquire.rb +71 -0
  280. data/spec/snippets/kernel/constant.rb +4 -8
  281. data/spec/snippets/numeric/filesize_format.rb +1 -1
  282. data/spec/snippets/ordered_set.rb +9 -2
  283. data/spec/snippets/ramaze/caller_info.rb +3 -3
  284. data/spec/snippets/ramaze/caller_lines.rb +3 -3
  285. data/spec/snippets/string/camel_case.rb +1 -1
  286. data/spec/snippets/string/color.rb +2 -2
  287. data/spec/snippets/string/snake_case.rb +5 -1
  288. data/spec/snippets/string/unindent.rb +1 -1
  289. data/spec/snippets/struct/fill.rb +14 -15
  290. data/spec/snippets/struct/values_at.rb +15 -10
  291. data/spec/snippets/symbol/to_proc.rb +13 -0
  292. data/spec/snippets/thread/into.rb +3 -4
  293. metadata +458 -386
  294. data/doc/README.html +0 -729
  295. data/doc/changes.txt +0 -5044
  296. data/doc/changes.xml +0 -5046
  297. data/lib/proto/public/error.zmr +0 -61
  298. data/lib/proto/src/element/page.rb +0 -17
  299. data/lib/proto/src/model.rb +0 -6
  300. data/lib/proto/template/index.xhtml +0 -15
  301. data/lib/ramaze/spec/helper/layout.rb +0 -58
  302. data/lib/ramaze/spec/helper/minimal.rb +0 -23
  303. data/lib/ramaze/spec/helper/wrap.rb +0 -198
  304. data/spec/snippets/kernel/aquire.rb +0 -71
@@ -9,7 +9,7 @@ BASEDIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
9
9
  NAME = "ramaze"
10
10
  VERS = Ramaze::VERSION
11
11
  COPYRIGHT = [
12
- "# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com",
12
+ "# Copyright (c) #{Time.now.year} Michael Fellinger m.fellinger@gmail.com",
13
13
  "# All files in this distribution are subject to the terms of the Ruby license."
14
14
  ]
15
15
  CLEAN.include %w[
@@ -205,13 +205,14 @@ end
205
205
 
206
206
  def authors
207
207
  author_map = {
208
- 'm.fellinger@gmail.com' => 'Michael Fellinger',
209
- 'manveru@weez-int.com' => 'Michael Fellinger',
210
- 'clive@crous.co.za' => 'Clive Crous',
211
208
  'blueonyx@dev-area.net' => 'Martin Hilbig',
212
- 'rff.rff@gmail.com' => 'Gabriele Renzi',
209
+ 'clive@crous.co.za' => 'Clive Crous',
213
210
  'comp.lang.zenix+ramaze@gmail.com' => 'zenix',
214
211
  'jesuswasramazing.10.pistos@geoshell.com' => 'Pistos',
212
+ 'manveru@weez-int.com' => 'Michael Fellinger',
213
+ 'm.fellinger@gmail.com' => 'Michael Fellinger',
214
+ 'outtenr@gmail.com' => 'Carlo Zottmann',
215
+ 'rff.rff@gmail.com' => 'Gabriele Renzi',
215
216
  'stephan@spaceboyz.net' => 'Stephan Maka',
216
217
  }
217
218
 
@@ -221,11 +222,12 @@ def authors
221
222
  email = author.pop.gsub(/<(.*?)>/, '\1')
222
223
  name = author.join(' ')
223
224
  name = author_map[email] if name.empty?
225
+ fail "#{email} doesn't have a name" unless name
224
226
  mapping[name] ||= { :email => email, :patches => 0 }
225
227
  mapping[name][:patches] += 1
226
228
  end
227
229
 
228
- max = mapping.map{|k,v| k.length}.max
230
+ max = mapping.map{|k,v| k.size }.max
229
231
  mapping.inject({}) {|h,(k,v)| h[k.ljust(max)] = v; h}
230
232
  end
231
233
 
@@ -2,47 +2,61 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  require 'rake'
5
- require 'ramaze/spec/helper/layout'
6
- require 'lib/ramaze/snippets/divide'
7
-
8
- SPEC_BASE = File.expand_path('spec')
9
- EXAMPLE_BASE = File.expand_path('examples')
10
- SNIPPETS_BASE = File.expand_path('snippets')
11
- # ignore files with these paths
12
- ignores = [ './*', './helper/*', './ramaze/adapter.rb', './ramaze/request.rb', ]
13
-
14
- files = Dir[SPEC_BASE/'**'/'*.rb'] +
15
- Dir[EXAMPLE_BASE/'**/spec'/'*.rb']
16
- Dir[SNIPPETS_BASE/'**/*.rb']
17
- ignores.each do |ignore|
18
- ignore_files = Dir[SPEC_BASE/ignore]
19
- ignore_files.each do |ignore_file|
20
- files.delete File.expand_path(ignore_file)
21
- end
22
- end
23
-
24
- files.sort!
25
-
26
- spec_layout = Hash.new{|h,k| h[k] = []}
5
+ require 'pp'
27
6
 
28
- files.each do |file|
29
- name = file.gsub(/^(#{SPEC_BASE}|#{EXAMPLE_BASE})/, '.')
30
- dir_name = File.dirname(name)[2..-1]
31
- task_name = ([:test] + dir_name.split('/')).join(':')
32
- spec_layout[task_name] << file
33
- end
34
-
35
- spec_layout.each do |task_name, specs|
36
-
37
- desc task_name
38
- task task_name => [:clean] do
39
- wrap = SpecWrap.new(*specs)
40
- wrap.run
7
+ require 'lib/ramaze/snippets/divide'
8
+ require 'lib/ramaze/snippets/string/color'
9
+
10
+ desc 'Run all specs'
11
+ task 'spec' do
12
+ non_verbose, non_fatal = ENV['non_verbose'], ENV['non_fatal']
13
+ require 'scanf'
14
+
15
+ root = File.expand_path(File.dirname(__FILE__)/'..')
16
+ libpath = root/'lib'
17
+
18
+ specs = Dir[root/'spec/{ramaze,examples,snippets,contrib}/**/*.rb'] +
19
+ Dir[root/'examples/**/spec/**/*.rb']
20
+
21
+ ignore = [
22
+ root/'spec/ramaze/adapter.rb', root/'spec/ramaze/request.rb',
23
+ ].map{|i| Dir[i].map{|f| File.expand_path(f) }}.flatten
24
+
25
+ config = RbConfig::CONFIG
26
+ bin = config['bindir']/config['ruby_install_name']
27
+
28
+ result_format = '%d tests, %d assertions, %d failures, %d errors'
29
+
30
+ list = (specs - ignore).sort
31
+ names = list.map{|l| l.sub(root + '/', '') }
32
+ width = names.sort_by{|s| s.size}.last.size
33
+ total = names.size
34
+
35
+ list.zip(names).each_with_index do |(spec, name), idx|
36
+ print '%2d/%d: ' % [idx + 1, total]
37
+ print name.ljust(width + 2)
38
+
39
+ stdout = `#{bin} -I#{libpath} #{spec} 2>&1`
40
+
41
+ status = $?.exitstatus
42
+ tests, assertions, failures, errors =
43
+ stdout[/.*\Z/].to_s.scanf(result_format)
44
+
45
+ if stdout =~ /Usually you should not worry about this failure, just install the/
46
+ lib = stdout[/^no such file to load -- (.*?)$/, 1] ||
47
+ stdout[/RubyGem version error: (.*)$/, 1]
48
+ puts "requires #{lib}".yellow
49
+ elsif status == 0
50
+ puts "all %3d passed".green % tests
51
+ else
52
+ out = result_format % [tests, assertions, failures, errors].map{|e| e.to_s.to_i}
53
+ puts out.red
54
+ puts stdout unless non_verbose
55
+ exit status unless non_fatal
56
+ end
41
57
  end
42
- end
43
58
 
44
- desc "Test all"
45
- task "test:all" => [:clean] do
46
- wrap = SpecWrap.new(*spec_layout.values.flatten)
47
- wrap.run
59
+ puts '', "joy: the emotion evoked by well-being, success, or good fortune or by the
60
+ prospect of possessing what one desires"
61
+ puts "All specs pass, go enjoy yourself :)"
48
62
  end
@@ -1,5 +1,5 @@
1
1
  require 'spec/helper'
2
- testcase_requires 'ruby2ruby'
2
+ spec_require 'ruby2ruby'
3
3
 
4
4
  Ramaze.contrib :auto_params
5
5
 
@@ -40,8 +40,24 @@ class MainController < Ramaze::Controller
40
40
  end
41
41
  end
42
42
 
43
+ class GetArgsTest
44
+ def one(a, b, c) end
45
+ def two(a, b = 1, c = nil) end
46
+ def three(a, *args) end
47
+ end
48
+
49
+ describe 'Method#get_args' do
50
+ it 'should return a list of arguments' do
51
+ gat = GetArgsTest.new
52
+ gat.method(:one).get_args.should == [[:a], [:b], [:c]]
53
+ gat.method(:two).get_args.should == [[:a], [:b, 1], [:c, nil]]
54
+ gat.method(:three).get_args.should == [[:a], [:"*args"]]
55
+ end
56
+ end
57
+
43
58
  describe 'Parameterized actions' do
44
- before(:all) { ramaze }
59
+ behaves_like 'http'
60
+ ramaze
45
61
 
46
62
  it 'should pass in values from request.params' do
47
63
  get('/create/Aman/20').body.should == 'Aman, 20'
@@ -82,7 +98,8 @@ describe 'Parameterized actions' do
82
98
  end if method(:puts).respond_to? :get_args
83
99
 
84
100
  describe 'Normal behavior' do
85
- before(:all) { ramaze }
101
+ extend MockHTTP
102
+ ramaze
86
103
 
87
104
  it 'should work with no arguments' do
88
105
  get('/page').body.should == 'page'
@@ -99,4 +116,4 @@ describe 'Normal behavior' do
99
116
  it 'should work with /' do
100
117
  get('/css/style.css').body.should == 'style.css'
101
118
  end
102
- end
119
+ end
@@ -1,5 +1,7 @@
1
1
  require 'spec/helper'
2
2
 
3
+ Ramaze.contrib :route
4
+
3
5
  class MainController < Ramaze::Controller
4
6
  def float(flt)
5
7
  "Float: #{flt}"
@@ -12,13 +14,28 @@ class MainController < Ramaze::Controller
12
14
  def price(p)
13
15
  "Price: \$#{p}"
14
16
  end
17
+
18
+ def sum(a, b)
19
+ a.to_i + b.to_i
20
+ end
15
21
  end
16
22
 
17
23
  describe 'Route' do
18
- before :all do
19
- Ramaze.contrib :route
20
- ramaze
21
- @route = Ramaze::Contrib::Route
24
+ behaves_like 'http'
25
+ ramaze
26
+ @route = Ramaze::Contrib::Route
27
+
28
+ it 'should take custom lambda routers' do
29
+ @route['string'] = lambda {|path, req| path if path =~ %r!^/string! }
30
+ @route['string'].class.should == Proc
31
+
32
+ @route['calc sum'] = lambda do |path, req|
33
+ if req[:do_calc]
34
+ lval, rval = req[:a, :b]
35
+ rval = rval.to_i * 10
36
+ "/sum/#{lval}/#{rval}"
37
+ end
38
+ end
22
39
  end
23
40
 
24
41
  it 'should be possible to define routes' do
@@ -55,4 +72,14 @@ describe 'Route' do
55
72
  r.status.should == 200
56
73
  r.body.should == 'Price: $12.84'
57
74
  end
75
+
76
+ it 'should use lambda routers' do
77
+ r = get('/string/abc')
78
+ r.status.should == 200
79
+ r.body.should == 'String: abc'
80
+
81
+ r = get('/', 'do_calc=1&a=2&b=6')
82
+ r.status.should == 200
83
+ r.body.should == '62'
84
+ end
58
85
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec/helper'
2
2
 
3
- testcase_requires 'sequel'
3
+ spec_require 'sequel'
4
4
 
5
5
  begin
6
6
  DB = Sequel.sqlite
@@ -35,9 +35,8 @@ class MainController < Ramaze::Controller
35
35
  end
36
36
 
37
37
  describe 'Route' do
38
- before :all do
39
- ramaze
40
- end
38
+ behaves_like 'http'
39
+ ramaze
41
40
 
42
41
  it 'should fill values from current request' do
43
42
  insert = get('/insert', 'name' => 'manveru')
@@ -2,15 +2,18 @@ require 'spec/helper'
2
2
  require 'examples/caching'
3
3
 
4
4
  describe 'Caching' do
5
+ behaves_like 'http'
5
6
  ramaze
6
7
 
7
8
  it '/' do
8
9
  3.times do
9
- lambda{ get('/') }.should_not change{ get('/').body }
10
+ lambda{ get('/') }.
11
+ should.not.change{ get('/').body }
10
12
  end
11
13
 
12
14
  3.times do
13
- lambda{ get('/invalidate') }.should change{ get('/').body }
15
+ lambda{ get('/invalidate') }.
16
+ should.change{ get('/').body }
14
17
  end
15
18
  end
16
19
  end
@@ -1,12 +1,15 @@
1
1
  require 'spec/helper'
2
+ spec_require 'haml'
2
3
  require 'examples/css'
3
4
 
4
5
  describe 'CSSController' do
6
+ behaves_like 'http'
5
7
  ramaze
6
8
 
7
9
  def req(path) r = get(path); [r.content_type, r.body] end
8
10
 
9
11
  it 'should cache generated css' do
10
- lambda{ req('/css/style.css') }.should_not change{ req('/css/style.css') }
12
+ lambda{ req('/css/style.css') }.
13
+ should.not.change{ req('/css/style.css') }
11
14
  end
12
- end
15
+ end
@@ -2,13 +2,14 @@ require 'spec/helper'
2
2
  require 'examples/element'
3
3
 
4
4
  describe 'Element' do
5
+ behaves_like 'http'
5
6
  ramaze
6
7
 
7
8
  it '/' do
8
9
  r = get('/').body
9
- r.should include('<title>examples/element</title>')
10
- r.should include('<h1>Test</h1>')
11
- r.should include('<a href="http://something.com">something</a>')
12
- r.should include('Hello, World!')
10
+ r.should.include('<title>examples/element</title>')
11
+ r.should.include('<h1>Test</h1>')
12
+ r.should.include('<a href="http://something.com">something</a>')
13
+ r.should.include('Hello, World!')
13
14
  end
14
15
  end
@@ -2,6 +2,7 @@ require 'spec/helper'
2
2
  require 'examples/hello'
3
3
 
4
4
  describe 'Hello' do
5
+ behaves_like 'http'
5
6
  ramaze
6
7
 
7
8
  it '/' do
@@ -0,0 +1,18 @@
1
+ require 'spec/helper'
2
+ require 'examples/linking'
3
+
4
+ describe 'Linking' do
5
+ behaves_like 'http'
6
+ ramaze
7
+
8
+ it 'should provide a link to help' do
9
+ r = get('/').body
10
+ r.should.include('<a href="/help">Help?</a>')
11
+ end
12
+
13
+ it 'should provide a link to another controller' do
14
+ r = get('/help').body
15
+ r.should.include('<a href="/link_to/another">A Different Controller</a>')
16
+ end
17
+
18
+ end
@@ -2,49 +2,44 @@ require 'spec/helper'
2
2
  require 'examples/simple'
3
3
 
4
4
  describe 'Simple' do
5
+ behaves_like 'http'
5
6
  ramaze
6
7
 
7
- after :each do
8
- @response.status.should == 200
8
+ def check(url)
9
+ response = get(url)
10
+ response.status.should == 200
11
+ response.body
9
12
  end
10
13
 
11
14
  it '/' do
12
- @response = get('/')
13
- @response.body.should == 'simple'
15
+ check('/').should == 'simple'
14
16
  end
15
17
 
16
18
  it '/simple' do
17
- @response = get('/simple')
18
- @response.body.should =~ /^#<Ramaze::Request/
19
+ check('/simple').should =~ /^#<Ramaze::Request/
19
20
  end
20
21
 
21
22
  it '/join/foo/bar' do
22
- @response = get('/join/foo/bar')
23
- @response.body.should == 'foobar'
23
+ check('/join/foo/bar').should == 'foobar'
24
24
  end
25
25
 
26
26
  it '/join/bar/baz' do
27
- @response = get('/join/bar/baz')
28
- @response.body.should == 'barbaz'
27
+ check('/join/bar/baz').should == 'barbaz'
29
28
  end
30
29
 
31
30
  it '/join_all' do
32
- @response = get('/join_all/a/b/c/d/e/f')
33
- @response.body.should == 'abcdef'
31
+ check('/join_all/a/b/c/d/e/f').should == 'abcdef'
34
32
  end
35
33
 
36
34
  it '/sum' do
37
- @response = get('/sum/1/2')
38
- @response.body.should == '3'
35
+ check('/sum/1/2').should == '3'
39
36
  end
40
37
 
41
38
  it '/post_or_get' do
42
- @response = get('/post_or_get')
43
- @response.body.should == 'GET'
39
+ check('/post_or_get').should == 'GET'
44
40
  end
45
41
 
46
42
  it '/other' do
47
- @response = get('/other')
48
- @response.body.should == "Hello, World from OtherController"
43
+ check('/other').should == "Hello, World from OtherController"
49
44
  end
50
45
  end
@@ -1,14 +1,15 @@
1
1
  require 'spec/helper'
2
2
 
3
- testcase_requires 'amrita2'
3
+ spec_require 'amrita2'
4
4
  require 'examples/templates/template_amrita2'
5
5
 
6
6
  describe 'Template Amrita2' do
7
+ behaves_like 'http'
7
8
  ramaze
8
9
 
9
10
  it '/external' do
10
11
  html = get('/external').body
11
- html.should_not == nil
12
+ html.should.not == nil
12
13
  html.should =~ %r{<title>Template::Amrita2 external</title>}
13
14
  html.should =~ %r{<h1>The external Template for Amrita2</h1>}
14
15
  end
@@ -1,9 +1,10 @@
1
1
  require 'spec/helper'
2
2
 
3
- testcase_requires 'erubis'
3
+ spec_require 'erubis'
4
4
  require 'examples/templates/template_erubis'
5
5
 
6
6
  describe 'Template Erubis' do
7
+ behaves_like 'http'
7
8
  ramaze
8
9
 
9
10
  it '/' do
@@ -14,7 +15,7 @@ describe 'Template Erubis' do
14
15
  %w[/internal /external].each do |url|
15
16
  it url do
16
17
  html = get(url).body
17
- html.should_not == nil
18
+ html.should.not == nil
18
19
  html.should =~ %r{<title>Template::Erubis (internal|external)</title>}
19
20
  html.should =~ %r{<h1>The (internal|external) Template for Erubis</h1>}
20
21
  end