diff options
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | cmd/ponzu/main.go | 4 | ||||
-rw-r--r-- | cmd/ponzu/options.go | 20 |
3 files changed, 35 insertions, 5 deletions
@@ -24,9 +24,8 @@ $ go get github.com/bosssauce/ponzu/... _A typical contribution workflow might look like:_ ```bash -# fork the repository and checkout -# ... after forking to your own account -$ git clone https://github.com/<YOUR_GITHUB>/ponzu 'path/to/local/ponzu' +# clone the repository and checkout ponzu-dev +$ git clone https://github.com/bosssauce/ponzu 'path/to/local/ponzu' $ git checkout ponzu-dev # install ponzu with go get or from your own local path @@ -51,6 +50,17 @@ $ git push origin ponzu-dev # ... go to https://github.com/bosssauce/ponzu and create a PR ``` +**Note:** if you intend to work on your own fork and contribute from it, you will +need to also pass `--fork=path/to/your/fork` (using OS-standard filepath structure), +where `path/to/your/fork` _must_ be within `$GOPATH/src`. + +For example: +```bash +# ($GOPATH/src is implied in the fork path, do not add it yourself) +$ ponzu --dev --fork=github.com/nilslice/ponzu new /path/to/new/project +``` + + ## Credits - [golang.org/x/text/transform](https://golang.org/x/text/transform) diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index d919242..ba85f36 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -75,7 +75,8 @@ var ( tls bool // for ponzu internal / core development - dev bool + dev bool + fork string ) func init() { @@ -88,6 +89,7 @@ func main() { flag.IntVar(&port, "port", 8080, "port for ponzu to bind its listener") flag.BoolVar(&tls, "tls", false, "enable automatic TLS/SSL certificate management") flag.BoolVar(&dev, "dev", false, "modify environment for Ponzu core development") + flag.StringVar(&fork, "fork", "", "modify repo source for Ponzu core development") flag.Parse() args := flag.Args() diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go index c5873c2..0090da7 100644 --- a/cmd/ponzu/options.go +++ b/cmd/ponzu/options.go @@ -215,11 +215,29 @@ func createProjInDir(path string) error { } if dev { + branch := exec.Command("git", "checkout", "ponzu-dev") + branch.Stdout = os.Stdout + branch.Stderr = os.Stderr + + err := branch.Start() + if err != nil { + return err + } + + err = branch.Wait() + if err != nil { + return err + } + + if fork != "" { + local = filepath.Join(gopath, "src", fork) + } + devClone := exec.Command("git", "clone", local, "--branch", "ponzu-dev", "--single-branch", path) devClone.Stdout = os.Stdout devClone.Stderr = os.Stderr - err := devClone.Start() + err = devClone.Start() if err != nil { return err } |