hobo 0.7.5 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. data/{hobo_files/plugin/CHANGES.txt → CHANGES.txt} +391 -0
  2. data/Manifest +146 -0
  3. data/{hobo_files/plugin/README → README} +0 -0
  4. data/bin/hobo +13 -26
  5. data/dryml_generators/rapid/cards.dryml.erb +55 -0
  6. data/dryml_generators/rapid/forms.dryml.erb +43 -0
  7. data/dryml_generators/rapid/pages.dryml.erb +284 -0
  8. data/hobo.gemspec +168 -0
  9. data/init.rb +9 -0
  10. data/lib/action_view_extensions/helpers/tag_helper.rb +7 -0
  11. data/lib/active_record/association_collection.rb +54 -0
  12. data/{hobo_files/plugin/lib → lib}/active_record/association_proxy.rb +12 -4
  13. data/{hobo_files/plugin/lib → lib}/active_record/association_reflection.rb +7 -1
  14. data/{hobo_files/plugin/lib → lib}/extensions/test_case.rb +17 -17
  15. data/{hobo_files/plugin/lib → lib}/hobo.rb +193 -100
  16. data/{hobo_files/plugin/lib → lib}/hobo/authentication_support.rb +8 -8
  17. data/{hobo_files/plugin/lib → lib}/hobo/bundle.rb +90 -89
  18. data/{hobo_files/plugin/lib → lib}/hobo/composite_model.rb +21 -21
  19. data/{hobo_files/plugin/lib → lib}/hobo/controller.rb +38 -25
  20. data/{hobo_files/plugin/lib → lib}/hobo/dev_controller.rb +10 -6
  21. data/lib/hobo/dryml.rb +167 -0
  22. data/{hobo_files/plugin/lib → lib}/hobo/dryml/dryml_builder.rb +28 -25
  23. data/lib/hobo/dryml/dryml_generator.rb +210 -0
  24. data/{hobo_files/plugin/lib → lib}/hobo/dryml/dryml_support_controller.rb +1 -1
  25. data/lib/hobo/dryml/parser.rb +3 -0
  26. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/attribute.rb +6 -6
  27. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/base_parser.rb +16 -16
  28. data/lib/hobo/dryml/parser/document.rb +57 -0
  29. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/element.rb +7 -7
  30. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/elements.rb +9 -9
  31. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/source.rb +3 -3
  32. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/text.rb +3 -3
  33. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/tree_parser.rb +3 -3
  34. data/{hobo_files/plugin/lib → lib}/hobo/dryml/part_context.rb +26 -26
  35. data/{hobo_files/plugin/lib → lib}/hobo/dryml/scoped_variables.rb +15 -15
  36. data/{hobo_files/plugin/lib → lib}/hobo/dryml/tag_parameters.rb +10 -10
  37. data/{hobo_files/plugin/lib → lib}/hobo/dryml/taglib.rb +43 -37
  38. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template.rb +290 -208
  39. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template_environment.rb +173 -115
  40. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template_handler.rb +19 -24
  41. data/lib/hobo/find_for.rb +95 -0
  42. data/{hobo_files/plugin/lib → lib}/hobo/generator.rb +2 -1
  43. data/{hobo_files/plugin/lib → lib}/hobo/guest.rb +12 -4
  44. data/{hobo_files/plugin/lib → lib}/hobo/hobo_helper.rb +146 -117
  45. data/lib/hobo/include_in_save.rb +43 -0
  46. data/lib/hobo/lifecycles.rb +94 -0
  47. data/lib/hobo/lifecycles/actions.rb +73 -0
  48. data/lib/hobo/lifecycles/creator.rb +76 -0
  49. data/lib/hobo/lifecycles/lifecycle.rb +205 -0
  50. data/lib/hobo/lifecycles/state.rb +23 -0
  51. data/lib/hobo/lifecycles/transition.rb +66 -0
  52. data/{hobo_files/plugin/lib → lib}/hobo/model.rb +306 -217
  53. data/{hobo_files/plugin/lib → lib}/hobo/model_controller.rb +342 -213
  54. data/{hobo_files/plugin/lib → lib}/hobo/model_router.rb +151 -120
  55. data/{hobo_files/plugin/lib → lib}/hobo/model_support.rb +9 -9
  56. data/{hobo_files/plugin/lib → lib}/hobo/rapid_helper.rb +30 -23
  57. data/{hobo_files/plugin/lib → lib}/hobo/scopes.rb +22 -68
  58. data/{hobo_files/plugin/lib → lib}/hobo/scopes/apply_scopes.rb +5 -5
  59. data/lib/hobo/scopes/association_proxy_extensions.rb +47 -0
  60. data/{hobo_files/plugin/lib → lib}/hobo/scopes/automatic_scopes.rb +104 -79
  61. data/lib/hobo/scopes/named_scope_extensions.rb +27 -0
  62. data/{hobo_files/plugin/lib → lib}/hobo/static_tags +1 -11
  63. data/{hobo_files/plugin/lib → lib}/hobo/undefined.rb +1 -1
  64. data/{hobo_files/plugin/lib → lib}/hobo/undefined_access_error.rb +0 -0
  65. data/{hobo_files/plugin/lib → lib}/hobo/user.rb +27 -25
  66. data/{hobo_files/plugin/lib → lib}/hobo/user_controller.rb +80 -34
  67. data/{hobo_files/plugin/generators → rails_generators}/hobo/hobo_generator.rb +7 -7
  68. data/rails_generators/hobo/templates/application.css +0 -0
  69. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/application.dryml +0 -2
  70. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/dryml-support.js +0 -0
  71. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/guest.rb +0 -0
  72. data/rails_generators/hobo/templates/initializer.rb +9 -0
  73. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/USAGE +0 -0
  74. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/hobo_front_controller_generator.rb +1 -3
  75. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/controller.rb +1 -1
  76. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/functional_test.rb +0 -0
  77. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/helper.rb +0 -0
  78. data/rails_generators/hobo_front_controller/templates/index.dryml +25 -0
  79. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/USAGE +0 -0
  80. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/hobo_model_generator.rb +0 -0
  81. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/fixtures.yml +0 -0
  82. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/model.rb +0 -0
  83. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/unit_test.rb +0 -0
  84. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/USAGE +0 -0
  85. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/hobo_model_controller_generator.rb +0 -7
  86. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/controller.rb +0 -0
  87. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/functional_test.rb +0 -0
  88. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/helper.rb +0 -0
  89. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/hobo_model_resource_generator.rb +0 -0
  90. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/controller.rb +0 -0
  91. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/functional_test.rb +0 -0
  92. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/helper.rb +0 -0
  93. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/hobo_rapid_generator.rb +21 -11
  94. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/IE7.js +1 -1
  95. data/rails_generators/hobo_rapid/templates/blank.gif +0 -0
  96. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/hobo-rapid.css +0 -0
  97. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/hobo-rapid.js +175 -104
  98. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/lowpro.js +0 -0
  99. data/rails_generators/hobo_rapid/templates/nicEditorIcons.gif +0 -0
  100. data/rails_generators/hobo_rapid/templates/nicedit.js +91 -0
  101. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/reset.css +0 -0
  102. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/fieldbg.gif +0 -0
  103. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/pencil.png +0 -0
  104. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/small_close.png +0 -0
  105. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/spinner.gif +0 -0
  106. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/stylesheets/clean.css +80 -71
  107. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +6 -1
  108. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/views/clean.dryml +4 -4
  109. data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +73 -0
  110. data/rails_generators/hobo_subsite/templates/application.dryml +1 -0
  111. data/rails_generators/hobo_subsite/templates/controller.rb +5 -0
  112. data/rails_generators/hobo_subsite/templates/site_taglib.dryml +13 -0
  113. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/USAGE +0 -0
  114. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/hobo_user_controller_generator.rb +0 -0
  115. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/controller.rb +0 -0
  116. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/functional_test.rb +0 -0
  117. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/helper.rb +0 -0
  118. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/USAGE +0 -0
  119. data/rails_generators/hobo_user_model/hobo_user_model_generator.rb +30 -0
  120. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/templates/fixtures.yml +0 -0
  121. data/rails_generators/hobo_user_model/templates/forgot_password.erb +10 -0
  122. data/rails_generators/hobo_user_model/templates/mailer.rb +14 -0
  123. data/rails_generators/hobo_user_model/templates/model.rb +55 -0
  124. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/templates/unit_test.rb +0 -0
  125. data/script/destroy +14 -0
  126. data/script/generate +14 -0
  127. data/{hobo_files/plugin/taglibs → taglibs}/core.dryml +6 -7
  128. data/{hobo_files/plugin/taglibs → taglibs}/rapid.dryml +36 -67
  129. data/{hobo_files/plugin/taglibs → taglibs}/rapid_document_tags.dryml +7 -24
  130. data/{hobo_files/plugin/taglibs → taglibs}/rapid_editing.dryml +51 -50
  131. data/{hobo_files/plugin/taglibs → taglibs}/rapid_forms.dryml +62 -56
  132. data/taglibs/rapid_generics.dryml +33 -0
  133. data/taglibs/rapid_lifecycles.dryml +43 -0
  134. data/{hobo_files/plugin/taglibs → taglibs}/rapid_navigation.dryml +23 -23
  135. data/taglibs/rapid_pages.dryml +183 -0
  136. data/{hobo_files/plugin/taglibs → taglibs}/rapid_plus.dryml +30 -5
  137. data/{hobo_files/plugin/taglibs → taglibs}/rapid_support.dryml +3 -4
  138. data/taglibs/rapid_user_pages.dryml +179 -0
  139. data/{hobo_files/plugin/tasks → tasks}/environments.rake +0 -0
  140. data/{hobo_files/plugin/tasks → tasks}/fix_dryml.rake +0 -0
  141. data/{hobo_files/plugin/tasks → tasks}/generate_tag_reference.rb +21 -22
  142. data/tasks/hobo_tasks.rake +32 -0
  143. data/test/test_generator_helper.rb +29 -0
  144. data/test/test_helper.rb +1 -0
  145. data/test/test_hobo_model_controller_generator.rb +56 -0
  146. data/{hobo_files/plugin/uninstall.rb → uninstall.rb} +0 -0
  147. metadata +240 -225
  148. data/README.txt +0 -18
  149. data/hobo_files/plugin/LICENSE.txt +0 -22
  150. data/hobo_files/plugin/Rakefile +0 -96
  151. data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +0 -24
  152. data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +0 -19
  153. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/banner.gif +0 -0
  154. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-bodytop.gif +0 -0
  155. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-01.gif +0 -0
  156. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-02.gif +0 -0
  157. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-03.gif +0 -0
  158. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-04.gif +0 -0
  159. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-bottom.gif +0 -0
  160. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-left.gif +0 -0
  161. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-right.gif +0 -0
  162. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-top.gif +0 -0
  163. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-blue.gif +0 -0
  164. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-dblue.gif +0 -0
  165. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-green.gif +0 -0
  166. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-purple.gif +0 -0
  167. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-red.gif +0 -0
  168. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/logo.gif +0 -0
  169. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/plus.png +0 -0
  170. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/spinner.gif +0 -0
  171. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-dblue.gif +0 -0
  172. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-green.gif +0 -0
  173. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-purple.gif +0 -0
  174. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-red.gif +0 -0
  175. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-01.gif +0 -0
  176. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-02.gif +0 -0
  177. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-03.gif +0 -0
  178. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-04.gif +0 -0
  179. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-bottom.gif +0 -0
  180. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-left.gif +0 -0
  181. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-right.gif +0 -0
  182. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-top.gif +0 -0
  183. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +0 -400
  184. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +0 -96
  185. data/hobo_files/plugin/generators/hobo_user_model/hobo_user_model_generator.rb +0 -25
  186. data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +0 -56
  187. data/hobo_files/plugin/init.rb +0 -101
  188. data/hobo_files/plugin/lib/action_view_extensions/base.rb +0 -15
  189. data/hobo_files/plugin/lib/active_record/has_many_association.rb +0 -55
  190. data/hobo_files/plugin/lib/active_record/has_many_through_association.rb +0 -20
  191. data/hobo_files/plugin/lib/hobo/dryml.rb +0 -165
  192. data/hobo_files/plugin/lib/hobo/dryml/parser/document.rb +0 -53
  193. data/hobo_files/plugin/lib/hobo/scopes/association_proxy_extensions.rb +0 -33
  194. data/hobo_files/plugin/lib/hobo/scopes/defined_scope_proxy_extender.rb +0 -90
  195. data/hobo_files/plugin/lib/hobo/scopes/scope_reflection.rb +0 -18
  196. data/hobo_files/plugin/lib/hobo/scopes/scoped_proxy.rb +0 -55
  197. data/hobo_files/plugin/taglib-docs/core.markdown +0 -165
  198. data/hobo_files/plugin/taglib-docs/rapid.markdown +0 -677
  199. data/hobo_files/plugin/taglib-docs/rapid_document_tags.markdown +0 -240
  200. data/hobo_files/plugin/taglib-docs/rapid_editing.markdown +0 -418
  201. data/hobo_files/plugin/taglib-docs/rapid_forms.markdown +0 -562
  202. data/hobo_files/plugin/taglib-docs/rapid_generics.markdown +0 -187
  203. data/hobo_files/plugin/taglib-docs/rapid_navigation.markdown +0 -214
  204. data/hobo_files/plugin/taglib-docs/rapid_pages.markdown +0 -530
  205. data/hobo_files/plugin/taglib-docs/rapid_plus.markdown +0 -65
  206. data/hobo_files/plugin/taglib-docs/rapid_support.markdown +0 -50
  207. data/hobo_files/plugin/taglib-docs/rapid_user_pages.markdown +0 -129
  208. data/hobo_files/plugin/taglibs/rapid_generics.dryml +0 -117
  209. data/hobo_files/plugin/taglibs/rapid_pages.dryml +0 -359
  210. data/hobo_files/plugin/taglibs/rapid_user_pages.dryml +0 -104
  211. data/hobo_files/plugin/tasks/dump_fixtures.rake +0 -70
  212. data/hobo_files/plugin/tasks/hobo_tasks.rake +0 -17
