mirror of
https://github.com/kennethreitz/herald.git
synced 2026-06-05 23:00:19 +00:00
24f8ca6b3a
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
69 lines
1.4 KiB
Go
69 lines
1.4 KiB
Go
package main
|
|
|
|
import "github.com/heroku/herald"
|
|
import "github.com/fatih/color"
|
|
import "time"
|
|
import "log"
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
// Redis stuff.
|
|
redis := herald.RedisConnect()
|
|
_ = redis
|
|
|
|
// Color Stuff.
|
|
color.NoColor = false
|
|
|
|
red := color.New(color.FgRed).SprintFunc()
|
|
magenta := color.New(color.FgMagenta).SprintFunc()
|
|
green := color.New(color.FgGreen).SprintFunc()
|
|
yellow := color.New(color.FgYellow).SprintFunc()
|
|
bold := color.New(color.Bold, color.FgWhite).SprintFunc()
|
|
|
|
for {
|
|
|
|
// Get a list of the buildpacks (as types).
|
|
buildpacks := herald.GetBuildpacks()
|
|
|
|
// Iterate over them.
|
|
for _, bp := range(buildpacks) {
|
|
|
|
// Download and extract each Buildpack.
|
|
log.Printf(bold("Downloading '%s'…"), red(bp.Name))
|
|
path := bp.Download()
|
|
|
|
log.Printf("Buildpack '%s' downloaded to '%s'!", red(bp), green(path))
|
|
|
|
// Find all version executables for the given buildpack.
|
|
executables := bp.FindVersionScripts()
|
|
|
|
for _, exe := range(executables) {
|
|
|
|
log.Printf(yellow("Executing '%s:%s' script…"), red(bp), magenta(exe))
|
|
|
|
// TODO: Ensure chmod for the executable.
|
|
exe.EnsureExecutable()
|
|
|
|
// Execute the executable, print the results.
|
|
results := exe.Execute()
|
|
|
|
// for _, result := range(results) {
|
|
|
|
// }
|
|
|
|
// Log results.
|
|
log.Printf("%s:%s results: %s", red(bp), magenta(exe), results)
|
|
|
|
}
|
|
}
|
|
|
|
log.Print(bold("Sleeping for 10 minutes…"))
|
|
|
|
// Sleep for ten minutes.
|
|
time.Sleep(10*time.Minute)
|
|
|
|
}
|
|
|
|
} |