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
data/doc/LEGAL CHANGED
@@ -20,3 +20,7 @@ lib/ramaze/spec/helper/simple_http.rb
20
20
  lib/ramaze/template/xslt.rb
21
21
  License: Ruby
22
22
  Author: Stephan Maka
23
+
24
+ lib/vendor/bacon.rb
25
+ License: MIT
26
+ Author: Christian Neukirchen
@@ -1,47 +1,80 @@
1
- This time we are proud to announce Version 0.2.0 of the Ramaze framework, a
2
- light and modular open source web framework.
1
+ This time we are proud to announce Version 0.3.0 of Ramaze, the light and
2
+ modular open source web framework.
3
3
 
4
- This release features a lot of work directly from our community and i am really
5
- greatful for everybody who helped in testing, patching and contributing new
6
- exciting features.
4
+ This release features a lot of work directly from our community and we are
5
+ really greatful for everybody who helped in testing, patching and contributing
6
+ new exciting features.
7
7
 
8
- An extensive set of specs and docs is covering almost every detail of the
9
- implementation and usage. It is under development by a growing community and in
10
- production-use at companies.
8
+ Our extensive set of specs and docs now covers almost every detail of
9
+ implementation and usage. Ramaze is under development by a growing community
10
+ and in production use at companies.
11
11
 
12
- Special (alphabetic) thanks go to:
13
12
 
14
- Aman 'tmm1' Gupta - tons of patches, specs and support
15
- Jonathan 'Kashia' Buch - patches for localization
16
- Riku Räisänen - as usual, extensive testing
17
- Pistos - submitted his first patch
18
- Stephan Maka - XSLT templating, implementation, specs and examples
13
+ Home page: http://ramaze.net
14
+ Screencasts: http://ramaze.net/screencasts
19
15
 
16
+ View source: http://source.ramaze.net
17
+ Darcsweb: http://darcs.ramaze.net
20
18
 
21
- Home page: http://ramaze.rubyforge.org
22
19
  IRC: #ramaze on irc.freenode.net
23
20
 
24
21
 
25
- Short summary of changes from 0.1.4 to 0.2.0:
22
+ Simple example:
23
+
24
+ require 'ramaze'
25
+
26
+ class MainController
27
+ def index
28
+ 'Hello, World!'
29
+ end
30
+ end
31
+
32
+ Ramaze.start
33
+
34
+
35
+ Special (alphabetic) thanks go to:
36
+
37
+ Aman 'tmm1' Gupta - lots of patches and friendly support
38
+ Antonio Cangiano - Article: http://tiny.cc/tRLfm
39
+ Carlo Zottmann - First patch!
40
+ Jonathan 'Kashia' Buch - patches for gettext and Og support
41
+ Pistos - PR through awesome screencasts
42
+
43
+
44
+ Selected summary of the 118 patches from 0.2.1 to 0.3.0:
45
+
46
+ - Specs switched from RSpec to bacon; Ramaze now runs on Ruby 1.9.
47
+
48
+ - /lib/proto (pregenerated base source code) updated to a new structure.
49
+
50
+ - Oddities in gem version of bin/ramaze fixed (hopefully? :) )
51
+
52
+ - Layouts fixed so the method on the right controller is called.
53
+
54
+ - contrib/facebook and simple facebook app example added.
26
55
 
27
- - Contrib facility, for simple experimental user-contributions
56
+ - Lambda router support added to contrib/route.
28
57
 
29
- - Routes
58
+ - examples/rapaste added.
30
59
 
31
- - As always, lots of bugfixes
60
+ - gettext contrib added; localize ramaze via gettext.
32
61
 
33
- - complete XSLT templating system, usage and specs
62
+ - Adapter for Thin Ruby webserver added.
34
63
 
35
- - Improved localization filter
64
+ - Index files can now be put into public directories and subdirectories.
36
65
 
37
- - Added gzip filter
66
+ - examples/blog switched from Og to Sequel.
38
67
 
39
- - Support for the new upcoming nagoro templating engine.
68
+ - view/ is now the subdirectory for templates; if not found, Ramaze falls
69
+ back to template/.
40
70
 
