hobo 1.1.0 → 1.3.0.RC

Sign up to get free protection for your applications and to get access to all the features.
Files changed (278) hide show
  1. data/CHANGES.txt +238 -287
  2. data/Rakefile +14 -31
  3. data/VERSION +1 -0
  4. data/{lib/hobo → app/controllers}/dev_controller.rb +6 -6
  5. data/app/controllers/dryml_support_controller.rb +13 -0
  6. data/{rails_generators/hobo_front_controller/templates → app/views/dev}/summary.dryml +7 -10
  7. data/bin/hobo +12 -144
  8. data/config/initializers/inflections.rb +3 -0
  9. data/config/routes.rb +6 -0
  10. data/{doctest → doctests}/hobo/lifecycles.rdoctest +40 -59
  11. data/{doctest → doctests/hobo}/model.rdoctest +33 -40
  12. data/{doctest → doctests/hobo}/multi_model_forms.rdoctest +15 -19
  13. data/{doctest → doctests/hobo}/scopes.rdoctest +27 -41
  14. data/doctests/prepare_testapp.rb +8 -0
  15. data/hobo.gemspec +26 -199
  16. data/lib/generators/hobo/activation_email.rb +11 -0
  17. data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +35 -0
  18. data/lib/generators/hobo/admin_subsite/templates/admin.css +20 -0
  19. data/lib/generators/hobo/admin_subsite/templates/admin_tag_injection.erb +10 -0
  20. data/{rails_generators/hobo_admin_site → lib/generators/hobo/admin_subsite}/templates/application.dryml +0 -0
  21. data/{rails_generators/hobo_admin_site/templates/controller.rb → lib/generators/hobo/admin_subsite/templates/controller.rb.erb} +5 -5
  22. data/lib/generators/hobo/admin_subsite/templates/users_index.dryml +7 -0
  23. data/lib/generators/hobo/assets/assets_generator.rb +18 -0
  24. data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/application.css +0 -0
  25. data/lib/generators/hobo/assets/templates/application.dryml.erb +9 -0
  26. data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/dryml-support.js +2 -2
  27. data/lib/generators/hobo/assets/templates/dryml_taglibs_initializer.rb +1 -0
  28. data/lib/generators/hobo/assets/templates/en_injection.yml +19 -0
  29. data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/guest.rb +1 -1
  30. data/lib/generators/hobo/controller.rb +35 -0
  31. data/lib/generators/hobo/controller/controller_generator.rb +6 -0
  32. data/lib/generators/hobo/controller/templates/controller.rb.erb +7 -0
  33. data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/USAGE +0 -0
  34. data/lib/generators/hobo/front_controller/front_controller_generator.rb +55 -0
  35. data/{rails_generators/hobo_front_controller/templates/controller.rb → lib/generators/hobo/front_controller/templates/controller.rb.erb} +0 -0
  36. data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/templates/index.dryml +6 -12
  37. data/lib/generators/hobo/i18n/i18n_generator.rb +35 -0
  38. data/lib/generators/hobo/i18n/templates/app.de.yml +30 -0
  39. data/lib/generators/hobo/i18n/templates/app.en.yml +25 -0
  40. data/lib/generators/hobo/i18n/templates/app.es.yml +31 -0
  41. data/lib/generators/hobo/i18n/templates/app.fr.yml +26 -0
  42. data/lib/generators/hobo/i18n/templates/app.it.yml +28 -0
  43. data/lib/generators/hobo/i18n/templates/app.pt-PT.yml +25 -0
  44. data/lib/generators/hobo/i18n/templates/app.ru.yml +24 -0
  45. data/lib/generators/hobo/i18n/templates/hobo.de.yml +204 -0
  46. data/lib/generators/hobo/i18n/templates/hobo.en.yml +195 -0
  47. data/lib/generators/hobo/i18n/templates/hobo.es.yml +202 -0
  48. data/lib/generators/hobo/i18n/templates/hobo.fr.yml +195 -0
  49. data/lib/generators/hobo/i18n/templates/hobo.it.yml +202 -0
  50. data/lib/generators/hobo/i18n/templates/hobo.pt-PT.yml +196 -0
  51. data/lib/generators/hobo/i18n/templates/hobo.ru.yml +200 -0
  52. data/lib/generators/hobo/invite_only.rb +18 -0
  53. data/lib/generators/hobo/model/USAGE +19 -0
  54. data/lib/generators/hobo/model/model_generator.rb +11 -0
  55. data/{rails_generators/hobo_model/templates/model.rb → lib/generators/hobo/model/templates/model_injection.rb.erb} +0 -2
  56. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/USAGE +0 -0
  57. data/lib/generators/hobo/rapid/rapid_generator.rb +24 -0
  58. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/IE7.js +0 -0
  59. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/blank.gif +0 -0
  60. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.css +0 -0
  61. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.js +65 -65
  62. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/ie7-recalc.js +21 -21
  63. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/lowpro.js +31 -31
  64. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/reset.css +1 -1
  65. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-ACD3E6-DBE1E5-H.png +0 -0
  66. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-DBE1E5-FCFEF5-H.png +0 -0
  67. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/300-3B5F87-ACD3E6-H.png +0 -0
  68. data/{rails_generators/hobo_rapid/templates/themes/clean → lib/generators/hobo/rapid/templates/themes/clean-sidemenu}/public/images/spinner.gif +0 -0
  69. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/stylesheets/clean-sidemenu.css +81 -0
  70. data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/views/clean-sidemenu.dryml +30 -0
  71. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/101-3B5F87-ACD3E6.png +0 -0
  72. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-3E547A-242E42.png +0 -0
  73. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-DBE1E5-FCFEF5.png +0 -0
  74. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/300-ACD3E6-fff.png +0 -0
  75. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/50-ACD3E6-fff.png +0 -0
  76. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/fieldbg.gif +0 -0
  77. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/pencil.png +0 -0
  78. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/small_close.png +0 -0
  79. data/lib/generators/hobo/rapid/templates/themes/clean/public/images/spinner.gif +0 -0
  80. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/clean.css +16 -16
  81. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/rapid-ui.css +3 -3
  82. data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/views/clean.dryml +1 -1
  83. data/lib/generators/hobo/resource/resource_generator.rb +23 -0
  84. data/lib/generators/hobo/routes/USAGE +9 -0
  85. data/lib/generators/hobo/routes/router.rb +115 -0
  86. data/lib/generators/hobo/routes/routes_generator.rb +40 -0
  87. data/lib/generators/hobo/routes/templates/hobo_routes.rb.erb +33 -0
  88. data/lib/generators/hobo/setup_wizard/USAGE +4 -0
  89. data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +274 -0
  90. data/lib/generators/hobo/subsite.rb +48 -0
  91. data/lib/generators/hobo/subsite/subsite_generator.rb +16 -0
  92. data/{rails_generators/hobo_subsite → lib/generators/hobo/subsite}/templates/application.dryml +0 -0
  93. data/{rails_generators/hobo_subsite/templates/controller.rb → lib/generators/hobo/subsite/templates/controller.rb.erb} +1 -1
  94. data/lib/generators/hobo/subsite_taglib/subsite_taglib_generator.rb +16 -0
  95. data/{rails_generators/hobo_admin_site/templates/site_taglib.dryml → lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb} +9 -10
  96. data/lib/generators/hobo/taglib.rb +12 -0
  97. data/lib/generators/hobo/test_framework/test_framework_generator.rb +72 -0
  98. data/lib/generators/hobo/test_options.rb +19 -0
  99. data/{rails_generators/hobo_user_controller → lib/generators/hobo/user_controller}/templates/accept_invitation.dryml +0 -0
  100. data/lib/generators/hobo/user_controller/templates/controller.rb.erb +31 -0
  101. data/lib/generators/hobo/user_controller/user_controller_generator.rb +25 -0
  102. data/lib/generators/hobo/user_mailer/templates/activation.erb +9 -0
  103. data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/forgot_password.erb +2 -2
  104. data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/invite.erb +2 -2
  105. data/lib/generators/hobo/user_mailer/templates/mailer.rb.erb +25 -0
  106. data/lib/generators/hobo/user_mailer/user_mailer_generator.rb +33 -0
  107. data/lib/generators/hobo/user_model/USAGE +12 -0
  108. data/{rails_generators/hobo_user_model/templates/model.rb → lib/generators/hobo/user_model/templates/model_injection.rb.erb} +40 -20
  109. data/lib/generators/hobo/user_model/user_model_generator.rb +23 -0
  110. data/lib/generators/hobo/user_resource/user_resource_generator.rb +27 -0
  111. data/lib/hobo.rb +29 -129
  112. data/lib/hobo/controller.rb +37 -47
  113. data/lib/hobo/controller/authentication_support.rb +109 -0
  114. data/lib/hobo/{model_controller.rb → controller/model.rb} +71 -79
  115. data/lib/hobo/{user_controller.rb → controller/user.rb} +59 -49
  116. data/lib/hobo/engine.rb +80 -0
  117. data/lib/hobo/extensions/action_controller/hobo_methods.rb +44 -0
  118. data/lib/hobo/extensions/action_mailer/helper.rb +38 -0
  119. data/lib/{action_view_extensions/helpers → hobo/extensions/action_view}/tag_helper.rb +5 -2
  120. data/lib/hobo/extensions/action_view/translation_helper.rb +25 -0
  121. data/lib/hobo/extensions/active_model/name.rb +16 -0
  122. data/lib/hobo/extensions/active_model/translation.rb +35 -0
  123. data/lib/{active_record/association_collection.rb → hobo/extensions/active_record/associations/collection.rb} +8 -17
  124. data/lib/{active_record/association_proxy.rb → hobo/extensions/active_record/associations/proxy.rb} +6 -7
  125. data/lib/hobo/extensions/active_record/associations/reflection.rb +23 -0
  126. data/lib/hobo/extensions/active_record/associations/scope.rb +35 -0
  127. data/lib/hobo/extensions/active_record/hobo_methods.rb +11 -0
  128. data/lib/hobo/extensions/active_record/permissions.rb +159 -0
  129. data/lib/hobo/extensions/active_record/relation_with_origin.rb +28 -0
  130. data/lib/hobo/extensions/array.rb +27 -0
  131. data/lib/hobo/extensions/enumerable.rb +12 -0
  132. data/lib/hobo/extensions/i18n.rb +17 -0
  133. data/lib/hobo/{hobo_helper.rb → helper.rb} +58 -31
  134. data/lib/hobo/helper/translations.rb +54 -0
  135. data/lib/hobo/helper/translations/normalizer.rb +39 -0
  136. data/lib/hobo/model.rb +61 -95
  137. data/lib/hobo/model/accessible_associations.rb +178 -0
  138. data/lib/hobo/{find_for.rb → model/find_for.rb} +17 -17
  139. data/lib/hobo/model/guest.rb +25 -0
  140. data/lib/hobo/model/include_in_save.rb +55 -0
  141. data/lib/hobo/model/lifecycles.rb +119 -0
  142. data/lib/hobo/model/lifecycles/actions.rb +146 -0
  143. data/lib/hobo/model/lifecycles/creator.rb +74 -0
  144. data/lib/hobo/model/lifecycles/lifecycle.rb +243 -0
  145. data/lib/hobo/model/lifecycles/state.rb +22 -0
  146. data/lib/hobo/model/lifecycles/transition.rb +70 -0
  147. data/lib/hobo/model/permissions.rb +448 -0
  148. data/lib/hobo/model/scopes.rb +38 -0
  149. data/lib/hobo/model/scopes/apply_scopes.rb +21 -0
  150. data/lib/hobo/model/scopes/automatic_scopes.rb +428 -0
  151. data/lib/hobo/model/user_base.rb +184 -0
  152. data/lib/hobo/model/view_hints.rb +123 -0
  153. data/{rapid_generators → lib/hobo/rapid/generators}/rapid/cards.dryml.erb +2 -2
  154. data/{rapid_generators → lib/hobo/rapid/generators}/rapid/forms.dryml.erb +3 -3
  155. data/{rapid_generators → lib/hobo/rapid/generators}/rapid/pages.dryml.erb +38 -51
  156. data/lib/hobo/rapid/helper.rb +166 -0
  157. data/{taglibs → lib/hobo/rapid/taglibs}/rapid.dryml +6 -5
  158. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_core.dryml +286 -118
  159. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_document_tags.dryml +2 -2
  160. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_editing.dryml +45 -45
  161. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_forms.dryml +190 -158
  162. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_generics.dryml +12 -9
  163. data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +107 -0
  164. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_lifecycles.dryml +7 -7
  165. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_navigation.dryml +15 -15
  166. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_pages.dryml +37 -36
  167. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_plus.dryml +107 -43
  168. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_summary.dryml +28 -57
  169. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_support.dryml +9 -9
  170. data/{taglibs → lib/hobo/rapid/taglibs}/rapid_user_pages.dryml +41 -40
  171. data/lib/hobo/routes.rb +31 -0
  172. data/{doctest → test/doctest}/hobo/hobo_helper.rdoctest +11 -11
  173. data/test/irt/generators/admin_subsite.irt +27 -0
  174. data/test/irt/generators/assets.irt +16 -0
  175. data/test/irt/generators/controller.irt +6 -0
  176. data/test/irt/generators/front_controller.irt +30 -0
  177. data/test/irt/generators/helper.rb +31 -0
  178. data/test/irt/generators/model.irt +28 -0
  179. data/test/irt/generators/partials/_account_user_model_tests.rb +21 -0
  180. data/test/irt/generators/partials/_accounts_users_controller_tests.rb +15 -0
  181. data/test/irt/generators/partials/_default_user_model_tests.rb +21 -0
  182. data/test/irt/generators/partials/_default_users_controller_tests.rb +16 -0
  183. data/test/irt/generators/partials/_house_controller_tests.rb +15 -0
  184. data/test/irt/generators/partials/_house_model_tests.rb +18 -0
  185. data/test/irt/generators/partials/_subsite_taglib_admin.rb +4 -0
  186. data/test/irt/generators/partials/_subsite_taglib_admin_invite_only.rb +3 -0
  187. data/test/irt/generators/partials/_subsite_taglib_noopt.rb +4 -0
  188. data/test/irt/generators/partials/_subsite_taglib_variables.rb +27 -0
  189. data/test/irt/generators/partials/_user_mailer_tests.rb +19 -0
  190. data/test/irt/generators/rapid.irt +29 -0
  191. data/test/irt/generators/resource.irt +8 -0
  192. data/test/irt/generators/subsite.irt +52 -0
  193. data/test/irt/generators/subsite_taglib.irt +23 -0
  194. data/test/irt/generators/test_framework.irt +62 -0
  195. data/test/irt/generators/user_controller.irt +10 -0
  196. data/test/irt/generators/user_mailer.irt +20 -0
  197. data/test/irt/generators/user_model.irt +10 -0
  198. data/test/irt/generators/user_resource.irt +14 -0
  199. data/test/irt/readme.txt +7 -0
  200. data/test/permissions/models/models.rb +27 -24
  201. data/test/permissions/test_permissions.rb +104 -104
  202. metadata +239 -217
  203. data/lib/active_record/association_reflection.rb +0 -20
  204. data/lib/active_record/viewhints_validations_interceptor.rb +0 -9
  205. data/lib/hobo/accessible_associations.rb +0 -183
  206. data/lib/hobo/authentication_support.rb +0 -131
  207. data/lib/hobo/generator.rb +0 -26
  208. data/lib/hobo/guest.rb +0 -25
  209. data/lib/hobo/include_in_save.rb +0 -55
  210. data/lib/hobo/lifecycles.rb +0 -137
  211. data/lib/hobo/lifecycles/actions.rb +0 -142
  212. data/lib/hobo/lifecycles/creator.rb +0 -72
  213. data/lib/hobo/lifecycles/lifecycle.rb +0 -249
  214. data/lib/hobo/lifecycles/state.rb +0 -22
  215. data/lib/hobo/lifecycles/transition.rb +0 -70
  216. data/lib/hobo/model_router.rb +0 -290
  217. data/lib/hobo/permissions.rb +0 -451
  218. data/lib/hobo/permissions/associations.rb +0 -175
  219. data/lib/hobo/rapid_helper.rb +0 -157
  220. data/lib/hobo/scopes.rb +0 -43
  221. data/lib/hobo/scopes/apply_scopes.rb +0 -23
  222. data/lib/hobo/scopes/association_proxy_extensions.rb +0 -62
  223. data/lib/hobo/scopes/automatic_scopes.rb +0 -421
  224. data/lib/hobo/scopes/named_scope_extensions.rb +0 -39
  225. data/lib/hobo/tasks/rails.rb +0 -4
  226. data/lib/hobo/translations.rb +0 -93
  227. data/lib/hobo/undefined_access_error.rb +0 -5
  228. data/lib/hobo/user.rb +0 -182
  229. data/lib/hobo/view_hints.rb +0 -115
  230. data/rails/init.rb +0 -10
  231. data/rails_generators/hobo/USAGE +0 -4
  232. data/rails_generators/hobo/hobo_generator.rb +0 -53
  233. data/rails_generators/hobo/templates/application.dryml +0 -1
  234. data/rails_generators/hobo/templates/initializer.rb +0 -2
  235. data/rails_generators/hobo_admin_site/USAGE +0 -16
  236. data/rails_generators/hobo_admin_site/hobo_admin_site_generator.rb +0 -45
  237. data/rails_generators/hobo_admin_site/templates/admin.css +0 -2
  238. data/rails_generators/hobo_admin_site/templates/users_index.dryml +0 -5
  239. data/rails_generators/hobo_front_controller/hobo_front_controller_generator.rb +0 -95
  240. data/rails_generators/hobo_front_controller/templates/functional_test.rb +0 -8
  241. data/rails_generators/hobo_front_controller/templates/helper.rb +0 -2
  242. data/rails_generators/hobo_model/USAGE +0 -25
  243. data/rails_generators/hobo_model/hobo_model_generator.rb +0 -43
  244. data/rails_generators/hobo_model/templates/fixtures.yml +0 -6
  245. data/rails_generators/hobo_model/templates/hints.rb +0 -7
  246. data/rails_generators/hobo_model/templates/unit_test.rb +0 -8
  247. data/rails_generators/hobo_model_controller/USAGE +0 -30
  248. data/rails_generators/hobo_model_controller/hobo_model_controller_generator.rb +0 -46
  249. data/rails_generators/hobo_model_controller/templates/controller.rb +0 -7
  250. data/rails_generators/hobo_model_controller/templates/functional_test.rb +0 -8
  251. data/rails_generators/hobo_model_controller/templates/helper.rb +0 -2
  252. data/rails_generators/hobo_model_resource/USAGE +0 -38
  253. data/rails_generators/hobo_model_resource/hobo_model_resource_generator.rb +0 -73
  254. data/rails_generators/hobo_model_resource/templates/controller.rb +0 -7
  255. data/rails_generators/hobo_model_resource/templates/functional_test.rb +0 -8
  256. data/rails_generators/hobo_model_resource/templates/helper.rb +0 -2
  257. data/rails_generators/hobo_rapid/hobo_rapid_generator.rb +0 -94
  258. data/rails_generators/hobo_subsite/USAGE +0 -16
  259. data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +0 -73
  260. data/rails_generators/hobo_subsite/templates/site_taglib.dryml +0 -13
  261. data/rails_generators/hobo_user_controller/USAGE +0 -34
  262. data/rails_generators/hobo_user_controller/hobo_user_controller_generator.rb +0 -65
  263. data/rails_generators/hobo_user_controller/templates/controller.rb +0 -29
  264. data/rails_generators/hobo_user_controller/templates/functional_test.rb +0 -8
  265. data/rails_generators/hobo_user_controller/templates/helper.rb +0 -2
  266. data/rails_generators/hobo_user_model/USAGE +0 -16
  267. data/rails_generators/hobo_user_model/hobo_user_model_generator.rb +0 -46
  268. data/rails_generators/hobo_user_model/templates/fixtures.yml +0 -19
  269. data/rails_generators/hobo_user_model/templates/mailer.rb +0 -29
  270. data/rails_generators/hobo_user_model/templates/unit_test.rb +0 -8
  271. data/script/destroy +0 -14
  272. data/script/generate +0 -14
  273. data/taglibs/rapid_translations.dryml +0 -36
  274. data/tasks/environments.rake +0 -19
  275. data/tasks/hobo_tasks.rake +0 -58
  276. data/test/generators/test_generator_helper.rb +0 -29
  277. data/test/generators/test_helper.rb +0 -1
  278. data/test/generators/test_hobo_model_controller_generator.rb +0 -56
