-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Check parent directories for Cakefiles #1687
Conversation
+1 on the idea. Minor nitpick: The way the patch is implemented, there's always a redundant |
Refactored to avoid that extra call, let me know if there's anything else you need there. |
I dig it -- thanks for the patch. |
Check parent directories for Cakefiles
One quick question. It seems correct, in order to not have to worry about relative paths getting screwed up ... but is it correct for the process to Are there no use cases where you might want to run a cake task in the current subdirectory? |
@jashkenas: I think we should have an invariant that the working directory of a Cakefile is its containing directory. It wouldn't be very fun to author Cakefiles without that invariant. So, to more directly answer your question: I think it's fine. edit: after thinking about it more, I could go either way. It wouldn't be that big of a hassle to have to remember to reset your working directory at the top of a Cakefile if you're going to make assumptions about it. |
That's a fair point, @jashkenas -- Rakefiles tend to use We can recommend the equivalent code for Cakefiles: process.chdir path.dirname __filename Or we can use @michaelficarra's suggestion and keep a static working directory -- but then we may need to expose the original path. |
FWIW, Rake exposes the directory from which the command is run as That may be the simplest model here for Cakefile authors. |
That should do the trick. |
Might be controversial, but figured I'd put it out there. Rake will crawl look for a Rakefile in parent directories, unless you specify the
-nosearch
flag. Been a decade since I used Make, but I believe it does the same as well. Cake does not.I'm a CS novice, so apologies for any non-idiomatic code. Happy to make revisions.
Was issue #1686