Sha256: 5628494d3042d9efdda83ae19205dcba4d56fb8fba17a95216c87ae7084c22ec

Contents?: true

Size: 855 Bytes

Versions: 19

Compression:

Stored size: 855 Bytes

Contents

# typed: true
# frozen_string_literal: true

module Packwerk
  module Generators
    class RootPackage
      extend T::Sig

      class << self
        def generate(root:, out:)
          new(root: root, out: out).generate
        end
      end

      def initialize(root:, out: $stdout)
        @root = root
        @out = out
      end

      sig { returns(T::Boolean) }
      def generate
        if Dir.glob("#{@root}/package.yml").any?
          @out.puts("⚠️  Root package already exists.")
          return true
        end

        @out.puts("📦 Generating `package.yml` file for root package...")

        source_file_path = File.join(__dir__, "/templates/package.yml")
        FileUtils.cp(source_file_path, @root)

        @out.puts("✅ `package.yml` for the root package generated in #{@root}")
        true
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
packwerk-2.3.0 lib/packwerk/generators/root_package.rb
packwerk-2.2.2 lib/packwerk/generators/root_package.rb
packwerk-2.2.1 lib/packwerk/generators/root_package.rb
packwerk-2.2.0 lib/packwerk/generators/root_package.rb
packwerk-2.1.1 lib/packwerk/generators/root_package.rb
packwerk-2.1.0 lib/packwerk/generators/root_package.rb
packwerk-2.0.0 lib/packwerk/generators/root_package.rb
packwerk-1.4.0 lib/packwerk/generators/root_package.rb
packwerk-1.3.2 lib/packwerk/generators/root_package.rb
packwerk-1.3.1 lib/packwerk/generators/root_package.rb
packwerk-1.3.0 lib/packwerk/generators/root_package.rb
packwerk-1.2.0 lib/packwerk/generators/root_package.rb
packwerk-1.1.3 lib/packwerk/generators/root_package.rb
packwerk-1.1.2 lib/packwerk/generators/root_package.rb
packwerk-1.1.1 lib/packwerk/generators/root_package.rb
packwerk-1.1.0 lib/packwerk/generators/root_package.rb
packwerk-1.0.2 lib/packwerk/generators/root_package.rb
packwerk-1.0.1 lib/packwerk/generators/root_package.rb
packwerk-1.0.0 lib/packwerk/generators/root_package.rb