Skip to content

Commit

Permalink
Move most packages into internal
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
  • Loading branch information
ameyer-pivotal committed Nov 8, 2019
1 parent 3a039e5 commit 2474de7
Show file tree
Hide file tree
Showing 521 changed files with 216 additions and 271 deletions.
10 changes: 5 additions & 5 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import (
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"

"github.com/buildpack/pack/api"
"github.com/buildpack/pack/blob"
"github.com/buildpack/pack/builder"
"github.com/buildpack/pack/cache"
"github.com/buildpack/pack/internal/api"
"github.com/buildpack/pack/internal/archive"
"github.com/buildpack/pack/style"
"github.com/buildpack/pack/internal/blob"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/cache"
"github.com/buildpack/pack/internal/style"
h "github.com/buildpack/pack/testhelpers"
)

Expand Down
51 changes: 0 additions & 51 deletions blob/testmocks/mock_downloader.go

This file was deleted.

12 changes: 6 additions & 6 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import (
"github.com/google/go-containerregistry/pkg/name"
"github.com/pkg/errors"

"github.com/buildpack/pack/api"
"github.com/buildpack/pack/build"
"github.com/buildpack/pack/builder"
"github.com/buildpack/pack/cmd"
"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/internal/api"
"github.com/buildpack/pack/internal/archive"
"github.com/buildpack/pack/internal/build"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/dist"
"github.com/buildpack/pack/internal/paths"
"github.com/buildpack/pack/stack"
"github.com/buildpack/pack/style"
"github.com/buildpack/pack/internal/stack"
"github.com/buildpack/pack/internal/style"
)

type Lifecycle interface {
Expand Down
12 changes: 6 additions & 6 deletions build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import (
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"

"github.com/buildpack/pack/api"
"github.com/buildpack/pack/blob"
"github.com/buildpack/pack/build"
"github.com/buildpack/pack/builder"
"github.com/buildpack/pack/cmd"
"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/internal/api"
"github.com/buildpack/pack/internal/blob"
"github.com/buildpack/pack/internal/build"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/dist"
ifakes "github.com/buildpack/pack/internal/fakes"
"github.com/buildpack/pack/internal/style"
"github.com/buildpack/pack/logging"
"github.com/buildpack/pack/style"
h "github.com/buildpack/pack/testhelpers"
)

Expand Down
4 changes: 2 additions & 2 deletions builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/BurntSushi/toml"
"github.com/pkg/errors"

"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/internal/dist"
"github.com/buildpack/pack/internal/paths"
"github.com/buildpack/pack/style"
"github.com/buildpack/pack/internal/style"
)

type Config struct {
Expand Down
28 changes: 24 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
package pack

import (
"context"
"os"
"path/filepath"

"github.com/buildpack/imgutil"
dockerClient "github.com/docker/docker/client"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/pkg/errors"

"github.com/buildpack/pack/blob"
"github.com/buildpack/pack/build"
"github.com/buildpack/pack/config"
"github.com/buildpack/pack/image"
"github.com/buildpack/pack/internal/blob"
"github.com/buildpack/pack/internal/build"
"github.com/buildpack/pack/internal/config"
"github.com/buildpack/pack/internal/image"
"github.com/buildpack/pack/logging"
)

//go:generate mockgen -package testmocks -destination testmocks/mock_image_fetcher.go github.com/buildpack/pack ImageFetcher
type ImageFetcher interface {
// Fetch fetches an image by resolving it both remotely and locally depending on provided parameters.
// If daemon is true, it will look return a `local.Image`. Pull, applicable only when daemon is true, will
// attempt to pull a remote image first.
Fetch(ctx context.Context, name string, daemon, pull bool) (imgutil.Image, error)
}

//go:generate mockgen -package testmocks -destination testmocks/mock_downloader.go github.com/buildpack/pack Downloader
type Downloader interface {
Download(ctx context.Context, pathOrURI string) (blob.Blob, error)
}

//go:generate mockgen -package testmocks -destination testmocks/mock_image_factory.go github.com/buildpack/pack ImageFactory
type ImageFactory interface {
NewImage(repoName string, local bool) (imgutil.Image, error)
}

type Client struct {
logger logging.Logger
imageFetcher ImageFetcher
Expand Down
4 changes: 2 additions & 2 deletions cmd/pack/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/buildpack/pack"
"github.com/buildpack/pack/cmd"
"github.com/buildpack/pack/commands"
"github.com/buildpack/pack/config"
"github.com/buildpack/pack/internal/commands"
"github.com/buildpack/pack/internal/config"
clilogger "github.com/buildpack/pack/internal/logging"
"github.com/buildpack/pack/logging"
)
Expand Down
4 changes: 2 additions & 2 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/google/go-containerregistry/pkg/name"

"github.com/buildpack/pack/builder"
"github.com/buildpack/pack/style"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/style"
)

