Class: Munge::Cli::Commands::Clean

Inherits:
Object
  • Object
show all
Defined in:
lib/munge/cli/commands/clean.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) ⇒ Clean

Returns a new instance of Clean.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/munge/cli/commands/clean.rb', line 6

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

  memory = Munge::Vfs::Memory.new
  vfs = new_vfs(dry_run, destination)

  loader = Munge::Load.new(bootloader.root_path)

  @runner =
    loader.app do |_application, conglomerate|
      Munge::Function::Write.new(
        conglomerate: conglomerate,
        reporter: Munge::Reporter.new(formatter: formatter("Silent"), verbosity: :silent),
        manager: Munge::WriteManager::All.new(memory),
        destination: memory
      ).call

      Munge::Function::Clean.new(
        memory: memory,
        destination: vfs
      )
    end

  @output_path = File.expand_path(build_root || config[:output_path], destination_root)
end

Instance Method Details

#callObject



34
35
36
# File 'lib/munge/cli/commands/clean.rb', line 34

def call
  @runner.call
end