Skip to content

Commit 575656f

Browse files
ryanmorandwillist
andauthored
Move main.go into run sub-package (#6)
This ensures that we don't have issues with importing `main` if that needs to happen. Co-authored-by: Daniel Thornton <dthornton@pivotal.io>
1 parent a5af3f5 commit 575656f

8 files changed

Lines changed: 26 additions & 25 deletions

File tree

build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package rackup
22

33
import (
44
"github.com/paketo-buildpacks/packit"

build_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main_test
1+
package rackup_test
22

33
import (
44
"bytes"
@@ -8,7 +8,7 @@ import (
88

99
"github.com/paketo-buildpacks/packit"
1010
"github.com/paketo-buildpacks/packit/scribe"
11-
main "github.com/paketo-community/rackup"
11+
"github.com/paketo-community/rackup"
1212
"github.com/sclevine/spec"
1313

1414
. "github.com/onsi/gomega"
@@ -40,7 +40,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
4040
buffer = bytes.NewBuffer(nil)
4141
logger := scribe.NewLogger(buffer)
4242

43-
build = main.Build(logger)
43+
build = rackup.Build(logger)
4444
})
4545

4646
it.After(func() {

detect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package rackup
22

33
import (
44
"fmt"

detect_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main_test
1+
package rackup_test
22

33
import (
44
"errors"
@@ -8,7 +8,7 @@ import (
88
"testing"
99

1010
"github.com/paketo-buildpacks/packit"
11-
main "github.com/paketo-community/rackup"
11+
"github.com/paketo-community/rackup"
1212
"github.com/paketo-community/rackup/fakes"
1313
"github.com/sclevine/spec"
1414

@@ -37,7 +37,7 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
3737

3838
gemfileLockParser = &fakes.GemParser{}
3939

40-
detect = main.Detect(gemfileLockParser)
40+
detect = rackup.Detect(gemfileLockParser)
4141
})
4242

4343
it.After(func() {
@@ -56,19 +56,19 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
5656
Requires: []packit.BuildPlanRequirement{
5757
{
5858
Name: "gems",
59-
Metadata: main.BuildPlanMetadata{
59+
Metadata: rackup.BuildPlanMetadata{
6060
Launch: true,
6161
},
6262
},
6363
{
6464
Name: "bundler",
65-
Metadata: main.BuildPlanMetadata{
65+
Metadata: rackup.BuildPlanMetadata{
6666
Launch: true,
6767
},
6868
},
6969
{
7070
Name: "mri",
71-
Metadata: main.BuildPlanMetadata{
71+
Metadata: rackup.BuildPlanMetadata{
7272
Launch: true,
7373
},
7474
},
@@ -93,19 +93,19 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
9393
Requires: []packit.BuildPlanRequirement{
9494
{
9595
Name: "gems",
96-
Metadata: main.BuildPlanMetadata{
96+
Metadata: rackup.BuildPlanMetadata{
9797
Launch: true,
9898
},
9999
},
100100
{
101101
Name: "bundler",
102-
Metadata: main.BuildPlanMetadata{
102+
Metadata: rackup.BuildPlanMetadata{
103103
Launch: true,
104104
},
105105
},
106106
{
107107
Name: "mri",
108-
Metadata: main.BuildPlanMetadata{
108+
Metadata: rackup.BuildPlanMetadata{
109109
Launch: true,
110110
},
111111
},

gemfile_lock_parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package rackup
22

33
import (
44
"bufio"

gemfile_lock_parser_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package main_test
1+
package rackup_test
22

33
import (
44
"io/ioutil"
55
"os"
66
"testing"
77

8-
main "github.com/paketo-community/rackup"
8+
"github.com/paketo-community/rackup"
99
"github.com/sclevine/spec"
1010

1111
. "github.com/onsi/gomega"
@@ -16,7 +16,7 @@ func testGemfileLockParser(t *testing.T, context spec.G, it spec.S) {
1616
Expect = NewWithT(t).Expect
1717

1818
path string
19-
parser main.GemfileLockParser
19+
parser rackup.GemfileLockParser
2020
)
2121

2222
it.Before(func() {
@@ -45,7 +45,7 @@ DEPENDENCIES
4545

4646
path = file.Name()
4747

48-
parser = main.NewGemfileLockParser()
48+
parser = rackup.NewGemfileLockParser()
4949
})
5050

5151
it.After(func() {

init_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main_test
1+
package rackup_test
22

33
import (
44
"testing"

main.go renamed to run/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import (
55

66
"github.com/paketo-buildpacks/packit"
77
"github.com/paketo-buildpacks/packit/scribe"
8+
"github.com/paketo-community/rackup"
89
)
910

1011
func main() {
1112
logger := scribe.NewLogger(os.Stdout)
12-
parser := NewGemfileLockParser()
13+
parser := rackup.NewGemfileLockParser()
1314

14-
detect := Detect(parser)
15-
build := Build(logger)
16-
17-
packit.Run(detect, build)
15+
packit.Run(
16+
rackup.Detect(parser),
17+
rackup.Build(logger),
18+
)
1819
}

0 commit comments

Comments
 (0)