executing scripts now

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2017-11-28 17:22:45 -06:00
parent 13d7f8c70e
commit a686b9b456
2 changed files with 18 additions and 1 deletions
+5 -1
View File
@@ -4,6 +4,7 @@ import "github.com/heroku/herald"
// todo: name that herlad
import "time"
import "log"
import "fmt"
@@ -28,8 +29,11 @@ func main() {
// TODO: Ensure chmod for the executable.
exe.EnsureExecutable()
// Execute the executable, print the results.
fmt.Print(exe.Execute())
//
log.Printf("Execututing '%s:%s' script…", bp, exe)
log.Printf("Executing '%s:%s' script…", bp, exe)
}
}
+13
View File
@@ -8,6 +8,8 @@ import "log"
import "path/filepath"
import "strings"
import "os"
import "os/exec"
// import "io"
const BP_BRANCH = "versions"
const BP_TARBALL_TEMPLATE = "https://github.com/heroku/heroku-buildpack-%s/archive/%s.zip"
@@ -47,6 +49,17 @@ func (e Executable) EnsureExecutable() {
}
}
// Executes the given executable, and returns results.
func (e Executable) Execute() []string {
out, err := exec.Command(e.Path).Output()
if err != nil {
// TODO: Update this to return, etc.
log.Fatal(err)
}
return strings.Split(string(out), "\n")
}
// Returns the GitHub ZipBall URI for the given buildpack.
func (b Buildpack) ZipballURI() string {
return fmt.Sprintf(BP_TARBALL_TEMPLATE, b.Name, BP_BRANCH)