-
Notifications
You must be signed in to change notification settings - Fork 17
Fixes bug in base_path resolution #20
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
base: master
Are you sure you want to change the base?
Conversation
Due to how paths are shipped around, base_path would not correctly handle files in the root path, nesting them. For instance, a base_path of 'app/js' has been passed, which becomes 'app/js/' in the task. Notice in the output that all files are properly re-based, except for those directly inside 'app/js/' (namely main.js, app.js): Running "coffee:app" (coffee) task Verifying property coffee.app exists in config...OK >> Note that grunt.utils has been renamed to grunt.util and is now deprecated. >> Please ensure that your custom tasks are up-to-date. (grunt 0.4.0+) Reading app/js/app.coffee...OK Writing generated\js\app\js\app.js...OK Reading app/js/controllers/auth.coffee...OK Writing generated\js\controllers\auth.js...OK Reading app/js/directives/directives.coffee...OK Writing generated\js\directives\directives.js...OK Reading app/js/filters/filters.coffee...OK Writing generated\js\filters\filters.js...OK Reading app/js/main.coffee...OK Writing generated\js\app\js\main.js...OK Reading app/js/services/auth.coffee...OK Writing generated\js\services\auth.js...OK
|
Looks good, except you should use path.sep instead of using the hard-coded |
|
You're right.. totally slipped my mind. Will update in a few. Note however that I'm on Windows... and my path chars are '/' ;0 |
|
Ok, so path.sep wouldn't work all of the time, because there is nothing to ensure that base_path has a style that matches the OS. Even though I'm on Windows, I tend to use So the solution also includes a bit of normalization.. and some tweaks to make sure the resultant RegEx is safe to use - but apparently Travis doesn't like it! Looking into it... |
|
Not sure what's causing the fails in the tests here... only failing on 0.6 |
|
Any ideas? |
|
Looks like path.sep was only introduced in the NodeJS 0.7 development cycle so it's not available in Node 0.6. I've removed the call to path.sep and instead just rely on path.join to "do the right thing" in this commit 0e10ca5. If that looks good to you, I'll merge it in. |
|
Sorry it took so long to get back with you here.... unfortunately that doesn't work either. However, I do have a fix -- pretty similar to this one. Updating pull in just a sec. |
Due to how paths are shipped around, base_path would not correctly handle files in the root path, nesting them. Properly normalizes paths / uses path.sep when available, so that this will work on all operating systems, regardless of how paths are configured in the configuration file. For instance, a base_path of 'app/js' has been passed, which becomes 'app/js/' in the task. Notice in the output that all files are properly re-based, except for those directly inside 'app/js/' (namely main.js, app.js): Running "coffee:app" (coffee) task Verifying property coffee.app exists in config...OK >> Note that grunt.utils has been renamed to grunt.util and is now deprecated. >> Please ensure that your custom tasks are up-to-date. (grunt 0.4.0+) Reading app/js/app.coffee...OK Writing generated\js\app\js\app.js...OK Reading app/js/controllers/auth.coffee...OK Writing generated\js\controllers\auth.js...OK Reading app/js/directives/directives.coffee...OK Writing generated\js\directives\directives.js...OK Reading app/js/filters/filters.coffee...OK Writing generated\js\filters\filters.js...OK Reading app/js/main.coffee...OK Writing generated\js\app\js\main.js...OK Reading app/js/services/auth.coffee...OK Writing generated\js\services\auth.js...OK
Due to how paths are shipped around,
base_path would not correctly handle files in the root path, nesting them.
For instance, a base_path of 'app/js' has been passed,
which becomes 'app/js/' in the task.
Notice in the output that all files are properly re-based,
except for those directly inside 'app/js/' (namely main.js, app.js):
With this fixed, we get the following desired output