Browse Source

Huge imporve for downloading repos on google code

pull/103/head
Unknown 12 years ago
parent
commit
bf14e02a1b
  1. 1
      .gitignore
  2. 1
      cmd/get.go
  3. 18
      doc/google.go

1
.gitignore vendored

@ -2,3 +2,4 @@
gopm
*.exe
*.exe~
repos/

1
cmd/get.go

@ -18,7 +18,6 @@ import (
"errors"
"fmt"
"os/user"
//"path"
"strings"
"github.com/gpmgo/gopm/doc"

18
doc/google.go

@ -52,16 +52,28 @@ func getGoogleDoc(client *http.Client, match map[string]string, installRepoPath
// Remove old files.
os.RemoveAll(installPath + "/")
match["tag"] = nod.Value
err := packer.PackToFile(match["importPath"], installPath+".zip", match)
ext := ".zip"
if match["vcs"] == "svn" {
ext = ".tar.gz"
}
err := packer.PackToFile(match["importPath"], installPath+ext, match)
if err != nil {
return nil, err
}
dirs, err := com.Unzip(installPath+".zip", path.Dir(installPath))
var dirs []string
if match["vcs"] != "svn" {
dirs, err = com.Unzip(installPath+ext, path.Dir(installPath))
} else {
dirs, err = com.UnTarGz(installPath+ext, path.Dir(installPath))
}
if err != nil {
return nil, err
}
os.Remove(installPath + ".zip")
os.Remove(installPath + ext)
os.Rename(path.Dir(installPath)+"/"+dirs[0], installPath)
// Check if need to check imports.

Loading…
Cancel
Save