lib/ruby/builder/ruby_builder.rb in ruby-builder-0.1.2 vs lib/ruby/builder/ruby_builder.rb in ruby-builder-0.1.3

- old
+ new

@@ -33,21 +33,22 @@ # @param [Array<String>] command # @param [String] dir def execute(*command, dir: nil) if dir Dir.chdir(dir) do - assert_execute(*command) + assert_execute(*command, dir: dir) end else - assert_execute(*command) + assert_execute(*command, dir: dir) end end # @param [Array<String>] command - def assert_execute(*command) + def assert_execute(*command, dir:) logger.info("+ #{command.shelljoin}") unless system(command.shelljoin) - raise BuildFailure.new("Failed to execute '#{command.shelljoin}' at '#{dir}' (exit status: #{$?.exitstatus})") + dir_info = "at '#{dir}' " if dir + raise BuildFailure.new("Failed to execute '#{command.shelljoin}' #{dir_info}(exit status: #{$?.exitstatus})") end end def logger @logger ||= Logger.new(STDOUT)