func (c *Client) parseTagReference(imageName string) (name.Reference, error) {
Expand Down
15 changes: 8 additions & 7 deletions create_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (
"github.com/buildpack/imgutil"
"github.com/pkg/errors"

"github.com/buildpack/pack/builder"
"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/image"
"github.com/buildpack/pack/style"
pubbldr "github.com/buildpack/pack/builder"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/dist"
"github.com/buildpack/pack/internal/image"
"github.com/buildpack/pack/internal/style"
)

type CreateBuilderOptions struct {
BuilderName string
BuilderConfig builder.Config
BuilderConfig pubbldr.Config
Publish bool
NoPull bool
}
Expand Down Expand Up @@ -112,7 +113,7 @@ func validateBuildpack(bp dist.Buildpack, source, expectedID, expectedBPVersion
return nil
}

func (c *Client) fetchLifecycle(ctx context.Context, config builder.LifecycleConfig) (builder.Lifecycle, error) {
func (c *Client) fetchLifecycle(ctx context.Context, config pubbldr.LifecycleConfig) (builder.Lifecycle, error) {
if config.Version != "" && config.URI != "" {
return nil, errors.Errorf(
"%s can only declare %s or %s, not both",
Expand Down Expand Up @@ -152,7 +153,7 @@ func uriFromLifecycleVersion(version semver.Version) string {
return fmt.Sprintf("https://github.com/buildpack/lifecycle/releases/download/v%s/lifecycle-v%s+linux.x86-64.tgz", version.String(), version.String())
}

func validateBuilderConfig(conf builder.Config) error {
func validateBuilderConfig(conf pubbldr.Config) error {
if conf.Stack.ID == "" {
return errors.New("stack.id is required")
}
Expand Down
16 changes: 8 additions & 8 deletions create_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import (
"runtime"
"testing"

"github.com/buildpack/pack/dist"

"github.com/buildpack/imgutil/fakes"
"github.com/golang/mock/gomock"
"github.com/heroku/color"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"

"github.com/buildpack/pack/blob"
"github.com/buildpack/pack/builder"
pubbldr "github.com/buildpack/pack/builder"
"github.com/buildpack/pack/internal/blob"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/dist"
ifakes "github.com/buildpack/pack/internal/fakes"
"github.com/buildpack/pack/logging"
h "github.com/buildpack/pack/testhelpers"
Expand Down Expand Up @@ -84,9 +84,9 @@ func testCreateBuilder(t *testing.T, when spec.G, it spec.S) {

opts = CreateBuilderOptions{
BuilderName: "some/builder",
BuilderConfig: builder.Config{
BuilderConfig: pubbldr.Config{
Description: "Some description",
Buildpacks: []builder.BuildpackConfig{
Buildpacks: []pubbldr.BuildpackConfig{
{
BuildpackInfo: dist.BuildpackInfo{ID: "bp.one", Version: "1.2.3"},
URI: "https://example.fake/bp-one.tgz",
Expand All @@ -97,13 +97,13 @@ func testCreateBuilder(t *testing.T, when spec.G, it spec.S) {
{BuildpackInfo: dist.BuildpackInfo{ID: "bp.one", Version: "1.2.3"}, Optional: false},
}},
},
Stack: builder.StackConfig{
Stack: pubbldr.StackConfig{
ID: "some.stack.id",
BuildImage: "some/build-image",
RunImage: "some/run-image",
RunImageMirrors: []string{"localhost:5000/some-run-image"},
},
Lifecycle: builder.LifecycleConfig{URI: "file:///some-lifecycle"},
Lifecycle: pubbldr.LifecycleConfig{URI: "file:///some-lifecycle"},
},
Publish: false,
NoPull: false,
Expand Down
6 changes: 3 additions & 3 deletions create_buildpackage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (

"github.com/pkg/errors"

"github.com/buildpack/pack/buildpackage"
"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/style"
"github.com/buildpack/pack/internal/buildpackage"
"github.com/buildpack/pack/internal/dist"
"github.com/buildpack/pack/internal/style"
)

type CreatePackageOptions struct {
Expand Down
6 changes: 3 additions & 3 deletions create_buildpackage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/sclevine/spec/report"

"github.com/buildpack/pack"
"github.com/buildpack/pack/api"
"github.com/buildpack/pack/buildpackage"
"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/internal/api"
"github.com/buildpack/pack/internal/buildpackage"
"github.com/buildpack/pack/internal/dist"
ifakes "github.com/buildpack/pack/internal/fakes"
"github.com/buildpack/pack/internal/logging"
h "github.com/buildpack/pack/testhelpers"
Expand Down
8 changes: 4 additions & 4 deletions inspect_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (

"github.com/pkg/errors"

"github.com/buildpack/pack/builder"
"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/image"
"github.com/buildpack/pack/style"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/dist"
"github.com/buildpack/pack/internal/image"
"github.com/buildpack/pack/internal/style"
)

type BuilderInfo struct {
Expand Down
6 changes: 3 additions & 3 deletions inspect_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"

"github.com/buildpack/pack/builder"
"github.com/buildpack/pack/dist"
"github.com/buildpack/pack/image"
"github.com/buildpack/pack/internal/builder"
"github.com/buildpack/pack/internal/dist"
ifakes "github.com/buildpack/pack/internal/fakes"
"github.com/buildpack/pack/internal/image"
h "github.com/buildpack/pack/testhelpers"
"github.com/buildpack/pack/testmocks"
)
Expand Down
2 changes: 1 addition & 1 deletion inspect_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/buildpack/lifecycle/metadata"
"github.com/pkg/errors"

"github.com/buildpack/pack/image"
"github.com/buildpack/pack/internal/image"
)

type ImageInfo struct {
Expand Down
2 changes: 1 addition & 1 deletion inspect_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"

"github.com/buildpack/pack/image"
ifakes "github.com/buildpack/pack/internal/fakes"
"github.com/buildpack/pack/internal/image"
h "github.com/buildpack/pack/testhelpers"
"github.com/buildpack/pack/testmocks"
)
Expand Down
30 changes: 0 additions & 30 deletions interfaces.go

This file was deleted.

2 changes: 1 addition & 1 deletion api/version.go → internal/api/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/pkg/errors"

"github.com/buildpack/pack/style"
"github.com/buildpack/pack/internal/style"
)

var regex = regexp.MustCompile(`^v?(\d+)\.(\d*)$`)
Expand Down
Loading

0 comments on commit 2474de7

Please sign in to comment.