-
Notifications
You must be signed in to change notification settings - Fork 388
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
ponzu add <addon URI> #87
Conversation
…rob don't need mkdir
|
||
// Go get | ||
cmdOptions = append(cmdOptions, "get", addonPath) | ||
get := exec.Command(gocmd, cmdOptions...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch to re-use the gocmd variable.. will be very useful when working with future go version betas / release candidates. thank you for being mindful about that!
cmd/ponzu/add.go
Outdated
// copy to ./addons folder | ||
// GOPATH can be a list delimited by ":" on Linux or ";" on Windows | ||
// `go get` uses the first, this should parse out the first whatever the OS | ||
gopath := resolveGOPATH() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly. I didn't know anything about that. I only upgraded to 1.8 to run Ponzu :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great -- thank you very much!
cmd/ponzu/usage.go
Outdated
@@ -162,6 +162,19 @@ var usageVersion = ` | |||
|
|||
` | |||
|
|||
var usageAdd = ` | |||
[--cli] add, a <addon URI> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is [--cli]
actually used in the add command? if not, lets clear that so it's not confusing. then in place of , let's say
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not in the end PR, I spotted it late and removed it in [this commit] (5fcca31)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good! Thank you. I figured it was a copy/paste thing.. and I appreciate you keeping to the style of the existing commands!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olliephillips - this is fantastic. thank you for the work you put here. if you could make the edits as per the comments and lmk what you think about GOPATH resolution since 1.8 changes it will help a lot to get this merged. I am on the road until later tonight, but will be able to check in if you have issues.
This is what I had in mind for GOPATH resolution
|
@olliephillips That script could have the same problem I commented you in the code. |
@sirikon - could you link me to the comment / line in the code you mention? I can't find it. |
@sirikon - sorry, I meant the link to your comment that you left about:
I don't see any comment there, maybe I'm just missing it.. |
@sirikon - odd, this is what I see when clicking your link. No comment from you on the whole PR.. Would you mind copying the comment you made and the line # you're referencing so I can understand what the issue is? Thanks & sorry for the inconvenience.. really not sure why I can't see the comment |
@sirikon That's a good point re Before I do could I have comments on the revised func above, which attempts to resolve a default GOPATH. |
The rest of the script seems perfect for me :) |
Needed an OS check in end. Hopefully, this should reliably get GOPATH or the default. At least for Windows/Linux/Mac. If agreed I'll update the PR.
|
Seems okay for me :) |
@sirikon - thank you for adding that, sorry it was pending.. not sure how to approve those things @olliephillips - that looks good to me, go ahead and update the PR at your convenience. Thanks! |
@nilslice That has been added to the PR. I've run through the |
cmd/ponzu/add.go
Outdated
gopaths = strings.Split(envGOPATH, ";") | ||
gopath = gopaths[0] | ||
return gopath | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this method work correctly?
(Didn't knew GOPATH could be multiple directories by the way, interesting)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean... This will only work in Windows, because 'gopath' var is overwritten.
Also, making the split by ":" and by ";" without checking what's the OS Host is tricky, for example, in Windows ":" is used to define drive letters (Like in the path C:\Users\Whatever)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks good. Will just run through some tests and merge.
@olliephillips, thank you for adding this. I think it will be a really big help to make addons a major component of Ponzu systems. @sirikon, thank you for your continued involvement and testing! I really appreciate all of your help. |
Reference issue #85. As discussed, this adds a
ponzu add
command to the CLI. It fetches the addon from its URI by wrappinggo get
then copies it to the projects local./addons
directory.There is no switch for automatically installing. Based on the issue discussion that feature needs more thought, so has been omitted.
I've updated the README to include documentation on the command.
It's been tested as per the approach in the README.