Class: McmsPagesGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- McmsPagesGenerator
- Defined in:
- lib/generators/mcms_pages/mcms_pages_generator.rb
Overview
@File Name : mcms_pagesn_generator.rb @Company Name : Mindfire Solutions Pvt. Ltd. @Creator Name : Vikram Kumar Mishra @Date Created : 2012-07-06
@Date Modified :
@Last Modification Details :
@Purpose : This file is responsible to install mcms_pages module in other application/module
Instance Method Summary collapse
- #add_migrations ⇒ Object
- #append_seed_data ⇒ Object
- #copy_asset_manager ⇒ Object
- #copy_initializer ⇒ Object
- #install_pages ⇒ Object
- #prompt_user ⇒ Object
Instance Method Details
#add_migrations ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/generators/mcms_pages/mcms_pages_generator.rb', line 50 def add_migrations say "copying migrations......." # running command line command to copy engine's migration file rake("mcms_pages_engine:install:migrations") end |
#append_seed_data ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/generators/mcms_pages/mcms_pages_generator.rb', line 62 def append_seed_data # create file deb/seeds.rb to parent app if not exists create_file "db/seeds.rb" unless File.exists?(File.join(destination_root, 'db', 'seeds.rb')) # append data to app's seeds.rb append_file 'db/seeds.rb', :verbose => true do <<-EOH McmsPages::Engine.load_seed EOH end # end block end |
#copy_asset_manager ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/generators/mcms_pages/mcms_pages_generator.rb', line 28 def copy_asset_manager #copy file lib/asset_manager.rb to app/lib/asset_manager.rb if it doesn't exists copy_file "asset.rb", "lib/asset.rb" unless File.exists?(File.join(destination_root, 'lib', 'asset.rb')) end |
#copy_initializer ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/generators/mcms_pages/mcms_pages_generator.rb', line 39 def copy_initializer #copy file lib/asset_manager.rb to app/lib/asset_manager.rb if it doesn't exists copy_file "ckeditor.rb", "config/initializers/ckeditor.rb" unless File.exists?(File.join(destination_root, 'config/initializers', 'ckeditor.rb')) end |
#install_pages ⇒ Object
19 20 21 22 23 |
# File 'lib/generators/mcms_pages/mcms_pages_generator.rb', line 19 def install_pages say "Installing MCMS_PAGES MODULE" end |
#prompt_user ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/generators/mcms_pages/mcms_pages_generator.rb', line 84 def prompt_user say "\ndon't forget to run the following \n rake db:migrate\n rake db:seed\n Add the line\n\n\t\t root :to => 'pages#home'\n\n\t in config/routes.rb file \n start the rails server and hit the url http://localhost:3000/mcms/pages\n Yay!\n\n" end |