Browse Source

Merge branch 'dev' of github.com:gpmgo/gopm into dev

pull/103/head
Unknown 11 years ago
parent
commit
8c7e4a1a5d
  1. 2
      cmd/gen.go
  2. 7
      cmd/get.go
  3. 5
      doc/github.go
  4. 25
      doc/utils.go
  5. 2
      gopm.go

2
cmd/gen.go

@ -57,7 +57,7 @@ func runGen(ctx *cli.Context) {
targetPath := parseTarget(gf.MustValue("target", "path"))
// Get 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.

7
cmd/get.go

@ -191,9 +191,6 @@ func copyToGopath(srcPath, destPath string) {
// if the commit is empty string, then it downloads all dependencies,
// otherwise, it only downloada package with specific commit only.
func downloadPackages(ctx *cli.Context, nodes []*doc.Node) {
for _, node := range nodes {
fmt.Println(node)
}
// Check all packages, they may be raw packages path.
for _, n := range nodes {
// Check if local reference
@ -233,8 +230,8 @@ func downloadPackages(ctx *cli.Context, nodes []*doc.Node) {
n.ImportPath, n.Type, doc.CheckNodeValue(n.Value))
// Only copy when no version control.
if ctx.Bool("gopath") && com.IsExist(installPath) ||
len(getVcsName(gopathDir)) == 0 {
if ctx.Bool("gopath") && (com.IsExist(installPath) ||
len(getVcsName(gopathDir)) == 0) {
copyToGopath(installPath, gopathDir)
}
continue

5
doc/github.go

@ -63,8 +63,9 @@ func getGithubDoc(client *http.Client, match map[string]string, installRepoPath
err := com.HttpGetJSON(client, com.Expand("https://api.github.com/repos/{owner}/{repo}/git/refs?{cred}", match), &refs)
if err != nil {
log.Error("GET", "Fail to get revision")
log.Error("", err.Error())
log.Warn("GET", "Fail to get revision")
log.Warn("", err.Error())
log.Help("Try 'gopm config github' to set and gain more API calls")
break
}

25
doc/utils.go

@ -56,26 +56,27 @@ func GetImports(absPath, importPath string, example bool) []string {
}
}
//fis := GetDirsInfo(absPath)
fis := GetDirsInfo(absPath)
absPath += "/"
// Load too much, skip for now.
// dirs := make([]string, 0)
// for _, fi := range fis {
// if fi.IsDir() && !strings.Contains(fi.Name(), VENDOR) {
// dirs = append(dirs, absPath+fi.Name())
// }
// }
imports := make([]string, 0, len(pkg.Imports))
for _, p := range pkg.Imports {
if !IsGoRepoPath(p) && !strings.HasPrefix(p, importPath) {
imports = append(imports, p)
}
}
// if len(dirs) > 0 {
// imports = append(imports, GetAllImports(dirs, importPath, example)...)
// }
// TODO: Load too much
dirs := make([]string, 0, len(imports))
for _, fi := range fis {
if fi.IsDir() && !strings.Contains(fi.Name(), VENDOR) {
dirs = append(dirs, absPath+fi.Name())
}
}
if len(dirs) > 0 {
imports = append(imports, GetAllImports(dirs, importPath, example)...)
}
return imports
}

2
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.0301"
const APP_VER = "0.6.3.0311"
// //cmd.CmdSearch,
// cmdClean,

Loading…
Cancel
Save