Class: McmsBlogGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- McmsBlogGenerator
- Defined in:
- lib/generators/mcms_blog/mcms_blog_generator.rb
Instance Method Summary collapse
- #add_migrations ⇒ Object
- #append_seed_data ⇒ Object
- #copy_asset_manager ⇒ Object
- #copy_initializer ⇒ Object
Instance Method Details
#add_migrations ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/generators/mcms_blog/mcms_blog_generator.rb', line 30 def add_migrations say "copying migrations......." # running command line command to copy engine's migration file rake("mcms_blog_engine:install:migrations") end |
#append_seed_data ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/generators/mcms_blog/mcms_blog_generator.rb', line 42 def append_seed_data # create file db/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 McmsBlog::Engine.load_seed EOH end # end block end |
#copy_asset_manager ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/generators/mcms_blog/mcms_blog_generator.rb', line 8 def copy_asset_manager #copy file lib/asset_manager.rb to app/lib/asset_manager.rb if it doesn't exists copy_file "asset_manager.rb", "lib/asset_manager.rb" unless File.exists?(File.join(destination_root, 'lib', 'asset_manager.rb')) end |
#copy_initializer ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/generators/mcms_blog/mcms_blog_generator.rb', line 19 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 |