merb 0.5.3 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. data/LICENSE +0 -20
  2. data/README +0 -277
  3. data/Rakefile +80 -199
  4. data/TODO +0 -3
  5. metadata +19 -438
  6. data/SVN_REVISION +0 -1
  7. data/app_generators/merb/USAGE +0 -5
  8. data/app_generators/merb/merb_generator.rb +0 -108
  9. data/app_generators/merb/templates/Rakefile +0 -124
  10. data/app_generators/merb/templates/app/controllers/application.rb +0 -3
  11. data/app_generators/merb/templates/app/controllers/exceptions.rb +0 -13
  12. data/app_generators/merb/templates/app/helpers/global_helper.rb +0 -5
  13. data/app_generators/merb/templates/app/mailers/views/layout/application.html.erb +0 -1
  14. data/app_generators/merb/templates/app/mailers/views/layout/application.text.erb +0 -1
  15. data/app_generators/merb/templates/app/parts/views/layout/application.html.erb +0 -1
  16. data/app_generators/merb/templates/app/views/exceptions/internal_server_error.html.erb +0 -216
  17. data/app_generators/merb/templates/app/views/exceptions/not_acceptable.html.erb +0 -38
  18. data/app_generators/merb/templates/app/views/exceptions/not_found.html.erb +0 -40
  19. data/app_generators/merb/templates/app/views/layout/application.html.erb +0 -11
  20. data/app_generators/merb/templates/config/boot.rb +0 -11
  21. data/app_generators/merb/templates/config/dependencies.rb +0 -41
  22. data/app_generators/merb/templates/config/environments/development.rb +0 -1
  23. data/app_generators/merb/templates/config/environments/production.rb +0 -1
  24. data/app_generators/merb/templates/config/environments/test.rb +0 -1
  25. data/app_generators/merb/templates/config/merb.yml +0 -82
  26. data/app_generators/merb/templates/config/merb_init.rb +0 -17
  27. data/app_generators/merb/templates/config/plugins.yml +0 -1
  28. data/app_generators/merb/templates/config/router.rb +0 -35
  29. data/app_generators/merb/templates/config/upload.conf +0 -0
  30. data/app_generators/merb/templates/public/images/merb.jpg +0 -0
  31. data/app_generators/merb/templates/public/merb.fcgi +0 -6
  32. data/app_generators/merb/templates/public/stylesheets/master.css +0 -119
  33. data/app_generators/merb/templates/script/destroy +0 -32
  34. data/app_generators/merb/templates/script/generate +0 -32
  35. data/app_generators/merb/templates/script/stop_merb +0 -13
  36. data/app_generators/merb/templates/script/win_script.cmd +0 -1
  37. data/app_generators/merb/templates/spec/spec.opts +0 -6
  38. data/app_generators/merb/templates/spec/spec_helper.rb +0 -15
  39. data/app_generators/merb/templates/test/test_helper.rb +0 -14
  40. data/app_generators/merb_plugin/USAGE +0 -5
  41. data/app_generators/merb_plugin/merb_plugin_generator.rb +0 -68
  42. data/app_generators/merb_plugin/templates/LICENSE +0 -20
  43. data/app_generators/merb_plugin/templates/README +0 -4
  44. data/app_generators/merb_plugin/templates/Rakefile +0 -35
  45. data/app_generators/merb_plugin/templates/TODO +0 -5
  46. data/app_generators/merb_plugin/templates/merbtasks.rb +0 -6
  47. data/app_generators/merb_plugin/templates/sampleplugin.rb +0 -10
  48. data/app_generators/merb_plugin/templates/sampleplugin_spec.rb +0 -7
  49. data/app_generators/merb_plugin/templates/spec_helper.rb +0 -2
  50. data/bin/merb +0 -4
  51. data/lib/autotest/discover.rb +0 -3
  52. data/lib/autotest/merb_rspec.rb +0 -80
  53. data/lib/merb.rb +0 -188
  54. data/lib/merb/abstract_controller.rb +0 -399
  55. data/lib/merb/assets.rb +0 -160
  56. data/lib/merb/assets.rb.orig +0 -119
  57. data/lib/merb/boot_loader.rb +0 -286
  58. data/lib/merb/boot_loader.rb.orig +0 -235
  59. data/lib/merb/caching.rb +0 -5
  60. data/lib/merb/caching/action_cache.rb +0 -92
  61. data/lib/merb/caching/fragment_cache.rb +0 -39
  62. data/lib/merb/caching/store/file_cache.rb +0 -90
  63. data/lib/merb/caching/store/memory_cache.rb +0 -85
  64. data/lib/merb/config.rb +0 -290
  65. data/lib/merb/constants.rb +0 -50
  66. data/lib/merb/controller.rb +0 -220
  67. data/lib/merb/cookies.rb +0 -95
  68. data/lib/merb/core_ext.rb +0 -15
  69. data/lib/merb/core_ext/array.rb +0 -0
  70. data/lib/merb/core_ext/class.rb +0 -180
  71. data/lib/merb/core_ext/enumerable.rb +0 -49
  72. data/lib/merb/core_ext/get_args.rb +0 -76
  73. data/lib/merb/core_ext/hash.rb +0 -306
  74. data/lib/merb/core_ext/inflections.rb +0 -112
  75. data/lib/merb/core_ext/inflector.rb +0 -275
  76. data/lib/merb/core_ext/kernel.rb +0 -242
  77. data/lib/merb/core_ext/mash.rb +0 -88
  78. data/lib/merb/core_ext/module.rb +0 -67
  79. data/lib/merb/core_ext/numeric.rb +0 -72
  80. data/lib/merb/core_ext/object.rb +0 -183
  81. data/lib/merb/core_ext/string.rb +0 -53
  82. data/lib/merb/core_ext/symbol.rb +0 -6
  83. data/lib/merb/dispatcher.rb +0 -109
  84. data/lib/merb/drb_server.rb +0 -19
  85. data/lib/merb/erubis_ext.rb +0 -10
  86. data/lib/merb/exceptions.rb +0 -192
  87. data/lib/merb/generators/merb_app/merb_app.rb +0 -22
  88. data/lib/merb/generators/merb_generator_helpers.rb +0 -318
  89. data/lib/merb/generators/merb_plugin.rb +0 -22
  90. data/lib/merb/logger.rb +0 -78
  91. data/lib/merb/mail_controller.rb +0 -268
  92. data/lib/merb/mailer.rb +0 -87
  93. data/lib/merb/mixins/basic_authentication.rb +0 -35
  94. data/lib/merb/mixins/controller.rb +0 -160
  95. data/lib/merb/mixins/erubis_capture.rb +0 -68
  96. data/lib/merb/mixins/general_controller.rb +0 -253
  97. data/lib/merb/mixins/inline_partial.rb +0 -32
  98. data/lib/merb/mixins/render.rb +0 -465
  99. data/lib/merb/mixins/responder.rb +0 -449
  100. data/lib/merb/mixins/view_context.rb +0 -558
  101. data/lib/merb/mixins/web_controller.rb +0 -36
  102. data/lib/merb/mongrel_handler.rb +0 -168
  103. data/lib/merb/part_controller.rb +0 -29
  104. data/lib/merb/plugins.rb +0 -16
  105. data/lib/merb/rack_adapter.rb +0 -37
  106. data/lib/merb/request.rb +0 -465
  107. data/lib/merb/router.rb +0 -646
  108. data/lib/merb/server.rb +0 -169
  109. data/lib/merb/session.rb +0 -23
  110. data/lib/merb/session/cookie_store.rb +0 -118
  111. data/lib/merb/session/mem_cache_session.rb +0 -131
  112. data/lib/merb/session/memory_session.rb +0 -176
  113. data/lib/merb/template.rb +0 -37
  114. data/lib/merb/template/erubis.rb +0 -68
  115. data/lib/merb/template/haml.rb +0 -87
  116. data/lib/merb/template/markaby.rb +0 -59
  117. data/lib/merb/template/xml_builder.rb +0 -50
  118. data/lib/merb/test/fake_request.rb +0 -74
  119. data/lib/merb/test/helper.rb +0 -260
  120. data/lib/merb/test/hpricot.rb +0 -136
  121. data/lib/merb/test/multipart.rb +0 -66
  122. data/lib/merb/test/rspec.rb +0 -18
  123. data/lib/merb/test/rspec_matchers/controller_matchers.rb +0 -117
  124. data/lib/merb/test/rspec_matchers/markup_matchers.rb +0 -98
  125. data/lib/merb/upload_handler.rb +0 -80
  126. data/lib/merb/upload_progress.rb +0 -48
  127. data/lib/merb/version.rb +0 -49
  128. data/lib/merb/view_context.rb +0 -79
  129. data/lib/tasks.rb +0 -7
  130. data/lib/tasks/merb.rake +0 -54
  131. data/merb_default_generators/model/USAGE +0 -0
  132. data/merb_default_generators/model/model_generator.rb +0 -16
  133. data/merb_default_generators/model/templates/new_model_template.erb +0 -5
  134. data/merb_default_generators/resource_controller/USAGE +0 -0
  135. data/merb_default_generators/resource_controller/resource_controller_generator.rb +0 -26
  136. data/merb_default_generators/resource_controller/templates/controller.rb +0 -30
  137. data/merb_default_generators/resource_controller/templates/edit.html.erb +0 -1
  138. data/merb_default_generators/resource_controller/templates/helper.rb +0 -5
  139. data/merb_default_generators/resource_controller/templates/index.html.erb +0 -1
  140. data/merb_default_generators/resource_controller/templates/new.html.erb +0 -1
  141. data/merb_default_generators/resource_controller/templates/show.html.erb +0 -1
  142. data/merb_generators/controller/USAGE +0 -5
  143. data/merb_generators/controller/controller_generator.rb +0 -16
  144. data/merb_generators/controller/templates/controller.rb +0 -8
  145. data/merb_generators/controller/templates/helper.rb +0 -5
  146. data/merb_generators/controller/templates/index.html.erb +0 -3
  147. data/merb_generators/part_controller/USAGE +0 -5
  148. data/merb_generators/part_controller/part_controller_generator.rb +0 -27
  149. data/merb_generators/part_controller/templates/controller.rb +0 -8
  150. data/merb_generators/part_controller/templates/helper.rb +0 -5
  151. data/merb_generators/part_controller/templates/index.html.erb +0 -3
  152. data/merb_generators/resource/USAGE +0 -0
  153. data/merb_generators/resource/resource_generator.rb +0 -67
  154. data/rspec_generators/merb_controller_test/merb_controller_test_generator.rb +0 -67
  155. data/rspec_generators/merb_controller_test/templates/controller_spec.rb +0 -8
  156. data/rspec_generators/merb_controller_test/templates/edit_spec.rb +0 -12
  157. data/rspec_generators/merb_controller_test/templates/helper_spec.rb +0 -5
  158. data/rspec_generators/merb_controller_test/templates/index_spec.rb +0 -12
  159. data/rspec_generators/merb_controller_test/templates/new_spec.rb +0 -12
  160. data/rspec_generators/merb_controller_test/templates/show_spec.rb +0 -5
  161. data/rspec_generators/merb_model_test/merb_model_test_generator.rb +0 -26
  162. data/rspec_generators/merb_model_test/templates/model_spec_template.erb +0 -7
  163. data/script/destroy +0 -14
  164. data/script/generate +0 -14
  165. data/spec/fixtures/config/environments/environment_config_test.yml +0 -1
  166. data/spec/fixtures/config/merb.yml +0 -18
  167. data/spec/fixtures/controllers/dispatch_spec_controllers.rb +0 -235
  168. data/spec/fixtures/controllers/render_spec_controllers.rb +0 -184
  169. data/spec/fixtures/foo.rb +0 -3
  170. data/spec/fixtures/mailers/views/layout/application.html.erb +0 -3
  171. data/spec/fixtures/mailers/views/layout/application.text.erb +0 -3
  172. data/spec/fixtures/mailers/views/test_mail_controller/eighth.html.erb +0 -1
  173. data/spec/fixtures/mailers/views/test_mail_controller/eighth.text.erb +0 -1
  174. data/spec/fixtures/mailers/views/test_mail_controller/first.html.erb +0 -1
  175. data/spec/fixtures/mailers/views/test_mail_controller/first.text.erb +0 -1
  176. data/spec/fixtures/mailers/views/test_mail_controller/ninth.html.erb +0 -1
  177. data/spec/fixtures/mailers/views/test_mail_controller/ninth.text.erb +0 -1
  178. data/spec/fixtures/mailers/views/test_mail_controller/second.text.erb +0 -1
  179. data/spec/fixtures/mailers/views/test_mail_controller/third.html.erb +0 -1
  180. data/spec/fixtures/models/router_spec_models.rb +0 -30
  181. data/spec/fixtures/parts/views/layout/todo_part.html.erb +0 -3
  182. data/spec/fixtures/parts/views/layout/todo_part.xml.erb +0 -3
  183. data/spec/fixtures/parts/views/todo_part/formatted_output.html.erb +0 -1
  184. data/spec/fixtures/parts/views/todo_part/formatted_output.js.erb +0 -1
  185. data/spec/fixtures/parts/views/todo_part/formatted_output.xml.erb +0 -1
  186. data/spec/fixtures/parts/views/todo_part/list.html.erb +0 -3
  187. data/spec/fixtures/sample.txt +0 -1
  188. data/spec/fixtures/views/erubis.html.erb +0 -1
  189. data/spec/fixtures/views/examples/_erubis.html.erb +0 -1
  190. data/spec/fixtures/views/examples/_haml.html.haml +0 -1
  191. data/spec/fixtures/views/examples/_markaby.html.mab +0 -1
  192. data/spec/fixtures/views/examples/_throw_content.html.erb +0 -6
  193. data/spec/fixtures/views/examples/hello.xml.builder +0 -1
  194. data/spec/fixtures/views/examples/js.js.erb +0 -1
  195. data/spec/fixtures/views/examples/template_catch_content.html.erb +0 -15
  196. data/spec/fixtures/views/examples/template_catch_content_from_partial.html.erb +0 -6
  197. data/spec/fixtures/views/examples/template_throw_content.html.erb +0 -10
  198. data/spec/fixtures/views/examples/template_throw_content_without_block.html.erb +0 -3
  199. data/spec/fixtures/views/exceptions/admin_access_required.html.erb +0 -1
  200. data/spec/fixtures/views/extension_template_controller/_nested_js.js.erb +0 -1
  201. data/spec/fixtures/views/extension_template_controller/_nested_xml.xml.erb +0 -1
  202. data/spec/fixtures/views/extension_template_controller/_render_partial_multiple_times.html.erb +0 -1
  203. data/spec/fixtures/views/extension_template_controller/erubis_templates.html.erb +0 -1
  204. data/spec/fixtures/views/extension_template_controller/erubis_templates.js.erb +0 -1
  205. data/spec/fixtures/views/extension_template_controller/erubis_templates.rhtml +0 -1
  206. data/spec/fixtures/views/extension_template_controller/erubis_templates.xml.erb +0 -1
  207. data/spec/fixtures/views/extension_template_controller/haml_index.html.haml +0 -0
  208. data/spec/fixtures/views/extension_template_controller/haml_templates.html.haml +0 -1
  209. data/spec/fixtures/views/extension_template_controller/haml_templates.js.haml +0 -1
  210. data/spec/fixtures/views/extension_template_controller/haml_templates.xml.haml +0 -1
  211. data/spec/fixtures/views/extension_template_controller/index.html.erb +0 -0
  212. data/spec/fixtures/views/extension_template_controller/markaby_index.html.mab +0 -0
  213. data/spec/fixtures/views/extension_template_controller/markaby_templates.html.mab +0 -1
  214. data/spec/fixtures/views/extension_template_controller/markaby_templates.js.mab +0 -1
  215. data/spec/fixtures/views/extension_template_controller/markaby_templates.xml.mab +0 -1
  216. data/spec/fixtures/views/extension_template_controller/render_multiple_partials.html.erb +0 -4
  217. data/spec/fixtures/views/extension_template_controller/render_nested_js.js.erb +0 -1
  218. data/spec/fixtures/views/extension_template_controller/render_nested_xml.xml.erb +0 -1
  219. data/spec/fixtures/views/haml.html.haml +0 -1
  220. data/spec/fixtures/views/haml.xml.haml +0 -2
  221. data/spec/fixtures/views/layout/application.html.erb +0 -1
  222. data/spec/fixtures/views/layout/application.xml.erb +0 -1
  223. data/spec/fixtures/views/layout/nested/example.html.erb +0 -1
  224. data/spec/fixtures/views/markaby.html.mab +0 -1
  225. data/spec/fixtures/views/nested/example/test.html.erb +0 -1
  226. data/spec/fixtures/views/partials/_erubis.html.erb +0 -1
  227. data/spec/fixtures/views/partials/_erubis_collection.html.erb +0 -1
  228. data/spec/fixtures/views/partials/_erubis_collection_with_locals.html.erb +0 -1
  229. data/spec/fixtures/views/partials/_erubis_new.html.erb +0 -1
  230. data/spec/fixtures/views/partials/_haml.html.haml +0 -1
  231. data/spec/fixtures/views/partials/_haml_collection.html.haml +0 -1
  232. data/spec/fixtures/views/partials/_haml_collection_with_locals.html.haml +0 -1
  233. data/spec/fixtures/views/partials/_haml_new.html.haml +0 -1
  234. data/spec/fixtures/views/partials/_markaby.html.mab +0 -1
  235. data/spec/fixtures/views/partials/_markaby_collection.html.mab +0 -1
  236. data/spec/fixtures/views/partials/_markaby_collection_with_locals.html.mab +0 -1
  237. data/spec/fixtures/views/partials/_markaby_new.html.mab +0 -1
  238. data/spec/fixtures/views/render_object_controller/render_object_with_template.html.erb +0 -1
  239. data/spec/fixtures/views/render_object_controller/render_object_with_template.js.erb +0 -1
  240. data/spec/fixtures/views/render_object_controller/render_object_with_template.xml.erb +0 -1
  241. data/spec/fixtures/views/template_views/interface__buffer_erubis.html.erb +0 -4
  242. data/spec/fixtures/views/template_views/interface__buffer_haml.html.haml +0 -7
  243. data/spec/fixtures/views/template_views/interface__buffer_markaby.html.mab +0 -7
  244. data/spec/fixtures/views/template_views/interface_capture_erubis.html.erb +0 -15
  245. data/spec/fixtures/views/template_views/interface_capture_haml.html.haml +0 -15
  246. data/spec/fixtures/views/template_views/interface_capture_markaby.html.mab +0 -4
  247. data/spec/fixtures/views/template_views/interface_concat_erubis.html.erb +0 -12
  248. data/spec/fixtures/views/template_views/interface_concat_haml.html.haml +0 -11
  249. data/spec/fixtures/views/template_views/interface_concat_markaby.html.mab +0 -14
  250. data/spec/fixtures/views/test.dir/the_template.html.erb +0 -1
  251. data/spec/merb/abstract_controller_spec.rb +0 -38
  252. data/spec/merb/assets_spec.rb +0 -207
  253. data/spec/merb/caching_spec.rb +0 -102
  254. data/spec/merb/config_spec.rb +0 -29
  255. data/spec/merb/controller_filters_spec.rb +0 -253
  256. data/spec/merb/controller_spec.rb +0 -126
  257. data/spec/merb/cookie_store_spec.rb +0 -72
  258. data/spec/merb/cookies_spec.rb +0 -96
  259. data/spec/merb/core_ext/class_spec.rb +0 -97
  260. data/spec/merb/core_ext/enumerable_spec.rb +0 -27
  261. data/spec/merb/core_ext/hash_spec.rb +0 -251
  262. data/spec/merb/core_ext/inflector_spec.rb +0 -34
  263. data/spec/merb/core_ext/kernel_spec.rb +0 -25
  264. data/spec/merb/core_ext/numeric_spec.rb +0 -26
  265. data/spec/merb/core_ext/object_spec.rb +0 -47
  266. data/spec/merb/core_ext/string_spec.rb +0 -22
  267. data/spec/merb/core_ext/symbol_spec.rb +0 -7
  268. data/spec/merb/dependency_spec.rb +0 -22
  269. data/spec/merb/dispatch_spec.rb +0 -528
  270. data/spec/merb/fake_request_spec.rb +0 -80
  271. data/spec/merb/generator_spec.rb +0 -248
  272. data/spec/merb/handler_spec.rb +0 -169
  273. data/spec/merb/mail_controller_spec.rb +0 -177
  274. data/spec/merb/mailer_spec.rb +0 -87
  275. data/spec/merb/multipart_spec.rb +0 -50
  276. data/spec/merb/part_controller_spec.rb +0 -124
  277. data/spec/merb/plugins_spec.rb +0 -80
  278. data/spec/merb/render_spec.rb +0 -469
  279. data/spec/merb/request_spec.rb +0 -287
  280. data/spec/merb/responder_spec.rb +0 -562
  281. data/spec/merb/router_spec.rb +0 -900
  282. data/spec/merb/server_spec.rb +0 -19
  283. data/spec/merb/template_spec.rb +0 -41
  284. data/spec/merb/upload_handler_spec.rb +0 -108
  285. data/spec/merb/version_spec.rb +0 -33
  286. data/spec/merb/view_context_spec.rb +0 -366
  287. data/spec/spec_generator_helper.rb +0 -34
  288. data/spec/spec_helper.rb +0 -101
  289. data/spec/spec_helpers/url_shared_behaviour.rb +0 -112
  290. data/test_unit_generators/merb_controller_test/merb_controller_test_generator.rb +0 -53
  291. data/test_unit_generators/merb_controller_test/templates/functional_test.rb +0 -17
  292. data/test_unit_generators/merb_controller_test/templates/helper_test.rb +0 -9
  293. data/test_unit_generators/merb_model_test/merb_model_test_generator.rb +0 -29
  294. data/test_unit_generators/merb_model_test/templates/model_test_unit_template.erb +0 -9
