ramaze 0.3.9.1 → 2008.06

Sign up to get free protection for your applications and to get access to all the features.
Files changed (400) hide show
  1. data/{doc/README → README.markdown} +78 -32
  2. data/Rakefile +53 -50
  3. data/benchmark/results.txt +131 -0
  4. data/benchmark/run.rb +362 -0
  5. data/benchmark/suite/minimal.rb +13 -0
  6. data/benchmark/suite/no_informer.rb +9 -0
  7. data/benchmark/suite/no_sessions.rb +10 -0
  8. data/benchmark/suite/no_template.rb +9 -0
  9. data/benchmark/suite/simple.rb +7 -0
  10. data/benchmark/suite/template_amrita2.rb +17 -0
  11. data/benchmark/suite/template_builder.rb +12 -0
  12. data/benchmark/suite/template_erubis.rb +10 -0
  13. data/benchmark/suite/template_ezamar.rb +10 -0
  14. data/benchmark/suite/template_haml.rb +15 -0
  15. data/benchmark/suite/template_liquid.rb +13 -0
  16. data/benchmark/suite/template_markaby.rb +11 -0
  17. data/benchmark/suite/template_nagoro.rb +10 -0
  18. data/benchmark/suite/template_redcloth.rb +15 -0
  19. data/benchmark/suite/template_tenjin.rb +10 -0
  20. data/benchmark/test.rb +35 -0
  21. data/bin/ramaze +32 -122
  22. data/cache.yaml +7 -0
  23. data/doc/AUTHORS +26 -22
  24. data/doc/CHANGELOG +16720 -3907
  25. data/doc/INSTALL +77 -19
  26. data/doc/LEGAL +0 -4
  27. data/doc/meta/announcement.txt +43 -54
  28. data/doc/meta/configuration.txt +3 -2
  29. data/doc/readme_chunks/examples.txt +2 -2
  30. data/doc/readme_chunks/installing.txt +66 -20
  31. data/doc/tutorial/todolist.html +338 -520
  32. data/doc/tutorial/todolist.mkd +36 -2
  33. data/examples/{auth → app/auth}/auth.rb +0 -0
  34. data/examples/{auth → app/auth}/template/layout.haml +0 -0
  35. data/examples/{auth → app/auth}/template/login.haml +0 -0
  36. data/examples/{blog → app/blog}/README +0 -0
  37. data/examples/{blog → app/blog}/controller/main.rb +1 -1
  38. data/examples/{blog → app/blog}/model/entry.rb +1 -1
  39. data/examples/{blog → app/blog}/public/styles/blog.css +0 -0
  40. data/examples/{blog → app/blog}/spec/blog.rb +2 -2
  41. data/examples/{blog → app/blog}/start.rb +0 -0
  42. data/examples/{blog → app/blog}/view/edit.xhtml +0 -0
  43. data/examples/{blog → app/blog}/view/index.xhtml +0 -0
  44. data/examples/{blog → app/blog}/view/layout.xhtml +0 -0
  45. data/examples/{blog → app/blog}/view/new.xhtml +0 -0
  46. data/examples/app/chat/model/history.rb +36 -0
  47. data/examples/app/chat/model/message.rb +7 -0
  48. data/examples/app/chat/public/css/chat.css +13 -0
  49. data/examples/app/chat/public/js/chat.js +22 -0
  50. data/examples/app/chat/public/js/jquery.js +3436 -0
  51. data/examples/app/chat/start.rb +40 -0
  52. data/examples/app/chat/view/chat.xhtml +9 -0
  53. data/examples/app/chat/view/index.xhtml +7 -0
  54. data/examples/app/chat/view/layout.xhtml +13 -0
  55. data/examples/app/localization/start.rb +35 -0
  56. data/examples/{rammit → app/rammit}/spec/rammit.rb +2 -1
  57. data/examples/{rammit → app/rammit}/src/controller/main.rb +0 -0
  58. data/examples/{rammit → app/rammit}/src/controller/page.rb +0 -0
  59. data/examples/{rammit → app/rammit}/src/model.rb +0 -0
  60. data/examples/{rammit → app/rammit}/start.rb +0 -0
  61. data/examples/{rammit → app/rammit}/template/index.xhtml +0 -0
  62. data/examples/{rammit → app/rammit}/template/page/view.xhtml +0 -0
  63. data/examples/{rapaste → app/rapaste}/Rakefile +0 -1
  64. data/examples/{rapaste → app/rapaste}/controller/paste.rb +3 -3
  65. data/examples/{rapaste → app/rapaste}/model/paste.rb +0 -0
  66. data/examples/{rapaste → app/rapaste}/public/css/active4d.css +0 -0
  67. data/examples/{rapaste → app/rapaste}/public/css/all_hallows_eve.css +0 -0
  68. data/examples/{rapaste → app/rapaste}/public/css/amy.css +0 -0
  69. data/examples/{rapaste → app/rapaste}/public/css/blackboard.css +0 -0
  70. data/examples/{rapaste → app/rapaste}/public/css/brilliance_black.css +0 -0
  71. data/examples/{rapaste → app/rapaste}/public/css/brilliance_dull.css +0 -0
  72. data/examples/{rapaste → app/rapaste}/public/css/cobalt.css +0 -0
  73. data/examples/{rapaste → app/rapaste}/public/css/dawn.css +0 -0
  74. data/examples/{rapaste → app/rapaste}/public/css/display.css +0 -0
  75. data/examples/{rapaste → app/rapaste}/public/css/eiffel.css +0 -0
  76. data/examples/{rapaste → app/rapaste}/public/css/espresso_libre.css +0 -0
  77. data/examples/{rapaste → app/rapaste}/public/css/idle.css +0 -0
  78. data/examples/{rapaste → app/rapaste}/public/css/iplastic.css +0 -0
  79. data/examples/{rapaste → app/rapaste}/public/css/lazy.css +0 -0
  80. data/examples/{rapaste → app/rapaste}/public/css/mac_classic.css +0 -0
  81. data/examples/{rapaste → app/rapaste}/public/css/magicwb_amiga.css +0 -0
  82. data/examples/{rapaste → app/rapaste}/public/css/pastels_on_dark.css +0 -0
  83. data/examples/{rapaste → app/rapaste}/public/css/slush_poppies.css +0 -0
  84. data/examples/{rapaste → app/rapaste}/public/css/spacecadet.css +0 -0
  85. data/examples/{rapaste → app/rapaste}/public/css/sunburst.css +0 -0
  86. data/examples/{rapaste → app/rapaste}/public/css/twilight.css +0 -0
  87. data/examples/{rapaste → app/rapaste}/public/css/zenburnesque.css +0 -0
  88. data/examples/{rapaste → app/rapaste}/public/js/jquery.js +0 -0
  89. data/examples/{rapaste → app/rapaste}/spec/rapaste.rb +2 -2
  90. data/examples/{rapaste → app/rapaste}/start.rb +0 -0
  91. data/examples/{rapaste → app/rapaste}/view/copy.xhtml +0 -0
  92. data/examples/{rapaste → app/rapaste}/view/index.xhtml +0 -0
  93. data/examples/{rapaste → app/rapaste}/view/layout.xhtml +0 -0
  94. data/examples/{rapaste → app/rapaste}/view/list.xhtml +0 -0
  95. data/examples/{rapaste → app/rapaste}/view/search.xhtml +0 -0
  96. data/examples/{rapaste → app/rapaste}/view/view.xhtml +0 -0
  97. data/examples/{sourceview → app/sourceview}/public/coderay.css +0 -0
  98. data/examples/{sourceview → app/sourceview}/public/images/file.gif +0 -0
  99. data/examples/{sourceview → app/sourceview}/public/images/folder.gif +0 -0
  100. data/examples/{sourceview → app/sourceview}/public/images/tv-collapsable-last.gif +0 -0
  101. data/examples/{sourceview → app/sourceview}/public/images/tv-collapsable.gif +0 -0
  102. data/examples/{sourceview → app/sourceview}/public/images/tv-expandable-last.gif +0 -0
  103. data/examples/{sourceview → app/sourceview}/public/images/tv-expandable.gif +0 -0
  104. data/examples/{sourceview → app/sourceview}/public/images/tv-item-last.gif +0 -0
  105. data/examples/{sourceview → app/sourceview}/public/images/tv-item.gif +0 -0
  106. data/examples/{sourceview → app/sourceview}/public/jquery.js +0 -0
  107. data/examples/{sourceview → app/sourceview}/public/jquery.treeview.css +0 -0
  108. data/examples/{sourceview → app/sourceview}/public/jquery.treeview.js +0 -0
  109. data/examples/{sourceview → app/sourceview}/public/sourceview.js +0 -0
  110. data/examples/{sourceview → app/sourceview}/sourceview.rb +1 -1
  111. data/examples/{sourceview → app/sourceview}/template/index.haml +0 -0
  112. data/examples/{todolist → app/todolist}/README +0 -0
  113. data/examples/{todolist → app/todolist}/public/favicon.ico +0 -0
  114. data/examples/{todolist → app/todolist}/public/js/jquery.js +0 -0
  115. data/examples/{todolist → app/todolist}/public/ramaze.png +0 -0
  116. data/examples/{todolist → app/todolist}/spec/todolist.rb +2 -2
  117. data/examples/{todolist → app/todolist}/src/controller/main.rb +0 -0
  118. data/examples/{todolist → app/todolist}/src/element/page.rb +0 -0
  119. data/examples/{todolist → app/todolist}/src/model.rb +0 -0
  120. data/examples/{todolist → app/todolist}/start.rb +0 -0
  121. data/examples/{todolist → app/todolist}/template/index.xhtml +0 -0
  122. data/examples/{todolist → app/todolist}/template/new.xhtml +0 -0
  123. data/examples/{upload → app/upload}/start.rb +0 -0
  124. data/examples/{upload → app/upload}/view/index.xhtml +0 -0
  125. data/examples/{whywiki → app/whywiki}/spec/whywiki.rb +3 -3
  126. data/examples/{whywiki → app/whywiki}/start.rb +0 -0
  127. data/examples/{whywiki → app/whywiki}/template/edit.xhtml +0 -0
  128. data/examples/{whywiki → app/whywiki}/template/show.xhtml +0 -0
  129. data/examples/{wikore → app/wikore}/spec/wikore.rb +2 -2
  130. data/examples/{wikore → app/wikore}/src/controller.rb +0 -0
  131. data/examples/{wikore → app/wikore}/src/model.rb +0 -0
  132. data/examples/{wikore → app/wikore}/start.rb +0 -0
  133. data/examples/{wikore → app/wikore}/template/index.xhtml +0 -0
  134. data/examples/{wiktacular → app/wiktacular}/README +0 -0
  135. data/examples/{wiktacular → app/wiktacular}/mkd/link/2007-07-20_19-45-51.mkd +0 -0
  136. data/examples/{wiktacular → app/wiktacular}/mkd/link/current.mkd +0 -0
  137. data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_16-31-33.mkd +0 -0
  138. data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-21-12.mkd +0 -0
  139. data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-23-10.mkd +0 -0
  140. data/examples/{wiktacular → app/wiktacular}/mkd/main/2007-07-20_19-45-07.mkd +0 -0
  141. data/examples/{wiktacular → app/wiktacular}/mkd/main/current.mkd +0 -0
  142. data/examples/{wiktacular → app/wiktacular}/mkd/markdown/current.mkd +0 -0
  143. data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-20_16-43-46.mkd +0 -0
  144. data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-20_19-43-50.mkd +0 -0
  145. data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-46-01.mkd +0 -0
  146. data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-46-32.mkd +0 -0
  147. data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-47-08.mkd +0 -0
  148. data/examples/{wiktacular → app/wiktacular}/mkd/testing/2007-07-21_18-47-54.mkd +0 -0
  149. data/examples/{wiktacular → app/wiktacular}/mkd/testing/current.mkd +0 -0
  150. data/examples/{wiktacular → app/wiktacular}/public/favicon.ico +0 -0
  151. data/examples/{wiktacular → app/wiktacular}/public/screen.css +0 -0
  152. data/examples/{wiktacular → app/wiktacular}/spec/wiktacular.rb +4 -5
  153. data/examples/{wiktacular → app/wiktacular}/src/controller.rb +0 -0
  154. data/examples/{wiktacular → app/wiktacular}/src/model.rb +0 -0
  155. data/examples/{wiktacular → app/wiktacular}/start.rb +0 -0
  156. data/examples/{wiktacular → app/wiktacular}/template/edit.xhtml +0 -0
  157. data/examples/{wiktacular → app/wiktacular}/template/html_layout.xhtml +0 -0
  158. data/examples/{wiktacular → app/wiktacular}/template/index.xhtml +0 -0
  159. data/examples/{wiktacular → app/wiktacular}/template/new.xhtml +0 -0
  160. data/examples/{element.rb → basic/element.rb} +0 -0
  161. data/examples/basic/gestalt.rb +27 -0
  162. data/examples/{hello.rb → basic/hello.rb} +0 -0
  163. data/examples/{layout.rb → basic/layout.rb} +0 -0
  164. data/examples/{linking.rb → basic/linking.rb} +0 -0
  165. data/examples/{simple.rb → basic/simple.rb} +3 -3
  166. data/examples/{caching.rb → helpers/cache.rb} +0 -0
  167. data/examples/helpers/form_with_sequel.rb +24 -0
  168. data/examples/helpers/httpdigest.rb +50 -0
  169. data/examples/{identity.rb → helpers/identity.rb} +0 -0
  170. data/examples/{nitro_form.rb → helpers/nitro_form.rb} +0 -0
  171. data/examples/helpers/provide.rb +23 -0
  172. data/examples/helpers/rest.rb +28 -0
  173. data/examples/helpers/simple_captcha.rb +29 -0
  174. data/examples/{css.rb → misc/css.rb} +0 -0
  175. data/examples/{facebook.rb → misc/facebook.rb} +0 -0
  176. data/examples/{memleak_detector.rb → misc/memleak_detector.rb} +0 -0
  177. data/examples/misc/nagoro_element.rb +43 -0
  178. data/examples/{ramaise.rb → misc/ramaise.rb} +0 -0
  179. data/examples/misc/rapp.rb +45 -0
  180. data/examples/misc/sequel_scaffolding.rb +34 -0
  181. data/examples/{simple_auth.rb → misc/simple_auth.rb} +0 -0
  182. data/examples/templates/template_amrita2.rb +1 -1
  183. data/examples/templates/template_erubis.rb +2 -2
  184. data/examples/templates/template_ezamar.rb +1 -1
  185. data/examples/templates/template_haml.rb +2 -2
  186. data/examples/templates/template_liquid.rb +2 -2
  187. data/examples/templates/template_markaby.rb +1 -1
  188. data/examples/templates/template_nagoro.rb +1 -1
  189. data/examples/templates/template_redcloth.rb +2 -2
  190. data/examples/templates/template_remarkably.rb +1 -1
  191. data/examples/templates/template_tenjin.rb +5 -9
  192. data/examples/templates/template_xslt.rb +1 -1
  193. data/lib/proto/public/dispatch.fcgi +0 -0
  194. data/lib/proto/public/js/jquery.js +750 -577
  195. data/lib/proto/spec/main.rb +1 -1
  196. data/lib/proto/start.ru +8 -0
  197. data/lib/proto/view/page.xhtml +13 -1
  198. data/lib/ramaze.rb +32 -15
  199. data/lib/ramaze/action.rb +18 -1
  200. data/lib/ramaze/action/render.rb +45 -17
  201. data/lib/ramaze/adapter.rb +8 -7
  202. data/lib/ramaze/adapter/base.rb +79 -13
  203. data/lib/ramaze/adapter/cgi.rb +5 -10
  204. data/lib/ramaze/adapter/ebb.rb +6 -20
  205. data/lib/ramaze/adapter/fake.rb +12 -0
  206. data/lib/ramaze/adapter/fcgi.rb +5 -11
  207. data/lib/ramaze/adapter/lsws.rb +5 -9
  208. data/lib/ramaze/adapter/mongrel.rb +5 -9
  209. data/lib/ramaze/adapter/scgi.rb +4 -8
  210. data/lib/ramaze/adapter/thin.rb +6 -11
  211. data/lib/ramaze/adapter/webrick.rb +13 -22
  212. data/lib/ramaze/cache.rb +36 -10
  213. data/lib/ramaze/cache/memcached.rb +3 -2
  214. data/lib/ramaze/contrib.rb +1 -1
  215. data/lib/ramaze/contrib/email.rb +1 -1
  216. data/lib/ramaze/contrib/file_cache.rb +1 -1
  217. data/lib/ramaze/contrib/gems.rb +79 -0
  218. data/lib/ramaze/contrib/gettext/po.rb +0 -0
  219. data/lib/ramaze/contrib/profiling.rb +1 -1
  220. data/lib/ramaze/contrib/rest.rb +14 -0
  221. data/lib/ramaze/controller.rb +45 -12
  222. data/lib/ramaze/controller/error.rb +4 -4
  223. data/lib/ramaze/controller/resolve.rb +61 -42
  224. data/lib/ramaze/current.rb +2 -2
  225. data/lib/ramaze/current/request.rb +25 -2
  226. data/lib/ramaze/current/response.rb +8 -0
  227. data/lib/ramaze/current/session.rb +64 -36
  228. data/lib/ramaze/current/session/flash.rb +14 -2
  229. data/lib/ramaze/current/session/hash.rb +3 -2
  230. data/lib/ramaze/dispatcher.rb +25 -12
  231. data/lib/ramaze/dispatcher/action.rb +12 -3
  232. data/lib/ramaze/dispatcher/directory.rb +4 -1
  233. data/lib/ramaze/dispatcher/error.rb +3 -3
  234. data/lib/ramaze/dispatcher/file.rb +11 -3
  235. data/lib/ramaze/gestalt.rb +1 -1
  236. data/lib/ramaze/helper.rb +17 -21
  237. data/lib/ramaze/helper/aspect.rb +20 -14
  238. data/lib/ramaze/helper/auth.rb +1 -1
  239. data/lib/ramaze/helper/cache.rb +3 -6
  240. data/lib/ramaze/helper/cgi.rb +6 -2
  241. data/lib/ramaze/helper/flash.rb +7 -7
  242. data/lib/ramaze/helper/form.rb +281 -0
  243. data/lib/ramaze/helper/formatting.rb +76 -0
  244. data/lib/ramaze/helper/gestalt.rb +15 -0
  245. data/lib/ramaze/helper/gravatar.rb +15 -0
  246. data/lib/ramaze/helper/httpdigest.rb +48 -0
  247. data/lib/ramaze/helper/identity.rb +87 -62
  248. data/lib/ramaze/helper/partial.rb +11 -2
  249. data/lib/ramaze/helper/redirect.rb +12 -3
  250. data/lib/ramaze/helper/rest.rb +43 -0
  251. data/lib/ramaze/helper/sendfile.rb +1 -3
  252. data/lib/ramaze/helper/sequel.rb +3 -0
  253. data/lib/ramaze/helper/simple_captcha.rb +31 -0
  254. data/lib/ramaze/helper/stack.rb +14 -5
  255. data/lib/ramaze/helper/user.rb +86 -34
  256. data/lib/ramaze/helper/xhtml.rb +23 -0
  257. data/lib/ramaze/log.rb +1 -2
  258. data/lib/ramaze/log/analogger.rb +24 -19
  259. data/lib/ramaze/log/growl.rb +24 -19
  260. data/lib/ramaze/log/hub.rb +25 -22
  261. data/lib/ramaze/log/informer.rb +104 -99
  262. data/lib/ramaze/log/knotify.rb +17 -12
  263. data/lib/ramaze/log/logger.rb +14 -8
  264. data/lib/ramaze/log/logging.rb +63 -60
  265. data/lib/ramaze/log/syslog.rb +24 -19
  266. data/lib/ramaze/log/xosd.rb +77 -71
  267. data/lib/ramaze/option.rb +153 -0
  268. data/lib/ramaze/option/dsl.rb +45 -0
  269. data/lib/ramaze/option/holder.rb +153 -0
  270. data/lib/ramaze/option/merger.rb +108 -0
  271. data/lib/ramaze/route.rb +15 -2
  272. data/lib/ramaze/setup.rb +50 -0
  273. data/lib/ramaze/snippets/binding/locals.rb +1 -1
  274. data/lib/ramaze/snippets/dictionary.rb +3 -3
  275. data/lib/ramaze/snippets/divide.rb +7 -7
  276. data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
  277. data/lib/ramaze/snippets/kernel/acquire.rb +0 -5
  278. data/lib/ramaze/snippets/metaid.rb +1 -1
  279. data/lib/ramaze/snippets/numeric/filesize_format.rb +11 -5
  280. data/lib/ramaze/snippets/object/instance_variable_defined.rb +8 -0
  281. data/lib/ramaze/snippets/object/scope.rb +1 -1
  282. data/lib/ramaze/snippets/object/thread_accessor.rb +1 -1
  283. data/lib/ramaze/snippets/ordered_set.rb +5 -1
  284. data/lib/ramaze/snippets/ramaze/deprecated.rb +7 -0
  285. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +15 -1
  286. data/lib/ramaze/snippets/string/esc.rb +2 -2
  287. data/lib/ramaze/snippets/string/start_with.rb +1 -0
  288. data/lib/ramaze/snippets/string/unindent.rb +9 -1
  289. data/lib/ramaze/snippets/struct/values_at.rb +17 -1
  290. data/lib/ramaze/snippets/thread/into.rb +1 -1
  291. data/lib/ramaze/sourcereload.rb +83 -76
  292. data/lib/ramaze/spec/helper.rb +39 -26
  293. data/lib/ramaze/spec/helper/bacon.rb +5 -5
  294. data/lib/ramaze/spec/helper/mock_http.rb +1 -7
  295. data/lib/ramaze/spec/helper/pretty_output.rb +10 -2
  296. data/lib/ramaze/spec/helper/requester.rb +14 -0
  297. data/lib/ramaze/template.rb +6 -3
  298. data/lib/ramaze/template/amrita2.rb +1 -0
  299. data/lib/ramaze/template/erubis.rb +7 -1
  300. data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
  301. data/lib/ramaze/template/nagoro.rb +1 -0
  302. data/lib/ramaze/template/redcloth.rb +1 -0
  303. data/lib/ramaze/template/tagz.rb +8 -8
  304. data/lib/ramaze/template/tenjin.rb +42 -2
  305. data/lib/ramaze/template/xslt.rb +4 -0
  306. data/lib/ramaze/tool/daemonize.rb +37 -0
  307. data/lib/ramaze/tool/localize.rb +142 -106
  308. data/lib/ramaze/version.rb +2 -10
  309. data/rake_tasks/conf.rake +11 -13
  310. data/rake_tasks/gem.rake +59 -37
  311. data/rake_tasks/git.rake +41 -0
  312. data/rake_tasks/maintenance.rake +263 -299
  313. data/rake_tasks/release.rake +63 -0
  314. data/rake_tasks/spec.rake +1 -1
  315. data/ramaze.gemspec +731 -0
  316. data/spec/contrib/profiling.rb +5 -2
  317. data/spec/examples/caching.rb +1 -1
  318. data/spec/examples/css.rb +1 -1
  319. data/spec/examples/element.rb +1 -1
  320. data/spec/examples/hello.rb +1 -1
  321. data/spec/examples/linking.rb +1 -1
  322. data/spec/examples/simple.rb +1 -1
  323. data/spec/examples/simple_auth.rb +1 -1
  324. data/spec/ramaze/action/cache.rb +58 -14
  325. data/spec/ramaze/action/file_cache.rb +48 -0
  326. data/spec/ramaze/action/layout.rb +2 -2
  327. data/spec/ramaze/action/render.rb +1 -2
  328. data/spec/ramaze/action/{template → view}/bar.xhtml +0 -0
  329. data/spec/ramaze/action/{template → view}/instancevars/layout.xhtml +0 -0
  330. data/spec/ramaze/action/{template → view}/other_wrapper.xhtml +0 -0
  331. data/spec/ramaze/action/{template → view}/single_wrapper.xhtml +0 -0
  332. data/spec/ramaze/action/{template → view}/sub/sub_wrapper.xhtml +0 -0
  333. data/spec/ramaze/adapter.rb +29 -2
  334. data/spec/ramaze/adapter/ebb.rb +12 -0
  335. data/spec/ramaze/cache.rb +82 -15
  336. data/spec/ramaze/controller.rb +6 -3
  337. data/spec/ramaze/controller/actionless_templates.rb +2 -2
  338. data/spec/ramaze/controller/resolve.rb +1 -1
  339. data/spec/ramaze/controller/template_resolving.rb +4 -6
  340. data/spec/ramaze/controller/{template → view}/greet.xhtml +0 -0
  341. data/spec/ramaze/controller/{template → view}/list.xhtml +0 -0
  342. data/spec/ramaze/controller/{template → view}/other/greet/other.xhtml +0 -0
  343. data/spec/ramaze/controller/{template → view}/other_wrapper.xhtml +0 -0
  344. data/spec/ramaze/error.rb +1 -1
  345. data/spec/ramaze/helper/aspect.rb +4 -4
  346. data/spec/ramaze/helper/cache.rb +56 -39
  347. data/spec/ramaze/helper/flash.rb +14 -1
  348. data/spec/ramaze/helper/form.rb +118 -0
  349. data/spec/ramaze/helper/formatting.rb +21 -0
  350. data/spec/ramaze/helper/link.rb +2 -2
  351. data/spec/ramaze/helper/pager.rb +2 -2
  352. data/spec/ramaze/helper/partial.rb +13 -1
  353. data/spec/ramaze/helper/simple_captcha.rb +22 -0
  354. data/spec/ramaze/helper/user.rb +7 -10
  355. data/spec/ramaze/helper/{template → view}/locals.xhtml +0 -0
  356. data/spec/ramaze/helper/{template → view}/loop.xhtml +0 -0
  357. data/spec/ramaze/helper/{template → view}/num.xhtml +0 -0
  358. data/spec/ramaze/helper/{template → view}/partial.xhtml +0 -0
  359. data/spec/ramaze/helper/{template → view}/recursive.xhtml +0 -0
  360. data/spec/ramaze/helper/{template → view}/recursive_local_ivars.xhtml +0 -0
  361. data/spec/ramaze/helper/{template → view}/recursive_locals.xhtml +0 -0
  362. data/spec/ramaze/helper/{template → view}/test_template.xhtml +0 -0
  363. data/spec/ramaze/localize.rb +22 -0
  364. data/spec/ramaze/log/informer.rb +10 -10
  365. data/spec/ramaze/log/syslog.rb +1 -1
  366. data/spec/ramaze/request.rb +13 -1
  367. data/spec/ramaze/request/ebb.rb +9 -0
  368. data/spec/ramaze/rewrite.rb +36 -0
  369. data/spec/ramaze/rewrite/file.css +1 -0
  370. data/spec/ramaze/route.rb +1 -0
  371. data/spec/ramaze/template.rb +5 -5
  372. data/spec/ramaze/template/amrita2.rb +1 -1
  373. data/spec/ramaze/template/builder.rb +18 -22
  374. data/spec/ramaze/template/erubis.rb +1 -1
  375. data/spec/ramaze/template/ezamar.rb +1 -1
  376. data/spec/ramaze/template/haml.rb +2 -2
  377. data/spec/ramaze/template/liquid.rb +1 -1
  378. data/spec/ramaze/template/markaby.rb +1 -1
  379. data/spec/ramaze/template/nagoro.rb +1 -1
  380. data/spec/ramaze/template/redcloth.rb +1 -1
  381. data/spec/ramaze/template/remarkably.rb +1 -1
  382. data/spec/ramaze/template/sass.rb +1 -1
  383. data/spec/ramaze/template/tagz.rb +1 -1
  384. data/spec/ramaze/template/tenjin.rb +4 -6
  385. data/spec/ramaze/template/xslt.rb +1 -1
  386. data/spec/snippets/string/unindent.rb +6 -0
  387. data/spec/snippets/struct/values_at.rb +8 -0
  388. metadata +522 -487
  389. data/doc/ProjectInfo +0 -53
  390. data/doc/migrate/1110_to_1111.txt +0 -131
  391. data/lib/ramaze/contrib/route.rb +0 -22
  392. data/lib/ramaze/global.rb +0 -116
  393. data/lib/ramaze/global/dsl.rb +0 -39
  394. data/lib/ramaze/global/globalstruct.rb +0 -147
  395. data/lib/ramaze/helper/inform.rb +0 -40
  396. data/lib/ramaze/inform.rb +0 -4
  397. data/lib/ramaze/snippets/kernel/aquire.rb +0 -1
  398. data/lib/vendor/bacon.rb +0 -323
  399. data/rake_tasks/darcs.rake +0 -5
  400. data/spec/contrib/route.rb +0 -36
