change build interface
This commit is contained in:
@@ -4,13 +4,15 @@ package build
|
|||||||
// Build is an interface for building packages
|
// Build is an interface for building packages
|
||||||
type Build interface {
|
type Build interface {
|
||||||
// Package builds a package
|
// Package builds a package
|
||||||
Package(name string, src *Source) (*Package, error)
|
Package(*Source) (*Package, error)
|
||||||
// Remove removes the package
|
// Remove removes the package
|
||||||
Remove(*Package) error
|
Remove(*Package) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Source is the source of a build
|
// Source is the source of a build
|
||||||
type Source struct {
|
type Source struct {
|
||||||
|
// Name of the source
|
||||||
|
Name string
|
||||||
// Path to the source if local
|
// Path to the source if local
|
||||||
Path string
|
Path string
|
||||||
// Language is the language of code
|
// Language is the language of code
|
||||||
|
@@ -18,7 +18,8 @@ type dockerBuild struct {
|
|||||||
Client *docker.Client
|
Client *docker.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dockerBuild) Package(name string, s *build.Source) (*build.Package, error) {
|
func (d *dockerBuild) Package(s *build.Source) (*build.Package, error) {
|
||||||
|
name := s.Name
|
||||||
image := name
|
image := name
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
|
@@ -34,7 +34,8 @@ func whichGo() string {
|
|||||||
return "go"
|
return "go"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *goBuild) Package(name string, src *build.Source) (*build.Package, error) {
|
func (g *goBuild) Package(src *build.Source) (*build.Package, error) {
|
||||||
|
name := src.Name
|
||||||
binary := filepath.Join(g.Path, name)
|
binary := filepath.Join(g.Path, name)
|
||||||
source := src.Path
|
source := src.Path
|
||||||
|
|
||||||
|
@@ -10,7 +10,8 @@ import (
|
|||||||
|
|
||||||
type tarBuild struct{}
|
type tarBuild struct{}
|
||||||
|
|
||||||
func (t *tarBuild) Package(name string, src *build.Source) (*build.Package, error) {
|
func (t *tarBuild) Package(src *build.Source) (*build.Package, error) {
|
||||||
|
name := src.Name
|
||||||
pkg := name + ".tar.gz"
|
pkg := name + ".tar.gz"
|
||||||
// path to the tarball
|
// path to the tarball
|
||||||
path := filepath.Join(os.TempDir(), src.Path, pkg)
|
path := filepath.Join(os.TempDir(), src.Path, pkg)
|
||||||
|
Reference in New Issue
Block a user