summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/ponzu/main.go7
-rw-r--r--cmd/ponzu/options.go5
-rw-r--r--cmd/ponzu/paths.go14
3 files changed, 23 insertions, 3 deletions
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go
index 6c52e01..0bb92d2 100644
--- a/cmd/ponzu/main.go
+++ b/cmd/ponzu/main.go
@@ -15,6 +15,8 @@ import (
"github.com/ponzu-cms/ponzu/system/db"
"github.com/ponzu-cms/ponzu/system/tls"
+ "path/filepath"
+
_ "github.com/ponzu-cms/ponzu/content"
)
@@ -146,7 +148,10 @@ func main() {
services = "admin,api"
}
- serve := exec.Command(buildOutputName(),
+ path := buildOutputPath()
+ name := buildOutputName()
+ buildPathName := strings.Join([]string{path, name}, string(filepath.Separator))
+ serve := exec.Command(buildPathName,
fmt.Sprintf("--port=%d", port),
fmt.Sprintf("--httpsport=%d", httpsport),
addTLS,
diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go
index 6173368..9023f84 100644
--- a/cmd/ponzu/options.go
+++ b/cmd/ponzu/options.go
@@ -303,7 +303,10 @@ func buildPonzuServer(args []string) error {
// execute go build -o ponzu-cms cmd/ponzu/*.go
buildOptions := []string{"build", "-o", buildOutputName()}
- cmdBuildFiles := []string{"main.go", "options.go", "generate.go", "usage.go"}
+ cmdBuildFiles := []string{
+ "main.go", "options.go", "generate.go",
+ "usage.go", "paths.go",
+ }
var cmdBuildFilePaths []string
for _, file := range cmdBuildFiles {
p := filepath.Join(pwd, "cmd", "ponzu", file)
diff --git a/cmd/ponzu/paths.go b/cmd/ponzu/paths.go
index 0ab2b06..73d8d73 100644
--- a/cmd/ponzu/paths.go
+++ b/cmd/ponzu/paths.go
@@ -2,11 +2,23 @@ package main
import "runtime"
-// buildOutputName returns the correct ponzu-server file name
+// buildOutputName returns the correct ponzu-server file name
// based on the host Operating System
func buildOutputName() string {
if runtime.GOOS == "windows" {
return "ponzu-server.exe"
}
+
return "ponzu-server"
}
+
+// buildOutputPath returns the correct path to the ponzu-server binary
+// built, based on the host Operating System. This is necessary so that
+// the UNIX-y systems know to look in the current directory, and not the $PATH
+func buildOutputPath() string {
+ if runtime.GOOS == "windows" {
+ return ""
+ }
+
+ return "."
+}