@@ -0,0 +1,41 @@
1
+ def git_branch
2
+ `git branch`[/^\*\s+(.*)/, 1]
3
+ end
4
+
5
+ namespace :git do
6
+ task :anon do
7
+ sh 'git config remote.origin.url git://github.com/manveru/ramaze'
8
+ puts "You're now accessing ramaze anonymous"
9
+ end
10
+
11
+ task :committer do
12
+ sh 'git config remote.origin.url git@github.com:manveru/ramaze'
13
+ puts "You're now accessing ramaze as committer"
14
+ end
15
+
16
+ desc 'Update from repository'
17
+ task :update do
18
+ puts "Putting your changes on stash"
19
+ sh 'git stash'
20
+
21
+ branch = git_branch
22
+ puts "Current branch is #{branch}"
23
+
24
+ if switch = branch != 'master'
25
+ puts "Switching to master branch"
26
+ sh 'git checkout master'
27
+ end
28
+
29
+ if switch
30
+ puts "Switching to #{branch} branch"
31
+ sh "git checkout '#{branch}'"
32
+ end
33
+
34
+ sh 'git stash apply'
35
+ end
36
+
37
+ desc 'Create patch files to send'
38
+ task :send do
39
+ sh 'git format-patch ^HEAD'
40
+ end
41
+ end
@@ -1,356 +1,304 @@
1
- desc "add copyright to all .rb files in the distribution"
2
- task 'add-copyright' do
3
- ignore = File.readlines('doc/LEGAL').
4
- select{|line| line.strip!; File.exist?(line)}.
5
- map{|file| File.expand_path(file)}
6
-
7
- puts "adding copyright to files that don't have it currently"
8
- puts COPYRIGHT
9
- puts
10
-
11
- Dir['{lib,test}/**/*{.rb}'].each do |file|
12
- file = File.expand_path(file)
13
- next if file =~ /_darcs/ or ignore.include? file
14
- lines = File.readlines(file).map{|l| l.chomp}
15
- unless lines.first(COPYRIGHT.size) == COPYRIGHT
16
- puts "#{file} seems to need attention, first 4 lines:"
17
- puts lines[0..3]
18
- puts
1
+ def version_today
2
+ Date.today.strftime("%Y.%m.%d")
3
+ end
4
+
5
+ def version_month
6
+ Date.today.strftime("%Y.%m")
7
+ end
8
+
9
+ namespace :maintenance do
10
+ desc "add copyright to all .rb files in the distribution"
11
+ task 'add-copyright' do
12
+ ignore = File.readlines('doc/LEGAL').
13
+ select{|line| line.strip!; File.exist?(line)}.
14
+ map{|file| File.expand_path(file)}
15
+
16
+ puts "adding copyright to files that don't have it currently"
17
+ puts COPYRIGHT
18
+ puts
19
+
20
+ Dir['{lib,test}/**/*{.rb}'].each do |file|
21
+ file = File.expand_path(file)
22
+ next if ignore.include? file
23
+ lines = File.readlines(file).map{|l| l.chomp}
24
+ unless lines.first(COPYRIGHT.size) == COPYRIGHT
25
+ puts "#{file} seems to need attention, first 4 lines:"
26
+ puts lines[0..3]
27
+ puts
28
+ end
19
29
  end
