本文整理汇总了Golang中github.com/bitrise-io/bitrise/models.BuildRunResultsModel.OrderedResults方法的典型用法代码示例。如果您正苦于以下问题:Golang BuildRunResultsModel.OrderedResults方法的具体用法?Golang BuildRunResultsModel.OrderedResults怎么用?Golang BuildRunResultsModel.OrderedResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/bitrise-io/bitrise/models.BuildRunResultsModel
的用法示例。
在下文中一共展示了BuildRunResultsModel.OrderedResults方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: PrintSummary
// PrintSummary ...
func PrintSummary(buildRunResults models.BuildRunResultsModel) {
iconBoxWidth := len(" ")
timeBoxWidth := len(" time (s) ")
titleBoxWidth := stepRunSummaryBoxWidthInChars - 4 - iconBoxWidth - timeBoxWidth
fmt.Println()
fmt.Println()
log.Infof("+%s+", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
whitespaceWidth := (stepRunSummaryBoxWidthInChars - 2 - len("bitrise summary")) / 2
log.Infof("|%sbitrise summary%s|", strings.Repeat(" ", whitespaceWidth), strings.Repeat(" ", whitespaceWidth))
log.Infof("+%s+%s+%s+", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
whitespaceWidth = stepRunSummaryBoxWidthInChars - len("| | title") - len("| time (s) |")
log.Infof("| | title%s| time (s) |", strings.Repeat(" ", whitespaceWidth))
log.Infof("+%s+%s+%s+", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
orderedResults := buildRunResults.OrderedResults()
tmpTime := time.Time{}
for _, stepRunResult := range orderedResults {
tmpTime = tmpTime.Add(stepRunResult.RunTime)
log.Info(stepResultCell(stepRunResult))
}
runtime := tmpTime.Sub(time.Time{})
log.Infof("+%s+", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
runtimeStr := TimeToFormattedSeconds(runtime, " sec")
whitespaceWidth = stepRunSummaryBoxWidthInChars - len(fmt.Sprintf("| Total runtime: %s|", runtimeStr))
log.Infof("| Total runtime: %s%s|", runtimeStr, strings.Repeat(" ", whitespaceWidth))
log.Infof("+%s+", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
fmt.Println()
}
示例2: PrintSummary
// PrintSummary ...
func PrintSummary(buildRunResults models.BuildRunResultsModel) {
iconBoxWidth := len(" ")
timeBoxWidth := len(" time (s) ")
titleBoxWidth := stepRunSummaryBoxWidthInChars - 4 - iconBoxWidth - timeBoxWidth
fmt.Println()
fmt.Println()
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
whitespaceWidth := (stepRunSummaryBoxWidthInChars - 2 - len("bitrise summary ")) / 2
fmt.Printf("|%sbitrise summary %s|\n", strings.Repeat(" ", whitespaceWidth), strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
whitespaceWidth = stepRunSummaryBoxWidthInChars - len("| | title") - len("| time (s) |")
fmt.Printf("| | title%s| time (s) |\n", strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
orderedResults := buildRunResults.OrderedResults()
tmpTime := time.Time{}
for _, stepRunResult := range orderedResults {
tmpTime = tmpTime.Add(stepRunResult.RunTime)
fmt.Println(getRunningStepFooterMainSection(stepRunResult))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
if stepRunResult.Error != nil || stepRunResult.StepInfo.GlobalInfo.RemovalDate != "" || isUpdateAvailable(stepRunResult.StepInfo) {
footerSubSection := getRunningStepFooterSubSection(stepRunResult)
if footerSubSection != "" {
fmt.Println(footerSubSection)
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
}
}
}
runtime := tmpTime.Sub(time.Time{})
runTimeStr, err := FormattedSecondsToMax8Chars(runtime)
if err != nil {
log.Errorf("Failed to format time, error: %s", err)
runTimeStr = "999+ hour"
}
whitespaceWidth = stepRunSummaryBoxWidthInChars - len(fmt.Sprintf("| Total runtime: %s|", runTimeStr))
if whitespaceWidth < 0 {
log.Errorf("Invalid time box size for RunTime: %#v", runtime)
whitespaceWidth = 0
}
fmt.Printf("| Total runtime: %s%s|\n", runTimeStr, strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
fmt.Println()
}
示例3: PrintSummary
// PrintSummary ...
func PrintSummary(buildRunResults models.BuildRunResultsModel) {
iconBoxWidth := len(" ")
timeBoxWidth := len(" time (s) ")
titleBoxWidth := stepRunSummaryBoxWidthInChars - 4 - iconBoxWidth - timeBoxWidth
fmt.Println()
fmt.Println()
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
whitespaceWidth := (stepRunSummaryBoxWidthInChars - 2 - len("bitrise summary ")) / 2
fmt.Printf("|%sbitrise summary %s|\n", strings.Repeat(" ", whitespaceWidth), strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
whitespaceWidth = stepRunSummaryBoxWidthInChars - len("| | title") - len("| time (s) |")
fmt.Printf("| | title%s| time (s) |\n", strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
orderedResults := buildRunResults.OrderedResults()
tmpTime := time.Time{}
for _, stepRunResult := range orderedResults {
tmpTime = tmpTime.Add(stepRunResult.RunTime)
fmt.Println(getRunningStepFooterMainSection(stepRunResult))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
if stepRunResult.Error != nil {
isUpdateAvailable := IsUpdateAvailable(stepRunResult.StepInfo)
footerSubSection := getRunningStepFooterSubSection(stepRunResult, isUpdateAvailable)
if footerSubSection != "" {
fmt.Println(footerSubSection)
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
}
}
}
runtime := tmpTime.Sub(time.Time{})
runtimeStr := TimeToFormattedSeconds(runtime, " sec")
whitespaceWidth = stepRunSummaryBoxWidthInChars - len(fmt.Sprintf("| Total runtime: %s|", runtimeStr))
fmt.Printf("| Total runtime: %s%s|\n", runtimeStr, strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
fmt.Println()
}