Sha256: 2fd5b76da0cd5b64d68f320c9e97833357e0686c07d46ce1f4f2bc640352f0f8

Contents?: true

Size: 561 Bytes

Versions: 5

Compression:

Stored size: 561 Bytes

Contents

class RailsPallet::InstallGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  def create_initializer
    template "initializer.rb", "config/initializers/rails_pallet.rb"
  end

  def mount_routes
    line = "Rails.application.routes.draw do"
    gsub_file "config/routes.rb", /(#{Regexp.escape(line)})/mi do |match|
      <<-HERE.gsub(/^ {9}/, '')
         #{match}
           mount RailsPallet::Engine => '/'
         HERE
    end
  end

  def copy_engine_migrations
    rake "railties:install:migrations"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_pallet-2.2.0 lib/generators/rails_pallet/install/install_generator.rb
rails_pallet-2.1.0 lib/generators/rails_pallet/install/install_generator.rb
rails_pallet-2.0.2 lib/generators/rails_pallet/install/install_generator.rb
rails_pallet-2.0.1 lib/generators/rails_pallet/install/install_generator.rb
rails_pallet-2.0.0 lib/generators/rails_pallet/install/install_generator.rb