20
30
  end
21
- end
22
31
 
23
- desc "doc/README to html"
24
- Rake::RDocTask.new('readme2html-build') do |rd|
25
- rd.options = %w[
32
+ desc "#{README} to doc/README.html"
33
+ Rake::RDocTask.new('readme2html-build') do |rd|
34
+ rd.options = %w[
26
35
  --quiet
27
36
  --opname readme.html
28
- ]
29
-
30
- rd.rdoc_dir = 'readme'
31
- rd.rdoc_files = ['doc/README']
32
- rd.main = 'doc/README'
33
- rd.title = "Ramaze documentation"
34
- end
37
+ ]
35
38
 
36
- desc "doc/README to doc/README.html"
37
- task 'readme2html' => ['readme-build', 'readme2html-build'] do
38
- cp('readme/files/doc/README.html', 'doc/README.html')
39
- rm_rf('readme')
40
- end
39
+ rd.rdoc_dir = 'readme'
40
+ rd.rdoc_files = [README]
41
+ rd.main = README
42
+ rd.title = "Ramaze documentation"
43
+ end
41
44
 
42
- desc "generate doc/TODO from the TODO tags in the source"
43
- task 'todolist' do
44
- list = `rake todo`
45
- tasks = {}
46
- current = nil
47
-
48
- list.split("\n")[2..-1].each do |line|
49
- if line =~ /TODO/ or line.empty?
50
- elsif line =~ /^vim/
51
- current = line.split[1]
52
- tasks[current] = []
53
- else
54
- tasks[current] << line
45
+ desc "generate doc/TODO from the TODO tags in the source"
46
+ task 'todolist' do
47
+ list = `rake todo`
48
+ tasks = {}
49
+ current = nil
50
+
51
+ list.split("\n")[2..-1].each do |line|
52
+ if line =~ /TODO/ or line.empty?
53
+ elsif line =~ /^vim/
54
+ current = line.split[1]
55
+ tasks[current] = []
56
+ else
57
+ tasks[current] << line
58
+ end
55
59
  end
