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.
- data/CHANGES.txt +238 -287
- data/Rakefile +14 -31
- data/VERSION +1 -0
- data/{lib/hobo → app/controllers}/dev_controller.rb +6 -6
- data/app/controllers/dryml_support_controller.rb +13 -0
- data/{rails_generators/hobo_front_controller/templates → app/views/dev}/summary.dryml +7 -10
- data/bin/hobo +12 -144
- data/config/initializers/inflections.rb +3 -0
- data/config/routes.rb +6 -0
- data/{doctest → doctests}/hobo/lifecycles.rdoctest +40 -59
- data/{doctest → doctests/hobo}/model.rdoctest +33 -40
- data/{doctest → doctests/hobo}/multi_model_forms.rdoctest +15 -19
- data/{doctest → doctests/hobo}/scopes.rdoctest +27 -41
- data/doctests/prepare_testapp.rb +8 -0
- data/hobo.gemspec +26 -199
- data/lib/generators/hobo/activation_email.rb +11 -0
- data/lib/generators/hobo/admin_subsite/admin_subsite_generator.rb +35 -0
- data/lib/generators/hobo/admin_subsite/templates/admin.css +20 -0
- data/lib/generators/hobo/admin_subsite/templates/admin_tag_injection.erb +10 -0
- data/{rails_generators/hobo_admin_site → lib/generators/hobo/admin_subsite}/templates/application.dryml +0 -0
- data/{rails_generators/hobo_admin_site/templates/controller.rb → lib/generators/hobo/admin_subsite/templates/controller.rb.erb} +5 -5
- data/lib/generators/hobo/admin_subsite/templates/users_index.dryml +7 -0
- data/lib/generators/hobo/assets/assets_generator.rb +18 -0
- data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/application.css +0 -0
- data/lib/generators/hobo/assets/templates/application.dryml.erb +9 -0
- data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/dryml-support.js +2 -2
- data/lib/generators/hobo/assets/templates/dryml_taglibs_initializer.rb +1 -0
- data/lib/generators/hobo/assets/templates/en_injection.yml +19 -0
- data/{rails_generators/hobo → lib/generators/hobo/assets}/templates/guest.rb +1 -1
- data/lib/generators/hobo/controller.rb +35 -0
- data/lib/generators/hobo/controller/controller_generator.rb +6 -0
- data/lib/generators/hobo/controller/templates/controller.rb.erb +7 -0
- data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/USAGE +0 -0
- data/lib/generators/hobo/front_controller/front_controller_generator.rb +55 -0
- data/{rails_generators/hobo_front_controller/templates/controller.rb → lib/generators/hobo/front_controller/templates/controller.rb.erb} +0 -0
- data/{rails_generators/hobo_front_controller → lib/generators/hobo/front_controller}/templates/index.dryml +6 -12
- data/lib/generators/hobo/i18n/i18n_generator.rb +35 -0
- data/lib/generators/hobo/i18n/templates/app.de.yml +30 -0
- data/lib/generators/hobo/i18n/templates/app.en.yml +25 -0
- data/lib/generators/hobo/i18n/templates/app.es.yml +31 -0
- data/lib/generators/hobo/i18n/templates/app.fr.yml +26 -0
- data/lib/generators/hobo/i18n/templates/app.it.yml +28 -0
- data/lib/generators/hobo/i18n/templates/app.pt-PT.yml +25 -0
- data/lib/generators/hobo/i18n/templates/app.ru.yml +24 -0
- data/lib/generators/hobo/i18n/templates/hobo.de.yml +204 -0
- data/lib/generators/hobo/i18n/templates/hobo.en.yml +195 -0
- data/lib/generators/hobo/i18n/templates/hobo.es.yml +202 -0
- data/lib/generators/hobo/i18n/templates/hobo.fr.yml +195 -0
- data/lib/generators/hobo/i18n/templates/hobo.it.yml +202 -0
- data/lib/generators/hobo/i18n/templates/hobo.pt-PT.yml +196 -0
- data/lib/generators/hobo/i18n/templates/hobo.ru.yml +200 -0
- data/lib/generators/hobo/invite_only.rb +18 -0
- data/lib/generators/hobo/model/USAGE +19 -0
- data/lib/generators/hobo/model/model_generator.rb +11 -0
- data/{rails_generators/hobo_model/templates/model.rb → lib/generators/hobo/model/templates/model_injection.rb.erb} +0 -2
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/USAGE +0 -0
- data/lib/generators/hobo/rapid/rapid_generator.rb +24 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/IE7.js +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/blank.gif +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.css +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/hobo-rapid.js +65 -65
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/ie7-recalc.js +21 -21
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/lowpro.js +31 -31
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/reset.css +1 -1
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-ACD3E6-DBE1E5-H.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/100-DBE1E5-FCFEF5-H.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/images/300-3B5F87-ACD3E6-H.png +0 -0
- data/{rails_generators/hobo_rapid/templates/themes/clean → lib/generators/hobo/rapid/templates/themes/clean-sidemenu}/public/images/spinner.gif +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/public/stylesheets/clean-sidemenu.css +81 -0
- data/lib/generators/hobo/rapid/templates/themes/clean-sidemenu/views/clean-sidemenu.dryml +30 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/101-3B5F87-ACD3E6.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-3E547A-242E42.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/30-DBE1E5-FCFEF5.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/300-ACD3E6-fff.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/50-ACD3E6-fff.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/fieldbg.gif +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/pencil.png +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/images/small_close.png +0 -0
- data/lib/generators/hobo/rapid/templates/themes/clean/public/images/spinner.gif +0 -0
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/clean.css +16 -16
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/public/stylesheets/rapid-ui.css +3 -3
- data/{rails_generators/hobo_rapid → lib/generators/hobo/rapid}/templates/themes/clean/views/clean.dryml +1 -1
- data/lib/generators/hobo/resource/resource_generator.rb +23 -0
- data/lib/generators/hobo/routes/USAGE +9 -0
- data/lib/generators/hobo/routes/router.rb +115 -0
- data/lib/generators/hobo/routes/routes_generator.rb +40 -0
- data/lib/generators/hobo/routes/templates/hobo_routes.rb.erb +33 -0
- data/lib/generators/hobo/setup_wizard/USAGE +4 -0
- data/lib/generators/hobo/setup_wizard/setup_wizard_generator.rb +274 -0
- data/lib/generators/hobo/subsite.rb +48 -0
- data/lib/generators/hobo/subsite/subsite_generator.rb +16 -0
- data/{rails_generators/hobo_subsite → lib/generators/hobo/subsite}/templates/application.dryml +0 -0
- data/{rails_generators/hobo_subsite/templates/controller.rb → lib/generators/hobo/subsite/templates/controller.rb.erb} +1 -1
- data/lib/generators/hobo/subsite_taglib/subsite_taglib_generator.rb +16 -0
- data/{rails_generators/hobo_admin_site/templates/site_taglib.dryml → lib/generators/hobo/subsite_taglib/templates/taglib.dryml.erb} +9 -10
- data/lib/generators/hobo/taglib.rb +12 -0
- data/lib/generators/hobo/test_framework/test_framework_generator.rb +72 -0
- data/lib/generators/hobo/test_options.rb +19 -0
- data/{rails_generators/hobo_user_controller → lib/generators/hobo/user_controller}/templates/accept_invitation.dryml +0 -0
- data/lib/generators/hobo/user_controller/templates/controller.rb.erb +31 -0
- data/lib/generators/hobo/user_controller/user_controller_generator.rb +25 -0
- data/lib/generators/hobo/user_mailer/templates/activation.erb +9 -0
- data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/forgot_password.erb +2 -2
- data/{rails_generators/hobo_user_model → lib/generators/hobo/user_mailer}/templates/invite.erb +2 -2
- data/lib/generators/hobo/user_mailer/templates/mailer.rb.erb +25 -0
- data/lib/generators/hobo/user_mailer/user_mailer_generator.rb +33 -0
- data/lib/generators/hobo/user_model/USAGE +12 -0
- data/{rails_generators/hobo_user_model/templates/model.rb → lib/generators/hobo/user_model/templates/model_injection.rb.erb} +40 -20
- data/lib/generators/hobo/user_model/user_model_generator.rb +23 -0
- data/lib/generators/hobo/user_resource/user_resource_generator.rb +27 -0
- data/lib/hobo.rb +29 -129
- data/lib/hobo/controller.rb +37 -47
- data/lib/hobo/controller/authentication_support.rb +109 -0
- data/lib/hobo/{model_controller.rb → controller/model.rb} +71 -79
- data/lib/hobo/{user_controller.rb → controller/user.rb} +59 -49
- data/lib/hobo/engine.rb +80 -0
- data/lib/hobo/extensions/action_controller/hobo_methods.rb +44 -0
- data/lib/hobo/extensions/action_mailer/helper.rb +38 -0
- data/lib/{action_view_extensions/helpers → hobo/extensions/action_view}/tag_helper.rb +5 -2
- data/lib/hobo/extensions/action_view/translation_helper.rb +25 -0
- data/lib/hobo/extensions/active_model/name.rb +16 -0
- data/lib/hobo/extensions/active_model/translation.rb +35 -0
- data/lib/{active_record/association_collection.rb → hobo/extensions/active_record/associations/collection.rb} +8 -17
- data/lib/{active_record/association_proxy.rb → hobo/extensions/active_record/associations/proxy.rb} +6 -7
- data/lib/hobo/extensions/active_record/associations/reflection.rb +23 -0
- data/lib/hobo/extensions/active_record/associations/scope.rb +35 -0
- data/lib/hobo/extensions/active_record/hobo_methods.rb +11 -0
- data/lib/hobo/extensions/active_record/permissions.rb +159 -0
- data/lib/hobo/extensions/active_record/relation_with_origin.rb +28 -0
- data/lib/hobo/extensions/array.rb +27 -0
- data/lib/hobo/extensions/enumerable.rb +12 -0
- data/lib/hobo/extensions/i18n.rb +17 -0
- data/lib/hobo/{hobo_helper.rb → helper.rb} +58 -31
- data/lib/hobo/helper/translations.rb +54 -0
- data/lib/hobo/helper/translations/normalizer.rb +39 -0
- data/lib/hobo/model.rb +61 -95
- data/lib/hobo/model/accessible_associations.rb +178 -0
- data/lib/hobo/{find_for.rb → model/find_for.rb} +17 -17
- data/lib/hobo/model/guest.rb +25 -0
- data/lib/hobo/model/include_in_save.rb +55 -0
- data/lib/hobo/model/lifecycles.rb +119 -0
- data/lib/hobo/model/lifecycles/actions.rb +146 -0
- data/lib/hobo/model/lifecycles/creator.rb +74 -0
- data/lib/hobo/model/lifecycles/lifecycle.rb +243 -0
- data/lib/hobo/model/lifecycles/state.rb +22 -0
- data/lib/hobo/model/lifecycles/transition.rb +70 -0
- data/lib/hobo/model/permissions.rb +448 -0
- data/lib/hobo/model/scopes.rb +38 -0
- data/lib/hobo/model/scopes/apply_scopes.rb +21 -0
- data/lib/hobo/model/scopes/automatic_scopes.rb +428 -0
- data/lib/hobo/model/user_base.rb +184 -0
- data/lib/hobo/model/view_hints.rb +123 -0
- data/{rapid_generators → lib/hobo/rapid/generators}/rapid/cards.dryml.erb +2 -2
- data/{rapid_generators → lib/hobo/rapid/generators}/rapid/forms.dryml.erb +3 -3
- data/{rapid_generators → lib/hobo/rapid/generators}/rapid/pages.dryml.erb +38 -51
- data/lib/hobo/rapid/helper.rb +166 -0
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid.dryml +6 -5
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_core.dryml +286 -118
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_document_tags.dryml +2 -2
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_editing.dryml +45 -45
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_forms.dryml +190 -158
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_generics.dryml +12 -9
- data/lib/hobo/rapid/taglibs/rapid_i18n.dryml +107 -0
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_lifecycles.dryml +7 -7
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_navigation.dryml +15 -15
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_pages.dryml +37 -36
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_plus.dryml +107 -43
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_summary.dryml +28 -57
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_support.dryml +9 -9
- data/{taglibs → lib/hobo/rapid/taglibs}/rapid_user_pages.dryml +41 -40
- data/lib/hobo/routes.rb +31 -0
- data/{doctest → test/doctest}/hobo/hobo_helper.rdoctest +11 -11
- data/test/irt/generators/admin_subsite.irt +27 -0
- data/test/irt/generators/assets.irt +16 -0
- data/test/irt/generators/controller.irt +6 -0
- data/test/irt/generators/front_controller.irt +30 -0
- data/test/irt/generators/helper.rb +31 -0
- data/test/irt/generators/model.irt +28 -0
- data/test/irt/generators/partials/_account_user_model_tests.rb +21 -0
- data/test/irt/generators/partials/_accounts_users_controller_tests.rb +15 -0
- data/test/irt/generators/partials/_default_user_model_tests.rb +21 -0
- data/test/irt/generators/partials/_default_users_controller_tests.rb +16 -0
- data/test/irt/generators/partials/_house_controller_tests.rb +15 -0
- data/test/irt/generators/partials/_house_model_tests.rb +18 -0
- data/test/irt/generators/partials/_subsite_taglib_admin.rb +4 -0
- data/test/irt/generators/partials/_subsite_taglib_admin_invite_only.rb +3 -0
- data/test/irt/generators/partials/_subsite_taglib_noopt.rb +4 -0
- data/test/irt/generators/partials/_subsite_taglib_variables.rb +27 -0
- data/test/irt/generators/partials/_user_mailer_tests.rb +19 -0
- data/test/irt/generators/rapid.irt +29 -0
- data/test/irt/generators/resource.irt +8 -0
- data/test/irt/generators/subsite.irt +52 -0
- data/test/irt/generators/subsite_taglib.irt +23 -0
- data/test/irt/generators/test_framework.irt +62 -0
- data/test/irt/generators/user_controller.irt +10 -0
- data/test/irt/generators/user_mailer.irt +20 -0
- data/test/irt/generators/user_model.irt +10 -0
- data/test/irt/generators/user_resource.irt +14 -0
- data/test/irt/readme.txt +7 -0
- data/test/permissions/models/models.rb +27 -24
- data/test/permissions/test_permissions.rb +104 -104
- metadata +239 -217
- data/lib/active_record/association_reflection.rb +0 -20
- data/lib/active_record/viewhints_validations_interceptor.rb +0 -9
- data/lib/hobo/accessible_associations.rb +0 -183
- data/lib/hobo/authentication_support.rb +0 -131
- data/lib/hobo/generator.rb +0 -26
- data/lib/hobo/guest.rb +0 -25
- data/lib/hobo/include_in_save.rb +0 -55
- data/lib/hobo/lifecycles.rb +0 -137
- data/lib/hobo/lifecycles/actions.rb +0 -142
- data/lib/hobo/lifecycles/creator.rb +0 -72
- data/lib/hobo/lifecycles/lifecycle.rb +0 -249
- data/lib/hobo/lifecycles/state.rb +0 -22
- data/lib/hobo/lifecycles/transition.rb +0 -70
- data/lib/hobo/model_router.rb +0 -290
- data/lib/hobo/permissions.rb +0 -451
- data/lib/hobo/permissions/associations.rb +0 -175
- data/lib/hobo/rapid_helper.rb +0 -157
- data/lib/hobo/scopes.rb +0 -43
- data/lib/hobo/scopes/apply_scopes.rb +0 -23
- data/lib/hobo/scopes/association_proxy_extensions.rb +0 -62
- data/lib/hobo/scopes/automatic_scopes.rb +0 -421
- data/lib/hobo/scopes/named_scope_extensions.rb +0 -39
- data/lib/hobo/tasks/rails.rb +0 -4
- data/lib/hobo/translations.rb +0 -93
- data/lib/hobo/undefined_access_error.rb +0 -5
- data/lib/hobo/user.rb +0 -182
- data/lib/hobo/view_hints.rb +0 -115
- data/rails/init.rb +0 -10
- data/rails_generators/hobo/USAGE +0 -4
- data/rails_generators/hobo/hobo_generator.rb +0 -53
- data/rails_generators/hobo/templates/application.dryml +0 -1
- data/rails_generators/hobo/templates/initializer.rb +0 -2
- data/rails_generators/hobo_admin_site/USAGE +0 -16
- data/rails_generators/hobo_admin_site/hobo_admin_site_generator.rb +0 -45
- data/rails_generators/hobo_admin_site/templates/admin.css +0 -2
- data/rails_generators/hobo_admin_site/templates/users_index.dryml +0 -5
- data/rails_generators/hobo_front_controller/hobo_front_controller_generator.rb +0 -95
- data/rails_generators/hobo_front_controller/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_front_controller/templates/helper.rb +0 -2
- data/rails_generators/hobo_model/USAGE +0 -25
- data/rails_generators/hobo_model/hobo_model_generator.rb +0 -43
- data/rails_generators/hobo_model/templates/fixtures.yml +0 -6
- data/rails_generators/hobo_model/templates/hints.rb +0 -7
- data/rails_generators/hobo_model/templates/unit_test.rb +0 -8
- data/rails_generators/hobo_model_controller/USAGE +0 -30
- data/rails_generators/hobo_model_controller/hobo_model_controller_generator.rb +0 -46
- data/rails_generators/hobo_model_controller/templates/controller.rb +0 -7
- data/rails_generators/hobo_model_controller/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_model_controller/templates/helper.rb +0 -2
- data/rails_generators/hobo_model_resource/USAGE +0 -38
- data/rails_generators/hobo_model_resource/hobo_model_resource_generator.rb +0 -73
- data/rails_generators/hobo_model_resource/templates/controller.rb +0 -7
- data/rails_generators/hobo_model_resource/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_model_resource/templates/helper.rb +0 -2
- data/rails_generators/hobo_rapid/hobo_rapid_generator.rb +0 -94
- data/rails_generators/hobo_subsite/USAGE +0 -16
- data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +0 -73
- data/rails_generators/hobo_subsite/templates/site_taglib.dryml +0 -13
- data/rails_generators/hobo_user_controller/USAGE +0 -34
- data/rails_generators/hobo_user_controller/hobo_user_controller_generator.rb +0 -65
- data/rails_generators/hobo_user_controller/templates/controller.rb +0 -29
- data/rails_generators/hobo_user_controller/templates/functional_test.rb +0 -8
- data/rails_generators/hobo_user_controller/templates/helper.rb +0 -2
- data/rails_generators/hobo_user_model/USAGE +0 -16
- data/rails_generators/hobo_user_model/hobo_user_model_generator.rb +0 -46
- data/rails_generators/hobo_user_model/templates/fixtures.yml +0 -19
- data/rails_generators/hobo_user_model/templates/mailer.rb +0 -29
- data/rails_generators/hobo_user_model/templates/unit_test.rb +0 -8
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/taglibs/rapid_translations.dryml +0 -36
- data/tasks/environments.rake +0 -19
- data/tasks/hobo_tasks.rake +0 -58
- data/test/generators/test_generator_helper.rb +0 -29
- data/test/generators/test_helper.rb +0 -1
- data/test/generators/test_hobo_model_controller_generator.rb +0 -56
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'find'
|
2
|
-
|
3
|
-
class HoboRapidGenerator < Hobo::Generator
|
4
|
-
|
5
|
-
default_options :import_tags => false
|
6
|
-
|
7
|
-
def manifest
|
8
|
-
if options[:command] == :create
|
9
|
-
import_tags if options[:import_tags]
|
10
|
-
end
|
11
|
-
|
12
|
-
record do |m|
|
13
|
-
m.file "hobo-rapid.js", "public/javascripts/hobo-rapid.js"
|
14
|
-
m.file "lowpro.js", "public/javascripts/lowpro.js"
|
15
|
-
m.file "IE7.js", "public/javascripts/IE7.js"
|
16
|
-
m.file "ie7-recalc.js", "public/javascripts/ie7-recalc.js"
|
17
|
-
m.file "blank.gif", "public/javascripts/blank.gif"
|
18
|
-
m.file "reset.css", "public/stylesheets/reset.css"
|
19
|
-
m.file "hobo-rapid.css", "public/stylesheets/hobo-rapid.css"
|
20
|
-
create_all(m, "themes/clean/public", "public/hobothemes/clean")
|
21
|
-
create_all(m, "themes/clean/views", "app/views/taglibs/themes/clean")
|
22
|
-
|
23
|
-
if with_admin_site?
|
24
|
-
options = ["admin"]
|
25
|
-
options.unshift "--make-front-site" unless File.exist?('app/views/taglibs/front_site.dryml')
|
26
|
-
options.unshift "--invite-only" if invite_only?
|
27
|
-
m.dependency 'hobo_admin_site', options
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def import_tags
|
33
|
-
path = File.join(RAILS_ROOT, "app/views/taglibs/application.dryml")
|
34
|
-
|
35
|
-
tag = %(<include src="rapid" plugin="hobo"/>
|
36
|
-
|
37
|
-
<include src="taglibs/auto/rapid/cards"/>
|
38
|
-
<include src="taglibs/auto/rapid/pages"/>
|
39
|
-
<include src="taglibs/auto/rapid/forms"/>
|
40
|
-
|
41
|
-
<set-theme name="clean"/>
|
42
|
-
)
|
43
|
-
|
44
|
-
if with_admin_site?
|
45
|
-
tag += %(
|
46
|
-
<extend tag="page">
|
47
|
-
<old-page merge>
|
48
|
-
<footer:>
|
49
|
-
<a href="&admin_users_url" if="¤t_user.administrator?">Admin</a>
|
50
|
-
</footer:>
|
51
|
-
</old-page>
|
52
|
-
</extend>
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
src = File.read(path)
|
57
|
-
return if src.include?(tag)
|
58
|
-
|
59
|
-
# first try putting it before the first tag
|
60
|
-
done = src.sub!(/<(?!!)/, tag + "\n<")
|
61
|
-
|
62
|
-
# otherwise append it
|
63
|
-
src << tag unless done
|
64
|
-
|
65
|
-
File.open(path, 'w') {|f| f.write(src) }
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
def with_admin_site?
|
70
|
-
options[:admin]
|
71
|
-
end
|
72
|
-
|
73
|
-
def invite_only?
|
74
|
-
options[:admin] == :invite_only
|
75
|
-
end
|
76
|
-
|
77
|
-
protected
|
78
|
-
def banner
|
79
|
-
"Usage: #{$0} #{spec.name} [--import-tags] [--admin | --invite-only]"
|
80
|
-
end
|
81
|
-
|
82
|
-
def add_options!(opt)
|
83
|
-
opt.separator ''
|
84
|
-
opt.separator 'Options:'
|
85
|
-
opt.on("--import-tags",
|
86
|
-
"Modify taglibs/application.dryml to import hobo-rapid and theme tags ") do |v|
|
87
|
-
options[:import_tags] = true
|
88
|
-
end
|
89
|
-
opt.on("--admin",
|
90
|
-
"Generate an admin subsite") { |v| options[:admin] = true }
|
91
|
-
opt.on("--invite-only",
|
92
|
-
"Generate an admin subsite with features for an invite only app") { |v| options[:admin] = :invite_only }
|
93
|
-
end
|
94
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
|
3
|
-
Creates a subsite, a namespaced section of your application.
|
4
|
-
|
5
|
-
The subsite will use app/views/taglibs/<subsite_name>_site.dryml
|
6
|
-
instead of app/views/taglibs/appplication.dryml. This allows you
|
7
|
-
to easily set different themes and choose different CSS files for
|
8
|
-
the subsite.
|
9
|
-
|
10
|
-
Controllers for the subsite are created in
|
11
|
-
app/controllers/<subsite_name>/ and views are also in their own
|
12
|
-
subdirectory. This allows you to have two different controllers
|
13
|
-
and two different sets of views for the same model.
|
14
|
-
|
15
|
-
The difference between hobo_admin_site and hobo_subsite is that
|
16
|
-
hobo_admin_site limits the subsite to use by administrators only.
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
class HoboSubsiteGenerator < Rails::Generator::NamedBase
|
4
|
-
|
5
|
-
default_options :rapid => true
|
6
|
-
|
7
|
-
def subsite_name
|
8
|
-
class_name
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
def generating?
|
13
|
-
options[:command] == :create
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
def app_name
|
18
|
-
front_name = File.read('app/views/taglibs/front_site.dryml').grep(%r(<def tag="app-name">(.*)</def>)){ $1 } rescue nil
|
19
|
-
front_name ? "#{front_name} - #{subsite_name.titleize}" : subsite_name.titleize
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
def can_mv_application_to_front_site?
|
24
|
-
File.exist?('app/views/taglibs/application.dryml') && !File.exist?('app/views/taglibs/front_site.dryml')
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
def manifest
|
29
|
-
if generating? && can_mv_application_to_front_site? && options[:make_front_site].nil?
|
30
|
-
puts "front_site.dryml is missing -- please specify either --make-front-site or --no-front-site"
|
31
|
-
exit 1
|
32
|
-
end
|
33
|
-
|
34
|
-
record do |m|
|
35
|
-
if generating? && options[:make_front_site]
|
36
|
-
unless can_mv_application_to_front_site?
|
37
|
-
puts "Cannot rename application.dryml to front_site.dryml"
|
38
|
-
exit 1
|
39
|
-
end
|
40
|
-
puts "Renaming app/views/taglibs/application.dryml to app/views/taglibs/front_site.dryml"
|
41
|
-
FileUtils.mv('app/views/taglibs/application.dryml', 'app/views/taglibs/front_site.dryml')
|
42
|
-
m.template "application.dryml", File.join('app/views/taglibs/application.dryml')
|
43
|
-
end
|
44
|
-
|
45
|
-
m.directory File.join('app', 'controllers', file_name)
|
46
|
-
m.directory File.join('app', 'views', file_name)
|
47
|
-
|
48
|
-
m.template "controller.rb", File.join('app/controllers', file_name, "#{file_name}_site_controller.rb")
|
49
|
-
m.template "site_taglib.dryml", File.join('app/views/taglibs', "#{file_name}_site.dryml")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
protected
|
55
|
-
def banner
|
56
|
-
"Usage: #{$0} #{spec.name} <subsite_name> [--make-front-site | --no-front-site]"
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
def add_options!(opt)
|
61
|
-
opt.separator ''
|
62
|
-
opt.separator 'Options:'
|
63
|
-
opt.on("--make-front-site", "rename application.dryml to front_site.dryml ") do |v|
|
64
|
-
options[:make_front_site] = true
|
65
|
-
end
|
66
|
-
opt.on("--no-front-site", "do not rename application.dryml to front_site.dryml ") do |v|
|
67
|
-
options[:make_front_site] = false
|
68
|
-
end
|
69
|
-
opt.on("--no-rapid", "don't include Rapid features in the subsite taglib") do |v|
|
70
|
-
options[:rapid] = false
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!-- Tag definitions for the <%= subsite_name %> subsite -->
|
2
|
-
|
3
|
-
<% if options[:rapid] -%>
|
4
|
-
<include src="rapid" plugin="hobo"/>
|
5
|
-
|
6
|
-
<include src="taglibs/auto/<%= file_name %>/rapid/cards"/>
|
7
|
-
<include src="taglibs/auto/<%= file_name %>/rapid/pages"/>
|
8
|
-
<include src="taglibs/auto/<%= file_name %>/rapid/forms"/>
|
9
|
-
|
10
|
-
<set-theme name="clean"/>
|
11
|
-
<% end -%>
|
12
|
-
|
13
|
-
<def tag="app-name"><%= app_name %></def>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
|
3
|
-
The controller generator creates a controller geared up to handle
|
4
|
-
login and signup for a specific user model. It can also be used as
|
5
|
-
a regular hobo_model_controller.
|
6
|
-
|
7
|
-
The generator takes a controller name and a list of views as
|
8
|
-
arguments. The controller name may be given in CamelCase or
|
9
|
-
under_score and should not be suffixed with 'Controller'. To
|
10
|
-
create a controller within a module, specify the controller name
|
11
|
-
as 'module/controller'.
|
12
|
-
|
13
|
-
The generator creates a controller class in app/controllers with view
|
14
|
-
templates in app/views/controller_name, a helper class in app/helpers,
|
15
|
-
and a functional test suite in test/functional.
|
16
|
-
|
17
|
-
Example:
|
18
|
-
./script/generate controller CreditCard open debit credit close
|
19
|
-
|
20
|
-
Credit card controller with URLs like /credit_card/debit.
|
21
|
-
Controller: app/controllers/credit_card_controller.rb
|
22
|
-
Views: app/views/credit_card/debit.rhtml [...]
|
23
|
-
Helper: app/helpers/credit_card_helper.rb
|
24
|
-
Test: test/functional/credit_card_controller_test.rb
|
25
|
-
|
26
|
-
Modules Example:
|
27
|
-
./script/generate hobo_user_controller 'admin/credit_card' suspend late_fee
|
28
|
-
|
29
|
-
Credit card admin controller with URLs /admin/credit_card/suspend.
|
30
|
-
Controller: app/controllers/admin/credit_card_controller.rb
|
31
|
-
Views: app/views/admin/credit_card/debit.rhtml [...]
|
32
|
-
Helper: app/helpers/admin/credit_card_helper.rb
|
33
|
-
Test: test/functional/admin/credit_card_controller_test.rb
|
34
|
-
|
@@ -1,65 +0,0 @@
|
|
1
|
-
class HoboUserControllerGenerator < Rails::Generator::NamedBase
|
2
|
-
|
3
|
-
def initialize(args, options)
|
4
|
-
args[0] = args[0].pluralize
|
5
|
-
super(args, options)
|
6
|
-
end
|
7
|
-
|
8
|
-
def manifest
|
9
|
-
record do |m|
|
10
|
-
# Check for class naming collisions.
|
11
|
-
m.class_collisions class_path, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper"
|
12
|
-
|
13
|
-
# Controller, helper, views, and test directories.
|
14
|
-
m.directory File.join('app/controllers', class_path)
|
15
|
-
m.directory File.join('app/helpers', class_path)
|
16
|
-
m.directory File.join('app/views', class_path, file_name)
|
17
|
-
m.directory File.join('test/functional', class_path)
|
18
|
-
|
19
|
-
# Controller class, functional test, and helper class.
|
20
|
-
m.template 'controller.rb',
|
21
|
-
File.join('app/controllers',
|
22
|
-
class_path,
|
23
|
-
"#{file_name}_controller.rb")
|
24
|
-
|
25
|
-
m.template 'functional_test.rb',
|
26
|
-
File.join('test/functional',
|
27
|
-
class_path,
|
28
|
-
"#{file_name}_controller_test.rb")
|
29
|
-
|
30
|
-
m.template 'helper.rb',
|
31
|
-
File.join('app/helpers',
|
32
|
-
class_path,
|
33
|
-
"#{file_name}_helper.rb")
|
34
|
-
|
35
|
-
# View template for each action.
|
36
|
-
actions.each do |action|
|
37
|
-
path = File.join('app/views', class_path, file_name, "#{action}.rhtml")
|
38
|
-
m.template 'view.rhtml', path,
|
39
|
-
:assigns => { :action => action, :path => path }
|
40
|
-
end
|
41
|
-
|
42
|
-
if invite_only?
|
43
|
-
m.template "accept_invitation.dryml", File.join('app/views', class_path, file_name, "accept_invitation.dryml")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def invite_only?
|
49
|
-
options[:invite_only]
|
50
|
-
end
|
51
|
-
|
52
|
-
protected
|
53
|
-
def banner
|
54
|
-
"Usage: #{$0} #{spec.name} ModelName [--invite-only]"
|
55
|
-
end
|
56
|
-
|
57
|
-
def add_options!(opt)
|
58
|
-
opt.separator ''
|
59
|
-
opt.separator 'Options:'
|
60
|
-
opt.on("--invite-only", "Add features for an invite only website") do |v|
|
61
|
-
options[:invite_only] = true
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
class <%= class_name %>Controller < ApplicationController
|
2
|
-
|
3
|
-
hobo_user_controller
|
4
|
-
|
5
|
-
auto_actions :all, :except => [ :index, :new, :create ]
|
6
|
-
<% if invite_only? -%>
|
7
|
-
|
8
|
-
def create
|
9
|
-
hobo_create do
|
10
|
-
if valid?
|
11
|
-
self.current_user = this
|
12
|
-
this.password = this.password_confirmation = nil # don't trigger password change validations
|
13
|
-
this.state = 'active'
|
14
|
-
this.save
|
15
|
-
flash[:notice] = ht("hobo.messages.you_are_site_admin", :default=>"You are now the site administrator")
|
16
|
-
redirect_to home_page
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def do_accept_invitation
|
22
|
-
do_transition_action :accept_invitation do
|
23
|
-
self.current_user = this
|
24
|
-
flash[:notice] = ht("hobo.messages.you_signed_up", :default=>"You have signed up")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
<% end -%>
|
28
|
-
|
29
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
The model generator creates stubs for a new model.
|
3
|
-
|
4
|
-
The generator takes a model name as its argument. The model name may be given in CamelCase or under_score and
|
5
|
-
should not be suffixed with 'Model'.
|
6
|
-
|
7
|
-
The generator creates a model class in app/models, a test suite in test/unit, test fixtures in
|
8
|
-
test/fixtures/singular_name.yml.
|
9
|
-
|
10
|
-
Examples:
|
11
|
-
./script/generate hobo_model account
|
12
|
-
|
13
|
-
This will create an Account model:
|
14
|
-
Model: app/models/account.rb
|
15
|
-
Test: test/unit/account_test.rb
|
16
|
-
Fixtures: test/fixtures/accounts.yml
|
@@ -1,46 +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
|
-
mailer_dir = File.join("app/views", class_path[0..-2], "#{file_name.singularize}_mailer")
|
13
|
-
m.directory mailer_dir
|
14
|
-
|
15
|
-
# Model class, unit test, and fixtures.
|
16
|
-
m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
17
|
-
m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
|
18
|
-
m.template 'fixtures.yml', File.join('test/fixtures', class_path, "#{table_name}.yml")
|
19
|
-
|
20
|
-
m.template 'mailer.rb', File.join('app/models', class_path, "#{file_name}_mailer.rb")
|
21
|
-
m.template 'forgot_password.erb', File.join(mailer_dir, "forgot_password.erb")
|
22
|
-
|
23
|
-
if invite_only?
|
24
|
-
m.template 'invite.erb', File.join(mailer_dir, "invite.erb")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def invite_only?
|
30
|
-
options[:invite_only]
|
31
|
-
end
|
32
|
-
|
33
|
-
protected
|
34
|
-
def banner
|
35
|
-
"Usage: #{$0} #{spec.name} ModelName [--invite-only]"
|
36
|
-
end
|
37
|
-
|
38
|
-
def add_options!(opt)
|
39
|
-
opt.separator ''
|
40
|
-
opt.separator 'Options:'
|
41
|
-
opt.on("--invite-only", "Add features for an invite only website") do |v|
|
42
|
-
options[:invite_only] = true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
2
|
-
|
3
|
-
<% unless attributes.empty? -%>
|
4
|
-
one:
|
5
|
-
<% for attribute in attributes -%>
|
6
|
-
<%= attribute.name %>: <%= attribute.default %>
|
7
|
-
<% end -%>
|
8
|
-
|
9
|
-
two:
|
10
|
-
<% for attribute in attributes -%>
|
11
|
-
<%= attribute.name %>: <%= attribute.default %>
|
12
|
-
<% end -%>
|
13
|
-
<% else -%>
|
14
|
-
# one:
|
15
|
-
# column: value
|
16
|
-
#
|
17
|
-
# two:
|
18
|
-
# column: value
|
19
|
-
<% end -%>
|