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

Version Path
rails_apps_pages-0.5.8 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.7 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.6 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.5 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.4 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.3 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.2 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.1 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.5.0 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.9 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.8 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.7 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.6 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.5 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.4 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.3 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.2 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.1 lib/generators/pages/home/home_generator.rb
rails_apps_pages-0.4.0 lib/generators/pages/home/home_generator.rb