Sha256: ee67a7ff420bff7cccb7300301bb1de7b056f32accb106ac5bf241eb70556f73
Contents?: true
Size: 724 Bytes
Versions: 19
Compression:
Stored size: 724 Bytes
Contents
require 'rails/generators' module Pages module Generators class HomeGenerator < ::Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) desc "Create a home page" def create_page 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 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 end end end
Version data entries
19 entries across 19 versions & 1 rubygems