From 1c1a87c57b6407a41b30e0eb9416f03f4b118aac Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Wed, 9 May 2018 12:16:36 -0600 Subject: [PATCH] merge contributions (#246) * expanded help to mention need to import addon (#243) * Remove unused extra backtick (#239) * remove import for golang.org/net/x/http2, co-locate error message * update CI code to run --dev if on ponzu-dev branch * CI: ensure we have latest from ponzu-dev branch --- .circleci/test-setup.sh | 15 +++++++++++---- cmd/ponzu/add.go | 3 ++- docs/src/Quickstart/Overview.md | 2 +- system/api/push.go | 9 +++++++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.circleci/test-setup.sh b/.circleci/test-setup.sh index 76085e32..33139a4d 100755 --- a/.circleci/test-setup.sh +++ b/.circleci/test-setup.sh @@ -7,20 +7,27 @@ set -ex # Install Ponzu CMS go get -u github.com/ponzu-cms/ponzu/... - # test install ponzu - # create a project and generate code -ponzu new github.com/ponzu-cms/ci/test-project +if [ $CIRCLE_BRANCH = "ponzu-dev" ]; then + # ensure we have the latest from ponzu-dev branch + cd /go/src/github.com/ponzu-cms/ponzu + git checkout ponzu-dev + git pull origin ponzu-dev + + # create new project using the ponzu-dev branch + ponzu new --dev github.com/ponzu-cms/ci/test-project +else + ponzu new github.com/ponzu-cms/ci/test-project +fi cd /go/src/github.com/ponzu-cms/ci/test-project ponzu gen content person name:string hashed_secret:string ponzu gen content message from:@person,hashed_secret to:@person,hashed_secret - # build and run dev http/2 server with TLS ponzu build diff --git a/cmd/ponzu/add.go b/cmd/ponzu/add.go index f4b9fea3..62824b1e 100644 --- a/cmd/ponzu/add.go +++ b/cmd/ponzu/add.go @@ -16,7 +16,8 @@ var addCmd = &cobra.Command{ Aliases: []string{"a"}, Short: "Downloads addon from specified import path", Long: `Downloads addon from specified import path to $GOPATH/src and copys it to the -current project's addons directory. Must be called from within a Ponzu project directory.`, +current project's addons directory. Must be called from within a Ponzu project directory. Addon +needs to imported in at least one content item for it to be included in the Ponzu server build.`, Example: `$ ponzu add github.com/bosssauce/fbscheduler`, RunE: func(cmd *cobra.Command, args []string) error { // expecting two args, add/a and the go gettable package uri diff --git a/docs/src/Quickstart/Overview.md b/docs/src/Quickstart/Overview.md index 6c4bec59..329a0f77 100644 --- a/docs/src/Quickstart/Overview.md +++ b/docs/src/Quickstart/Overview.md @@ -18,7 +18,7 @@ $ cd $GOPATH/src/github.com/nilslice/reviews 5) Generate content type file and boilerplate code (creates `content/review.go`): ```bash -$ ponzu generate content review title:"string" author:"string" rating:"float64" body:"string":richtext website_url:"string" items:"[]string" photo:string:file` +$ ponzu generate content review title:"string" author:"string" rating:"float64" body:"string":richtext website_url:"string" items:"[]string" photo:string:file ``` 6) Build your project: diff --git a/system/api/push.go b/system/api/push.go index f7755e5d..04695484 100644 --- a/system/api/push.go +++ b/system/api/push.go @@ -3,13 +3,15 @@ package api import ( "log" "net/http" + "strings" "github.com/ponzu-cms/ponzu/system/item" "github.com/tidwall/gjson" - "golang.org/x/net/http2" ) +const errRecursivePush = "recursive push not allowed" + func push(res http.ResponseWriter, req *http.Request, pt interface{}, data []byte) { // Push(target string, opts *PushOptions) error if pusher, ok := res.(http.Pusher); ok { @@ -40,7 +42,10 @@ func push(res http.ResponseWriter, req *http.Request, pt interface{}, data []byt err := pusher.Push(v.String(), nil) // check for error, "http2: recursive push not allowed" // and return, suppressing a log message - if err != nil && err.Error() == http2.ErrRecursivePush.Error() { + // XXX: errRecursivePush has been co-located to this + // package instead of importing golang.org/x/net/http2 + // to get the error itself. + if err != nil && strings.Contains(err.Error(), errRecursivePush) { return true } if err != nil {