From 76f93617a788d350124f749acb3790276a436cc0 Mon Sep 17 00:00:00 2001 From: James Culbertson Date: Sat, 17 Mar 2018 17:40:21 -0500 Subject: [PATCH] Add support for sqlite build tag required by Buffalo. --- cmd/run.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/run.go b/cmd/run.go index 4bbbc36..5f3f864 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -1,7 +1,9 @@ package cmd import ( + "bytes" "fmt" + "io/ioutil" "os/exec" "github.com/markbates/grift/grift" @@ -45,7 +47,14 @@ func Run(name string, args []string) error { } func run(args []string) error { - rargs := []string{"run", exePath} + rargs := []string{"run"} + // Test for special cases requiring sqlite build tag + if b, err := ioutil.ReadFile("database.yml"); err == nil { + if bytes.Contains(b, []byte("sqlite")) { + rargs = append(rargs, "-tags", "sqlite") + } + } + rargs = append(rargs, exePath) rargs = append(rargs, args...) if err := grift.RunSource(exec.Command("go", rargs...)); err != nil { return errors.WithStack(err)