class Rails::Generator::Commands::Create def draw_routes file_start = 'ActionController::Routing::Routes.draw do |map|' unless options[:pretend] gsub_file 'config/routes.rb', /(#{Regexp.escape(file_start)})/mi do |match| "#{match}\n map.slightcms_pages '/:path', :controller => :slightcms_pages, :action => :show\n" end end end end class SlightcmsSetupGenerator < Rails::Generator::Base def manifest record do |m| # Setup directories m.directory('public/slightcms/assets') # Setup migration file m.migration_template('migrate/slightcms_setup_migration.rb', 'db/migrate') # Setup routes in routes.rb # m.draw_routes end end def file_name "slightcms_setup" end end