Class: Munge::Cli::Commands::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/munge/cli/commands/build.rb

Overview

This class is used by the CLI to build and calculate output

Instance Method Summary collapse

Constructor Details

#initialize(bootloader, dry_run:, reporter:, verbosity:, build_root: nil) ⇒ Build

Returns a new instance of Build.

Parameters:

  • bootloader (Munge::Bootloader)
  • dry_run (true, false)
  • reporter (Munge::Reporters)
  • build_root (String, nil) (defaults to: nil)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/munge/cli/commands/build.rb', line 10

def initialize(bootloader, dry_run:, reporter:, verbosity:, build_root: nil)
  destination_root = bootloader.root_path
  config           = bootloader.config
  app              = application(bootloader)
  destination      = File.expand_path(build_root || config[:output_path], destination_root)

  @runner =
    Munge::Runner.new(
      items: app.vomit(:items),
      router: app.vomit(:router),
      processor: app.vomit(:processor),
      writer: writer(dry_run),
      formatter: formatter(reporter),
      verbosity: verbosity.to_sym,
      destination: destination
    )
end

Instance Method Details

#callObject



28
29
30
# File 'lib/munge/cli/commands/build.rb', line 28

def call
  @runner.write
end