aboutsummaryrefslogblamecommitdiffstats
path: root/lib/generators/refinery/blog/blog_generator.rb
blob: 26e37d3802f6d5d0edb71844bf66bd28dd480f36 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                               
 





                                                                                                                                       

                                              
                                                  

       
                             
                                                                                                  


                                                    
                                   






                                
module Refinery
  class BlogGenerator < Rails::Generators::Base

    source_root File.expand_path("../templates", __FILE__)

    def generate_blog_initializer
      template "config/initializers/refinery/blog.rb.erb", File.join(destination_root, "config", "initializers", "refinery", "blog.rb")
    end

    def rake_db
      rake("refinery_blog:install:migrations")
      rake("refinery_settings:install:migrations")
    end

    def append_load_seed_data
      create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
      append_file 'db/seeds.rb', :verbose => true do
        <<-EOH

# Added by Refinery CMS Blog engine
Refinery::Blog::Engine.load_seed
        EOH
      end
    end

  end
end