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

Fixes double file generation #1753

Merged
merged 2 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions buffalo/cmd/fix/plush.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

// Plush will update foo.html templates to foo.plush.html templates
func Plush(r *Runner) error {
fmt.Println("~~~ Adding .plush extension to .html files ~~~")
return filepath.Walk(r.App.Root, func(p string, info os.FileInfo, err error) error {
fmt.Println("~~~ Adding .plush extension to .html/.js/.md files ~~~")
return filepath.Walk(filepath.Join(r.App.Root, "templates"), func(p string, info os.FileInfo, err error) error {
if err != nil {
return err
}
Expand All @@ -20,7 +20,8 @@ func Plush(r *Runner) error {
base := filepath.Base(p)
sep := strings.Split(base, ".")

if filepath.Ext(p) != ".html" {
ext := filepath.Ext(p)
if !(ext == ".html" || ext == ".js" || ext == ".md") {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion genny/assets/standard/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func New(opts *Options) (*genny.Generator, error) {
g.Transformer(t)

g.RunFn(func(r *genny.Runner) error {
f, err := r.FindFile("templates/application.html")
f, err := r.FindFile("templates/application.plush.html")
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions genny/assets/standard/standard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Test_New(t *testing.T) {
r.NoError(err)

run := gentest.NewRunner()
run.Disk.Add(genny.NewFileS("templates/application.html", layout))
run.Disk.Add(genny.NewFileS("templates/application.plush.html", layout))
run.LookPathFn = func(s string) (string, error) {
return s, nil
}
Expand All @@ -33,15 +33,15 @@ func Test_New(t *testing.T) {
"public/assets/buffalo.css",
"public/assets/images/favicon.ico",
"public/assets/images/logo.svg",
"templates/application.html",
"templates/application.plush.html",
}

r.Len(res.Files, len(files))
for i, f := range res.Files {
r.Equal(files[i], f.Name())
}

layout, ferr := res.Find("templates/application.html")
layout, ferr := res.Find("templates/application.plush.html")
r.NoError(ferr)

r.Contains(layout.String(), "href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\"")
Expand Down
4 changes: 2 additions & 2 deletions genny/assets/webpack/webpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func runner() *genny.Runner {
run := gentest.NewRunner()
run.Disk.Add(genny.NewFileS("templates/application.html", layout))
run.Disk.Add(genny.NewFileS("templates/application.plush.html", layout))
run.LookPathFn = func(s string) (string, error) {
return s, nil
}
Expand Down Expand Up @@ -45,7 +45,7 @@ func Test_Webpack_New(t *testing.T) {
"assets/js/application.js",
"package.json",
"public/assets/.keep",
"templates/application.html",
"templates/application.plush.html",
"webpack.config.js",
}
r.Len(res.Files, len(files))
Expand Down
2 changes: 1 addition & 1 deletion genny/build/_fixtures/coke/actions/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var assetsBox = packr.NewBox("app:assets", "../public")
func init() {
r = render.New(render.Options{
// HTML layout to be used for all HTML requests:
HTMLLayout: "application.html",
HTMLLayout: "application.plush.html",

// Box containing all of the templates:
TemplatesBox: packr.New("../templates", "../templates"),
Expand Down
2 changes: 1 addition & 1 deletion genny/newapp/web/templates/actions/render.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var assetsBox = packr.New("app:assets", "../public")
func init() {
r = render.New(render.Options{
// HTML layout to be used for all HTML requests:
HTMLLayout: "application.html",
HTMLLayout: "application.plush.html",

// Box containing all of the templates:
TemplatesBox: packr.New("app:templates", "../templates"),
Expand Down
2 changes: 1 addition & 1 deletion genny/newapp/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func New(opts *Options) (*genny.Group, error) {

t := gogen.TemplateTransformer(data, helpers)
g.Transformer(t)
g.Box(packr.New("github.com/gobuffalo/buffalo/genny/newapp/web", "../web/templates"))
g.Box(packr.New("github.com/gobuffalo/buffalo:genny/newapp/web", "../web/templates"))

gg.Add(g)

Expand Down
6 changes: 3 additions & 3 deletions genny/newapp/web/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ var commonExpected = []string{
"README.md",
"locales/all.en-us.yaml",
"public/robots.txt",
"templates/_flash.html",
"templates/application.html",
"templates/index.html",
"templates/_flash.plush.html",
"templates/application.plush.html",
"templates/index.plush.html",
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/gobuffalo/pop v4.11.2+incompatible
github.com/gobuffalo/release v1.8.3
github.com/gobuffalo/tags v2.1.0+incompatible
github.com/google/go-cmp v0.3.0
github.com/google/go-cmp v0.3.1
github.com/gorilla/mux v1.7.3
github.com/gorilla/sessions v1.2.0
github.com/karrick/godirwalk v1.10.12
Expand All @@ -38,15 +38,15 @@ require (
github.com/markbates/refresh v1.8.0
github.com/markbates/safe v1.0.1
github.com/markbates/sigtx v1.0.0
github.com/monoculum/formam v0.0.0-20190307031628-bc555adff0cd
github.com/monoculum/formam v0.0.0-20190730134247-0612307a4099
github.com/sirupsen/logrus v1.4.2
github.com/spf13/afero v1.2.1 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.3.0
golang.org/x/sync v0.0.0-20190423024810-112230192c58
golang.org/x/tools v0.0.0-20190716221150-e98af2309876
golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
gopkg.in/yaml.v2 v2.2.2
)
13 changes: 7 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c h1:2zRrJWIt/f9c9HhNHAgrRgq0San5gRRUJTBXLkchal0=
github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk=
Expand Down Expand Up @@ -498,8 +497,8 @@ github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
Expand Down Expand Up @@ -636,8 +635,9 @@ github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/monoculum/formam v0.0.0-20180901015400-4e68be1d79ba/go.mod h1:RKgILGEJq24YyJ2ban8EO0RUVSJlF1pGsEvoLEACr/Q=
github.com/monoculum/formam v0.0.0-20190307031628-bc555adff0cd h1:IXT4e1P5FWjF2zZa45blCFdkaNy2OXKTEUSjUK96/DA=
github.com/monoculum/formam v0.0.0-20190307031628-bc555adff0cd/go.mod h1:JKa2av1XVkGjhxdLS59nDoXa2JpmIHpnURWNbzCtXtc=
github.com/monoculum/formam v0.0.0-20190730134247-0612307a4099 h1:zOo1doIqdLBWPFiIVGCkEzOeq36jmzD3S3++1VWxQGw=
github.com/monoculum/formam v0.0.0-20190730134247-0612307a4099/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 Expand Up @@ -948,8 +948,9 @@ golang.org/x/tools v0.0.0-20190613204242-ed0dc450797f/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190716221150-e98af2309876 h1:XskQVJACjxHVCFlm4GsSEh6ZLclQPLobzuvB4DQYHtw=
golang.org/x/tools v0.0.0-20190716221150-e98af2309876/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de h1:VNumCimp/Bwk6fRqgPHkjiUPZ/vzlpi23/kQTuQ4gBA=
golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
Expand Down
30 changes: 15 additions & 15 deletions packrd/packed-packr.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func Test_App_NamedRoutes(t *testing.T) {
var resourcesResource Resource = ResourcesResource{}

rr := render.New(render.Options{
HTMLLayout: "application.html",
HTMLLayout: "application.plush.html",
TemplatesBox: packr.New("../templates", "../templates"),
Helpers: map[string]interface{}{},
})
Expand Down Expand Up @@ -461,7 +461,7 @@ func Test_App_NamedRoutes_MissingParameter(t *testing.T) {
a := New(Options{})

rr := render.New(render.Options{
HTMLLayout: "application.html",
HTMLLayout: "application.plush.html",
TemplatesBox: packr.New("../templates", "../templates"),
Helpers: map[string]interface{}{},
})
Expand Down