Skip to content
This repository has been archived by the owner on May 11, 2019. It is now read-only.

Commit

Permalink
pinning bunch (closes #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkulchenko committed May 19, 2015
1 parent 6a84230 commit 8f02eb9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -21,6 +21,9 @@ go get github.com/dkulchenko/bunch
Alternatively, [precompiled binaries](https://github.com/dkulchenko/bunch/releases) for
supported operating systems are available.

You can pin bunch itself, if you'd like to lock the version of bunch down. If bunch finds a version
of itself in the vendored environment (that is, .vendor/bin/bunch exists), it will use that version instead.

## Bunchfile

See this [repo's Bunchfile](https://github.com/dkulchenko/bunch/blob/master/Bunchfile) as an example.
Expand Down
23 changes: 23 additions & 0 deletions bunch.go
@@ -1,7 +1,10 @@
package main

import (
"fmt"
"os"
"os/exec"
"path"
"time"

"github.com/codegangsta/cli"
Expand All @@ -16,6 +19,26 @@ var SpinnerCharSet = 14
var SpinnerInterval = 50 * time.Millisecond

func main() {
vendoredBunchPath := path.Join(".vendor", "bin", "bunch")
if exists, _ := pathExists(vendoredBunchPath); exists {
cmd := exec.Command(vendoredBunchPath, os.Args[1:]...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

err := cmd.Run()
if err != nil {
fmt.Println("running vendored bin/bunch was unsuccessful")
os.Exit(1)
} else {
if cmd.ProcessState.Success() {
os.Exit(0)
} else {
os.Exit(1)
}
}
}

InitialPath = os.Getenv("PATH")
InitialGoPath = os.Getenv("GOPATH")

Expand Down

0 comments on commit 8f02eb9

Please sign in to comment.