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('db/migrate') m.directory('public/slightcms/assets') # Setup migration file m.file('slightcms_setup_migration.rb', '#{Time.now.to_s}_slightcms_setup.rb' # Setup routes in routes.rb m.draw_routes end end end