Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
this fixes the pq registered twice issue (#1033)
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates authored Apr 19, 2018
1 parent ecee77f commit 8245894
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 0 additions & 2 deletions generators/newapp/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,8 @@ const GopkgTomlTmpl = `
name = "github.com/gobuffalo/buffalo"
unused-packages = false
{{ if .opts.WithPop }}
# DO NOT DELETE
[[prune.project]] # pop
name = "github.com/gobuffalo/pop"
unused-packages = false
{{ end }}
`
3 changes: 1 addition & 2 deletions internal/vbuffalo/dep.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"io/ioutil"
"os"
"os/exec"
"path/filepath"

"html/template"
Expand Down Expand Up @@ -43,7 +42,7 @@ func depEnsure() error {
return errors.WithStack(err)
}

return run(exec.Command("dep", "ensure", "-v"))
return run("dep", []string{"ensure", "-v"})
}

if addPrune {
Expand Down
18 changes: 11 additions & 7 deletions internal/vbuffalo/vbuffalo.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package vbuffalo

import (
"fmt"
"os"
"os/exec"
"path/filepath"
Expand All @@ -18,6 +19,7 @@ var binPath = filepath.Join(pwd, "bin", "vbuffalo")
var app meta.App

func init() {
fmt.Println("vbuffalo")
if runtime.GOOS == "windows" {
binPath += ".exe"
}
Expand Down Expand Up @@ -59,15 +61,13 @@ func execute() error {
args = append(args, "--tags", "sqlite")
}
args = append(args, "-o", binPath)
cmd := exec.Command("go", args...)
return run(cmd)
return run("go", args)
})
if err != nil {
return errors.WithStack(err)
}

cmd := exec.Command(binPath, os.Args[1:]...)
return run(cmd)
return run(binPath, os.Args[1:])
}

func cd(dir string, fn func() error) error {
Expand All @@ -76,12 +76,16 @@ func cd(dir string, fn func() error) error {
return fn()
}

func run(cmd *exec.Cmd) error {
// fmt.Println(strings.Join(cmd.Args, " "))
func run(name string, args []string) error {
// fmt.Println("vbuffalo", name, strings.Join(args, " "))
cmd := exec.Command(name, args...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
if err := cmd.Start(); err != nil {
return errors.WithStack(err)
}
return cmd.Wait()
}

func exists(f string) bool {
Expand Down

0 comments on commit 8245894

Please sign in to comment.