@@ -1,4 +1,4 @@
1
- html, body {color: #193440; background: url(../images/300-ACD3E6-fff.png) repeat-x #fff; }
1
+ body {color: #193440; background: url(../images/300-ACD3E6-fff.png) repeat-x #fff; }
2
2
  .page-header {color: white; background: url(../images/101-3B5F87-ACD3E6.png) repeat-x #3F606E;}
3
3
  .page-header .navigation.main-nav a {
4
4
  background: url(../images/30-3E547A-242E42.png) repeat-x #242E42;
@@ -28,7 +28,7 @@ html, body {color: #193440; background: url(../images/300-ACD3E6-fff.png) repeat
28
28
 
29
29
 
30
30
  body {
31
- width: 960px;
31
+ width: 960px;
32
32
  margin: 0 auto 20px;
33
33
  font: 12px "Lucida Grande", "Trebuchet MS", Arial, sans-serif; line-height: 18px;
34
34
  }
@@ -45,11 +45,11 @@ li {margin-left: 20px;}
45
45
  a {
46
46
  border-bottom: 1px dotted #ccc;
47
47
  color: #222; background: #fafafa;
48
- text-decoration: none;
48
+ text-decoration: none;
49
49
  }
50
50
  a:hover {
51
51
  border-bottom: 1px dotted #aaa;
52
- color: black; background: #f2f2f2;
52
+ color: black; background: #f2f2f2;
53
53
  }
54
54
  h1 a, h2 a, h3 a {border: none; background: none;}
55
55
 
@@ -116,30 +116,30 @@ form .actions input { margin: 0; }
116
116
  .field-list .input-help { color: #888;}
117
117
 
118
118
  .content-header, .content-body, .content-footer {margin: 0 45px 15px; padding: 0;}
119
- .content-header {padding: 5px 0;}
119
+ .content-header {padding: 5px 0;}
120
120
  .content-body {padding: 15px 0;}
121
121
  .content-footer {padding-bottom: 20px;}
122
122
 
123
123
  .page-header {margin-top: 25px; padding: 0 0 0;}
124
124
  .page-header h1 {
125
- margin: 0; padding: 20px 30px 30px;
125
+ margin: 0; padding: 20px 30px 30px;
126
126
  font-family: "Arial Black", Tahoma, Arial, sans-serif; font-size: 36px; letter-spacing: -1.5pt;
127
127
  }
128
128
  .page-header ul {zoom: 1; overflow: hidden;}
129
129
  .page-header li {float: left; margin-left: 0; list-style: none;}
130
130
 
131
- .page-header .navigation a,
131
+ .page-header .navigation a,
132
132
  .page-header .navigation a:hover,
133
- .page-header h1 a,
133
+ .page-header h1 a,
134
134
  .page-header h1 a:hover
135
135
  {border: none; color: white; background: none;}
136
136
 
137
137
  .page-header div.search {
138
138
  float: right;
139
- padding: 0 30px 8px 15px;
139
+ padding: 0 30px 8px 15px;
140
140
  }
141
141
  .page-header div.search label {
142
- padding-right: 10px;
142
+ padding-right: 10px;
143
143
  font: bold 9px Arial, sans-serif; text-transform: uppercase; letter-spacing: 1.0pt;
144
144
  }
145
145
  .page-header div.search input {
@@ -147,7 +147,7 @@ form .actions input { margin: 0; }
147
147
  }
148
148
  #search-results-panel {
149
149
  position: absolute; top: 35px; right: 25px; z-index: 50;
150
- width: 350px; height: 500px; overflow: auto;
150
+ width: 350px; height: 500px; overflow: auto;
151
151
  padding: 0 20px 20px; border: 1px solid #ddd;
152
152
  color: black; background: #f2f2f2;
153
153
  }
@@ -168,8 +168,8 @@ form .actions input { margin: 0; }
168
168
  font-size: 11px;
169
169
  }
170
170
  .account-nav li {
171
- float: left;
172
- margin-left: 0; padding-left: 20px;
171
+ float: left;
172
+ margin-left: 0; padding-left: 20px;
173
173
  color: #ddd;
174
174
  list-style: none;
175
175
  }
@@ -229,7 +229,7 @@ form .actions {margin: 30px 0; width: 100%; text-align: center;}
229
229
  .card h4 {margin-top: 0;}
230
230
  .card a {background: #f5f5f5;}
231
231
  .card .creation-details {
232
- display: block; color: #333; font-size: 11px;
232
+ display: block; color: #333; font-size: 11px;
233
233
  }
234
234
  .card .datetime {color: #666;}
235
235
  .card .actions { position:absolute; right: 10px; top: 10px; }
@@ -237,7 +237,7 @@ div.ordering-handle { float: left; background: #ccc; color: white; margin-right:
237
237
 
238
238
  .card.content.with-owner {
239
239
  padding: 0; margin: 10px 0 30px; border: none;
240
- background: none;
240
+ background: none;
241
241
  font-size: 11px;
242
242
  }
243
243
  .card.content .creation-details {
@@ -300,7 +300,7 @@ div.select-many .item .remove-item { float: right; }
300
300
  /* you can delete them if you over-ride it */
301
301
 
302
302
  .front-page .welcome-message {
303
- padding: 10px 20px 20px; border: 1px solid #e8e8e8;
303
+ padding: 10px 20px 20px; border: 1px solid #e8e8e8;
304
304
  color: #222;
305
305
  background: url(../images/50-ACD3E6-fff.png) repeat-x #fff;
306
306
  }
@@ -8,13 +8,13 @@
8
8
  background-repeat: no-repeat;
9
9
  }
10
10
 
11
- .inplaceeditor-form input, .inplaceeditor-form textarea,
11
+ .inplaceeditor-form input, .inplaceeditor-form textarea,
12
12
  table.new-record textarea, table.new-record input {
13
13
  border: 1px dotted #666;
14
14
  padding: 3px; width: 100%;
15
15
  }
16
16
  .inplaceeditor-form, .inplaceeditor-form input {
17
- display: inline;
17
+ display: inline;
18
18
  }
19
19
 
20
20
  /**** Admin ****/
@@ -99,4 +99,4 @@ optgroup.disabled-option {
99
99
  height: 1em;
100
100
  }
101
101
 
102
- input.nil-value { color:grey; }
102
+ input.nil-value { color:grey; }
@@ -7,4 +7,4 @@
7
7
  <stylesheet name="application" param="app-stylesheet"/>
8
8
  </stylesheets:>
9
9
  </old-page>
10
- </extend>
10
+ </extend>
@@ -0,0 +1,23 @@
1
+ module Hobo
2
+ class ResourceGenerator < Rails::Generators::NamedBase
3
+
4
+ argument :attributes,
5
+ :type => :array,
6
+ :default => [],
7
+ :banner => "field:type field:type"
8
+
9
+ class_option :timestamps,
10
+ :type => :boolean
11
+
12
+ def generate_hobo_controller
13
+ invoke 'hobo:controller', [name.pluralize], options
14
+ end
15
+
16
+ def generate_hobo_model
17
+ # is there any better way to pass attributes?
18
+ attr = attributes.map{|a| "#{a.name}:#{a.type}"}
19
+ invoke 'hobo:model', [name, attr], options
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,9 @@
1
+ Description:
2
+ This generator prepares the auto routes for your Application.
3
+ It is automatically used internally, so you should not use it manually
4
+
5
+ Example:
6
+ rails generate hobo:routes
7
+
8
+ This will create:
9
+ config/hobo_routes.rb
@@ -0,0 +1,115 @@
1
+ module Generators
2
+ module Hobo
3
+ module Routes
4
+ class Router
5
+
6
+ # specify that an id CANNOT be null - needed to disambiguate /models from /models/[nil]
7
+ ID_REQUIREMENT = "{ :id => %r([^#{ActionController::Routing::SEPARATORS.join}]+) }"
8
+
9
+ attr_reader :subsite, :controller, :model, :record, :records
10
+
11
+ def initialize(subsite, controller)
12
+ raise ::Hobo::Error, "#{controller} is not a Hobo::Controller::Model" unless controller < ::Hobo::Controller::Model
13
+ @subsite = subsite
14
+ @controller = controller
15
+ @model = controller.model
16
+ @records = controller.controller_name
17
+ @record = @records.singularize
18
+ end
19
+
20
+ def index_action_routes
21
+ controller.index_actions.map do |action|
22
+ link( "get '#{records}/#{action}(.:format)', :as => '#{action}_#{records}'", action )
23
+ end.compact
24
+ end
25
+
26
+ def lifecycle_routes(subsite)
27
+ return [] unless defined? model::Lifecycle
28
+ routes = []
29
+ model::Lifecycle.creators.values.where.routable_for?(subsite).*.name.each do |creator|
30
+ routes << link("post '#{records}/#{creator}(.:format)' => '#{records}#do_#{creator}', :as => 'do_#{record}_#{creator}'", creator, :post)
31
+ routes << link("get '#{records}/#{creator}(.:format)' => '#{records}##{creator}', :as => '#{record}_#{creator}'", creator)
32
+ end
33
+ model::Lifecycle.transitions.where.routable_for?(subsite).*.name.each do |transition|
34
+ routes << link("put '#{records}/:id/#{transition}(.:format)' => '#{records}#do_#{transition}', :as => 'do_#{record}_#{transition}'", transition, :put)
35
+ routes << link("get '#{records}/:id/#{transition}(.:format)' => '#{records}##{transition}', :as => '#{record}_#{transition}'", transition)
36
+ end
37
+ routes.compact
38
+ end
39
+
40
+ def resource_routes
41
+ [
42
+ link("get '#{records}(.:format)' => '#{records}#index', :as => '#{records}'", 'index'),
43
+ link("get '#{records}/new(.:format)', :as => 'new_#{record}'", 'new'),
44
+ link("get '#{records}/:id/edit(.:format)' => '#{records}#edit', :as => 'edit_#{record}'", 'edit'),
45
+ link("get '#{records}/:id(.:format)' => '#{records}#show', :as => '#{record}', :constraints => #{ID_REQUIREMENT}", 'show'),
46
+ link("post '#{records}(.:format)' => '#{records}#create', :as => 'create_#{record}'", 'create', :post),
47
+ link("put '#{records}/:id(.:format)' => '#{records}#update', :as => 'update_#{record}', :constraints => #{ID_REQUIREMENT}", 'update', :put),
48
+ link("delete '#{records}/:id(.:format)' => '#{records}#destroy', :as => 'destroy_#{record}', :constraints => #{ID_REQUIREMENT}", 'destroy', :delete)
49
+ ].compact
50
+ end
51
+
52
+ def owner_routes
53
+ routes = []
54
+ controller.owner_actions.each_pair do |owner, actions|
55
+ collection_refl = model.reverse_reflection(owner)
56
+ raise ::Hobo::Error, "Hob routing error -- can't find reverse association for #{model}##{owner} " +
57
+ "(e.g. the :has_many that corresponds to a :belongs_to)" if collection_refl.nil?
58
+ collection = collection_refl.name
59
+ owner_class = model.reflections[owner].klass.name.underscore
60
+ owner = owner.to_s.singularize if model.reflections[owner].macro == :has_many
61
+ collection_path = "#{owner_class.pluralize}/:#{owner}_id/#{collection}"
62
+
63
+ actions.each do |action|
64
+ action_for_owner = "#{action}_for_#{owner}"
65
+ case action
66
+ when :index
67
+ routes << link("get '#{collection_path}(.:format)' => '#{records}##{action_for_owner}', :as => '#{records}_for_#{owner}'", action_for_owner)
68
+ when :new
69
+ routes << link("get '#{collection_path}/new(.:format)' => '#{records}##{action_for_owner}', :as => 'new_#{record}_for_#{owner}'", action_for_owner)
70
+ when :create
71
+ routes << link("post '#{collection_path}(.:format)' => '#{records}##{action_for_owner}', :as => 'create_#{record}_for_#{owner}'", action_for_owner, :post)
72
+ end
73
+ end
74
+ end
75
+ routes.compact
76
+ end
77
+
78
+ def web_method_routes
79
+ controller.web_methods.map do |action|
80
+ link("post '#{records}/:id/#{action}(.:format)' => '#{records}##{action}', :as => '#{record}_#{action}'", action, :post)
81
+ end.compact
82
+ end
83
+
84
+ def show_action_routes
85
+ controller.show_actions.map do |action|
86
+ link("get '#{records}/:id/#{action}(.:format)' => '#{records}##{action}', :as => '#{record}_#{action}'", action)
87
+ end.compact
88
+ end
89
+
90
+ def reorder_routes
91
+ [ link("post '#{records}/reorder(.:format)', :as => 'reorder_#{records}'", 'reorder', :post) ].compact
92
+ end
93
+
94
+ def user_routes
95
+ return [] unless controller < ::Hobo::Controller::User
96
+ prefix = records == "users" ? "" : "#{record}_"
97
+ [
98
+ link("match '#{prefix}login(.:format)' => '#{records}#login', :as => '#{record}_login'", 'login'),
99
+ link("get '#{prefix}logout(.:format)' => '#{records}#logout', :as => '#{record}_logout'", 'logout'),
100
+ link("match '#{prefix}forgot_password(.:format)' => '#{records}#forgot_password', :as => '#{record}_forgot_password'", 'forgot_password'),
101
+ ].compact
102
+ end
103
+
104
+ private
105
+
106
+ def link(route, action, method=:get)
107
+ return unless controller.public_method_defined?(action)
108
+ ::Hobo::Routes.linkable!( model, action, :subsite => subsite, :method => method )
109
+ route
110
+ end
111
+
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,40 @@
1
+ require 'generators/hobo_support/eval_template'
2
+
3
+ module Hobo
4
+ class RoutesGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ include Generators::HoboSupport::EvalTemplate
8
+
9
+ def self.banner
10
+ "rails generate hobo:routes #{self.arguments.map(&:usage).join(' ')} [options]"
11
+ end
12
+
13
+ def generate_routes
14
+ Hobo::Routes.reset_linkables
15
+ h = Hobo::Engine.config.hobo
16
+ template_name = 'hobo_routes.rb.erb'
17
+ if h.read_only_file_system
18
+ # just fill the @linkable_keys without writing any file
19
+ eval_template template_name
20
+ else
21
+ template template_name, h.routes_path
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def subsites
28
+ [nil, *Hobo.subsites]
29
+ end
30
+
31
+ def controllers_for(subsite)
32
+ Hobo::Controller::Model.all_controllers(subsite, :force).select { |c| c < Hobo::Controller::Model }
33
+ end
34
+
35
+ def router_for(subsite, controller)
36
+ Generators::Hobo::Routes::Router.new(subsite, controller)
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,33 @@
1
+ # This is an auto-generated file: don't edit!
2
+ # You can add your own routes in the config/routes.rb file
3
+ # which will override the routes in this file.
4
+
5
+ <%= Rails.application.class.name %>.routes.draw do
6
+ <% for subsite in subsites -%>
7
+ <%- if subsite -%>
8
+
9
+ <%= "namespace :#{subsite} do" %>
10
+ <%- end -%>
11
+ <%- for controller in controllers_for(subsite) -%>
12
+ <%- router = router_for(subsite, controller)
13
+ groups = %w[ index_action lifecycle resource owner web_method show_action reorder user ] -%>
14
+
15
+ <%- for group in groups -%>
16
+ <%- gr = "#{group}_routes"
17
+ routes = gr == 'lifecycle_routes' ? router.send(gr.to_sym, subsite) : router.send(gr.to_sym) -%>
18
+ <%- unless routes.empty? -%>
19
+
20
+ <%= " " if subsite %><%= %(# #{gr.humanize} for controller "#{controller.controller_path}") %>
21
+ <%- end -%>
22
+ <%- for route in routes -%>
23
+ <%= " " if subsite %><%= route %>
24
+ <%- end -%>
25
+ <%- end -%>
26
+ <%- end -%>
27
+ <%- if subsite -%>
28
+
29
+ end
30
+ <%- end -%>
31
+ <%- end -%>
32
+
33
+ end
@@ -0,0 +1,4 @@
1
+ Description:
2
+ This wizard is used by bin/hobo to configure a new
3
+ created application. You can use it directly in order
4
+ to overwrite any file of the original installation.
@@ -0,0 +1,274 @@
1
+ require 'generators/hobo_support/thor_shell'
2
+ module Hobo
3
+ class SetupWizardGenerator < Rails::Generators::Base
4
+
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ include Generators::HoboSupport::ThorShell
8
+ include Generators::Hobo::InviteOnly
9
+ include Generators::Hobo::ActivationEmail
10
+ include Generators::Hobo::TestOptions
11
+ include Generators::Hobo::Taglib
12
+
13
+ def self.banner
14
+ "rails generate hobo:setup_wizard [options]"
15
+ end
16
+
17
+ class_option :main_title, :type => :boolean,
18
+ :desc => "Shows the main title", :default => true
19
+
20
+ class_option :wizard, :type => :boolean,
21
+ :desc => "Ask instead using options", :default => true
22
+
23
+ class_option :front_controller_name, :type => :string,
24
+ :desc => "Front Controller Name", :default => 'front'
25
+
26
+ class_option :admin_subsite_name, :type => :string,
27
+ :desc => "Admin Subsite Name", :default => 'admin'
28
+
29
+ class_option :private_site, :type => :boolean,
30
+ :desc => "Make the site unaccessible to non-members"
31
+
32
+ class_option :migration_generate, :type => :boolean,
33
+ :desc => "Generate migration only"
34
+
35
+ class_option :migration_migrate, :type => :boolean,
36
+ :desc => "Generate migration and migrate", :default => true
37
+
38
+ class_option :default_locale, :type => :string,
39
+ :desc => "Sets the default locale"
40
+
41
+ class_option :locales, :type => :array,
42
+ :desc => "Choose the locales", :default => %w[en]
43
+
44
+ class_option :git_repo, :type => :boolean,
45
+ :desc => "Create the git repository with the initial commit"
46
+
47
+ class_option :gitignore_auto_generated_files, :type => :boolean,
48
+ :desc => "Add the auto-generated files to .gitignore", :default => true
49
+
50
+ class_option :dryml_only_templates, :type => :boolean,
51
+ :desc => "The application uses only dryml templates",
52
+ :default => Rails.application.config.hobo.dryml_only_templates
53
+
54
+ def startup
55
+ if wizard?
56
+ say_title options[:main_title] ? 'Hobo Setup Wizard' : 'Startup'
57
+ say 'Installing Hobo assets...'
58
+ end
59
+ invoke 'hobo:assets'
60
+ end
61
+
62
+ def choose_test_framework
63
+ if wizard?
64
+ say_title 'Test Framework'
65
+ return unless yes_no? "Do you want to customize the test_framework?"
66
+ require 'generators/hobo/test_framework/test_framework_generator'
67
+ f = Hobo::TestFrameworkGenerator::FRAMEWORKS * '|'
68
+ test_framework = choose("Choose your preferred test framework: [<enter>=#{f}]:", /^(#{f})$/, 'test_unit')
69
+ fixtures = yes_no?("Do you want the test framework to generate the fixtures?")
70
+ fixture_replacement = ask("Type your preferred fixture replacement or <enter> for no replacement:")
71
+ else
72
+ # return if it is all default so no invoke is needed
73
+ return if (options[:test_framework].to_s == 'test_unit' && options[:fixtures] && options[:fixture_replacement].blank?)
74
+ test_framework = options[:test_framework]
75
+ fixtures = options[:fixtures]
76
+ fixture_replacement = options[:fixture_replacement]
77
+ end
78
+ invoke 'hobo:test_framework', [test_framework],
79
+ :fixture_replacement => fixture_replacement,
80
+ :fixtures => fixtures,
81
+ :update => true
82
+ end
83
+
84
+ def user_options
85
+ if wizard?
86
+ say_title 'User Resource'
87
+ @user_resource_name = ask("Choose a name for the user resource: [<enter>=user|<custom_name>]", 'user')
88
+ @activation_email = @invite_only ? false : yes_no?("Do you want to send an activation email to activate the user?")
89
+ else
90
+ @user_resource_name = options[:user_resource_name]
91
+ @activation_email = options[:activation_email]
92
+ end
93
+ end
94
+
95
+ def site_options
96
+ if wizard?
97
+ say_title 'Invite Only Option'
98
+ return unless (@invite_only = yes_no?("Do you want to add the features for an invite only website?"))
99
+ private_site = yes_no?("Do you want to prevent all access to the site to non-members?\n(Choose 'y' only if ALL your site will be private, choose 'n' if at least one controller will be public)")
100
+ say( %( If you wish to prevent all access to some controller to non-members, add 'before_filter :login_required'
101
+ to the relevant controllers:
102
+
103
+ include Hobo::Controller::AuthenticationSupport
104
+ before_filter :login_required
105
+
106
+ (note that the include statement is not required for hobo_controllers)
107
+
108
+ NOTE: You might want to sign up as the administrator before adding this!
109
+ ), Color::YELLOW) unless private_site
110
+ else
111
+ @invite_only = invite_only?
112
+ private_site = options[:private_site]
113
+ end
114
+ inject_into_file 'app/controllers/application_controller.rb', <<EOI, :after => "protect_from_forgery\n" if private_site
115
+ include Hobo::Controller::AuthenticationSupport
116
+ before_filter :except => [:login, :forgot_password, :accept_invitation, :do_accept_invitation, :reset_password,
117
+ :do_reset_password] do
118
+ login_required unless #{@user_resource_name.camelize}.count == 0
119
+ end
120
+ EOI
121
+ end
122
+
123
+ def dryml_only_templates_option
124
+ if wizard?
125
+ say_title 'Templates Option'
126
+ dryml_only_templates = yes_no?("Will your application use only hobo/dryml web page templates?\n(Choose 'n' only if you also plan to use plain rails/erb web page templates)")
127
+ else
128
+ dryml_only_templates = options[:dryml_only_templates]
129
+ end
130
+ if dryml_only_templates
131
+ remove_file 'app/views/layouts/application.html.erb'
132
+ remove_file 'app/helpers/application_helper.rb'
133
+ environment "\n config.hobo.dryml_only_templates = true\n"
134
+ end
135
+ end
136
+
137
+ def rapid
138
+ if wizard?
139
+ say_title 'Hobo Rapid'
140
+ say 'Installing Hobo Rapid and default theme...'
141
+ end
142
+ invoke 'hobo:rapid'
143
+ end
144
+
145
+ def front_controller
146
+ if wizard?
147
+ say_title 'Front Controller'
148
+ front_controller_name = ask("Choose a name for the front controller: [<enter>=front|<custom_name>]", 'front')
149
+ say "Installing #{front_controller_name} controller..."
150
+ else
151
+ front_controller_name = options[:front_controller_name]
152
+ end
153
+ invoke 'hobo:front_controller', [front_controller_name], :user_resource_name => @user_resource_name, :invite_only => @invite_only
154
+ end
155
+
156
+ def admin_subsite
157
+ return unless @invite_only
158
+ if wizard?
159
+ say_title 'Admin Subsite'
160
+ @admin_subsite_name = ask("Choose a name for the admin subsite: [<enter>=admin|<custom_name>]", 'admin')
161
+ else
162
+ @admin_subsite_name = options[:admin_subsite_name]
163
+ end
164
+ end
165
+
166
+ def invoking_user_and_admin
167
+ say "Installing '#{@user_resource_name}' resources..."
168
+ invoke 'hobo:user_resource', [@user_resource_name],
169
+ :invite_only => @invite_only,
170
+ :activation_email => @activation_email,
171
+ :admin_subsite_name => @admin_subsite_name
172
+ return unless @invite_only
173
+ say "Installing admin subsite..."
174
+ invoke 'hobo:admin_subsite', [@admin_subsite_name],
175
+ :user_resource_name => @user_resource_name,
176
+ :invite_only => @invite_only
177
+ end
178
+
179
+ def generate_migration
180
+ if wizard?
181
+ say_title 'DB Migration'
182
+ action = choose("Initial Migration: [s]kip, [g]enerate migration file only, generate and [m]igrate: [s|g|m]", /^(s|g|m)$/)
183
+ opt = case action
184
+ when 's'
185
+ return say('Migration skipped!')
186
+ when 'g'
187
+ {:generate => true}
188
+ when 'm'
189
+ {:migrate => true}
190
+ end
191
+ say action == 'g' ? 'Generating Migration...' : 'Migrating...'
192
+ else
193
+ return if !options[:migration_generate] && !options[:migration_migrate]
194
+ opt = options[:migration_migrate] ? {:migrate => true} : {:generate => true}
195
+ end
196
+ rake 'db:setup'
197
+ invoke 'hobo:migration', ['initial_migration'], opt
198
+ end
199
+
200
+ def i18n
201
+ if wizard?
202
+ say_title 'I18n'
203
+ i18n_templates = File.expand_path('../../i18n/templates', __FILE__)
204
+ supported_locales = Dir.glob("#{i18n_templates}/hobo.*.yml").map do |l|
205
+ l =~ /([^\/.]+)\.yml$/
206
+ $1
207
+ end
208
+ say "The Hobo supported locales are #{supported_locales * ' '} (please, contribute to more translations)"
209
+ locales = ask("Type the locales (space separated) you want to add to your application or <enter> for 'en':", 'en').split(/\s/)
210
+ unless locales.size == 1 && locales.first == 'en'
211
+ default_locale = ask "Do you want to set a default locale? Type the locale or <enter> to skip:"
212
+ end
213
+ else
214
+ default_locale = options[:default_locale]
215
+ locales = options[:locales]
216
+ end
217
+ unless default_locale.blank?
218
+ default_locale.gsub!(/\:/, '')
219
+ environment "config.i18n.default_locale = #{default_locale.to_sym.inspect}"
220
+ end
221
+ ls = (locales - %w[en]).map {|l| ":#{l}" }
222
+ lstr = ls.to_sentence
223
+ invoke 'hobo:i18n', locales
224
+ say(<<STR , Color::YELLOW) unless ls.empty?
225
+ NOTICE: You should manually install in 'config/locales' also the official Rails locale #{ls.size==1 ? 'file' : 'files'} for #{lstr} that your application will use.
226
+ Official rails I18n URLs:
227
+ - Readme: https://github.com/svenfuchs/rails-i18n/blob/master/README.md
228
+ - locale dir: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale/
229
+ STR
230
+ end
231
+
232
+ def git_repo
233
+ if wizard?
234
+ say_title 'Git Repository'
235
+ return unless yes_no?("Do you want to initialize a git repository now?")
236
+ gitignore_auto_generated = yes_no? "Do you want git to ignore the auto-generated files?\n(Choose 'n' only if you are planning to deploy on a read-only File System like Heroku)"
237
+ say 'Initializing git repository...'
238
+ else
239
+ return unless options[:git_repo]
240
+ gitignore_auto_generated = options[:gitignore_auto_generated_files]
241
+ end
242
+ if gitignore_auto_generated
243
+ hobo_routes_rel_path = Hobo::Engine.config.hobo.routes_path.relative_path_from Rails.root
244
+ append_file '.gitignore', "app/views/taglibs/auto/**/*\n#{hobo_routes_rel_path}\n"
245
+ end
246
+ git :init
247
+ git :add => '.'
248
+ git :commit => '-m "initial commit"'
249
+ say("NOTICE: If you change the config.hobo.routes_path, you should update the .gitignore file accordingly.", Color::YELLOW) if gitignore_auto_generated
250
+ end
251
+
252
+ def finalize
253
+ return unless wizard?
254
+ say_title 'Process completed!'
255
+ say %(You can start your application with `rails server`
256
+ (run with --help for options). Then point your browser to
257
+ http://localhost:3000/
258
+
259
+ Follow the guidelines to start developing your application.
260
+ You can find the following resources handy:
261
+
262
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
263
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
264
+ )
265
+ end
266
+
267
+ private
268
+
269
+ def wizard?
270
+ options[:wizard]
271
+ end
272
+
273
+ end
274
+ end