Skip to content

Commit

Permalink
Add support for sqlite build tag required by Buffalo.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Culbertson authored and markbates committed Mar 19, 2018
1 parent 5499956 commit 76f9361
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cmd

import (
"bytes"
"fmt"
"io/ioutil"
"os/exec"

"github.com/markbates/grift/grift"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 76f9361

Please sign in to comment.