data/LICENSE CHANGED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2006 Ezra Zygmuntowicz
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README CHANGED
@@ -1,277 +0,0 @@
1
- = Merb
2
-
3
- Like Ruby on Rails, Merb (Mongrel + ERB) is an MVC framework. Unlike Rails, Merb is ORM-agnostic, JavaScript library agnostic, and template language agnostic, preferring plugins that add in support for a particular feature rather than trying to produce a monolithic library with everything in the core. In fact, this is a guiding principle of the project, which has led to third-party support for the ActiveRecord, DataMapper, and Sequel ORMs.
4
-
5
- In addition, it means that the core code in Merb is kept simple and well organised. This has multiple benefits. It means it's faster for one thing. It's also easier to understand, maintain and extend.
6
-
7
- === Get Merb
8
-
9
- The simplest way to get Merb is to install the gem:
10
-
11
- $ sudo gem install merb --include-dependencies
12
-
13
- If you want to contribute (or just use the latest code), you can build the gem from the svn trunk:
14
-
15
- $ sudo gem install mongrel json json_pure erubis mime-types rspec hpricot mocha rubigen haml markaby mailfactory Ruby2Ruby -y
16
- $ svn co http://svn.devjavu.com/merb/trunk merb
17
- $ cd merb
18
- $ rake install
19
-
20
- To generate a new merb app after the gem is installed:
21
-
22
- $ merb myapp
23
-
24
- ==== Dependencies
25
-
26
- Currently, Merb itself depends on the following gems:
27
-
28
- * mongrel
29
- * json_pure
30
- * erubis
31
- * mime-types
32
- * rspec
33
- * rubigen
34
- * ruby2ruby
35
- * rake
36
-
37
- ** If you are on windows see this blog post oj how to get up and running:
38
- http://www.ghostonthird.com/2007/11/17/merb-on-windows-it-works/
39
-
40
- You must also have either the json or json_pure gem installed. Note that the json gem
41
- provides a faster library but will not work with jRuby.
42
-
43
- Optionally, merb can take advantage of the following gems:
44
-
45
- * mailfactory (if you wish to use merb's mailers)
46
- * haml 1.8 or greater (if you wish to use HAML templates, i.e. .haml files)
47
- * markaby (if you wish to use Markaby template, i.e. .mab files)
48
- * builder (if you wish to use Builder templates, i.e. .rxml, .rerb or .builder files)
49
- * memcache-client (for use with Danga Interactive's memcached)
50
- * swiftiply
51
- * eventmachine
52
- * rcov
53
- * ruby-debug (if you want to use debugging functionality)
54
-
55
- You will also probably need to install your ORM of choice as well as any gem plugins you want to use (see below).
56
-
57
- === The +merb+ server
58
-
59
- right now you add your routes in
60
- the appdir/config/router.rb file. So by default it runs on port 4000
61
-
62
- $ cd /path/to/your/merb/app
63
- $ merb
64
-
65
- Or to start merb on a different port:
66
-
67
- $ merb -p 3500
68
-
69
- To start a cluster of merb servers you specify the first port and then how many
70
- servers you want spawned. SO this command will start a merb instance on ports
71
- 3000, 3001, 3002
72
-
73
- $ merb -p 3000 -c 3
74
-
75
- To start a Merb IRB console where all your models and other classes are pre loaded
76
- use the -i flag
77
-
78
- $ merb -i
79
-
80
- To enable ruby-debug support, start Merb with
81
-
82
- $ merb -D
83
-
84
- Now you can use the +debugger+ method everywhere in your code to open an rdebug session.
85
-
86
- To see all the available command line flags use:
87
-
88
- $ merb -h
89
-
90
-
91
- == Using Merb
92
-
93
- Merb uses the Model-View-Controller (MVC) pattern. Incoming requests are matched in the Router and
94
- directed to an appropriate controller action.
95
-
96
- === Model
97
-
98
- Merb does not come with its own model layer. While you are free to use whatever data system you like,
99
- the merb core team does maintain plugins for the following Object Relational Mappers (ORM's):
100
-
101
- ActiveRecord:: The same ORM that Rails uses. (<tt>sudo gem install merb_activerecord</tt>)
102
- DataMapper:: Fairly new ORM. (<tt>sudo gem install merb_datamapper</tt>)
103
- Sequel:: Fairly new ORM. (<tt>sudo gem install merb_sequel</tt>)
104
-
105
- To use your choice ORM, install the appropriate gem and uncomment the appropriate +use_orm+ line in
106
- Merb.root/config/dependencies.rb
107
-
108
- === Controllers
109
-
110
- (Merb.root/app/controllers/*)
111
-
112
- Merb controllers inherit from Merb::Controller and contain built in view/template rendering.
113
- Incoming requests are usually mapped to a specific method in a controller. For example, using
114
- the default routes, a request to http://www.yourapp.com/posts/show/1 would call the the #show
115
- method of your PostsController (and params[:id] would = 1.)
116
-
117
- The return value of your action function gets sent back to the client as the view. In most cases,
118
- you are going to want to end your functions with a call to +render+. By default, +render+ will
119
- render the view template associated with your action (in default merb that would be
120
- Merb.root/app/views/<controller>/<action>.html.erb - see the View section for more info.)
121
-
122
- Controllers can be generated by calling Merb.root/script/generate controller ControllerName.
123
- By default, generated controllers inherit from the Application class (Merb.root/app/controllers/application.rb)
124
- which itself inherits from Merb:Controller. Application is a good place to put code pertinent to all controllers.
125
- An example would be setting a filter to check if a user is logged in or to preload user data for each controller.
126
-
127
- ==== +before+ and +after+ filters
128
-
129
- Use the +before+ method in your controllers. +before+ accepts either a symbol, string or a Proc/lambda object. If you give it a symbol it will call a method with the same name as the symbol. If you give it a proc that takes one argument it will call the proc with the current controller as that argument. You can use :only and :exclude as options to your filters to exclude or include actions from certain filters. :only and :exclude take :symbols or [:sym, :sam] array of symbols.
130
-
131
- class Foo < Merb::Controller
132
-
133
- before :setup_user, :only => :foo
134
- before lambda {|c| c.headers['X-Foo] = 'bar' }, :exclude => [:foo, :baz]
135
-
136
- def setup_user
137
- # blah blah
138
- end
139
-
140
- def foo
141
- # blah
142
- end
143
-
144
- def regular_action
145
- # blah
146
- end
147
-
148
- end
149
-
150
- To stop the before filter chain you use throw :halt with a few options:
151
-
152
- # halts the filter chain and calls filters_halted which you can override
153
- # in your controller to specialize it.
154
-
155
- throw :halt
156
-
157
- # halts the filters and calls the method named after the symbol:
158
-
159
- throw :halt, :other_action
160
-
161
- # halts the filter chain and returns the result of the Proc being called
162
-
163
- throw :halt, Proc.new{ |c| c.redirect "/foo" }
164
-
165
- # halts the chain and returns whatever is in the string
166
-
167
- throw :halt, "<h1>You don't have permissions dude!</h1>"
168
-
169
- or even render templates:
170
-
171
- throw :halt, render 'foo'
172
- throw :halt, partial 'foo'
173
-
174
- After filters accept a symbol, string or Proc and call that proc with the controller:
175
-
176
- after Proc.new {|c| Tidy.new(c.body) }, :only => :index
177
-
178
-
179
- === Views
180
-
181
- (Merb.root/app/views/*)
182
-
183
- A view can be loosely defined as any data sent back to the client (a "view" of your data.)
184
- By default, Merb controllers send the return value of your controller action as the view.
185
- The Controller#render method simply renders the specified view and returns it as a string.
186
- By default, a call to +render+ without any options renders the view template associated
187
- with that controller action. Using the default ERB templating system, this means that a
188
- call to +render+ in Posts#index would render the file Merb.root/app/views/posts/index.html.erb
189
-
190
- ==== Layouts
191
-
192
- (Merb.root/app/views/layout/*)
193
-
194
- Layouts are generic templates in which your specific view templates are rendered. A sample
195
- layout could look like:
196
-
197
- <html>
198
- <head><title>My Application Layout</title></head>
199
- <body>
200
- <img src="header" />
201
- <div id="content">
202
- <%= catch_content :layout %>
203
- </div>
204
- </body>
205
- </html>
206
-
207
- By default, +render+ will look for a corresponding layout for your controller in the form
208
- of Merb.root/app/views/layout/<controller>.html.erb . If no specific layout is present,
209
- +render+ will attempt to use Merb.root/app/view/layout/application.html.erb
210
-
211
- <i>See #render for more details/options, as well as how to use different templating systems
212
- in your app.</i>
213
-
214
- You can return several different types of values from your controller actions:
215
-
216
- * String: Any string will get sent to the browser as standard text/html
217
- * File/IO: Any file descriptor will get handed over to mongrel to be streamed to the client.
218
- * Proc Object: The object will be called and the return value sent to the client.
219
-
220
- That last point has some cool connotations if you think about it. Merb does
221
- have a mutex lock around the call to your controller’s action anywhere that
222
- you can call AR objects. Merb’s lock is way smaller then rails giant lock
223
- though and allows for many more concurrent requests to be handled by one
224
- process. By returning a Proc object from your action, you allow merb to
225
- release the lock and the proc is called in multi threaded way. This allows
226
- for all kinds of cool streaming and ‘futures’ where you return the proc and
227
- release the mutex. It’s basically like handing over the proc to mongrel and
228
- mongrel handles calling it in a thread safe manner.
229
-
230
- === Helpers
231
-
232
- (Merb.root/app/helpers/*)
233
-
234
- app/helpers/global_helper.rb will be available to all of your views.
235
- Helpers named after your controller plus _helper.rb will be included in the views
236
- for that controller only.
237
-
238
- === File uploads
239
- When a file is uploaded with Merb, it gets put in a Tempfile. So
240
- you just want to copy it to the right place on the filesystem.
241
-
242
- def upload
243
- puts params[:file].inspect
244
- FileUtils.mv params[:file][:tempfile].path, Merb.root+"/uploads/#{params[:file][:filename]}"
245
- render
246
- end
247
-
248
- A file upload will have a hash of params like this:
249
-
250
- {
251
- :filename => File.basename(filename),
252
- :content_type => content_type,
253
- :tempfile => <Tempfile>,
254
- :size => File.size(body)
255
- }
256
-
257
- == Merb app layout
258
-
259
- merb_app:
260
-
261
- app
262
- controllers
263
- helpers
264
- mailers
265
- models
266
- parts
267
- views
268
- config
269
- gems
270
- lib
271
- log
272
- public
273
- Rakefile
274
- script
275
- spec
276
- test
277
- unit
data/Rakefile CHANGED
@@ -1,237 +1,118 @@
1
- require "rake"
2
- require "rake/clean"
3
- require "rake/gempackagetask"
4
- require "rake/rdoctask"
5
- require "rake/testtask"
6
- require "spec/rake/spectask"
7
- require "fileutils"
1
+ ## THESE ARE CRUCIAL
2
+ module Merb
3
+ # Set this to the version of merb-core that you are building against/for
4
+ VERSION = "0.9.2"
8
5
 
9
- def __DIR__
10
- File.dirname(__FILE__)
6
+ # Set this to the version of merb-more you plan to release
7
+ MORE_VERSION = "0.9.2"
11
8
  end
12
9
 
13
- require __DIR__ + "/tools/rakehelp"
14
- require __DIR__ + "/tools/annotation_extract"
15
-
10
+ require "rake/clean"
11
+ require "rake/gempackagetask"
12
+ require 'fileutils'
16
13
  include FileUtils
17
14
 
18
- NAME = "merb"
19
-
20
- require "lib/merb/version"
21
-
22
- ##############################################################################
23
- # Packaging & Installation
24
- ##############################################################################
25
- CLEAN.include ["**/.*.sw?", "*.gem", ".config"]
26
-
27
- windows = (PLATFORM =~ /win32|cygwin/)
28
-
29
- SUDO = windows ? "" : "sudo"
15
+ gems = %w[
16
+ merb-action-args merb-assets merb-gen merb-haml
17
+ merb-builder merb-mailer merb-parts merb-cache
18
+ ]
30
19
 
31
- setup_clean ["pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache"]
32
-
33
- desc "Packages up Merb."
34
- task :default => :package
35
-
36
- task :merb => [:clean, :rdoc, :package]
37
-
38
- spec = Gem::Specification.new do |s|
39
- s.name = NAME
40
- s.version = Merb::VERSION
20
+ merb_more_spec = Gem::Specification.new do |s|
21
+ s.name = "merb-more"
22
+ s.version = Merb::MORE_VERSION
41
23
  s.platform = Gem::Platform::RUBY
42
24
  s.author = "Ezra Zygmuntowicz"
43
25
  s.email = "ez@engineyard.com"
44
- s.homepage = "http://merb.devjavu.com"
45
- s.summary = "Merb == Mongrel + Erb. Pocket rocket web framework."
46
- s.bindir = "bin"
26
+ s.homepage = "http://www.merbivore.com"
27
+ s.summary = "(merb - merb-core) == merb-more. The Full Stack. Take what you need; leave what you don't."
47
28
  s.description = s.summary
48
- s.executables = %w( merb )
49
- s.require_path = "lib"
50
- s.files = %w( LICENSE README Rakefile TODO ) + [Merb.svn_revision_filename] + Dir["{bin,spec,lib,examples,app_generators,merb_generators,merb_default_generators,rspec_generators,test_unit_generators,script}/**/*"]
51
-
52
- # rdoc
53
- s.has_rdoc = true
54
- s.extra_rdoc_files = %w( README LICENSE TODO )
55
- #s.rdoc_options += RDOC_OPTS + ["--exclude", "^(app|uploads)"]
56
-
57
- # Dependencies
58
- s.add_dependency "mongrel"
59
- s.add_dependency "erubis"
60
- #s.add_dependency "haml", ">= 1.8"
61
- s.add_dependency "mime-types"
62
- s.add_dependency "rubigen"
63
- s.add_dependency "rake"
64
- s.add_dependency "ruby2ruby"
65
- s.add_dependency "json_pure"
66
-
67
- # Requirements
68
- s.requirements << "install the json gem to get faster json parsing"
69
- s.required_ruby_version = ">= 1.8.4"
70
- end
71
-
72
- Rake::GemPackageTask.new(spec) do |package|
73
- # package.need_tar = true
74
- package.gem_spec = spec
75
- end
76
-
77
- desc "Run :package and install the resulting .gem"
78
- task :install => :package do
79
- sh %{#{SUDO} gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
29
+ s.files = %w( LICENSE README Rakefile TODO lib/merb-more.rb )
30
+ s.add_dependency "merb-core", ">= #{Merb::VERSION}"
31
+ gems.each do |gem|
32
+ s.add_dependency gem, [">= #{Merb::VERSION}", "<= 1.0"]
33
+ end
80
34
  end
81
35
 
82
- desc "Run :clean and uninstall the .gem"
83
- task :uninstall => :clean do
84
- sh %{#{SUDO} gem uninstall #{NAME}}
36
+ merb_spec = Gem::Specification.new do |s|
37
+ s.name = "merb"
38
+ s.version = Merb::MORE_VERSION
39
+ s.platform = Gem::Platform::RUBY
40
+ s.author = "Ezra Zygmuntowicz"
41
+ s.email = "ez@engineyard.com"
42
+ s.homepage = "http://www.merbivore.com"
43
+ s.summary = "(merb-core + merb-more) == all of Merb"
44
+ s.description = s.summary
45
+ s.files = %w( LICENSE README Rakefile TODO )
46
+ s.add_dependency "merb-core", "= #{Merb::VERSION}"
47
+ s.add_dependency "merb-more", "= #{Merb::MORE_VERSION}"
85
48
  end
86
49
 
87
- ##############################################################################
88
- # Documentation
89
- ##############################################################################
90
- task :doc => [:rdoc]
91
- namespace :doc do
92
-
93
- Rake::RDocTask.new do |rdoc|
94
- files = ["README", "LICENSE", "CHANGELOG", "lib/**/*.rb"]
95
- rdoc.rdoc_files.add(files)
96
- rdoc.main = "README"
97
- rdoc.title = "Merb Docs"
98
- rdoc.template = __DIR__ + "/tools/allison-2.0.2/lib/allison.rb"
99
- rdoc.rdoc_dir = "doc/rdoc"
100
- rdoc.options << "--line-numbers" << "--inline-source"
101
- end
50
+ CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "lib/merb-more.rb"]
102
51
 
103
- desc "run webgen"
104
- task :webgen do
105
- sh %{cd doc/site; webgen}
106
- end
107
-
108
- desc "rdoc to rubyforge"
109
- task :rubyforge do
110
- # sh %{rake doc}
111
- sh %{#{SUDO} chmod -R 755 doc} unless windows
112
- sh %{/usr/bin/scp -r -p doc/rdoc/* ezmobius@rubyforge.org:/var/www/gforge-projects/merb}
113
- end
114
-
115
- end
52
+ windows = (PLATFORM =~ /win32|cygwin/) rescue nil
116
53
 
117
- ##############################################################################
118
- # rSpec & rcov
119
- ##############################################################################
120
- desc "Run :specs, :rcov"
121
- task :aok => [:specs, :rcov]
54
+ SUDO = windows ? "" : "sudo"
122
55
 
123
- desc "Run all specs"
124
- Spec::Rake::SpecTask.new("specs") do |t|
125
- t.spec_opts = ["--format", "specdoc", "--colour"]
126
- t.spec_files = Dir["spec/**/*_spec.rb"].sort
127
- end
56
+ # desc "Installs Merb More."
57
+ # task :default => :install
128
58
 
129
- desc "Run a specific spec with TASK=xxxx"
130
- Spec::Rake::SpecTask.new("spec") do |t|
131
- t.spec_opts = ["--format", "specdoc", "--colour"]
132
- t.libs = ["lib", "server/lib" ]
133
- t.spec_files = (ENV["TASK"] || '').split(',').map do |task|
134
- "spec/merb/#{task}_spec.rb"
135
- end
59
+ Rake::GemPackageTask.new(merb_more_spec) do |package|
60
+ package.gem_spec = merb_more_spec
136
61
  end
137
62
 
138
- desc "Run all specs output html"
139
- Spec::Rake::SpecTask.new("specs_html") do |t|
140
- t.spec_opts = ["--format", "html"]
141
- t.libs = ["lib", "server/lib" ]
142
- t.spec_files = Dir["spec/**/*_spec.rb"].sort
63
+ Rake::GemPackageTask.new(merb_spec) do |package|
64
+ package.gem_spec = merb_spec
143
65
  end
144
66
 
145
- desc "RCov"
146
- Spec::Rake::SpecTask.new("rcov") do |t|
147
- t.rcov_opts = ["--exclude", "gems", "--exclude", "spec"]
148
- t.spec_opts = ["--format", "specdoc", "--colour"]
149
- t.rcov_opts = ["--exclude","gems"]
150
- t.spec_files = Dir["spec/**/*_spec.rb"].sort
151
- t.libs = ["lib", "server/lib" ]
152
- t.rcov = true
67
+ desc "Install it all"
68
+ task :install => [:install_gems, :package] do
69
+ sh %{#{SUDO} gem install --local pkg/merb-more-#{Merb::MORE_VERSION}.gem --no-update-sources}
70
+ sh %{#{SUDO} gem install --local pkg/merb-#{Merb::MORE_VERSION}.gem --no-update-sources}
153
71
  end
154
72
 
155
- STATS_DIRECTORIES = [
156
- ['Code', 'lib/'],
157
- ['Unit tests', 'specs']
158
- ].collect { |name, dir| [ name, "./#{dir}" ] }.
159
- select { |name, dir| File.directory?(dir) }
160
-
161
- desc "Report code statistics (KLOCs, etc) from the application"
162
- task :stats do
163
- require __DIR__ + "/tools/code_statistics"
164
- # require "extra/stats"
165
- verbose = true
166
- CodeStatistics.new(*STATS_DIRECTORIES).to_s
73
+ desc "Build the merb-more gems"
74
+ task :build_gems do
75
+ gems.each do |dir|
76
+ Dir.chdir(dir){ sh "rake package" }
77
+ end
167
78
  end
168
79
 
169
- task :release => :package do
170
- if ENV["RELEASE"]
171
- puts %{rubyforge add_release merb merb "#{ENV["RELEASE"]}" pkg/#{NAME}-#{Merb::VERSION}.gem}
172
- else
173
- puts "Usage: rake release RELEASE='Clever tag line goes here'"
80
+ desc "Install the merb-more sub-gems"
81
+ task :install_gems do
82
+ gems.each do |dir|
83
+ Dir.chdir(dir){ sh "#{SUDO} rake install" }
174
84
  end
175
85
  end
176
86
 
177
- ##############################################################################
178
- # SVN
179
- ##############################################################################
180
- namespace :repo do
181
-
182
- desc "Add new files to repository"
183
- task :add do
184
- if File.directory?(".git")
185
- system "git add *"
186
- elsif File.directory?(".svn")
187
- system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add"
188
- end
87
+ desc "Uninstall the merb-more sub-gems"
88
+ task :uninstall_gems do
89
+ gems.each do |sub_gem|
90
+ sh %{#{SUDO} gem uninstall #{sub_gem}}
189
91
  end
92
+ end
190
93
 
191
- desc "Fetch changes from master repository"
192
- task :rebase do
193
- if File.directory?(".git")
194
- system "git stash ; git svn rebase ; git stash apply"
195
- elsif File.directory?(".svn")
196
- system "svn update"
197
- end
198
- end
199
-
200
- desc "commit modified changes to the repository"
201
- task :commit do
202
- if File.directory?(".git")
203
- system "git commit"
204
- elsif File.directory?(".svn")
205
- system "svn commit"
94
+ task :package => ["lib/merb-more.rb"]
95
+ desc "Create merb-more.rb"
96
+ task "lib/merb-more.rb" do
97
+ mkdir_p "lib"
98
+ File.open("lib/merb-more.rb","w+") do |file|
99
+ file.puts "### AUTOMATICALLY GENERATED. DO NOT EDIT."
100
+ gems.each do |gem|
101
+ next if gem == "merb-gen"
102
+ file.puts "require '#{gem}'"
206
103
  end
207
104
  end
208
-
209
105
  end
210
106
 
211
- # Run specific tests or test files. Searches nested spec directories as well.
212
- #
213
- # Based on a technique popularized by Geoffrey Grosenbach
214
- rule "" do |t|
215
- spec_cmd = (RUBY_PLATFORM =~ /java/) ? "jruby -S spec" : "spec"
216
- # spec:spec_file:spec_name
217
- if /spec:(.*)$/.match(t.name)
218
- arguments = t.name.split(':')
219
-
220
- file_name = arguments[1]
221
- spec_name = arguments[2..-1]
222
-
223
- spec_filename = "#{file_name}_spec.rb"
224
- specs = Dir["spec/merb/**/#{spec_filename}"]
225
-
226
- if path = specs.detect { |f| spec_filename == File.basename(f) }
227
- run_file_name = path
228
- else
229
- puts "No specs found for #{t.name.inspect}"
230
- exit
107
+ desc "Bundle up all the merb-more gems"
108
+ task :bundle => [:package, :build_gems] do
109
+ mkdir_p "bundle"
110
+ cp "pkg/merb-#{Merb::MORE_VERSION}.gem", "bundle"
111
+ cp "pkg/merb-more-#{Merb::MORE_VERSION}.gem", "bundle"
112
+ gems.each do |gem|
113
+ File.open("#{gem}/Rakefile") do |rakefile|
114
+ rakefile.read.detect {|l| l =~ /^VERSION\s*=\s*"(.*)"$/ }
115
+ sh %{cp #{gem}/pkg/#{gem}-#{$1}.gem bundle/}
231
116
  end
232
-
233
- example = " -e '#{spec_name}'" unless spec_name.empty?
234
-
235
- sh "#{spec_cmd} #{run_file_name} --format specdoc --colour #{example}"
236
117
  end
237
118
  end