lib/munge/cli/commands/build.rb in munge-0.17.0 vs lib/munge/cli/commands/build.rb in munge-0.18.0

- old
+ new

@@ -7,23 +7,25 @@ # @param dry_run [true, false] # @param reporter [Munge::Reporters] # @param build_root [String, nil] 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) + config = bootloader.config + app = application(bootloader) + destination = File.expand_path(build_root || config[:output_path], destination_root) + io = new_io(dry_run) + @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 + io: io, + reporter: Munge::Reporter.new(formatter: new_formatter(reporter), verbosity: verbosity.to_sym), + destination: destination, + manager: Munge::WriteManager::OnlyNeeded.new(io) ) end # @return [Array<String>] list of updated items routes def call @@ -36,18 +38,18 @@ bootstrap = bootloader.init bootstrap.app end - def writer(dry_run) + def new_io(dry_run) if dry_run - Munge::Writers::Noop.new + Munge::Io::DryRun.new(Munge::Io::Filesystem.new) else - Munge::Writers::Filesystem.new + Munge::Io::Filesystem.new end end - def formatter(class_name) + def new_formatter(class_name) Munge::Formatters.const_get(class_name).new end end end end