From 580f906c8e766f23def696e68a1cf895d91b8777 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 2 Dec 2013 07:57:29 -0500 Subject: [PATCH] Bug fixed --- README.md | 6 +++--- cmd/bin.go | 17 ++++++++++++++--- cmd/gen.go | 2 +- cmd/get.go | 6 +++--- cmd/gopath.go | 2 +- cmd/helper_windows.go | 3 --- cmd/install.go | 2 +- gopm.go | 2 -- 8 files changed, 23 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 16d0d1912..2c9c2fce3 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,17 @@ USAGE: gopm [global options] command [command options] [arguments...] VERSION: - 0.5.6.1130 + 0.5.7.1202 COMMANDS: get fetch remote package(s) and dependencies to local repository bin download and link dependencies and build executable binary - gen generate a gopmfile according current go project + gen generate a gopmfile according current Go project run link dependencies and go run build link dependencies and go build install link dependencies and go install help, h Shows a list of commands or help for one command - + GLOBAL OPTIONS: --version print the version --help, -h show help diff --git a/cmd/bin.go b/cmd/bin.go index 9bee3d772..c65a91cbb 100644 --- a/cmd/bin.go +++ b/cmd/bin.go @@ -15,8 +15,10 @@ package cmd import ( + "fmt" "os" "path" + "runtime" "strings" "github.com/Unknwon/com" @@ -39,7 +41,7 @@ Can only specify one each time, and only works for projects that contains main package`, Action: runBin, Flags: []cli.Flag{ - cli.BoolFlag{"dir", "build binary to given directory(second argument)"}, + cli.BoolFlag{"dir, d", "build binary to given directory(second argument)"}, }, } @@ -94,7 +96,10 @@ func runBin(ctx *cli.Context) { } // Get code. - com.ExecCmd("gopm", "get", ctx.Args()[0]) + stdout, _, _ := com.ExecCmd("gopm", "get", ctx.Args()[0]) + if len(stdout) > 0 { + fmt.Print(stdout) + } // Check if previous steps were successful. pkgPath := installRepoPath + "/" + pkgName @@ -121,7 +126,10 @@ func runBin(ctx *cli.Context) { } // Build application. - com.ExecCmd("gopm", "build") + stdout, _, _ = com.ExecCmd("gopm", "build") + if len(stdout) > 0 { + fmt.Print(stdout) + } defer func() { // Clean files. os.RemoveAll(pkgPath + "/vendor") @@ -129,6 +137,9 @@ func runBin(ctx *cli.Context) { // Check if previous steps were successful. binName := path.Base(pkgName) + if runtime.GOOS == "windows" { + binName += ".exe" + } if !com.IsFile(binName) { log.Error("Bin", "Fail to continue command") log.Fatal("", "Previous steps weren't successful or the project does not contain main package") diff --git a/cmd/gen.go b/cmd/gen.go index a8b222dcc..ee3e1c5d3 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -35,7 +35,7 @@ gopm gen Make sure you run this command in the root path of a go project.`, Action: runGen, Flags: []cli.Flag{ - cli.BoolFlag{"example", "check dependencies for example(s)"}, + cli.BoolFlag{"example, e", "check dependencies for example(s)"}, }, } diff --git a/cmd/get.go b/cmd/get.go index a9c0cc087..d682e008b 100644 --- a/cmd/get.go +++ b/cmd/get.go @@ -53,9 +53,9 @@ Can specify one or more: gopm get beego@tag:v0.9.0 github.com/beego/bee If no argument is supplied, then gopmfile must be present`, Action: runGet, Flags: []cli.Flag{ - cli.BoolFlag{"gopath", "download package(s) to GOPATH"}, - cli.BoolFlag{"force", "force to update pakcage(s) and dependencies"}, - cli.BoolFlag{"example", "download dependencies for example(s)"}, + cli.BoolFlag{"gopath, g", "download package(s) to GOPATH"}, + cli.BoolFlag{"force, f", "force to update pakcage(s) and dependencies"}, + cli.BoolFlag{"example, e", "download dependencies for example(s)"}, }, } diff --git a/cmd/gopath.go b/cmd/gopath.go index c7cb35f99..93f692902 100644 --- a/cmd/gopath.go +++ b/cmd/gopath.go @@ -217,7 +217,7 @@ func genNewGoPath(ctx *cli.Context, isTest bool) { log.Fatal("", err.Error()) } - newGoPath = filepath.Join(curPath, "vendor") + newGoPath = filepath.Join(curPath, ".vendor") newGoPathSrc := filepath.Join(newGoPath, "src") os.RemoveAll(newGoPathSrc) os.MkdirAll(newGoPathSrc, os.ModePerm) diff --git a/cmd/helper_windows.go b/cmd/helper_windows.go index 291b30a91..da38f5919 100644 --- a/cmd/helper_windows.go +++ b/cmd/helper_windows.go @@ -8,9 +8,6 @@ import ( "github.com/Unknwon/com" ) -func init() { -} - func makeLink(srcPath, destPath string) error { // Check if Windows version is XP. if getWindowsVersion() >= 6 { diff --git a/cmd/install.go b/cmd/install.go index e614b3d62..0d25f4fc5 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -34,7 +34,7 @@ gopm install If no argument is supplied, then gopmfile must be present`, Action: runInstall, Flags: []cli.Flag{ - cli.BoolFlag{"verbose", "show process details"}, + cli.BoolFlag{"verbose, v", "show process details"}, }, } diff --git a/gopm.go b/gopm.go index ee4bb4fea..e9e14385c 100644 --- a/gopm.go +++ b/gopm.go @@ -18,7 +18,6 @@ package main import ( "os" "runtime" - "time" "github.com/codegangsta/cli" @@ -61,6 +60,5 @@ func main() { cmd.CmdInstall, //cmd.CmdTest, } - app.Compiled = time.Now() app.Run(os.Args) }