56
- end
57
60
 
58
- lines = tasks.map{ |name, items| [name, items, ''] }.flatten
59
- lines.pop
61
+ lines = tasks.map{ |name, items| [name, items, ''] }.flatten
62
+ lines.pop
60
63
 
61
- File.open(File.join('doc', 'TODO'), 'w+') do |f|
62
- f.puts "This list is programmaticly generated by `rake todolist`"
63
- f.puts "If you want to add/remove items from the list, change them at the"
64
- f.puts "position specified in the list."
65
- f.puts
66
- f.puts(lines)
64
+ File.open(File.join('doc', 'TODO'), 'w+') do |f|
65
+ f.puts "This list is programmaticly generated by `rake todolist`"
66
+ f.puts "If you want to add/remove items from the list, change them at the"
67
+ f.puts "position specified in the list."
68
+ f.puts
69
+ f.puts(lines)
70
+ end
67
71
  end
68
- end
69
72
 
70
- desc "remove those annoying spaces at the end of lines"
71
- task 'fix-end-spaces' do
72
- Dir['{lib,spec}/**/*.rb'].each do |file|
73
- next if file =~ /_darcs/
74
- lines = File.readlines(file)
75
- new = lines.dup
76
- lines.each_with_index do |line, i|
77
- if line =~ /\s+\n/
78
- puts "fixing #{file}:#{i + 1}"
79
- p line
80
- new[i] = line.rstrip
73
+ desc "remove those annoying spaces at the end of lines"
74
+ task 'fix-end-spaces' do
75
+ Dir['{lib,spec}/**/*.rb'].each do |file|
76
+ lines = File.readlines(file)
77
+ new = lines.dup
78
+ lines.each_with_index do |line, i|
79
+ if line =~ /\s+\n/
80
+ puts "fixing #{file}:#{i + 1}"
81
+ p line
82
+ new[i] = line.rstrip
83
+ end
81
84
  end
