Merge pull request #28 from runcom/fix-gitcommit

remove cmd/ subdir
This commit is contained in:
Antonio Murdaca 2016-03-25 12:21:26 +01:00
commit d7ae061a83
11 changed files with 25 additions and 24 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
!cmd/skopeo/
/skopeo
/skopeo.1
/layers-*

View File

@ -22,12 +22,11 @@ endif
DOCKER_RUN_DOCKER := $(DOCKER_FLAGS) "$(DOCKER_IMAGE)"
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true)
LDFLAGS := "-X github.com/projectatomic/skopeo.GitCommit=${GIT_COMMIT} ${LDFLAGS}"
all: man binary
binary:
go build -ldflags ${LDFLAGS} -o ${DEST}skopeo ./cmd/skopeo
go build -ldflags "-X main.gitCommit=${GIT_COMMIT}" -o ${DEST}skopeo .
build-container:
docker build ${DOCKER_BUILD_ARGS} -t "$(DOCKER_IMAGE)" .

View File

@ -1,4 +1,4 @@
package skopeo
package main
import (
"crypto/tls"

View File

@ -6,7 +6,6 @@ import (
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/projectatomic/skopeo"
)
var inspectCmd = cli.Command{
@ -19,7 +18,7 @@ var inspectCmd = cli.Command{
},
},
Action: func(c *cli.Context) {
img, err := skopeo.ParseImage(c)
img, err := parseImage(c)
if err != nil {
logrus.Fatal(err)
}

View File

@ -3,7 +3,6 @@ package main
import (
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/projectatomic/skopeo"
)
// TODO(runcom): document args and usage
@ -11,7 +10,7 @@ var layersCmd = cli.Command{
Name: "layers",
Usage: "get images layers",
Action: func(c *cli.Context) {
img, err := skopeo.ParseImage(c)
img, err := parseImage(c)
if err != nil {
logrus.Fatal(err)
}

View File

@ -6,18 +6,26 @@ import (
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/projectatomic/skopeo"
"github.com/projectatomic/skopeo/version"
)
// gitCommit will be the hash that the binary was built from
// and will be populated by the Makefile
var gitCommit = ""
const (
usage = `interact with registries`
)
func main() {
app := cli.NewApp()
app.Name = "skopeo"
if skopeo.GitCommit != "" {
app.Version = fmt.Sprintf("%s commit: %s", skopeo.Version, skopeo.GitCommit)
if gitCommit != "" {
app.Version = fmt.Sprintf("%s commit: %s", version.Version, gitCommit)
} else {
app.Version = skopeo.Version
app.Version = version.Version
}
app.Usage = "interact with registries"
app.Usage = usage
// TODO(runcom)
//app.EnableBashCompletion = true
app.Flags = []cli.Flag{

View File

@ -8,12 +8,12 @@ import (
"fmt"
"time"
"github.com/projectatomic/skopeo"
"github.com/projectatomic/skopeo/version"
)
const (
signatureType = "atomic container signature"
signatureCreatorID = "atomic " + skopeo.Version
signatureCreatorID = "atomic " + version.Version
)
// InvalidSignatureError is returned when parsing an invalid signature.

View File

@ -1,4 +1,4 @@
package skopeo
package main
import (
"fmt"
@ -9,7 +9,7 @@ import (
)
// ParseImage converts image URL-like string to an initialized handler for that image.
func ParseImage(c *cli.Context) (types.Image, error) {
func parseImage(c *cli.Context) (types.Image, error) {
var (
imgName = c.Args().First()
certPath = c.GlobalString("cert-path")

View File

@ -1,7 +0,0 @@
package skopeo
// Version is a version of thils build.
const Version = "0.1.12-dev"
// GitCommit is a git commit hash of this build. It is ordinarily overriden by LDFLAGS in Makefile.
var GitCommit = ""

4
version/version.go Normal file
View File

@ -0,0 +1,4 @@
package version
// Version is the version of the build.
const Version = "0.1.12-dev"