Sha256: 47fa6aadd85c2ab1cf6a5738df8eb7a5cea87ec0b32ef92ec065db5f5611b86d

Contents?: true

Size: 843 Bytes

Versions: 6

Compression:

Stored size: 843 Bytes

Contents

require 'rails/generators/base'

module SpiffyStoresApp
  module Generators
    class HomeControllerGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)

      def create_home_controller
        template 'home_controller.rb', 'app/controllers/home_controller.rb'
      end

      def create_home_index_view
        copy_file 'index.html.erb', 'app/views/home/index.html.erb'
        if embedded_app?
          prepend_to_file(
            'app/views/home/index.html.erb',
            File.read(File.expand_path(find_in_source_paths('spiffy_stores_app_ready_script.html.erb')))
          )
        end
      end

      def add_home_index_route
        route "root :to => 'home#index'"
      end

      def embedded_app?
        SpiffyStoresApp.configuration.embedded_app?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spiffy_stores_app-8.2.11 lib/generators/spiffy_stores_app/home_controller/home_controller_generator.rb
spiffy_stores_app-8.2.10 lib/generators/spiffy_stores_app/home_controller/home_controller_generator.rb
spiffy_stores_app-8.2.9 lib/generators/spiffy_stores_app/home_controller/home_controller_generator.rb
spiffy_stores_app-8.2.8 lib/generators/spiffy_stores_app/home_controller/home_controller_generator.rb
spiffy_stores_app-8.2.7 lib/generators/spiffy_stores_app/home_controller/home_controller_generator.rb
spiffy_stores_app-8.2.6 lib/generators/spiffy_stores_app/home_controller/home_controller_generator.rb