class Umwelt::CLI::Commands::Convey

Public Instance Methods

call(phase:, semantic:, **options) click to toggle source
# File lib/umwelt/cli/commands/convey.rb, line 32
def call(phase:, semantic:, **options)
  puts "Buildung phase: #{phase} with semantic #{semantic}..."

  if phase.to_i.zero?
    puts 'Error: Phase must be an integer'
    return
  end

  report(
    Umwelt::Command::Convey.new.call(
      phase_id: phase.to_i,
      semantic: classify(semantic).to_sym,
      source: Pathname.new(options.fetch(:source)),
      target: Pathname.new(options.fetch(:target))
    )
  )
end

Private Instance Methods

report(result) click to toggle source
# File lib/umwelt/cli/commands/convey.rb, line 52
def report(result)
  if result.success?
    result.written_paths.each_pair do |key, value|
      puts "#{key} => (#{value})"
    end
    puts "#{result.written_paths.keys.count} files written succesfully"
  else
    result.errors.each { |e| puts "Error: #{e}" }
  end
end