lib/generators/simple_pages/install_generator.rb in simple-pages-rails-0.1.0 vs lib/generators/simple_pages/install_generator.rb in simple-pages-rails-0.2.0

- old
+ new

@@ -12,10 +12,26 @@ def copy_config_file template 'simple_pages.rb', 'config/initializers/simple_pages.rb' end + def mount_routes + insert_into_file 'config/routes.rb', after: "routes.draw do\n" do + " mount SimplePages::Engine, at: '/'\n" + end + end + + def inject_application_controller + insert_into_file 'app/controllers/application_controller.rb', after: /class ApplicationController < ActionController::Base\n/ do + <<-CODE + include DeviseExt + include CanCanExt + include SimplePages::Controllers::PageLayoutAt + CODE + end + end + def append_user_mixin user_model = "app/models/#{options[:user_model].downcase}.rb" unless File.exist? user_model raise 'You need to specify an user model. Try --user-model option' end @@ -25,15 +41,9 @@ email end include SimplePages::Models::PageAuthor CODE - end - end - - def mount_routes - insert_into_file 'config/routes.rb', after: "routes.draw do\n" do - " mount SimplePages::Engine, at: '/'\n" end end end end end