Skip to content

Commit

Permalink
Merge pull request #134 from jchesterpivotal/detect-condition-first
Browse files Browse the repository at this point in the history
Show group detection conditions first
  • Loading branch information
ekcasey committed May 20, 2019
2 parents a5743d7 + 6eba69a commit 1facd31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ func (bg *BuildpackGroup) Detect(c *DetectConfig) (plan []byte, group *Buildpack
optional := bg.Buildpacks[i].Optional
switch code {
case CodeDetectPass:
c.Out.Printf("%s: pass", name)
c.Out.Printf("pass: %s", name)
group.Buildpacks = append(group.Buildpacks, bg.Buildpacks[i])
case CodeDetectFail:
if optional {
c.Out.Printf("%s: skip", name)
c.Out.Printf("skip: %s", name)
} else {
c.Out.Printf("%s: fail", name)
c.Out.Printf("fail: %s", name)
}
detected = detected && optional
default:
c.Out.Printf("%s: error (%d)", name, code)
c.Out.Printf("err: %s: (%d)", name, code)
detected = detected && optional
}
}
Expand Down
6 changes: 3 additions & 3 deletions detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func testDetector(t *testing.T, when spec.G, it spec.S) {
"======== Output: buildpack4-name ========\n"+
"stdout: 4\nstderr: 4\n"+
"======== Results ========\n"+
"buildpack1-name: pass\nbuildpack2-name: pass\nbuildpack3-name: pass\nbuildpack4-name: skip\n",
"pass: buildpack1-name\npass: buildpack2-name\npass: buildpack3-name\nskip: buildpack4-name\n",
) {
t.Fatalf("Unexpected log: %s\n", outLog)
}
Expand All @@ -137,7 +137,7 @@ func testDetector(t *testing.T, when spec.G, it spec.S) {
"======== Output: buildpack2-name ========\n"+
"stdout: 1\nstderr: 1\n"+
"======== Results ========\n"+
"buildpack1-name: fail\nbuildpack2-name: fail\n",
"fail: buildpack1-name\nfail: buildpack2-name\n",
) {
t.Fatalf("Unexpected log: %s\n", outLog)
}
Expand All @@ -161,7 +161,7 @@ func testDetector(t *testing.T, when spec.G, it spec.S) {
"======== Output: buildpack2-name ========\n"+
"stdout: 1\nstderr: 1\n"+
"======== Results ========\n"+
"buildpack1-name: error (1)\nbuildpack2-name: error (1)\n",
"err: buildpack1-name: (1)\nerr: buildpack2-name: (1)\n",
) {
t.Fatalf("Unexpected log: %s\n", outLog)
}
Expand Down

0 comments on commit 1facd31

Please sign in to comment.