Explorar el Código

Merge pull request #134 from ckeditor/t/133

t/133: Builder fails on Windows
Szymon Cofalik hace 9 años
padre
commit
35299f1809
Se han modificado 2 ficheros con 13 adiciones y 3 borrados
  1. 4 2
      dev/tasks/build/utils.js
  2. 9 1
      dev/tests/build/utils.js

+ 4 - 2
dev/tasks/build/utils.js

@@ -434,7 +434,8 @@ require( [ 'tests' ], bender.defer(), function( err ) {
 		function renderThemeFromEntryPoints( callback ) {
 			gutil.log( `Compiling '${ gutil.colors.cyan( fileName ) }' from ${ gutil.colors.cyan( paths.length ) } entry points...` );
 
-			const dataToRender = paths.map( p => `@import '${ p }';` )
+			// Note: Make sure windows\\style\\paths are preserved.
+			const dataToRender = paths.map( p => `@import "${ p.replace( /\\/g, '\\\\' ) }";` )
 				.join( '\n' );
 
 			try {
@@ -534,7 +535,8 @@ require( [ 'tests' ], bender.defer(), function( err ) {
 		return {
 			shape: {
 				id: {
-					generator: name => `ck-icon-${ name.match( /([^\/]*)\.svg$/ )[ 1 ] }`
+					// Note: Consider unix/style/paths and windows\\style\\paths.
+					generator: name => `ck-icon-${ name.match( /([^\/\\]*)\.svg$/ )[ 1 ] }`
 				},
 			},
 			svg: {

+ 9 - 1
dev/tests/build/utils.js

@@ -631,6 +631,11 @@ describe( 'build-utils', () => {
 						path: 'baz/qux/theme.scss',
 						contents: new Buffer( '' )
 					} ),
+					new Vinyl( {
+						cwd: './',
+						path: 'C:\\win\\dows\\theme.scss',
+						contents: new Buffer( '' )
+					} )
 				];
 
 				const fake = new stream.Readable( { objectMode: true } );
@@ -662,7 +667,8 @@ describe( 'build-utils', () => {
 				}, () => {
 					expect( compiledThemePath ).to.be.equal( 'abc.css' );
 					expect( compiledThemeCss.toString() ).to.be.equal(
-`/*! baz/qux/theme.scss */
+`/*! C:\\win\\dows\\theme.scss */
+/*! baz/qux/theme.scss */
 /*! foo/bar/theme.scss */
 ` );
 
@@ -703,6 +709,8 @@ describe( 'build-utils', () => {
 			const options = utils.getIconSpriteOptions();
 
 			expect( options.shape.id.generator( 'foo.svg' ) ).to.equal( 'ck-icon-foo' );
+			expect( options.shape.id.generator( 'foo/bar/foo.svg' ) ).to.equal( 'ck-icon-foo' );
+			expect( options.shape.id.generator( 'C:\\foo\\foo.svg' ) ).to.equal( 'ck-icon-foo' );
 		} );
 
 		it( 'returns configuration to output JavaScript sprite', () => {