Class: Chapter07::Generators::SolutionsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/chapter07/solutions/solutions_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_help_routeObject



10
11
12
13
14
15
16
# File 'lib/generators/chapter07/solutions/solutions_generator.rb', line 10

def add_help_route

  dest = File.join(Rails.root,'config','routes.rb')
  insert_into_file(dest, :after => %r{/about.*:to.*pages#about.*$}) do
    "\n  match '/help',    :to => 'pages#help'"
  end
end

#copy_app_treeObject



6
7
8
# File 'lib/generators/chapter07/solutions/solutions_generator.rb', line 6

def copy_app_tree
  directory(self.class.source_root, Rails.root)
end

#remove_static_index_html_fileObject



18
19
20
# File 'lib/generators/chapter07/solutions/solutions_generator.rb', line 18

def remove_static_index_html_file
  remove_file(File.join(Rails.root, 'public', 'index.html'))
end