Comments (20)
That is close - but you need to build the project before you run it. Also, just by running go get
on the project, you should have the ponzu CLI installed and available to run globally.
The steps are:
go get github.com/ponzu-cms/ponzu/...
(gets Ponzu code and installs binary CLI)ponzu new github.com/jksmithiii/mycms
cd $GOPATH/github.com/jksmithiii/mycms
ponzu build
ponzu run
You can use the code generator ponzu generate content [your details here]
in between steps 3. and 4.
Let me know if that works for you.
Steve
from ponzu.
Ok, that's where I'm getting thrown off. Did a fresh get. I didn't see the binary in GOPATH/bin. I'll run back through the steps.
Thanks
from ponzu.
Sweet. Looks good on win 10 so far. Thanks
from ponzu.
Hi @jksmithiii -
Would you be able to paste the output from when your generate
command failed, in addition to the full command you entered?
@sirikon - if you have time, maybe you can take a look at this to as the in-house Windows pro? :)
from ponzu.
Sure. Console output attached.
In generate.go, first fix was in setFieldView. Subsequent fix in generateContentType. The log lines printed out because I inserted a log.printLn for tracing purposes. Check error for malformed path.
from ponzu.
It looks like you are running this command from inside ponzu (the CLI), not your own ponzu project. is that accurate?
did you run this first?
$ ponzu new myProject
$ cd myProject
Where myProject
is the path to your new ponzu project.
from ponzu.
Ok, I'm not clear on the steps then.
- Go get ponzu
- Build ponzu in GOPATH\src\github.com\ponzu-cms\ponzu\cmd\ponzu
- run GOPATH\src\github.com\ponzu-cms\ponzu\cmd\ponzu\ponzu.exe new mycms
- run GOPATH\src\mycms\cmd\ponzu\ponzu.exe gen ...
Is that correct? When does ponzu build come into play?
Thanks for help.
from ponzu.
@nilslice sorry for the delay... should be able to look at this tomorrow.
#117 (comment) Should it actually fail doing this? And doing this generation command: #117 (comment)
from ponzu.
@sirikon - no worries! I think the issue was that the CLI was being used from inside its own directory, not from a new Ponzu project.
Idk if there is an elegant way to protect it from failing (maybe just handle the error and Println a "make sure you're inside a Ponzu project" kind of message?) - but that error was not from intended use.
from ponzu.
@nilslice Ok! ^^
About the error message... a message like "Are you in a Ponzu project?" could be useful, the question is when triggering it.
Is there any way to be 100% sure that a folder is a ponzu project? Any file that is 100% required? Something inside myProject/cmd/ponzu/ ?
from ponzu.
@sirikon -
There is a way to know, since a Ponzu project will have the Ponzu source code inside the cmd/ponzu/vendor directory, whereas in the Ponzu source code itself (meaning the go get
ponzu code), the source does not exist.
So the flow would be:
Are we in a Ponzu project?
- check for
/cmd/ponzu/vendor/github.com/ponzu-cms/ponzu
-> PASSES- YES
- check for
/cmd/ponzu/vendor/github.com/ponzu-cms/ponzu
-> FAILS- NO
from ponzu.
@nilslice Hmm... didn't tought that... anyway, isn't possible to have a Ponzu project with ponzu dependency in GOPATH instead of vendor?
Also, maybe this check shouldn't be blocking... for example, if I run a generate command and the check fails, will try to do it anyway, and then show the message "Are you in a Ponzu project?" if the command fails AND the check fails too.
from ponzu.
@sirikon - It is possible to have the dependency in GOPATH instead of vendor, but the CLI intentionally copies ponzu into vendor per each execution of $ ponzu new ...
, since you would otherwise be forced to use the same version of ponzu for all your ponzu projects on each $ ponzu build
.
The reasoning for this decision was that there could certainly be cases where users are on 0.8.x for $PROJ1, and 0.9.x for $PROJ2. If the dependency is in GOPATH for both projects, each project's internal API could break and they'd be forced to use the latest version on their system. Hence, the $ponzu [--cli] version
and $ ponzu upgrade
commands.
from ponzu.
Also, maybe this check shouldn't be blocking... for example, if I run a generate command and the check fails, will try to do it anyway, and then show the message "Are you in a Ponzu project?" if the command fails AND the check fails too.
That is a good point. Personally, I think we should only show the message if the command fails.. there could be other generators (like $ ponzu g addon
) created later, and its possible that a generator could be used to modify the source CLI.. in all cases of the message being shown, we may want to print the current working directory so it's clear to the user that we're referring to a file system location concern.
Do you agree?
from ponzu.
@nilslice Totally agree :)
I see here two options to check:
1.- Existence of ponzu inside vendor folder
2.- Existence of the required folders for each command (If a generator creates content, then 'content' folder should exist if the folder is a valid Ponzu project
First option is more like a near-silver-bullet, but could fail when a user, because some reason, uses the ponzu inside GOPATH instead the one from vendor folder. Would agree to this if the Ponzu-inside-vendor thing is a design requirement, more than a default decision in Ponzu project generator. Otherwise, would prefer the second option
from ponzu.
Hey @sirikon -
I just realized we are missing one other scenario that is easy to catch... if pwd is $GOPATH/src/github.com/ponzu-cms/ponzu, we should block commands that move/copy/create files. There should never be a case where someone uses the ponzu-cms/ponzu
repo as their own project - this is the same as someone using the rails
gem as their own rails project - it just shouldn't happen.
With that, we should just print the message "Make sure you are in a Ponzu project" etc, if there are any errors from the cmd/ponzu/main() cases.
I think all that we'd need to add is some error wrapping func specific to this check..
func warnProjectLocation(err error) {
fmt.Println(err)
pwd, err := os.Getwd()
if err != nil {
fmt.Println("Failed to find current directory:", err)
return
}
// check if user is running a command from inside the ponzu-cms/ponzu repo
gopath, gopathErr := getGOPATH()
if gopathErr != nil {
fmt.Println("Failed to locate GOPATH environment variable:", gopathErr)
return
}
ponzuCLIRepo := filepath.Join(gopath, "src", "github.com", "ponzu-cms", "ponzu")
if pwd == ponzuCLIRepo {
fmt.Println("Only run this command from within a Ponzu project created by the 'new' command, not the Ponzu source code.")
return
}
fmt.Println("Are you sure you are inside a Ponzu project?")
}
Do you think that covers it?
from ponzu.
@nilslice Looks great for me :) Just a detail: Wouldn't be better if, for comparing the file paths, we use this instead: https://golang.org/pkg/os/#SameFile ?
Comparing a filesystem path by its string representation could lead to some wrong 'false' returns. What do you think?
from ponzu.
@sirikon - I was not aware of os.SameFile
, seems like a better option indeed! should take care of the non-existent path case as well.
from ponzu.
@jksmithiii - I know you're already on your way with Ponzu, but if you would like a proper introduction to the project, I have just released this video:
https://www.youtube.com/watch?v=T_1ncPoLgrg
Hope it is helpful!
from ponzu.
Closing this issue. There's been no activity on the issue for some time. Please reopen if need to.
from ponzu.
Related Issues (20)
- CLI is not working HOT 14
- Zap v11 was deleted HOT 14
- go module support HOT 9
- search sort HOT 2
- Custom databases HOT 3
- ponzu 0.11.0 fails to build HOT 2
- The "must" search operator in blevesearch can't be passed into ponzu HOT 1
- NOTICE: original author & maintainer is stepping away from the project HOT 7
- how to change to Summernote
- Redis Support for ponzu
- There is three CSRF vulnerability that can add the administrator account, delete administrator account, edit configuration.
- Only latest tag saving
- Error with "go get..." HOT 6
- Current state of Ponzu HOT 1
- Is this project still maintained? HOT 3
- Suggested install method no longer works HOT 2
- Is Ponzu dead? HOT 10
- Potential goroutine leak in achive.go
- How can you develop addons more efficiently?
- How to setup development env
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ponzu.