82
- end
83
85
 
84
- unless new == lines
85
- File.open(file, 'w+') do |f|
86
- new.each do |line|
87
- f.puts(line)
86
+ unless new == lines
87
+ File.open(file, 'w+') do |f|
88
+ new.each do |line|
89
+ f.puts(line)
90
+ end
88
91
  end
89
92
  end
90
93
  end
91
94
  end
92
- end
93
95
 
94
- desc "Compile the doc/README from the parts of doc/readme"
95
- task 'readme-build' do
96
- require 'enumerator'
97
-
98
- chapters = [
99
- 'About Ramaze', 'introduction',
100
- 'Features Overview', 'features',
101
- 'Basic Principles', 'principles',
102
- 'Installation', 'installing',
103
- 'Getting Started', 'getting_started',
104
- 'A couple of Examples', 'examples',
105
- 'How to find Help', 'getting_help',
106
- 'Appendix', 'appendix',
107
- 'And thanks to...', 'thanks',
108
- ]
109
-
110
- File.open('doc/README', 'w+') do |readme|
111
- readme.puts COPYRIGHT.map{|l| l[1..-1]}, ''
112
-
113
- chapters.each_slice(2) do |title, file|
114
- file = File.join('doc', 'readme_chunks', "#{file}.txt")
115
- chapter = File.read(file)
116
- readme.puts "= #{title}", '', chapter
117
- readme.puts '', '' unless title == chapters[-2]
118
- end
119
- end
120
- end
96
+ desc "Rebuild doc/tutorial/todolist.html"
97
+ task 'tutorial' do
98
+ require 'maruku'
99
+ require 'hpricot'
121
100
 
