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 gopm
*.exe *.exe
*.exe~ *.exe~
repos/

1
cmd/get.go

@ -18,7 +18,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"os/user" "os/user"
//"path"
"strings" "strings"
"github.com/gpmgo/gopm/doc" "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. // Remove old files.
os.RemoveAll(installPath + "/") os.RemoveAll(installPath + "/")
match["tag"] = nod.Value 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 { if err != nil {
return nil, err 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 { if err != nil {
return nil, err return nil, err
} }
os.Remove(installPath + ".zip") os.Remove(installPath + ext)
os.Rename(path.Dir(installPath)+"/"+dirs[0], installPath) os.Rename(path.Dir(installPath)+"/"+dirs[0], installPath)
// Check if need to check imports. // Check if need to check imports.

Loading…
Cancel
Save