lib/project/runner.rb in project-0.8.0 vs lib/project/runner.rb in project-0.9.0

- old
+ new

@@ -14,21 +14,34 @@ self.workflow = Workflow.find(project.workflow) exit_with "No workflow found using key '#{self.project.workflow}'" if self.project.nil? end def run! - $stdout.puts "* Opening project '#{self.key}' using workflow '#{self.project.workflow}'" + say "* Opening project '#{self.key}' using workflow '#{self.project.workflow}'" + seperator - self.workflow.each do |command| + self.workflow.each_with_index do |command, index| command = Template.new(command, self.project).parse + output = %x[ #{command} ].chomp - %x[ #{command} ] + unless output.empty? + say output + seperator unless index == (self.workflow.size - 1) + end end end private + def say(*things) + $stdout.puts *things + end + def exit_with(message, code=1) - $stdout.puts message + say message Kernel.exit(code) + end + + def seperator + say "", ("*" * 80), "" end end end