Beispiel #1
0
def print_summary (successful, summary, start, end, options, failure_message):
    sys.stdout.write("\n")
    drawLine()
    if successful:
        msg = "BUILD SUCCESSFUL\n"
        if should_colorize(options):
            msg = styled_text(msg, BOLD, fg(GREEN))
    else:
        msg = "BUILD FAILED - %s\n" % failure_message
        if should_colorize(options):
            msg = styled_text(msg, BOLD, fg(RED))
    sys.stdout.write(msg)
    drawLine()

    if successful and summary:
        sys.stdout.write("Build Summary\n")
        sys.stdout.write("%20s: %s\n" % ("Project", summary.project.name))
        sys.stdout.write("%20s: %s\n" % ("Version", summary.project.version))
        sys.stdout.write("%20s: %s\n" % ("Base directory", summary.project.basedir))
        sys.stdout.write("%20s: %s\n" % ("Environments", ", ".join(options.environments)))

        task_summary = ""
        for task in summary.task_summaries:
            task_summary += " %s [%d ms]" % (task.task, task.execution_time)

        sys.stdout.write("%20s:%s\n" % ("Tasks", task_summary))

    time_needed = end - start
    millis = ((time_needed.days * 24 * 60 * 60) + time_needed.seconds) * 1000 + time_needed.microseconds / 1000

    sys.stdout.write("Build finished at %s\n" % format_timestamp(end))
    sys.stdout.write("Build took %d seconds (%d ms)\n" % (time_needed.seconds, millis))
Beispiel #2
0
 def _level_to_string(self, level):
     if Logger.DEBUG == level:
         return italic("[DEBUG]")
     if Logger.INFO == level:
         return bold("[INFO] ")
     if Logger.WARN == level:
         return styled_text("[WARN] ", BOLD, fg(BROWN))
     return styled_text("[ERROR]", BOLD, fg(RED))