Class: Packwerk::Generators::RootPackage
- Inherits:
-
Object
- Object
- Packwerk::Generators::RootPackage
- Extended by:
- T::Sig
- Defined in:
- lib/packwerk/generators/root_package.rb
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(root:, out: $stdout) ⇒ RootPackage
constructor
A new instance of RootPackage.
Constructor Details
#initialize(root:, out: $stdout) ⇒ RootPackage
Returns a new instance of RootPackage.
19 20 21 22 |
# File 'lib/packwerk/generators/root_package.rb', line 19 def initialize(root:, out: $stdout) @root = root @out = out end |
Class Method Details
.generate(root:, out:) ⇒ Object
13 14 15 |
# File 'lib/packwerk/generators/root_package.rb', line 13 def generate(root:, out:) new(root: root, out: out).generate end |
Instance Method Details
#generate ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/packwerk/generators/root_package.rb', line 25 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 |