41
- - Tool::Tidy is gone for good
71
+ - Default error pages updated: colour gradient removed; textmate link added;
72
+ Javascript optimized; CSS tweaked.
42
73
 
74
+ - Templates are no longer searched for in public/.
43
75
 
44
- A complete Changelog is available at http://manveru.net/ramaze/doc/CHANGELOG
76
+ A complete Changelog is available at
77
+ http://darcs.ramaze.net/ramaze/doc/CHANGELOG
45
78
 
46
79
 
47
80
  Known issues:
@@ -49,36 +82,35 @@ Known issues:
49
82
  - none yet, waiting for your reports :)
50
83
 
51
84
 
52
- Features:
85
+ Ramaze Features:
53
86
  - Builds on top of the Rack library, which provides easy use of adapters like
54
- Mongrel, WEBrick, CGI or FCGI.
87
+ Mongrel, WEBrick, LiteSpeed, Thin, CGI or FCGI.
55
88
 
56
- - Supports a wide range of templating-engines like:
57
- Amrita2, Erubis, Haml, Liquid, Markaby, Remarkably and its own engine
58
- called Ezamar.
89
+ - Supports a wide range of templating-engines like: Amrita2, Erubis, Haml,
90
+ Liquid, Markaby, Remarkably and its own engine called Ezamar and (still
91
+ unofficial) Nagoro.
59
92
 
60
- - Highly modular structure, you can just use the parts you like. This also
61
- means that it's very simple to add your own customizations.
93
+ - Highly modular structure: you can just use the parts you like. This also
94
+ means that it's very simple to add your own customizations.
62
95
 
63
96
  - A variety of helpers is already available, giving you things like advanced
64
- caching, OpenID-authentication or aspect-oriented programming for your
65
- controllers.
97
+ caching, OpenID-authentication or aspect-oriented programming for your
98
+ controllers.
66
99
 
67
- - It is possible to use the ORM you like, be it ActiveRecord, Og, Kansas or
68
- something more simplistic like a wrapper around YAML::Store.
100
+ - It is possible to use the ORM you like, be it Sequel, DataMapper,
101
+ ActiveRecord, Og, Kansas or something more simplistic like DBI, or a
102
+ wrapper around YAML::Store.
69
103
 
70
- - Good documentation: although we don't have 100% (dcov says around 75%)
71
- documentation right now, just about every part of Ramaze is covered with
72
- basic and advanced docs.
73
- There are a variety of examples and a tutorial available.
104
+ - Good documentation: although we don't have 100% documentation right now
105
+ (dcov says around 75%), just about every part of Ramaze is covered with
106
+ basic and advanced docs. There are a variety of examples, screencasts and a
107
+ tutorial available.
74
108
 
75
- - Friendly community: lastly, but still quite important, there are people from
76
- all over the world using Ramaze, so you can get almost instant help and
77
- info.
109
+ - Friendly community: there are people from all over the world using Ramaze,
110
+ so you can get almost instant help and info.
78
111
 
79
112
 
