Skip to content

Commit db4b945

Browse files
Arjun SreedharanRyan Moran
andauthored
Do not generously set bundle-install to be launch layer (#8)
- unless asked by a downstream cnb - Use the build-plan cnb in the testdata app Co-authored-by: Ryan Moran <rmoran@pivotal.io>
1 parent 6febdfb commit db4b945

55 files changed

Lines changed: 650 additions & 126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bundle/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package bundle
33
import (
44
"time"
55

6-
"github.com/cloudfoundry/packit"
6+
"github.com/paketo-buildpacks/packit"
77
)
88

99
//go:generate faux --interface InstallProcess --output fakes/install_process.go

bundle/build_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"testing"
1010
"time"
1111

12-
"github.com/cloudfoundry/packit"
12+
"github.com/paketo-buildpacks/packit"
1313
"github.com/paketo-community/bundle-install/bundle"
1414
"github.com/paketo-community/bundle-install/bundle/fakes"
1515
"github.com/sclevine/spec"

bundle/bundle_install_process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"fmt"
66

7-
"github.com/cloudfoundry/packit/pexec"
7+
"github.com/paketo-buildpacks/packit/pexec"
88
)
99

1010
//go:generate faux --interface Executable --output fakes/executable.go

bundle/bundle_install_process_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
"testing"
99

10-
"github.com/cloudfoundry/packit/pexec"
10+
"github.com/paketo-buildpacks/packit/pexec"
1111
"github.com/paketo-community/bundle-install/bundle"
1212
"github.com/paketo-community/bundle-install/bundle/fakes"
1313
"github.com/sclevine/spec"

bundle/detect.go

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package bundle
22

33
import (
4-
"errors"
54
"fmt"
6-
"os"
75
"path/filepath"
86

9-
"github.com/cloudfoundry/packit"
7+
"github.com/paketo-buildpacks/packit"
108
)
119

1210
//go:generate faux --interface VersionParser --output fakes/version_parser.go
@@ -21,15 +19,6 @@ type BuildPlanMetadata struct {
2119

2220
func Detect(gemfileParser VersionParser) packit.DetectFunc {
2321
return func(context packit.DetectContext) (packit.DetectResult, error) {
24-
_, err := os.Stat(filepath.Join(context.WorkingDir, "Gemfile"))
25-
if err != nil {
26-
if errors.Is(err, os.ErrNotExist) {
27-
return packit.DetectResult{}, packit.Fail
28-
}
29-
30-
panic(err)
31-
}
32-
3322
mriVersion, err := gemfileParser.ParseVersion(filepath.Join(context.WorkingDir, "Gemfile"))
3423
if err != nil {
3524
return packit.DetectResult{}, fmt.Errorf("failed to parse Gemfile: %w", err)
@@ -41,26 +30,17 @@ func Detect(gemfileParser VersionParser) packit.DetectFunc {
4130
{Name: GemsDependency},
4231
},
4332
Requires: []packit.BuildPlanRequirement{
44-
{
45-
Name: GemsDependency,
46-
Metadata: BuildPlanMetadata{
47-
Build: false,
48-
Launch: true,
49-
},
50-
},
5133
{
5234
Name: BundlerDependency,
5335
Metadata: BuildPlanMetadata{
54-
Build: true,
55-
Launch: true,
36+
Build: true,
5637
},
5738
},
5839
{
5940
Name: MRIDependency,
6041
Version: mriVersion,
6142
Metadata: BuildPlanMetadata{
62-
Build: true,
63-
Launch: true,
43+
Build: true,
6444
},
6545
},
6646
},

bundle/detect_test.go

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"io/ioutil"
1010

11-
"github.com/cloudfoundry/packit"
11+
"github.com/paketo-buildpacks/packit"
1212
"github.com/paketo-community/bundle-install/bundle"
1313
"github.com/paketo-community/bundle-install/bundle/fakes"
1414
"github.com/sclevine/spec"
@@ -52,43 +52,22 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
5252
{Name: "gems"},
5353
},
5454
Requires: []packit.BuildPlanRequirement{
55-
{
56-
Name: "gems",
57-
Metadata: bundle.BuildPlanMetadata{
58-
Launch: true,
59-
},
60-
},
6155
{
6256
Name: "bundler",
6357
Metadata: bundle.BuildPlanMetadata{
64-
Build: true,
65-
Launch: true,
58+
Build: true,
6659
},
6760
},
6861
{
6962
Name: "mri",
7063
Metadata: bundle.BuildPlanMetadata{
71-
Build: true,
72-
Launch: true,
64+
Build: true,
7365
},
7466
},
7567
},
7668
}))
7769
})
7870

79-
context("when the Gemfile file does not exist", func() {
80-
it.Before(func() {
81-
Expect(os.Remove(filepath.Join(workingDir, "Gemfile"))).To(Succeed())
82-
})
83-
84-
it("fails detection", func() {
85-
_, err := detect(packit.DetectContext{
86-
WorkingDir: workingDir,
87-
})
88-
Expect(err).To(MatchError(packit.Fail))
89-
})
90-
})
91-
9271
context("when the Gemfile specifies an mri ruby version", func() {
9372
it.Before(func() {
9473
gemfileParser.ParseVersionCall.Returns.Version = "2.6.x"
@@ -104,25 +83,17 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
10483
{Name: "gems"},
10584
},
10685
Requires: []packit.BuildPlanRequirement{
107-
{
108-
Name: "gems",
109-
Metadata: bundle.BuildPlanMetadata{
110-
Launch: true,
111-
},
112-
},
11386
{
11487
Name: "bundler",
11588
Metadata: bundle.BuildPlanMetadata{
116-
Build: true,
117-
Launch: true,
89+
Build: true,
11890
},
11991
},
12092
{
12193
Name: "mri",
12294
Version: "2.6.x",
12395
Metadata: bundle.BuildPlanMetadata{
124-
Build: true,
125-
Launch: true,
96+
Build: true,
12697
},
12798
},
12899
},

bundle/fakes/executable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package fakes
33
import (
44
"sync"
55

6-
"github.com/cloudfoundry/packit/pexec"
6+
"github.com/paketo-buildpacks/packit/pexec"
77
)
88

99
type Executable struct {

bundle/log_emitter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package bundle
33
import (
44
"io"
55

6-
"github.com/cloudfoundry/packit"
7-
"github.com/cloudfoundry/packit/scribe"
6+
"github.com/paketo-buildpacks/packit"
7+
"github.com/paketo-buildpacks/packit/scribe"
88
)
99

1010
type LogEmitter struct {

bundle/log_emitter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"testing"
66

7-
"github.com/cloudfoundry/packit"
7+
"github.com/paketo-buildpacks/packit"
88
"github.com/paketo-community/bundle-install/bundle"
99
"github.com/sclevine/spec"
1010

cmd/build/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"os"
55
"time"
66

7-
"github.com/cloudfoundry/packit"
8-
"github.com/cloudfoundry/packit/pexec"
7+
"github.com/paketo-buildpacks/packit"
8+
"github.com/paketo-buildpacks/packit/pexec"
99
"github.com/paketo-community/bundle-install/bundle"
1010
)
1111

0 commit comments

Comments
 (0)