122
- task 'tutorial2html' do
123
- require 'bluecloth'
124
-
125
- basefile = File.join('doc', 'tutorial', 'todolist')
126
-
127
- content = File.read(basefile + '.mkd')
128
-
129
- html = BlueCloth.new(content).to_html
130
-
131
- wrap = %{
132
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
133
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
134
- <html>
135
- <head>
136
- <title>Ramaze Tutorial: Todolist</title>
137
- <style>
138
- body {
139
- background: #eee;
140
- }
141
- code {
142
- background: #ddd;
143
- }
144
- pre code {
145
- background: #ddd;
146
- width: 70%;
147
- display: block;
148
- margin: 1em;
149
- padding: 0.7em;
150
- overflow: auto;
151
- }
152
- </style>
153
- <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
154
- </head>
155
- <body>
156
- #{html}
157
- </body>
158
- </html>
159
- }.strip
160
-
161
- File.open(basefile + '.html', 'w+'){|f| f.puts(wrap) }
162
- end
101
+ syntax_dir = File.dirname(Gem::latest_load_paths.grep(/syntax-/).first)
102
+ ruby_css = File.join(syntax_dir, 'data/ruby.css')
103
+ basefile = 'doc/tutorial/todolist'
163
104
 
164
- desc "Rebuild doc/tutorial/todolist.html"
165
- task 'tutorial' => ['tutorial2html'] do
166
- require 'hpricot'
105
+ content = File.read(basefile + '.mkd')
106
+ html = Maruku.new(content).to_html_document
167
107
 
168
- system 'rake tutorial2html'
108
+ doc = Hpricot(html)
109
+ css = %(<style type="text/css">
110
+ #{File.read(ruby_css)}
111
+ </style>)
112
+ doc.at('title').after(css)
169
113
 
170
- filename = 'doc/tutorial/todolist.html'
171
- file = File.read(filename)
172
- doc = Hpricot(file)
114
+ File.open(basefile + '.html', 'w+'){|io| io << doc.to_s }
115
+ end
173
116
 
174
- to_links = []
117
+ def existing_authors
118
+ authors = {}
175
119
 
