diff --git a/README.md b/README.md index 2e27181f6..54ab15b33 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,14 @@ Please see **[Documentation](https://github.com/gpmgo/docs)** before you ever st # Commands ``` +NAME: + gopm - Go Package Manager + USAGE: gopm [global options] command [command options] [arguments...] VERSION: - 0.6.3.0313 + 0.6.4.0318 COMMANDS: get fetch remote package(s) and dependencies to local repository @@ -30,7 +33,7 @@ COMMANDS: update check and update gopm resources including itself config configurate gopm global settings help, h Shows a list of commands or help for one command - + GLOBAL OPTIONS: --noterm disable color output --version, -v print the version diff --git a/cmd/bin.go b/cmd/bin.go index bc9b0975b..b1fd5c088 100644 --- a/cmd/bin.go +++ b/cmd/bin.go @@ -1,4 +1,4 @@ -// Copyright 2013 gopm authors. +// Copyright 2013-2014 gopm authors. // // Licensed under the Apache License, Version 2.0 (the "License"): you may // not use this file except in compliance with the License. You may obtain @@ -110,8 +110,7 @@ func runBin(ctx *cli.Context) { // Change to repository path. log.Log("Changing work directory to %s", repoPath) - err = os.Chdir(repoPath) - if err != nil { + if err = os.Chdir(repoPath); err != nil { log.Error("bin", "Fail to change work directory:") log.Fatal("", "\t"+err.Error()) } @@ -123,6 +122,7 @@ func runBin(ctx *cli.Context) { os.RemoveAll(path.Join(repoPath, doc.VENDOR)) }() + includes := make([]string, 0, 3) // Check if previous steps were successful. if com.IsFile(doc.GOPM_FILE_NAME) { log.Trace("Loading gopmfile...") @@ -133,6 +133,8 @@ func runBin(ctx *cli.Context) { if err == nil { log.Log("Target name: %s", pkgName) } + + includes = strings.Split(gf.MustValue("res", "include"), "|") } if len(pkgName) == 0 { @@ -157,20 +159,30 @@ func runBin(ctx *cli.Context) { } if com.IsExist(movePath + "/" + binName) { - err = os.Remove(movePath + "/" + binName) - if err != nil { + if err = os.Remove(movePath + "/" + binName); err != nil { log.Warn("Cannot remove binary in work directory:") log.Warn("\t %s", err) } } - err = os.Rename(binName, movePath+"/"+binName) - if err != nil { + if err = os.Rename(binName, movePath+"/"+binName); err != nil { log.Error("bin", "Fail to move binary:") log.Fatal("", "\t"+err.Error()) } os.Chmod(movePath+"/"+binName, os.ModePerm) + if len(includes) > 0 { + log.Log("Copying resources to %s", movePath) + for _, include := range includes { + if com.IsDir(include) { + if err = com.CopyDir(include, filepath.Join(movePath, include)); err != nil { + log.Error("bin", "Fail to copy following resource:") + log.Error("", "\t"+include) + } + } + } + } + log.Log("Changing work directory back to %s", wd) os.Chdir(wd) diff --git a/cmd/gen.go b/cmd/gen.go index 1c78171e0..fe504a9f9 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -59,7 +59,6 @@ func runGen(ctx *cli.Context) { targetPath := parseTarget(gf.MustValue("target", "path")) // Get and set dependencies. imports := doc.GetAllImports([]string{workDir}, targetPath, ctx.Bool("example")) - log.Log("%v", imports) for _, p := range imports { p = doc.GetProjectPath(p) // Skip subpackage(s) of current project. diff --git a/gopm.go b/gopm.go index 3d3d98cdf..3e6385f00 100644 --- a/gopm.go +++ b/gopm.go @@ -29,7 +29,7 @@ import ( // Test that go1.1 tag above is included in builds. main.go refers to this definition. const go11tag = true -const APP_VER = "0.6.3.0315" +const APP_VER = "0.6.4.0318" // //cmd.CmdSearch, // cmdClean,