Sha256: e174951e53eb1301cf4ea13fee7f4eec27c079c4eb280af3c11700d00106431c

Contents?: true

Size: 755 Bytes

Versions: 9

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

module Quilt
  class RailsSetupGenerator < Rails::Generators::Base
    source_root File.expand_path('templates', __dir__)

    desc "This generator mounts the Quilt engine and add Procfile."

    def create_procfile_entry
      procfile_path = "Procfile"

      if File.exist?(procfile_path)
        append_file(procfile_path, File.read(File.expand_path(find_in_source_paths(procfile_path))))
      else
        copy_file(procfile_path)
      end
    end

    def create_route_file
      routes_path = "config/routes.rb"

      if File.exist?(routes_path)
        route("mount Quilt::Engine, at: '/'")
      else
        copy_file("routes.rb", routes_path)
      end

      say("Added Quilt engine mount")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
quilt_rails-3.5.5 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.5.4 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.5.2 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.5.1 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.5.0 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.4.2 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.4.1 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.4.0 lib/generators/quilt/rails_setup/rails_setup_generator.rb
quilt_rails-3.3.1 lib/generators/quilt/rails_setup/rails_setup_generator.rb