Skip to content

Conversation

@Iristyle
Copy link

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

With this fixed, we get the following desired output

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...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\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):

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
@avalade
Copy link
Owner

avalade commented Sep 11, 2012

Looks good, except you should use path.sep instead of using the hard-coded / character. If you want to update your commit with that, then I will merge it.

@Iristyle
Copy link
Author

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

@Iristyle
Copy link
Author

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 / in config files because in my experience, it just works.

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...

@Iristyle
Copy link
Author

Not sure what's causing the fails in the tests here... only failing on 0.6

@Iristyle
Copy link
Author

Any ideas?

@avalade
Copy link
Owner

avalade commented Sep 25, 2012

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.

@Iristyle
Copy link
Author

Iristyle commented Oct 5, 2012

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.
arian/wrapup@74fd505

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants