lib/umwelt/cli/commands/convey.rb in umwelt-0.1.1 vs lib/umwelt/cli/commands/convey.rb in umwelt-0.2

- old
+ new

@@ -35,23 +35,29 @@ if phase.to_i.zero? puts 'Error: Phase must be an integer' return end - @convey = 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)) + 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 - if @convey.success? - @convey.result.each_pair do |key, value| + private + + def report(result) + if result.success? + result.written_paths.each_pair do |key, value| puts "#{key} => (#{value})" end - puts "#{@convey.result.keys.count} files written succesfully" + puts "#{result.written_paths.keys.count} files written succesfully" else - @convey.errors.each { |e| puts "Error: #{e}" } + result.errors.each { |e| puts "Error: #{e}" } end end end end