diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-10-09 22:21:16 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-10-09 22:21:16 -0700 |
commit | 06c4fedf892d065d579b95e3416b567e19ff729b (patch) | |
tree | 61b04ebd45f0ff08ad3f302a3ce8fe046267e08c /cmd/ponzu/main.go | |
parent | 5deea97f48a0c6205642dc79fd538b3a53919ef6 (diff) |
added a build and run cli command to package, vendor & compile code, and then run the built binary using the same command signature as $ ponze serve
Diffstat (limited to 'cmd/ponzu/main.go')
-rw-r--r-- | cmd/ponzu/main.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index ddc4b98..fcb6035 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -6,6 +6,7 @@ import ( "log" "net/http" "os" + "os/exec" "strings" "github.com/bosssauce/ponzu/system/admin" @@ -116,6 +117,38 @@ func main() { fmt.Println(err) os.Exit(1) } + case "build": + err := buildPonzuServer(args) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + case "run": + if len(args) < 2 { + flag.PrintDefaults() + os.Exit(1) + } + + var addTLS string + if tls { + addTLS = "--tls" + } else { + addTLS = "--tls=false" + } + serve := exec.Command("./ponzu-server", + fmt.Sprintf("--port=%d", port), + addTLS, + "serve", + args[1], + ) + + err := serve.Run() + if err != nil { + fmt.Println(err) + os.Exit(1) + } + case "serve", "s": db.Init() if len(args) > 1 { |