Skip to content

Commit

Permalink
merge contributions (#246)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nilslice committed May 9, 2018
1 parent dab5481 commit 1c1a87c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
15 changes: 11 additions & 4 deletions .circleci/test-setup.sh
Expand Up @@ -7,20 +7,27 @@ set -ex
# Install Ponzu CMS # Install Ponzu CMS
go get -u github.com/ponzu-cms/ponzu/... go get -u github.com/ponzu-cms/ponzu/...



# test install # test install
ponzu ponzu



# create a project and generate code # 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 cd /go/src/github.com/ponzu-cms/ci/test-project


ponzu gen content person name:string hashed_secret:string ponzu gen content person name:string hashed_secret:string
ponzu gen content message from:@person,hashed_secret to:@person,hashed_secret ponzu gen content message from:@person,hashed_secret to:@person,hashed_secret



# build and run dev http/2 server with TLS # build and run dev http/2 server with TLS
ponzu build ponzu build


3 changes: 2 additions & 1 deletion cmd/ponzu/add.go
Expand Up @@ -16,7 +16,8 @@ var addCmd = &cobra.Command{
Aliases: []string{"a"}, Aliases: []string{"a"},
Short: "Downloads addon from specified import path", Short: "Downloads addon from specified import path",
Long: `Downloads addon from specified import path to $GOPATH/src and copys it to the 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`, Example: `$ ponzu add github.com/bosssauce/fbscheduler`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
// expecting two args, add/a and the go gettable package uri // expecting two args, add/a and the go gettable package uri
Expand Down
2 changes: 1 addition & 1 deletion docs/src/Quickstart/Overview.md
Expand Up @@ -18,7 +18,7 @@ $ cd $GOPATH/src/github.com/nilslice/reviews


5) Generate content type file and boilerplate code (creates `content/review.go`): 5) Generate content type file and boilerplate code (creates `content/review.go`):
```bash ```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: 6) Build your project:
Expand Down
9 changes: 7 additions & 2 deletions system/api/push.go
Expand Up @@ -3,13 +3,15 @@ package api
import ( import (
"log" "log"
"net/http" "net/http"
"strings"


"github.com/ponzu-cms/ponzu/system/item" "github.com/ponzu-cms/ponzu/system/item"


"github.com/tidwall/gjson" "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) { func push(res http.ResponseWriter, req *http.Request, pt interface{}, data []byte) {
// Push(target string, opts *PushOptions) error // Push(target string, opts *PushOptions) error
if pusher, ok := res.(http.Pusher); ok { if pusher, ok := res.(http.Pusher); ok {
Expand Down Expand Up @@ -40,7 +42,10 @@ func push(res http.ResponseWriter, req *http.Request, pt interface{}, data []byt
err := pusher.Push(v.String(), nil) err := pusher.Push(v.String(), nil)
// check for error, "http2: recursive push not allowed" // check for error, "http2: recursive push not allowed"
// and return, suppressing a log message // 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 return true
} }
if err != nil { if err != nil {
Expand Down

0 comments on commit 1c1a87c

Please sign in to comment.