progress!

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2017-11-28 13:15:36 -06:00
parent 4e73d39f35
commit ec8a0dbac7
2 changed files with 47 additions and 23 deletions
+5 -2
View File
@@ -12,10 +12,13 @@ func main() {
for {
// Do the buldpack thing.
herald.DownloadBuildpacks()
buildpacks := herald.GetBuildpacks()
for _, bp := range(buildpacks) {
log.Print(bp.Download())
}
log.Print("Sleeping for 5 minutes…")
// Sleep for five minutes.
time.Sleep(5*time.Minute)
+42 -21
View File
@@ -10,35 +10,56 @@ import "log"
const BP_TARBALL_TEMPLATE = "https://github.com/heroku/heroku-buildpack-%s/archive/master.zip"
var BUILDPACKS = []string { "python", "php", "nodejs" }
func getBuildpackZipballs() []string {
collected := []string{}
for _, bp := range(BUILDPACKS) {
// Add comment here.
collected = append(collected, fmt.Sprintf(BP_TARBALL_TEMPLATE, bp))
}
return collected
type Version string
type Buildpack struct{
Versions []Version
Tarball string
Path string
// ExecutablePath string
Name string
}
func DownloadBuildpacks() {
// create temp directory
// use 'fake' for now
target, err := ioutil.TempDir("", "buildpacks")
if err != nil {
log.Fatal(err)
}
func (b Buildpack) ZipballURI() string {
return fmt.Sprintf(BP_TARBALL_TEMPLATE, b.Name)
}
func (b Buildpack) Download() string {
target, _ := ioutil.TempDir("", "buildpacks")
log.Printf("Downloading '%s'…", b.Name)
getter.Get(target, b.ZipballURI())
return target
// Download and unpack each Zipball from GitHub.
for _, tb := range(getBuildpackZipballs()) {
log.Printf("Downloading '%s' to '%s'…", tb, target)
getter.Get(target, tb)
}
func NewBuildpack(name string) Buildpack {
return Buildpack{
// Path: nil,
// ExecutablePath: path + "/bin/execute",
Name: name,
}
}
func GetBuildpacks() []Buildpack {
// Download and unpack each Zipball from GitHub.
buildpacks := []Buildpack{}
for _, bp := range(BUILDPACKS) {
// log.Printf("Downloading '%s'…", bp)
// err := getter.Get(target, tb)
// if err != nil {
// return err
buildpacks = append(buildpacks, NewBuildpack(bp))
}
return buildpacks
}
// func ExecutesBuildpacks() {
// glob('*/updater/detect'