class ModelSecurityGenerator < Rails::Generator::NamedBase def manifest record do |m| # Check for class naming collisions. m.class_collisions class_path, "User", "UserController", "UserMailer", "UserSupport", "Modal", "ModalHelper", "ModelSecurity", "ModelSecurityHelper" # Libraries m.file "lib/modal.rb", "lib/modal.rb" m.file "lib/model_security.rb", "lib/model_security.rb" m.file "lib/once.rb", "lib/once.rb" m.file "lib/user_support.rb", "lib/user_support.rb" # Helpers m.file "helpers/modal_helper.rb", "app/helpers/modal_helper.rb" m.file "helpers/model_security_helper.rb", "app/helpers/model_security_helper.rb" # User m.file "models/user.rb", "app/models/user.rb" m.file "controllers/user_controller.rb", "app/controllers/user_controller.rb" # User mailer m.file "models/user_mailer.rb", "app/models/user_mailer.rb" # Testing related stuff m.file "test/user_controller_test.rb", "test/functional/user_controller_test.rb" m.file "test/user_test.rb", "test/unit/user_test.rb" m.file "test/mock_mailer.rb", "test/mocks/test/user_mailer.rb" m.file "test/mock_time.rb", "test/mocks/test/time.rb" m.file "test/users.yml", "test/fixtures/users.yml" # Schemas, configuration and miscellaneous m.file "db/demo.sql", "db/demo.sql" m.file "db/users.sql", "db/users.sql" # Layout and stylesheet. # Views m.directory "app/views/user" user_views.each do |action| m.file "views/#{action}.rhtml", "app/views/user/#{action}.rhtml" end # Partials m.directory "app/views/user" partial_views.each do |action| m.file "views/_#{action}.rhtml", "app/views/user/_#{action}.rhtml" end # Mailer m.directory "app/views/user_mailer" mailer_views.each do |action| m.file "mailer/#{action}.rhtml", "app/views/user_mailer/#{action}.rhtml" end end end def user_views %w(activate admin_created created edit forgot_password_done list login login_admin logout new show success) end def partial_views %w(form) end def mailer_views %w(forgot_password new_user) end end