示例#1
0
文件: npm.go 项目: go-gonzo/npm
func get(ctx context.Context, pkg pkg.Package) gonzo.Pipe {

	return web.Get(ctx, pkg.Dist.Tarball).Pipe(
		gzip.Uncompress(),
		tar.Untar(tar.Options{
			StripComponenets: 1,
		}),
		path.Rename(func(old string) string {
			return filepath.Join(pkg.Name, old)
		}),
	)
}
示例#2
0
文件: github.go 项目: go-gonzo/github
func get(ctx context.Context, release Release) gonzo.Pipe {

	repo := fmt.Sprintf("%s/%s#%s", release.User, release.Repo, release.Tag)
	ctx.Warn(repo)
	return web.Get(
		context.WithValue(ctx, "repo", repo),
		fmt.Sprintf(
			"https://codeload.github.com/%s/%s/tar.gz/%s",
			release.User,
			release.Repo,
			release.Tag,
		),
	).Pipe(
		gzip.Uncompress(),
		tar.Untar(tar.Options{
			StripComponenets: 1,
			Pluck:            release.Pluck,
		}),
		path.Rename(func(old string) string {
			return filepath.Join(release.Repo, old)
		}),
	)
}