Browse Source

Bug fixed

pull/103/head
Unknown 11 years ago
parent
commit
580f906c8e
  1. 4
      README.md
  2. 17
      cmd/bin.go
  3. 2
      cmd/gen.go
  4. 6
      cmd/get.go
  5. 2
      cmd/gopath.go
  6. 3
      cmd/helper_windows.go
  7. 2
      cmd/install.go
  8. 2
      gopm.go

4
README.md

@ -17,12 +17,12 @@ 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

17
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")

2
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)"},
},
}

6
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)"},
},
}

2
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)

3
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 {

2
cmd/install.go

@ -34,7 +34,7 @@ gopm install <import path>
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"},
},
}

2
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)
}

Loading…
Cancel
Save