Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

make dependencies also work on windows #5

Merged
merged 1 commit into from

2 participants

@sziep

with this change the dependencies can be specified in an OS agnostic way. So both "some/path" and "some\path" are working now.

@tJener
Owner

Hi! =D

Thanks for the pull request, it looks great. If you help me out with a couple small issues, I can merge this in posthaste.

  1. I'd like to keep the whitespace consistent, and will mark the specific lines where there are discrepancies.
  2. Could you squash/fixup your second commit into your first commit? I'd prefer to keep the history clean when possible.
tasks/lib/file-graph.js
@@ -143,7 +143,7 @@ exports.init = function( grunt ) {
}
if ( fileList ) {
- var files = _.words( split[1], ',' ).map( trimElems );
+ var files = _.words( split[1], ',' ).map( trimElems ).map(normalizePath);
@tJener Owner
tJener added a note

whitespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
tasks/lib/file-graph.js
@@ -163,5 +163,9 @@ exports.init = function( grunt ) {
return _( str ).trim();
};
+ var normalizePath = function( p ) {
+ return p.replace(/[\/\\]+/g, path.sep);
@tJener Owner
tJener added a note

whitespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
test/dep-concat_test.js
@@ -56,7 +56,7 @@ exports['dep-concat'] = {
basePath: 'test/fixtures/'
}, function( orderedFiles ) {
var indices = {};
- _.each([ 'main', 2, 5, 7, 8, 9, 10, 11 ], function( file ) {
+ _.each([ 'main', 2, 5, 7, 8, 9, 10, 11, 'somedir/12'], function( file ) {
@tJener Owner
tJener added a note

whitespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
test/fixtures/9.js
@@ -1 +1,2 @@
-// Some file
+// file path windows style
+//load: somedir\\12.js
@tJener Owner
tJener added a note

Would this work with just one \?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@sziep

Like so? :)

@tJener tJener merged commit 171e034 into tJener:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 27, 2013
  1. pathes work on windows machines as well

    Stephan Ziep authored
This page is out of date. Refresh to see the latest.
View
6 tasks/lib/file-graph.js
@@ -143,7 +143,7 @@ exports.init = function( grunt ) {
}
if ( fileList ) {
- var files = _.words( split[1], ',' ).map( trimElems );
+ var files = _.words( split[1], ',' ).map( trimElems ).map( normalizePath );
push.apply( fileList, files );
}
}
@@ -163,5 +163,9 @@ exports.init = function( grunt ) {
return _( str ).trim();
};
+ var normalizePath = function( p ) {
+ return p.replace( /[\/\\]+/g, path.sep );
+ };
+
return exports;
};
View
7 test/dep-concat_test.js
@@ -36,7 +36,7 @@ exports['dep-concat'] = {
helper: function( test ) {
var _ = grunt.util._;
- test.expect( 11 );
+ test.expect( 12 );
var depList = fileGraph.parseFile( 'test/fixtures/main.js', {
basePath: 'test/fixtures/'
});
@@ -56,7 +56,7 @@ exports['dep-concat'] = {
basePath: 'test/fixtures/'
}, function( orderedFiles ) {
var indices = {};
- _.each([ 'main', 2, 5, 7, 8, 9, 10, 11 ], function( file ) {
+ _.each([ 'main', 2, 5, 7, 8, 9, 10, 11, 'somedir/12' ], function( file ) {
indices[ file ] = orderedFiles.indexOf( 'test/fixtures/' + file + '.js' );
});
@@ -68,10 +68,11 @@ exports['dep-concat'] = {
test.ok( indices[ '5' ] > indices[ '11' ] );
test.ok( indices[ '11' ] > indices[ '9' ] );
test.ok( indices[ '11' ] > indices[ '2' ] );
+ test.ok( indices[ '9' ] > indices[ 'somedir/12' ] );
test.equal( _.filter( indices, function( e ) {
return e !== -1;
- }).length, 8, 'all files included' );
+ }).length, 9, 'all files included' );
test.done();
});
View
3  test/fixtures/9.js
@@ -1 +1,2 @@
-// Some file
+// file path windows style
+//load: somedir\12.js
View
1  test/fixtures/somedir/12.js
@@ -0,0 +1 @@
+// some file
Something went wrong with that request. Please try again.