class Preseason::Recipe::Routes

Public Instance Methods

prepare() click to toggle source
# File lib/preseason/recipe/routes.rb, line 2
def prepare
  remove_comments_and_newlines
  add_root_path
  generate_site_controller
end

Private Instance Methods

add_root_path() click to toggle source
# File lib/preseason/recipe/routes.rb, line 14
def add_root_path
  insert_into_file 'config/routes.rb', "  root :to => 'site#index'\n", :before => /^end$/
end
generate_site_controller() click to toggle source
# File lib/preseason/recipe/routes.rb, line 18
def generate_site_controller
  generate 'controller site index --no-assets --no-helper'
end
remove_comments_and_newlines() click to toggle source
# File lib/preseason/recipe/routes.rb, line 9
def remove_comments_and_newlines
  gsub_file 'config/routes.rb', /^\s*#\s*.*$/, ''
  gsub_file 'config/routes.rb', /^\n/, ''
end