class Pages::Generators::HomeGenerator
Public Instance Methods
add_tests()
click to toggle source
# File lib/generators/pages/home/home_generator.rb, line 18 def add_tests return unless File.exists?('spec/spec_helper.rb') copy_file 'home_page_spec.rb', 'spec/features/visitors/home_page_spec.rb' end
create_page()
click to toggle source
# File lib/generators/pages/home/home_generator.rb, line 10 def create_page return if File.exists?('app/views/visitors/index.html.erb') copy_file 'index.html.erb', 'app/views/visitors/index.html.erb' copy_file 'visitors_controller.rb', 'app/controllers/visitors_controller.rb' route = " root to: 'visitors#index'" inject_into_file 'config/routes.rb', route + "\n", :after => "routes.draw do\n" end