Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] buffalo grenerate resource wrong template path #1769

Open
badstorm opened this issue Aug 18, 2019 · 2 comments

Comments

@badstorm
Copy link

commented Aug 18, 2019

Description

If I create a new resource with this nomencalture NameOthername, the generation command create in the template folder a direcotry "name" with inside a subdirectory "othername" and inside all the html files.
But If I try to connect to one of the action of this resource, buffalo try to find the template in other path "name_othername/file.html"

Steps to Reproduce the Problem

Crate a resource withj two uppercase letters:

$ buffalo g r NameOthername title description
$ buffalo pop migrate up
$ buffalo dev

Expected Behavior

Access to the resource paths

Actual Behavior

Actualy you get an error in anyone of the resources paths:
name_othername/index.html: could not find template name_othername/index.html

Info

-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/go/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.12.7, meets the minimum requirements.

-> Go: Checking GOPATH
✓ You appear to be operating inside of your GOPATH.

-> Go: Checking Package Management
⚠ You do not appear to be using a package management system.

It is strongly suggested that you use one of the following package management systems:

* Go Modules (Recommended) - https://gobuffalo.io/en/docs/gomods
* Dep - https://github.com/golang/dep

For help setting up your Go environment please follow the instructions for you platform at:

https://www.gopherguides.com/courses/preparing-your-environment-for-go-development

-> Go: Checking PATH
✓ Your PATH contains /home/badstorm/go/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v10.16.2, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.9.0, meets the minimum requirements.

-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /usr/bin/yarnpkg

-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 1.17.3, meets the minimum requirements.

-> PostgreSQL: Checking installation
✘ The `postgres` executable could not be found on your system.
For help setting up your Postgres environment please follow the instructions for you platform at:

https://www.postgresql.org/download/

-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:

https://www.mysql.com/downloads/

-> SQLite3: Checking installation
✘ The `sqlite3` executable could not be found on your system.
For help setting up your SQLite3 environment please follow the instructions for you platform at:

https://www.sqlite.org/download.html

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo: Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo

-> Buffalo: Checking minimum version requirements
✓ Your version of Buffalo, v0.14.9, meets the minimum requirements.

-> Buffalo: Application Details
Pwd         /home/badstorm/go/src/duckpage.com/rde01
Root        /home/badstorm/go/src/duckpage.com/rde01
GoPath      /home/badstorm/go
PackagePkg  duckpage.com/rde01
ActionsPkg  duckpage.com/rde01/actions
ModelsPkg   duckpage.com/rde01/models
GriftsPkg   duckpage.com/rde01/grifts
WithModules false
Name        rde01
Bin         bin/rde01
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[]}

-> Buffalo: config/buffalo-app.toml
name = "rde01"
bin = "bin/rde01"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-auth"
  go_get = "github.com/gobuffalo/buffalo-auth"

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop"
@tobiashienzsch

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

The problem seems to be in genny/resource/resource.go:48

In the example from @badstorm pres.Name.String() still returns the expected NameOthername, but pres.Name.Folder().String() returns name/othername

@tobiashienzsch

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

After a little more research, it seems like the error is in gobuffalo/flect. I opened an issue, see here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.