@@ -1,96 +0,0 @@
1
- <include src="rapid" plugin="hobo"/>
2
-
3
- <def tag="page" extend-with="theme">
4
- <page-without-theme merge>
5
- <wrapper:>
6
- <div id="page-top">
7
- <div id="page-right">
8
- <div id="page-bottom">
9
- <div id="page-left">
10
- <div id="page-corner02">
11
- <div id="page-corner04">
12
- <div id="page-corner03">
13
- <div id="page-corner01">
14
- <div id="page-inner-top">
15
- <param-content/>
16
- </div></div></div></div></div></div></div></div></div>
17
- </wrapper>
18
-
19
- <stylesheets:><param-content/><theme-stylesheet/></stylesheets>
20
-
21
- </page-without-theme>
22
- </def>
23
-
24
-
25
- <def tag="old-page" attrs="title-prefix, title">
26
- <% title ||= type_name + ": " + name(:no_wrapper => true) %>
27
- <doctype version="HTML 4.01 Transitional"/>
28
- <html>
29
- <head param="head">
30
- <title><%= title_prefix %><%= title %></title>
31
- <theme-stylesheet/>
32
- <%= javascript_include_tag :defaults %>
33
- <hobo-rapid-javascripts param="rapid-javascripts"/>
34
- </head>
35
-
36
- <body onload="Hobo.applyEvents()" param="body">
37
-
38
- <ajax-progress/>
39
-
40
- <div id="page">
41
-
42
- <div id="page-top">
43
- <div id="page-right">
44
- <div id="page-bottom">
45
- <div id="page-left">
46
- <div id="page-corner02">
47
- <div id="page-corner04">
48
- <div id="page-corner03">
49
- <div id="page-corner01">
50
- <div id="page-inner-top">
51
-
52
- <div id='header' param="header">
53
- <div class="logo" param="logo"><theme-image src="logo.gif"/></div>
54
- <nav param>
55
- <magic-nav class="main-nav" param="main-nav"/>
56
- <if test="&defined_route? :login"><account-nav param/></if>
57
- </nav>
58
- </div>
59
-
60
- <flash-message/>
61
-
62
- <div param="intro"></div>
63
- <div param="main">
64
- <div class="maincol" param="maincol"/>
65
- <div class="sidecol" param="sidecol"/>
66
- </div>
67
-
68
- <clearer/>
69
-
70
- </div></div></div></div></div></div></div></div></div>
71
- </div>
72
-
73
- </body>
74
- </html>
75
- </def>
76
-
77
-
78
- <def tag="panel">
79
- <div class="panel" merge-attrs="&true">
80
- <div class="panel-top"><div class="panel-right">
81
- <div class="panel-bottom"><div class="panel-left">
82
- <div class="panel-corner02"><div class="panel-corner04">
83
- <div class="panel-corner03"><div class="panel-corner01">
84
-
85
- <do param="default"/>
86
-
87
- </div></div></div></div></div></div></div></div>
88
- </div>
89
- </def>
90
-
91
- <def tag="navbar" attrs="items,current">
92
- <repeat with="&items">
93
- <div class='nav-item <%= "current" if current == this[0] %>'><%= link_to this[0].upcase, this[1] %></div>
94
- </repeat>
95
- <clearer/>
96
- </def>
@@ -1,25 +0,0 @@
1
- class HoboUserModelGenerator < Rails::Generator::NamedBase
2
-
3
- def manifest
4
- record do |m|
5
- # Check for class naming collisions.
6
- m.class_collisions class_path, class_name, "#{class_name}Test"
7
-
8
- # Model, test, and fixture directories.
9
- m.directory File.join('app/models', class_path)
10
- m.directory File.join('test/unit', class_path)
11
- m.directory File.join('test/fixtures', class_path)
12
-
13
- # Model class, unit test, and fixtures.
14
- m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
15
- m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
16
- m.template 'fixtures.yml', File.join('test/fixtures', class_path, "#{table_name}.yml")
17
- end
18
- end
19
-
20
- protected
21
- def banner
22
- "Usage: #{$0} #{spec.name} ModelName"
23
- end
24
-
25
- end
@@ -1,56 +0,0 @@
1
- class <%= class_name %> < ActiveRecord::Base
2
-
3
- hobo_user_model # Don't put anything above this
4
-
5
- fields do
6
- username :string, :login => true, :name => true
7
- administrator :boolean, :default => false
8
- timestamps
9
- end
10
-
11
- set_admin_on_first_user
12
-
13
- # --- Hobo Permissions --- #
14
-
15
- # It is possible to override the permission system entirely by
16
- # returning true from super_user?
17
- # def super_user?; true; end
18
-
19
- def creatable_by?(creator)
20
- creator.administrator? || !administrator
21
- end
22
-
23
- def updatable_by?(updater, new)
24
- updater.administrator?
25
- end
26
-
27
- def deletable_by?(deleter)
28
- deleter.administrator?
29
- end
30
-
31
- def viewable_by?(viewer, field)
32
- true
33
- end
34
-
35
-
36
- # --- Fallback permissions --- #
37
-
38
- # (Hobo checks these for models that do not define the *_by? methods)
39
-
40
- def can_create?(obj)
41
- false
42
- end
43
-
44
- def can_update?(obj, new)
45
- false
46
- end
47
-
48
- def can_delete?(obj)
49
- false
50
- end
51
-
52
- def can_view?(obj, field)
53
- true
54
- end
55
-
56
- end
@@ -1,101 +0,0 @@
1
- # gem dependencies
2
- require 'hobosupport'
3
- require 'hobofields'
4
- begin
5
- require 'will_paginate'
6
- rescue MissingSourceFile
7
- # OK, Hobo won't do pagination then
8
- end
9
-
10
- # Monkey patches, ooh ooh
11
- require 'active_record/has_many_association'
12
- require 'active_record/has_many_through_association'
13
- require 'active_record/association_proxy'
14
- require 'active_record/association_reflection'
15
- require 'action_view_extensions/base'
16
-
17
- require 'hobo'
18
- require 'hobo/dryml'
19
-
20
- require 'hobo/model'
21
-
22
- require 'hobo/dryml/template'
23
- require 'hobo/dryml/taglib'
24
- require 'hobo/dryml/template_environment'
25
- require 'hobo/dryml/template_handler'
26
-
27
- require 'extensions/test_case' if RAILS_ENV == "test"
28
-
29
-
30
-
31
- ActionView::Base.register_template_handler("dryml", Hobo::Dryml::TemplateHandler)
32
-
33
- class ActionController::Base
34
-
35
- def self.hobo_user_controller(model=nil)
36
- @model = model
37
- include Hobo::ModelController
38
- include Hobo::UserController
39
- end
40
-
41
- def self.hobo_model_controller(model=nil)
42
- @model = model
43
- include Hobo::ModelController
44
- end
45
-
46
- def self.hobo_controller
47
- include Hobo::Controller
48
- end
49
-
50
- end
51
-
52
- class ActiveRecord::Base
53
- def self.hobo_model
54
- include Hobo::Model
55
- fields # force hobofields to load
56
- end
57
- def self.hobo_user_model
58
- include Hobo::Model
59
- include Hobo::User
60
- end
61
- end
62
-
63
- # Default settings
64
-
65
- Hobo.developer_features = RAILS_ENV.in?(["development", "test"]) if Hobo.developer_features?.nil?
66
-
67
-
68
- module ::Hobo
69
- # Empty class to represent the boolean type.
70
- class Boolean; end
71
- end
72
-
73
-
74
- if defined? HoboFields
75
- HoboFields.never_wrap(Hobo::Undefined)
76
- end
77
-
78
-
79
- # Add support for type metadata to arrays
80
- class ::Array
81
-
82
- attr_accessor :member_class, :origin, :origin_attribute
83
-
84
- def to_url_path
85
- base_path = origin_object.try.to_url_path
86
- "#{base_path}/#{origin_attribute}" unless base_path.blank?
87
- end
88
-
89
- def typed_id
90
- origin_id = origin.try.typed_id
91
- "#{origin_id}_#{origin_attribute}" if origin_id
92
- end
93
-
94
- end
95
-
96
-
97
- class NilClass
98
- def typed_id
99
- "nil"
100
- end
101
- end
@@ -1,15 +0,0 @@
1
- module ActionView
2
-
3
- class Base
4
-
5
- def render_file_with_dryml(template_path, *args)
6
- @hobo_template_path = template_path
7
- render_file_without_dryml(template_path, *args)
8
- end
9
-
10
- alias_method_chain :render_file, :dryml
11
-
12
- end
13
-
14
- end
15
-
@@ -1,55 +0,0 @@
1
- module ActiveRecord::Associations
2
-
3
- class HasManyAssociation
4
-
5
- def hobo_has_many?
6
- Hobo::Model.in?(@owner.class.included_modules)
7
- end
8
-
9
- def build_with_reverse_reflection(*args)
10
- res = build_without_reverse_reflection(*args)
11
- set_reverse_association(res) if hobo_has_many?
12
- res
13
- end
14
- alias_method_chain :build, :reverse_reflection
15
-
16
-
17
- def new(attributes = {})
18
- record = @reflection.klass.new(attributes)
19
- if hobo_has_many?
20
- set_belongs_to_association_for(record)
21
- set_reverse_association(record) unless proxy_reflection.options[:as]
22
- end
23
- record
24
- end
25
-
26
-
27
- def member_class
28
- proxy_reflection.klass
29
- end
30
-
31
-
32
- def origin
33
- proxy_owner
34
- end
35
-
36
-
37
- def origin_attribute
38
- proxy_reflection.association_name
39
- end
40
-
41
-
42
- private
43
-
44
- def set_reverse_association(object)
45
- if @owner.new_record? && (refl = @owner.class.reverse_reflection(@reflection.name))
46
- bta = ActiveRecord::Associations::BelongsToAssociation.new(object, refl)
47
- bta.replace(@owner)
48
- object.instance_variable_set("@#{refl.name}", bta)
49
- end
50
- end
51
-
52
- end
53
-
54
- end
55
-
@@ -1,20 +0,0 @@
1
- module ActiveRecord::Associations
2
-
3
- class HasManyThroughAssociation
4
-
5
- def member_class
6
- proxy_reflection.klass
7
- end
8
-
9
- def origin
10
- proxy_owner
11
- end
12
-
13
- def origin_attribute
14
- proxy_reflection.association_name
15
- end
16
-
17
- end
18
-
19
- end
20
-
@@ -1,165 +0,0 @@
1
- module Hobo
2
-
3
- module Dryml
4
-
5
- class DrymlSyntaxError < RuntimeError; end
6
-
7
- class DrymlException < Exception
8
- def initialize(message, path=nil, line_num=nil)
9
- if path && line_num
10
- super(message + " -- at #{path}:#{line_num}")
11
- else
12
- super(message)
13
- end
14
- end
15
- end
16
-
17
- class AttributeExtensionString < String;
18
- def drop_prefix; self[2..-1]; end
19
- end
20
-
21
- TagDef = Struct.new "TagDef", :name, :attrs, :proc
22
-
23
- RESERVED_WORDS = %w{if for while do class else elsif unless case when module in}
24
-
25
- EMPTY_PAGE = "[tag-page]"
26
-
27
- APPLICATION_TAGLIB = { :src => "taglibs/application" }
28
- CORE_TAGLIB = { :src => "core", :plugin => "hobo" }
29
-
30
- DEFAULT_IMPORTS = (if defined?(ApplicationHelper)
31
- [Hobo::HoboHelper, ApplicationHelper]
32
- else
33
- [Hobo::HoboHelper]
34
- end)
35
-
36
- @renderer_classes = {}
37
- @tag_page_renderer_classes = {}
38
-
39
- class << self
40
-
41
- attr_accessor :last_if
42
-
43
- def clear_cache
44
- @renderer_classes = {}
45
- @tag_page_renderer_classes = {}
46
- end
47
-
48
- def render_tag(view, tag, options={})
49
- renderer = empty_page_renderer(view)
50
- renderer.render_tag(tag, options)
51
- end
52
-
53
-
54
- def empty_page_renderer(view)
55
- controller_name = view.controller.class.name.underscore.sub(/_controller$/, "")
56
- page_renderer(view, [], "#{controller_name}/#{EMPTY_PAGE}")
57
- end
58
-
59
-
60
- def page_renderer(view, local_names=[], page=nil)
61
- if RAILS_ENV == "development"
62
- clear_cache
63
- Taglib.clear_cache
64
- end
65
- page ||= view.instance_variable_get('@hobo_template_path')
66
-
67
- prepare_view!(view)
68
- included_taglibs = ([subsite_taglib(page)] + controller_taglibs(view.controller.class)).compact
69
-
70
- if page.ends_with?(EMPTY_PAGE)
71
- # DELETE ME: controller_class = controller_class_for(page)
72
- controller_class = view.controller.class
73
- @tag_page_renderer_classes[controller_class.name] ||=
74
- make_renderer_class("", page, local_names, DEFAULT_IMPORTS, included_taglibs)
75
- @tag_page_renderer_classes[controller_class.name].new(page, view)
76
- else
77
- template_path = "app/views/" + page + ".dryml"
78
- src_file = File.join(RAILS_ROOT, template_path)
79
- mtime = File.mtime(src_file)
80
- renderer_class = @renderer_classes[page]
81
-
82
- # do we need to recompile?
83
- if (!renderer_class or # nothing cached?
84
- (local_names - renderer_class.compiled_local_names).any? or # any new local names?
85
- renderer_class.load_time < mtime) # cache out of date?
86
- renderer_class = make_renderer_class(File.read(src_file), template_path, local_names,
87
- DEFAULT_IMPORTS, included_taglibs)
88
- renderer_class.load_time = mtime
89
- @renderer_classes[page] = renderer_class
90
- end
91
- renderer_class.new(page, view)
92
- end
93
- end
94
-
95
-
96
- # TODO: Delete this - not needed (use view.controller.class)
97
- def controller_class_for(page)
98
- controller, view = Controller.controller_and_view_for(page)
99
- "#{controller.camelize}Controller".constantize
100
- end
101
-
102
-
103
- def controller_taglibs(controller_class)
104
- (controller_class.respond_to?(:included_taglibs) && controller_class.included_taglibs) || []
105
- end
106
-
107
-
108
- def subsite_taglib(page)
109
- parts = page.split("/")
110
- if parts.length == 3
111
- subsite = parts.first
112
- { :src => "taglibs/#{subsite}" } if File.exists?("#{RAILS_ROOT}/app/views/taglibs/#{subsite}.dryml")
113
- end
114
- end
115
-
116
-
117
- def prepare_view!(view)
118
- # Not sure why this isn't done for me...
119
- # There's probably a button to press round here somewhere
120
- for var in %w(@flash @cookies @action_name @_session @_request @request_origin
121
- @template @request @ignore_missing_templates @_headers @variables_added
122
- @_flash @response @template_class
123
- @_cookies @before_filter_chain_aborted @url
124
- @_response @template_root @headers @_params @params @session)
125
- unless @view.instance_variables.include?(var)
126
- view.instance_variable_set(var, view.controller.instance_variable_get(var))
127
- end
128
- end
129
- end
130
-
131
-
132
- def make_renderer_class(template_src, template_path, locals, imports, included_taglibs=[])
133
- renderer_class = Class.new(TemplateEnvironment)
134
- compile_renderer_class(renderer_class, template_src, template_path, locals, imports, included_taglibs)
135
- renderer_class
136
- end
137
-
138
-
139
- def compile_renderer_class(renderer_class, template_src, template_path, locals, imports, included_taglibs=[])
140
- template = Template.new(template_src, renderer_class, template_path)
141
- imports.each {|m| template.import_module(m)}
142
-
143
- taglibs = [CORE_TAGLIB, APPLICATION_TAGLIB] + included_taglibs
144
-
145
- # the sum of all the names we've seen so far - eventually we'll be ready for all of 'em
146
- all_local_names = renderer_class.compiled_local_names | locals
147
-
148
- template.compile(all_local_names, taglibs)
149
- end
150
-
151
-
152
- def unreserve(word)
153
- word = word.to_s
154
- if RESERVED_WORDS.include?(word)
155
- word + "_"
156
- else
157
- word
158
- end
159
- end
160
-
161
- end
162
-
163
- end
164
-
165
- end