Пример #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
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
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
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
}