Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
v0.16.14 (#2030)
Browse files Browse the repository at this point in the history
* adding direct version on the docker build

* fixing plugin installation

* Fix npm's package.json permissions (#2005)

Changed created file permissions from 644 (`-w----r--`) to 0644 (`rw-r--r--`)

* Bump spf13/viper to v1.7.0 (#1999)

* bunping version

* changing version on dockerfile

* patch to fix the keywords check on new app

* removing unneeded append

* Task fixing html binder (#2016)

* binder was not wired

* packing

* adding new version number

* pulling the buffalo binary from gobinaries.com

* Task updating formam (#2025)

* v0.16.13 (#2019)

* adding direct version on the docker build

* fixing plugin installation

* Fix npm's package.json permissions (#2005)

Changed created file permissions from 644 (`-w----r--`) to 0644 (`rw-r--r--`)

* Bump spf13/viper to v1.7.0 (#1999)

* bunping version

* changing version on dockerfile

* patch to fix the keywords check on new app

* removing unneeded append

* Task fixing html binder (#2016)

* binder was not wired

* packing

* adding new version number

* pulling the buffalo binary from gobinaries.com

Co-authored-by: Disconnect3d <[email protected]>
Co-authored-by: hackerman <[email protected]>

* updating formam

Co-authored-by: Disconnect3d <[email protected]>
Co-authored-by: hackerman <[email protected]>

* Fixes #1987 and #2023 (#2026)

* v0.16.13 (#2019)

* adding direct version on the docker build

* fixing plugin installation

* Fix npm's package.json permissions (#2005)

Changed created file permissions from 644 (`-w----r--`) to 0644 (`rw-r--r--`)

* Bump spf13/viper to v1.7.0 (#1999)

* bunping version

* changing version on dockerfile

* patch to fix the keywords check on new app

* removing unneeded append

* Task fixing html binder (#2016)

* binder was not wired

* packing

* adding new version number

* pulling the buffalo binary from gobinaries.com

Co-authored-by: Disconnect3d <[email protected]>
Co-authored-by: hackerman <[email protected]>

* fixing #1987 and #2023

* adding missing converstion

* removing commented code

Co-authored-by: Disconnect3d <[email protected]>
Co-authored-by: hackerman <[email protected]>

* changing version number

Co-authored-by: Disconnect3d <[email protected]>
Co-authored-by: hackerman <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2020
1 parent 0260f6e commit 98a801e
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN npm install -g --no-progress yarn \
# Install golangci
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
# Installing buffalo binary
RUN curl -sf https://gobinaries.com/gobuffalo/buffalo/[email protected].13 | sh
RUN curl -sf https://gobinaries.com/gobuffalo/buffalo/[email protected].14 | sh
RUN go get github.com/gobuffalo/buffalo-pop/v2
RUN buffalo version

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.slim.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN npm i -g --no-progress yarn \
&& yarn config set yarn-offline-mirror-pruning true

# Pulling docker binary from releases
RUN curl -sf https://gobinaries.com/gobuffalo/buffalo/[email protected].13 | sh
RUN curl -sf https://gobinaries.com/gobuffalo/buffalo/[email protected].14 | sh
RUN go get github.com/gobuffalo/buffalo-pop/v2
RUN buffalo version

Expand Down
10 changes: 10 additions & 0 deletions genny/newapp/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ func Test_New(t *testing.T) {
r.NoError(err)
r.Contains(f.String(), `return c.Render(http.StatusOK, r.JSON(map[string]string{"message": "Welcome to Buffalo!"}))`)

f, err = res.Find("actions/app.go")
r.NoError(err)
r.Contains(f.String(), `i18n "github.com/gobuffalo/mw-i18n"`)
r.Contains(f.String(), `var T *i18n.Translator`)
r.Contains(f.String(), `func translations() buffalo.MiddlewareFunc {`)

f, err = res.Find("locales/all.en-us.yaml")
r.NoError(err)
r.Contains(f.String(), `translation: "Welcome to Buffalo (EN)"`)

unexpected := []string{
"Dockerfile",
"database.yml",
Expand Down
14 changes: 14 additions & 0 deletions genny/newapp/api/templates/actions/app.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
forcessl "github.com/gobuffalo/mw-forcessl"
paramlogger "github.com/gobuffalo/mw-paramlogger"
"github.com/unrolled/secure"
i18n "github.com/gobuffalo/mw-i18n"

{{ if .opts.App.WithPop }}
"{{.opts.App.ModelsPkg}}"
Expand All @@ -21,6 +22,7 @@ import (
// application is being run. Default is "development".
var ENV = envy.Get("GO_ENV", "development")
var app *buffalo.App
var T *i18n.Translator

// App is where all routes and middleware for buffalo
// should be defined. This is the nerve center of your
Expand Down Expand Up @@ -68,6 +70,18 @@ func App() *buffalo.App {
return app
}

// translations will load locale files, set up the translator `actions.T`,
// and will return a middleware to use to load the correct locale for each
// request.
// for more information: https://gobuffalo.io/en/docs/localization
func translations() buffalo.MiddlewareFunc {
var err error
if T, err = i18n.New(packr.New("app:locales", "../locales"), "en-US"); err != nil {
app.Stop(err)
}
return T.Middleware()
}

// forceSSL will return a middleware that will redirect an incoming request
// if it is not HTTPS. "http://example.com" => "https://example.com".
// This middleware does **not** enable SSL. for your application. To do that
Expand Down
3 changes: 3 additions & 0 deletions genny/newapp/api/templates/locales/all.en-us.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# For more information on using i18n see: https://github.com/nicksnyder/go-i18n
- id: welcome_greeting
translation: "Welcome to Buffalo (EN)"
34 changes: 34 additions & 0 deletions genny/resource/resource_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package resource

import (
"fmt"
"path"
"path/filepath"
"strings"
Expand Down Expand Up @@ -220,3 +221,36 @@ func Test_New_UseModel(t *testing.T) {
r.Contains(f.String(), "users := &models.Users{}")

}

func Test_New_SkipModel(t *testing.T) {
r := require.New(t)

app := meta.New(".")
app.PackageRoot("github.com/markbates/coke")

opts := &Options{
App: app,
Name: "Widget",
SkipModel: true,
}

g, err := New(opts)
r.NoError(err)

run := runner()
run.With(g)
r.NoError(run.Run())

res := run.Results()

r.Len(res.Commands, 0)
r.Len(res.Files, 9)

f, err := res.Find("actions/widgets.go")
r.NoError(err)
actions := []string{"List", "Show", "Create", "Update", "Destroy", "New", "Edit"}
for _, action := range actions {
r.Contains(f.String(), fmt.Sprintf("func (v WidgetsResource) %v(c buffalo.Context) error {", action))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type {{.opts.Name.Resource}}Resource struct{
}

{{ range $a := .actions }}
// {{$a.String}} default implementation.
func (v {{$.opts.Name.Resource}}Resource) {{$a.String}}(c buffalo.Context) error {
return c.Render(http.StatusOK, r.String("{{$.opts.Model.Proper}}#{{$a.String}}"))
// {{$a.Pascalize}} default implementation.
func (v {{$.opts.Name.Resource}}Resource) {{$a.Pascalize}}(c buffalo.Context) error {
return c.Render(http.StatusOK, r.String("{{$.opts.Model.Proper}}#{{$a.Pascalize}}"))
}

{{end}}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
github.com/markbates/refresh v1.11.1
github.com/markbates/safe v1.0.1
github.com/markbates/sigtx v1.0.0
github.com/monoculum/formam v0.0.0-20200316225015-49f0baed3a1b
github.com/monoculum/formam v0.0.0-20200527175922-6f3cce7a46cf
github.com/sirupsen/logrus v1.5.0
github.com/spf13/cobra v0.0.6
github.com/spf13/pflag v1.0.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,8 @@ github.com/monoculum/formam v0.0.0-20191229172733-952f0766a724 h1:qlTmDrFZLQIGXn
github.com/monoculum/formam v0.0.0-20191229172733-952f0766a724/go.mod h1:JKa2av1XVkGjhxdLS59nDoXa2JpmIHpnURWNbzCtXtc=
github.com/monoculum/formam v0.0.0-20200316225015-49f0baed3a1b h1:BvSZE/bUSz180cQzAEDVOh7seh57UNBlcGAte0CQ8l4=
github.com/monoculum/formam v0.0.0-20200316225015-49f0baed3a1b/go.mod h1:JKa2av1XVkGjhxdLS59nDoXa2JpmIHpnURWNbzCtXtc=
github.com/monoculum/formam v0.0.0-20200527175922-6f3cce7a46cf h1:DJ+VDi88ZNh+C3HkJlNtfWIeOdLPxFjbtwGbWa/D3sY=
github.com/monoculum/formam v0.0.0-20200527175922-6f3cce7a46cf/go.mod h1:JKa2av1XVkGjhxdLS59nDoXa2JpmIHpnURWNbzCtXtc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
Expand Down
6 changes: 4 additions & 2 deletions packrd/packed-packr.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion runtime/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package runtime

// Version is the current version of the buffalo binary
var Version = "v0.16.13"
var Version = "v0.16.14"

0 comments on commit 98a801e

Please sign in to comment.