diff --git a/build-all.go b/build-all.go index 957f46e..8b75241 100644 --- a/build-all.go +++ b/build-all.go @@ -236,11 +236,22 @@ func main() { pkg.os, arch, ) - pathmanFile := filepath.Join(outdir, "bin", "pathman") + pkg.exe + pathmanFile := filepath.Join(outdir, "node_modules/.bin", "pathman") + pkg.exe err = download("pathman", pathmanURL, pathmanFile, true) if nil != err { panic(err) } + if ".exe" == pkg.exe { + sh := strings.Join([]string{ + `#!/usr/bin/env bash`, + `"$(dirname "$0")/pathman.exe" "$@"`, + `exit $?`, + }, "\n") + script := filepath.Join(outdir, "node_modules/.bin", "pathman") + if err := ioutil.WriteFile(script, []byte(sh), 0755); nil != err { + panic(err) + } + } // Get serviceman for the platform servicemanURL := fmt.Sprintf( @@ -248,11 +259,22 @@ func main() { pkg.os, arch, ) - servicemanFile := filepath.Join(outdir, "bin", "serviceman") + pkg.exe + servicemanFile := filepath.Join(outdir, "node_modules/.bin", "serviceman") + pkg.exe err = download("serviceman", servicemanURL, servicemanFile, true) if nil != err { panic(err) } + if ".exe" == pkg.exe { + sh := strings.Join([]string{ + `#!/usr/bin/env bash`, + `"$(dirname "$0")/serviceman.exe" "$@"`, + `exit $?`, + }, "\n") + script := filepath.Join(outdir, "node_modules/.bin", "serviceman") + if err := ioutil.WriteFile(script, []byte(sh), 0755); nil != err { + panic(err) + } + } // Write out the packaged deliverable f, err := os.OpenFile(outdir+"."+pkg.ext, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)