Class: Packwerk::Commands::InitCommand

Inherits:
BaseCommand show all
Extended by:
T::Sig
Defined in:
lib/packwerk/commands/init_command.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

description, #initialize

Constructor Details

This class inherits a constructor from Packwerk::Commands::BaseCommand

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/packwerk/commands/init_command.rb', line 12

def run
  out.puts("📦 Initializing Packwerk...")

  configuration_file = Generators::ConfigurationFile.generate(
    root: configuration.root_path,
    out: out
  )

  root_package = Generators::RootPackage.generate(root: configuration.root_path, out: out)

  success = configuration_file && root_package

  if success
    out.puts(<<~EOS)

      🎉 Packwerk is ready to be used. You can start defining packages and run `bin/packwerk check`.
      For more information on how to use Packwerk, see: https://github.com/Shopify/packwerk/blob/main/USAGE.md
    EOS
  else
    out.puts(<<~EOS)

      ⚠️  Packwerk is not ready to be used.
      Please check output and refer to https://github.com/Shopify/packwerk/blob/main/USAGE.md for more information.
    EOS
  end

  success
end