mirror of
https://github.com/kennethreitz/herald.git
synced 2026-06-05 23:00:19 +00:00
executing scripts now
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user