Sha256: 4e5fe505cb30e260ba89fe0cb4d866164923c587944731cff52a88dac1e3f96e

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

# frozen_string_literal: true

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

    desc "This generator creates a sewing-kit config file."

    def initialize(args, *options)
      @application_name = Rails.application.class.module_parent.to_s.underscore
      super(args, *options)
    end

    def create_package_json
      package_json_path = "package.json"

      copy_file(package_json_path)
      gsub_file(package_json_path, "\${application_name}", @application_name)
    end

    def create_sk_config
      sk_config_path = "config/sewing-kit.config.ts"

      copy_file("sewing-kit.config.ts", sk_config_path)
      gsub_file(sk_config_path, "\${application_name}", @application_name)
    end

    def create_config_files
      copy_file(".editorconfig")
      copy_file(".eslintignore")
      copy_file(".prettierignore")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quilt_rails-1.13.0 lib/generators/sewing_kit/install_generator.rb