Esempio n. 1
0
File: npm.go Progetto: 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)
		}),
	)
}
Esempio n. 2
0
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)
		}),
	)
}