Closed barbogast closed 11 years ago
Good point! To be fair, I had just planned the dest
option as a way to place the test files in separate directories to avoid putting them in the .git
while developing. Didn't think of the other way around, to put the hooks in the proper folder when the Gruntfile is not at the root of the project :s
I agree the default templates should handle the situation. I think passing a new gruntfileDirectory
variable to the templates so they can chose the way they want to chdir
and updating the default templates should do the trick there.
When using the option 'dest' the grunt calls in the hook script doesn't work. The reason is that git hooks are executed from the directory that contains the
.git
directory. Thedest
option is used when.git
is not in the same directory asGruntfile.js
. Therefore the grunt calls in the generated hook file cannot be executed because theGruntfile.js
is missing.I generated a custom template file in which a call
process.chdir('path')
to the path where myGruntfile.js
is. A more elegant solution could be to automatically insert theprocess.chdir()
call into the hook file. The target path could be retrieved byprocess.cwd()
while writing the hook file.