-
Notifications
You must be signed in to change notification settings - Fork 386
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
on windows #117
Comments
Hi @jksmithiii - Would you be able to paste the output from when your @sirikon - if you have time, maybe you can take a look at this to as the in-house Windows pro? :) |
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 |
Ok, I'm not clear on the steps then.
Is that correct? When does ponzu build come into play? Thanks for help. |
That is close - but you need to build the project before you run it. Also, just by running The steps are:
You can use the code generator Let me know if that works for you. Steve |
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 |
@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) |
@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. |
Sweet. Looks good on win 10 so far. Thanks |
@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/ ? |
@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 So the flow would be: Are we in a Ponzu project?
|
@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. |
@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 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 |
That is a good point. Personally, I think we should only show the message if the command fails.. there could be other generators (like Do you agree? |
@nilslice Totally agree :) I see here two options to check: 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 |
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 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? |
@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? |
@sirikon - I was not aware of |
@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: Hope it is helpful! |
Closing this issue. There's been no activity on the issue for some time. Please reopen if need to. |
Got generate to complete on windows. Had to do stuff like the following:
func setFieldView(field *generateField, viewType string) error {
var err error
var tmpl *template.Template
buf := &bytes.Buffer{}
Haven't tried this on linux. On to build. Similar issues in there I think.
The text was updated successfully, but these errors were encountered: