示例#1
0
func getBitbucketArchive(client *http.Client, match map[string]string, n *Node) error {
	match["sha"] = n.Revision

	// Downlaod archive.
	if err := com.HttpGetToFile(client,
		com.Expand("https://bitbucket.org/{owner}/{repo}/get/{sha}.zip", match), nil, n.ArchivePath); err != nil {
		return fmt.Errorf("fail to download archive(%s): %v", n.ImportPath, err)
	}
	return nil
}
示例#2
0
文件: gopkg.go 项目: harryyeh/switch
func getGopkgArchive(client *http.Client, match map[string]string, n *Node) error {
	// We use .zip here.
	// zip: https://github.com/{owner}/{repo}/archive/{sha}.zip

	// Downlaod archive.
	if err := com.HttpGetToFile(client,
		fmt.Sprintf("https://%s/archive/%s.zip", n.DownloadURL, n.Revision), nil, n.ArchivePath); err != nil {
		return fmt.Errorf("fail to download archive(%s): %v", n.ImportPath, err)
	}
	return nil
}
示例#3
0
文件: github.go 项目: harryyeh/switch
func getGithubArchive(client *http.Client, match map[string]string, n *Node) error {
	match["sha"] = n.Revision
	// match["cred"] = setting.GithubCredentials

	// We use .zip here.
	// zip: https://github.com/{owner}/{repo}/archive/{sha}.zip
	// tarball: https://github.com/{owner}/{repo}/tarball/{sha}

	// Downlaod archive.
	if err := com.HttpGetToFile(client,
		com.Expand("https://github.com/{owner}/{repo}/archive/{sha}.zip", match), nil, n.ArchivePath); err != nil {
		return fmt.Errorf("fail to download archive(%s): %v", n.ImportPath, err)
	}
	return nil
}
示例#4
0
文件: google.go 项目: harryyeh/switch
func getGoogleArchive(client *http.Client, match map[string]string, n *Node) error {
	setupGoogleMatch(match)
	match["tag"] = n.Revision

	if match["vcs"] == "svn" {
		return fmt.Errorf("SVN not support yet")
	} else {
		// Downlaod archive.
		if err := com.HttpGetToFile(client,
			com.Expand("http://{subrepo}{dot}{repo}.googlecode.com/archive/{tag}.zip", match), nil, n.ArchivePath); err != nil {
			return fmt.Errorf("fail to download archive(%s): %v", n.ImportPath, err)
		}
	}
	return nil
}