176
- (doc/:h2).each do |h2|
177
- text = h2.inner_html
178
- link_id = text.gsub(' ', '_')
179
- to_links << %{<a href="##{link_id}">#{text}</a>}
180
- to_link = %{<a name="#{link_id}"><h2>#{text}</h2></a>}
120
+ File.readlines('doc/AUTHORS').each do |line|
121
+ if line =~ /\s+(.*?)\s*:\s*(.*@.*)/
122
+ authors[$1] = {:email => $2, :patches => 0}
123
+ end
124
+ end
181
125
 
182
- file.gsub!(h2.to_html, to_link)
126
+ authors
183
127
  end
184
128
 
185
- links = to_links.join("</ol>\n <ol>")
186
- h1 = "<h1>To-do List Tutorial</h1>"
187
- menu =
188
- %{
189
- #{h1}
129
+ def authors
130
+ format = "%an ** %ae"
131
+ log = `git-log --pretty=format:'#{format}'`
190
132
 
191
- <div class="menu">
192
- <h3>Table of Contents</h3>
193
- <li>
194
- <ol>#{links}</ol>
195
- </li>
196
- </div>
197
- }
133
+ mapping = existing_authors
198
134
 
199
- file.gsub!(h1, menu)
135
+ log.split("\n").each do |line|
136
+ name, email = line.split(' ** ')
200
137
 
201
- File.open(filename, 'w+') do |f|
202
- f.puts file
203
- end
204
- end
138
+ if name =~ /(\S+@\S+)/
139
+ email ||= $1
140
+ name.sub!(email, '').strip!
141
+ end
142
+
143
+ email_start = /^#{Regexp.escape(name)}@(.*)/
144
+ AUTHOR_MAP.each do |e, a|
145
+ if e =~ email_start
146
+ email, name = e, a
147
+ break
148
+ end
149
+ end
205
150
 
206
- def authors
207
- mapping = {}
208
- `darcs show authors`.split("\n").each do |line|
209
- atoms = line.split
210
- patches = atoms.shift.to_i
151
+ name = AUTHOR_MAP[name] || name
152
+ email = AUTHOR_MAP.index(name) || email
211
153
 
212
- if email = atoms.find{|a| a.gsub!(/(.*?@.*?)/, '\1') }
213
- email.tr!('<>', '')
214
- atoms.delete email
154
+ mapping[name] ||= {:email => email, :patches => 0}
155
+ mapping[name][:patches] += 1
215
156
  end
216
157
 
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 }
158
+ max = mapping.map{|k,v| k.size }.max
159
+ mapping.inject({}) {|h,(k,v)| h[k.ljust(max)] = v; h}
222
160
  end
223
161
 
224
- max = mapping.map{|k,v| k.size }.max
225
- mapping.inject({}) {|h,(k,v)| h[k.ljust(max)] = v; h}
226
- end
162
+ desc "Update /doc/AUTHORS"
163
+ task 'authors' do
164
+ # get the authors before we overwrite the file
165
+ authors = authors().sort_by{|k,v| k}
227
166
 
228
- desc "Update /doc/AUTHORS"
229
- task 'authors' do
230
- File.open('doc/AUTHORS', 'w+') do |fp|
231
- fp.puts "Following persons (in alphabetical order) have contributed to Ramaze:"
232
- fp.puts
233
- authors.sort_by{|k,v| k}.each do |name, author|
234
- fp.puts " #{name} - #{author[:email]}"
167
+ File.open('doc/AUTHORS', 'w+') do |fp|
168
+ fp.puts "Following persons (in alphabetical order) have contributed to Ramaze:"
169
+ fp.puts
170
+ authors.each do |name, author|
171
+ fp.puts " #{name} : #{author[:email]}"
172
+ end
173
+ fp.puts
235
174
  end
236
- fp.puts
237
175
  end
238
- end
239
176
 
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
177
+ desc "show how many patches we made so far"
178
+ task :patchsize do
179
+ patches = `git rev-list HEAD | wc -l`.to_i
180
+ puts "currently we have #{patches} patches"
181
+ init = Time.parse("Sat Oct 14 04:22:49 JST 2006")
182
+ days = (Time.now - init) / (3600 * 24)
183
+ puts "%d days since init, avg %4.2f patches per day" % [days, patches/days]
184
+ end
248
185
 
249
- desc "show who made how many patches"
250
- task :patchstat do
251
- total = 0.0
186
+ desc "show who made how many patches"
187
+ task :patchstat do
188
+ total = 0.0
252
189
 
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]
190
+ authors.map do |name, hash|
191
+ patches = hash[:patches]
192
+ total += patches
193
+ [patches, name]
194
+ end.sort.reverse_each do |patches, name|
195
+ puts "%s %4d [%6.2f%% ]" % [name, patches, patches/total * 100]
196
+ end
259
197
  end
260
- end
261
198
 
262
- desc "upload packages to rubyforge"
263
- task 'release' => ['distribute'] do
264
- sh 'rubyforge login'
265
- sh "rubyforge add_release ramaze ramaze #{VERS} pkg/ramaze-#{VERS}.gem"
199
+ desc "upload packages to rubyforge"
200
+ task 'release' => ['distribute'] do
201
+ sh 'rubyforge login'
202
+ sh "rubyforge add_release ramaze ramaze #{VERS} pkg/ramaze-#{VERS}.gem"
266
203
 
267
- require 'open-uri'
268
- require 'hpricot'
204
+ require 'open-uri'
205
+ require 'hpricot'
269
206
 
270
- url = "http://rubyforge.org/frs/?group_id=3034"
271
- doc = Hpricot(open(url))
272
- a = (doc/:a).find{|a| a[:href] =~ /release_id/}
207
+ url = "http://rubyforge.org/frs/?group_id=3034"
208
+ doc = Hpricot(open(url))
209
+ a = (doc/:a).find{|a| a[:href] =~ /release_id/}
273
210
 
274
- version = a.inner_html
275
- release_id = Hash[*a[:href].split('?').last.split('=').flatten]['release_id']
211
+ version = a.inner_html
212
+ release_id = Hash[*a[:href].split('?').last.split('=').flatten]['release_id']
276
213
 
277
- sh "rubyforge add_file ramaze ramaze #{release_id} pkg/ramaze-#{VERS}.tar.gz"
278
- sh "rubyforge add_file ramaze ramaze #{release_id} pkg/ramaze-#{VERS}.tar.bz2"
279
- end
214
+ sh "rubyforge add_file ramaze ramaze #{release_id} pkg/ramaze-#{VERS}.tar.gz"
215
+ sh "rubyforge add_file ramaze ramaze #{release_id} pkg/ramaze-#{VERS}.tar.bz2"
216
+ end
280
217
 
281
- task 'undocumented-module' do
282
- require 'strscan'
283
- require 'term/ansicolor'
218
+ task 'undocumented-module' do
219
+ require 'strscan'
220
+ require 'term/ansicolor'
284
221
 
285
- class String
286
- include Term::ANSIColor
287
- end
222
+ $stdout.sync = true
288
223
 