80
- For more information please come to http://ramaze.rubyforge.org or ask directly
81
- on IRC (irc://irc.freenode.net/#ramaze)
113
+ For more information please come to http://ramaze.net or ask directly on IRC
114
+ irc://irc.freenode.net/#ramaze
82
115
 
83
- Thank you,
84
- Michael 'manveru' Fellinger and the Ramaze community
116
+ Thank you, Michael 'manveru' Fellinger and the Ramaze community
@@ -1,3 +1,3 @@
1
- a simple blog engine which uses Og as the persistence layer.
2
- Og uses sqlite as the default DBMS engine and will create the database
1
+ A simple blog engine that uses Sequel as the persistence layer.
2
+ Sequel uses sqlite as the default DBMS engine and will create the database
3
3
  automatically on startup.
@@ -1,50 +1,44 @@
1
1
  require 'ramaze'
2
2
  require 'ramaze/spec/helper'
3
3
 
4
- # if these libraries are missing there is no sense in running the tests,
5
- # cause they won't work at all.
6
- testcase_requires 'og'
7
- testcase_requires 'hpricot'
8
-
9
- # Og sets this in the global namespace and uses the STDERR to write messages
10
- # We can replace it with Ramaze's logger that does The Right Thing (TM)
11
- class Logger
12
- @@global_logger = Ramaze::Inform
13
- end
14
- $:.unshift 'examples/blog'
4
+ spec_require 'hpricot', 'sequel'
5
+
6
+ $LOAD_PATH.unshift base = __DIR__/'..'
15
7
  require 'start'
16
8
 
17
- # fix the paths to template and public for the spec
18
- # this is not needed usually, but this tests are also part of ramaze's suite
19
- class MainController
20
- template_root __DIR__ / '../template'
21
- end
9
+ describe 'Blog' do
10
+ behaves_like 'http'
11
+ ramaze :public_root => base/:public,
12
+ :template_root => base/:template
22
13
 
23
- describe 'blog' do
14
+ after do
15
+ Entry.each{|e| e.delete unless e.id == 1 }
16
+ end
24
17
 
25
- def check_page(name)
26
- page = get('/'+name)
18
+ def check_page(name = '')
19
+ page = get("/#{name}")
27
20
  page.status.should == 200
28
- page.body.should_not be_nil
21
+ page.body.should.not == nil
29
22
 
30
23
  doc = Hpricot(page.body)
31
24
  doc.at('title').inner_html.should == 'bl_Og'
32
25
  doc.at('h1').inner_html.should == 'bl_Og'
33
26
 
34
- doc.search('div#entries').length.should == 1
27
+ doc.search('div#entries').size.should == 1
35
28
 
36
29
  doc
37
30
  end
38
31
 
39
- it 'should start' do
40
- ramaze :public_root => 'examples/blog/public', :port => 7001
41
- get('/').status.should == 200
32
+ def create_page(title,content)
33
+ page = post('/create','title'=>title,'content'=>content)
34
+ page.status.should == 303
35
+ page.location.should == '/'
42
36
  end
43
37
 
44
38
  it 'should have main page' do
45
- doc = check_page('')
39
+ doc = check_page
46
40
  doc.at('div#actions>a').inner_html.should == 'new entry'
47
- doc.search('div.entry').length.should == 1
41
+ doc.search('div.entry').size.should == 1
48
42
  end
49
43
 
50
44
  it 'should have new entry page' do
@@ -54,18 +48,12 @@ describe 'blog' do
54
48
  form.at('textarea').inner_html.should == ''
55
49
  form.at('input[@type=submit]')['value'].should == 'Add Entry'
56
50
  end
57
-
58
- def create_page(title,content)
59
- page = post('/create','title'=>title,'content'=>content)
60
- page.status.should == 303
61
- page.location.should == '/'
62
- end
63
51
 
64
52
  it 'should add new pages' do
65
53
  create_page('new page', 'cool! a new page')
66
- doc = check_page('')
54
+ doc = check_page
67
55
  entry = doc.search('div.entry')
68
- entry.length.should == 2
56
+ entry.size.should == 2
69
57
  entry = entry.last
70
58
 
71
59
  entry.at('div.title').inner_html == 'new page'
@@ -74,11 +62,11 @@ describe 'blog' do
74
62
 
75
63
  it 'should edit existing pages' do
76
64
  create_page('new page', 'cool! a new page')
77
- post('/save','oid'=>'2','title'=>'new title','content'=>'bla bla')
78
- doc = check_page('')
79
- entry = doc.search('div.entry')
80
- entry.length.should == 2
81
- entry = entry.first
65
+ post('/save','id'=>'2','title'=>'new title','content'=>'bla bla')
66
+ doc = check_page
67
+ entries = doc/'div.entry'
68
+ entries.size.should == 2
69
+ entry = entries.first
82
70
 
83
71
  entry.at('div.title').inner_html == 'new title'
84
72
  entry.at('div.content').inner_html == 'bla bla'
@@ -86,17 +74,14 @@ describe 'blog' do
86
74
 
87
75
  it 'should delete existing pages' do
88
76
  create_page("page to delete", 'content')
89
- check_page('').search('div.entry').length.should == 2
90
- page = get('/delete/2')
77
+ entries = check_page/'div.entry'
78
+ entries.size.should == 2
79
+ delete_link = entries.last.at("a:contains('delete')")
80
+ page = get(delete_link[:href])
91
81
  page.status.should == 303
92
82
  page.location.should == '/'
93
- check_page('').search('div.entry').length.should == 1
94
- end
95
-
96
- after do
97
- Entry.all.each do |e|
98
- e.delete unless e.oid == 1
99
- end
83
+ (check_page/'div.entry').size.should == 1
100
84
  end
101
85
 
86
+ FileUtils.rm_f(__DIR__/'../blog.db')
102
87
  end
@@ -1,25 +1,27 @@
1
- class MainController < Controller
1
+ class MainController < Ramaze::Controller
2
2
  def index
3
- @entries = Entry.all :order => 'created DESC'
3
+ @entries = Entry.order(:created.DESC).all
4
4
  end
5
- def delete oid
6
- Entry.delete oid
5
+
6
+ def delete id
7
+ entry = Entry[id]
8
+ entry.delete
7
9
  redirect :/
8
10
  end
9
- def edit oid
10
- @entry = Entry[oid]
11
+
12
+ def edit id
13
+ @entry = Entry[id]
14
+ redirect_referrer unless @entry
11
15
  end
16
+
12
17
  def create
13
- Entry.create request['title'], request['content']
18
+ Entry.add(*request[:title, :content])
14
19
  redirect :/
15
20
  end
21
+
16
22
  def save
17
- redirect_referer unless oid = request['oid']
18
- entry = Entry[oid]
19
- entry.title = request['title']
20
- entry.content = request['content']
21
- entry.updated = Time.now
22
- entry.save
23
+ redirect_referer unless entry = Entry[request[:id]]
24
+ entry.update(*request[:title, :content])
23
25
  redirect :/
24
26
  end
25
27
  end
@@ -1,12 +1,30 @@
1
- class Entry
2
- property :created, Time
3
- property :updated, Time
4
- property :title, String
5
- property :content, String
6
- def initialize title, content
7
- @created=Time.now
8
- @updated=Time.now
9
- @title=title
10
- @content=content
1
+ require 'sequel'
2
+
3
+ DB = Sequel("sqlite:///#{__DIR__}/../blog.db")
4
+
5
+ class Entry < Sequel::Model(:entry)
6
+ set_schema do
7
+ primary_key :id
8
+
9
+ time :created
10
+ time :updated
11
+ text :title
12
+ text :content
11
13
  end
14
+
15
+ def self.add(title, content)
16
+ create :title => title, :content => content,
17
+ :created => Time.now, :updated => Time.now
18
+ end
19
+
20
+ def update(title = title, content = content)
21
+ self.title, self.content, self.updated = title, content, Time.now
22
+ save
23
+ end
24
+ end
25
+
26
+ Entry.create_table! unless Entry.table_exists?
27
+
28
+ if Entry.empty?
29
+ Entry.add 'Blog created', 'Exciting news today, this blog was created'
12
30
  end
@@ -1,17 +1,7 @@
1
- $DBG = true # turn on debugging in Og
2
-
3
1
  require 'ramaze'
4
- require 'og'
5
-
6
- include Ramaze
7
2
 
8
3
  require 'src/model'
9
4
  require 'src/view'
10
5
  require 'src/controller'
11
6
 
12
- Og.setup :evolve_schema => :full
13
-
14
- Entry.create "Blog created", "Exciting news today, this blog was created!" if
15
- Entry.count == 0
16
-
17
7
  Ramaze.start
@@ -3,7 +3,7 @@
3
3
  <div id="entries">
4
4
  <div class="entry">
5
5
  <form method="post" action="#{R self,:save}">
6
- <input name="oid" type="hidden" value="#{@entry.oid}"/>
6
+ <input name="id" type="hidden" value="#{@entry.id}"/>
7
7
  <div class="header">
8
8
  <div class="title">
9
9
  <input name="title" type="text" value="#{@entry.title}"/>
@@ -7,8 +7,8 @@
7
7
  <div class="title">#{entry.title}</div>
8
8
  <div class="created">Created: #{entry.created}</div>
9
9
  <ul>
10
- <li>#{A 'edit', :href => Rs(:edit, entry.oid)}</li>
11
- <li>#{A 'delete', :href => Rs(:delete, entry.oid)}</li>
10
+ <li>#{A 'edit', :href => Rs(:edit, entry.id)}</li>
11
+ <li>#{A 'delete', :href => Rs(:delete, entry.id)}</li>
12
12
  </ul>
13
13
  </div>
14
14
  <div class="content">#{entry.content}</div>
@@ -0,0 +1,152 @@
1
+ require 'rubygems'
2
+ require 'ramaze'
3
+
4
+ Ramaze.contrib :facebook
5
+
6
+ # Settings for your facebook app
7
+ # SERVER: where this ramaze app is running
8
+ # URL: the apps.facebook.com url to your app
9
+ # KEY: API key for your app
10
+ # SECRET: Secret key for your app
11
+ # ID: Your app's ID (from the about page url)
12
+ # ADMINS: uids of facebook users that are admins
13
+ # SESSION: an admin's session key
14
+ #
15
+ # These vars are used by the Facebook Helper are are also useful
16
+ # within your controller and templates. For example,
17
+ # <a href="#{Facebook::URL}/search">click here to search</a>
18
+ #
19
+ # In addition, set the following options on your app's 'Edit Settings' page:
20
+ # Callback URL: http://myapp.domain.com:7000/ (trailing slash required)
21
+ # Canvas Page URL: ramazing
22
+ # Can your app be added on Facebook: Yes
23
+ # Who can add your app: Users
24
+ # Post-Add URL: http://apps.facebook.com/ramazing/install
25
+ # Post-Remove URL: http://myapp.domain.com:7000/uninstall
26
+ # Side Nav URL: http://apps.facebook.com/ramazing
27
+
28
+ module Facebook
29
+ SERVER = 'http://myapp.domain.com:7000'
30
+ URL = 'http://apps.facebook.com/ramazing'
31
+ KEY = 'b32f58685c06a7f8107bc7915354bd89'
32
+ SECRET = 'e0f9........................9429'
33
+ ID = 2502696782
34
+ ADMINS = [ 15601088 ]
35
+ SESSION = ''
36
+ end unless defined? Facebook::ID
37
+
38
+ # The facebook helper (included your controller using +helper :facebook+)
39
+ # defines a +facebook+ object, which is also aliased to +fb+.
40
+ #
41
+ # POST parameters sent by the facebook servers can be accessed via fb.params
42
+ # and also fb[]. Wherever possible, values will be converted to native ruby
43
+ # types (Time objects, true/false, arrays)
44
+ #
45
+ # fb.params = { :api_key => "b32f58685c06a7f8107bc7915354bd89",
46
+ # :added => true,
47
+ # :profile_update_time => Mon Oct 15 15:07:28 -0400 2007,
48
+ # :friends => [1,2,3],
49
+ # :session_key => "f7bed6aefaa5467b3a6344f2-15601088",
50
+ # :time => Sat Dec 01 02:02:50 -0500 2007,
51
+ # :user => 15601088,
52
+ # :position_fix => false,
53
+ # :expires => 0,
54
+ # :in_canvas => true }
55
+ #
56
+ # fb[:user] == facebook[:user] == facebook.params[:user]
57
+ #
58
+ # The facebook object can also be used to make API calls. Native ruby types (true, false, strings, hashes and arrays)
59
+ # will be returned. If facebook returns an array with only one element, that element will be returned instead.
60
+ #
61
+ # facebook.auth.createToken # => "41b5dc65792ba4bf405faf857a17267c"
62
+ # fb.users.getInfo :uids => 15601088, :fields => [:name] # => {"name"=>"Aman Gupta", "uid"=>15601088}
63
+ # fb.profile.setFBML :uid => 15601088, :markup => 'Hi!' # => true
64
+ #
65
+ # API calls will use the current viewing users' session key (from fb[:session_key]) if present,
66
+ # or Facebook::SESSION, which should be set to one of the admin's keys. You can also provide another
67
+ # session key yourself from your users database:
68
+ #
69
+ # fb.feed.publishActionOfUser :session_key => "the user's session key", :title => 'is using Ramaze!'
70
+ #
71
+ # Finally, you can use the following facebook object methods:
72
+ #
73
+ # facebook.valid? # verify fb_sig, if invalid fb.params will return {}
74
+ # facebook.redirect '/url' # redirect to /url using <fb:redirect/>
75
+ # facebook.addurl # return the add url for the current app
76
+ # facebook.addurl '/url' # add url for app that redirects to /url after successful install
77
+
78
+ class MainController < Ramaze::Controller
79
+ helper :formatting # for time_diff
80
+ helper :facebook
81
+
82
+ before_all {
83
+ # show some information about current user in logs
84
+ # INFO Facebook {:user=>15601088, :in_canvas=>true, :added=>true}
85
+ inform :info, "Facebook " + fb.params.reject{|k,v| k.to_s !~ /^(in|is|user|added)/}.inspect if fb[:user]
86
+
87
+ # suggest setting SESSION key if one is not set, and current user is an admin
88
+ # INFO Set a default session key: SESSION = 'b3638446fa02466210c49f42-15601088'
89
+ if Facebook::SESSION.empty? and Facebook::ADMINS.include? fb[:user]
90
+ inform :info, "Set a default session key: SESSION = '#{fb[:session_key]}'"
91
+ end
92
+ nil
93
+ }
94
+
95
+ def install
96
+ inform :info, "#{fb[:user]} installed app" if request['installed'] == '1'
97
+ facebook.profile.setFBML :uid => fb[:user], :markup => "Isn't this a great surprise!?"
98
+ facebook.redirect request['next'] || '/'
99
+ end
100
+
101
+ def uninstall
102
+ inform :info, "#{fb[:user]} uninstalled app"
103
+ end
104
+
105
+ def main
106
+ fb.redirect '/index' unless fb[:user]
107
+ @userinfo = facebook.users.getInfo :uids => facebook[:user], :fields => [:name, :pic_square]
108
+ %q(
109
+ Hey there #{@userinfo['name']}. You look like this: <img src="#{@userinfo['pic_square']}"/>. <br/>
110
+ You updated your profile #{time_diff fb[:profile_update_time]} ago. You have #{fb[:friends].size} friends. <br/>
111
+ <p>
112
+ <?r unless fb[:added] ?>
113
+ I know you already logged in, but you should really <a href="#{facebook.addurl}">add this app</a>.
114
+ You'll get a real nifty surprise on your profile if you do.
115
+ <?r else ?>
116
+ Now that you added this app, I can access your profile and news feed. <br/>
117
+ Did you see the cool surprise I left on <a href="http://www.facebook.com/profile.php?id=#{fb[:user]}">your profile</a>?
118
+ <?r end ?>
119
+ </p>
120
+ )
121
+ end
122
+
123
+ def index
124
+ facebook.redirect '/main' if facebook[:user]
125
+ %q(
126
+ This is a great app. Here are some reasons you'll like it:
127
+ <ul>
128
+ <li>It's on facebook</li>
129
+ <li>It's written in Ramaze</li>
130
+ </ul>
131
+ <a href="#{Facebook::URL}/main" requirelogin="true">Login</a> to start using it. Or, to
132
+ get the full benefit, you should <a href="#{facebook.addurl '/main'}">add it</a> so we have
133
+ access to your newsfeed and can add a box to your profile.
134
+ )
135
+ end
136
+
137
+ def layout
138
+ %q(
139
+ <fb:dashboard>
140
+ <?r unless fb[:added] ?>
141
+ <fb:create-button href="#{facebook.addurl '/main'}">Add App</fb:create-button>
142
+ <?r end ?>
143
+ </fb:dashboard>
144
+ <div id="content" style="margin: 0 2em 2em 2em">
145
+ #@content
146
+ </div>
147
+ )
148
+ end
149
+ layout :layout
150
+ end
151
+
152
+ Ramaze.start :adapter => :mongrel