summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Treusch von Buttlar <martin.tvb@vitraum.de>2017-05-16 07:24:47 +0200
committerMartin Treusch von Buttlar <martin.tvb@vitraum.de>2017-05-16 07:24:47 +0200
commitfa6a4907557b79f2da6835074233bec717725105 (patch)
tree5cf7da7117cd980ff59a1fac96f744b612534e07
parent4ad35136b67fb35c1dac1662d9330e2a1cfcca58 (diff)
build command now builds the ./cmd/ponzu package instead of a list of files
-rw-r--r--cmd/ponzu/build.go23
1 files changed, 5 insertions, 18 deletions
diff --git a/cmd/ponzu/build.go b/cmd/ponzu/build.go
index 8760096..53cd968 100644
--- a/cmd/ponzu/build.go
+++ b/cmd/ponzu/build.go
@@ -5,20 +5,16 @@ import (
"os"
"os/exec"
"path/filepath"
+ "strings"
"github.com/spf13/cobra"
)
func buildPonzuServer() error {
- pwd, err := os.Getwd()
- if err != nil {
- return err
- }
-
// copy all ./content files to internal vendor directory
src := "content"
dst := filepath.Join("cmd", "ponzu", "vendor", "github.com", "ponzu-cms", "ponzu", "content")
- err = emptyDir(dst)
+ err := emptyDir(dst)
if err != nil {
return err
}
@@ -36,18 +32,9 @@ func buildPonzuServer() 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", "paths.go", "add.go",
- }
- var cmdBuildFilePaths []string
- for _, file := range cmdBuildFiles {
- p := filepath.Join(pwd, "cmd", "ponzu", file)
- cmdBuildFilePaths = append(cmdBuildFilePaths, p)
- }
-
- build := exec.Command(gocmd, append(buildOptions, cmdBuildFilePaths...)...)
+ cmdPackageName := strings.Join([]string{".", "cmd", "ponzu"}, "/")
+ buildOptions := []string{"build", "-o", buildOutputName(), cmdPackageName}
+ build := exec.Command(gocmd, buildOptions...)
build.Stderr = os.Stderr
build.Stdout = os.Stdout