289
- class SimpleDoc
290
- def initialize(string)
291
- @s = StringScanner.new(string)
224
+ class String
225
+ include Term::ANSIColor
292
226
  end
293
227
 
294
- def scan
295
- comment = false
296
- total, missing = [], []
297
- until @s.eos?
298
- unless @s.scan(/^\s*#.*/)
299
- comment = true if @s.scan(/^=begin[^$]*$/)
300
- comment = false if comment and @s.scan(/^=end$/)
301
-
302
- unless comment
303
- if @s.scan(/(?:class ).*/)
304
- #p @s.matched
305
- elsif @s.scan(/(?:module ).*/)
306
- #p @s.matched
307
- elsif @s.scan(/(?:def )[\w?!*+\/-]+(?=[\(\s])/)
308
- total << @s.matched.split.last
309
- prev = @s.pre_match.split("\n")
310
- prev.delete_if{|s| s.strip.empty?}
311
- unless prev.last =~ /^\s*#.*/
312
- missing << @s.matched.split.last
313
- end
314
- else
315
- @s.scan(/./m)
316
- end
228
+ class SimpleDoc
229
+ def initialize(string)
230
+ @s = StringScanner.new(string)
231
+ end
232
+
233
+ def scan
234
+ comment = false
235
+ total, missing = [], []
236
+ until @s.eos?
237
+ unless @s.scan(/^\s*#.*/)
238
+ comment = true if @s.scan(/^=begin[^$]*$/)
239
+ comment = false if comment and @s.scan(/^=end$/)
240
+
241
+ unless comment
242
+ if @s.scan(/(?:class ).*/)
243
+ #p @s.matched
244
+ elsif @s.scan(/(?:module ).*/)
245
+ #p @s.matched
246
+ elsif @s.scan(/(?:[\s$]def\s+)[\w?!*=+\/-]+(?=[\(\s])/)
247
+ total << @s.matched.split.last
248
+ prev = @s.pre_match.split("\n")
249
+ prev.delete_if{|s| s.strip.empty?}
250
+ unless prev.last =~ /^\s*#.*/
251
+ missing << @s.matched.split.last
252
+ end
253
+ else
254
+ @s.scan(/./m)
255
+ end
256
+ end
317
257
  end
318
258
  end
319
- end
320
259
 
321
- return total, missing
260
+ return total, missing
261
+ end
322
262
  end
323
- end
324
263
 
325
- all = {}
326
- files = Dir['lib/**/*.rb']
264
+ all = {}
265
+ files = Dir['lib/**/*.rb']
266
+ ignore = [
267
+ %r'contrib/gettext/(mo|po)\.rb',
268
+ %r'snippets/dictionary\.rb',
269
+ %r'lib/vendor',
270
+ ]
271
+
272
+ print "scanning ~#{files.size} files "
273
+ files.each do |file|
274
+ next if ignore.any?{|i| file =~ i}
275
+ print "."
276
+ t, m = SimpleDoc.new(File.read(file)).scan
277
+ all[file] = [t, m]
278
+ end
279
+ puts " done."
327
280
 
328
- files.each do |file|
329
- t, m = SimpleDoc.new(File.read(file)).scan
330
- all[file] = [t, m]
331
- end
281
+ failed = all.reject{|k,(t,m)| m.size == 0}
332
282
 
333
- failed = all.reject{|k,(t,m)| m.size == 0}
283
+ max = failed.keys.sort_by{|f| f.size}.last.size
334
284
 
335
- max = failed.keys.sort_by{|f| f.size}.last.size
285
+ colors = {
286
+ (0..25 ) => :blue,
287
+ (25..50 ) => :green,
288
+ (50..75 ) => :yellow,
289
+ (75..100) => :red,
290
+ }
336
291
 
337
- colors = {
338
- (0..25 ) => :blue,
339
- (25..50 ) => :green,
340
- (50..75 ) => :yellow,
341
- (75..100) => :red,
342
- }
292
+ puts "\nAll undocumented methods\n\n"
343
293
 
344
- puts "\nAll undocumented methods\n\n"
345
-
346
- failed.sort.each do |file, (t, m)|
347
- ts, ms = t.size, m.size
294
+ failed.sort.each do |file, (t, m)|
295
+ ts, ms = t.size, m.size
348
296
  tss, mss = ts.to_s, ms.to_s
349
297
  ratio = ((ms.to_f/ts)*100).to_i
350
298
  color = colors.find{|k,v| k.include?(ratio)}.last
351
299
  complete = ms.to_f/ts.to_f
352
300
  mthc = "method"
353
- if ratio != 100
301
+ if ms > 0
354
302
  puts "#{file.ljust(max)}\t[#{[mss, tss].join('/').center(8)}]".send(color)
355
303
  mthc = "methods" if ts > 1
356
304
  if $VERBOSE
@@ -360,25 +308,41 @@ task 'undocumented-module' do
360
308
  print "#{mthc.capitalize}: "
361
309
  end
362
310
  puts m.join(', ')
311
+ puts "vim #{file} '+/def #{m.first}'"
363
312
  puts
364
313
  end
365
- end
314
+ end
315
+
316
+ puts "The colors mean percentages of documentation left (ratio of undocumented methods to total):"
317
+ colors.sort_by{|k,v| k.begin}.each do |r, color|
318
+ print "[#{r.inspect}] ".send(color)
319
+ end
320
+ puts "", ""
321
+
322
+ documented = 0
323
+ undocumented = 0
366
324
 
367
- puts "The colors mean percentages of documentation left (ratio of undocumented methods to total):"
368
- colors.sort_by{|k,v| k.begin}.each do |r, color|
369
- print "[#{r.inspect}] ".send(color)
325
+ all.values.each do |(d,m)|
326
+ documented += d.size
327
+ undocumented += m.size
328
+ end
329
+
330
+ total = documented + undocumented
331
+ ratio = (documented * 100.0) / total
332
+
333
+ puts "Total documented: #{documented}, undocumented: #{undocumented}"
334
+ puts "%.2f%% of Ramaze is documented!" % ratio
370
335
  end
371
- puts
372
- end
373
336
 
374
- desc "list all undocumented methods"
375
- task 'undocumented' do
376
- $VERBOSE = false
377
- Rake::Task['undocumented-module'].execute
378
- end
337
+ desc "list all undocumented methods"
338
+ task 'undocumented' do
339
+ $VERBOSE = false
340
+ Rake::Task['undocumented-module'].invoke
341
+ end
379
342
 
380
- desc "list all undocumented methods verbosely"
381
- task 'undocumented-verbose' do
382
- $VERBOSE = true
383
- Rake::Task['undocumented-module'].execute
343
+ desc "list all undocumented methods verbosely"
344
+ task 'undocumented-verbose' do
345
+ $VERBOSE = true
346
+ Rake::Task['undocumented-module'].invoke
347
+ end
384
348
  end