aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-03-03 13:48:01 +0100
committerFelix Nagel <info@felixnagel.com>2013-03-03 13:48:01 +0100
commitdffe8f66109714af2d4ed8f582af4cf3439433e3 (patch)
treed83889fc566946bd35e4f8dc866f2aac5e4b095a /build/tasks
parentd94e217065745e9ad0638cf68d3d973ffe44035a (diff)
parent6d3a1e1fe8cc21f385456ea26075f3909136a589 (diff)
downloadjquery-ui-dffe8f66109714af2d4ed8f582af4cf3439433e3.tar.gz
jquery-ui-dffe8f66109714af2d4ed8f582af4cf3439433e3.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'build/tasks')
-rw-r--r--build/tasks/build.js78
1 files changed, 27 insertions, 51 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js
index 75cbca4a0..a8f25f98f 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -159,7 +159,7 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() {
grunt.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", function() {
// remove dest file before creating it, to make sure itself is not included
- if ( path.existsSync( this.file.dest ) ) {
+ if ( fs.existsSync( this.file.dest ) ) {
fs.unlinkSync( this.file.dest );
}
var crypto = require( "crypto" ),
@@ -175,67 +175,43 @@ grunt.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", fun
});
grunt.registerTask( "generate_themes", function() {
- var download, files, done, configContent,
- target = "dist/" + grunt.template.process( grunt.config( "files.themes" ), grunt.config() ) + "/",
+ var download, done,
distFolder = "dist/" + grunt.template.process( grunt.config( "files.dist" ), grunt.config() ),
- configFile = "node_modules/download.jqueryui.com/config.json";
+ target = "dist/" + grunt.template.process( grunt.config( "files.themes" ), grunt.config() ) + "/";
+
try {
require.resolve( "download.jqueryui.com" );
} catch( error ) {
throw new Error( "You need to manually install download.jqueryui.com for this task to work" );
}
- // copy release files into download builder to avoid cloning again
- grunt.file.expandFiles( distFolder + "/**" ).forEach(function( file ) {
- grunt.file.copy( file, "node_modules/download.jqueryui.com/release/" + file.replace(/^dist\/jquery-ui-/, "") );
- });
- // make it look for the right version
- configContent = grunt.file.readJSON( configFile );
- configContent.jqueryUi.stable.version = grunt.config( "pkg.version" );
- grunt.file.write( configFile, JSON.stringify( configContent, null, "\t" ) + "\n" );
-
- download = new ( require( "download.jqueryui.com" ) )();
-
- files = grunt.file.expandFiles( distFolder + "/themes/base/**/*" );
- files.forEach(function( fileName ) {
- grunt.file.copy( fileName, target + fileName.replace( distFolder, "" ) );
+ download = require( "download.jqueryui.com" )({
+ config: {
+ "jqueryUi": {
+ "stable": { "path": path.resolve( __dirname + "/../../" + distFolder ) }
+ },
+ "jquery": "skip"
+ }
});
done = this.async();
- grunt.utils.async.forEach( download.themeroller.gallery(), function( theme, done ) {
- var folderName = theme.folderName(),
- concatTarget = "css-" + folderName,
- cssContent = theme.css(),
- cssFolderName = target + "themes/" + folderName + "/",
- cssFileName = cssFolderName + "jquery.ui.theme.css",
- cssFiles = grunt.config.get( "concat.css.src" )[ 1 ].slice();
-
- grunt.file.write( cssFileName, cssContent );
-
- // get css components, replace the last file with the current theme
- cssFiles.splice(-1);
- cssFiles.push( "<strip_all_banners:" + cssFileName + ">" );
- grunt.config.get( "concat" )[ concatTarget ] = {
- src: [ "<banner:meta.bannerCSS>", cssFiles ],
- dest: cssFolderName + "jquery-ui.css"
- };
- grunt.task.run( "concat:" + concatTarget );
-
- theme.fetchImages(function( err, files ) {
- if ( err ) {
- done( err );
- return;
- }
- files.forEach(function( file ) {
- grunt.file.write( cssFolderName + "images/" + file.path, file.data );
- });
- done();
- });
- }, function( err ) {
- if ( err ) {
- grunt.log.error( err );
+ download.buildThemesBundle(function( error, files ) {
+ if ( error ) {
+ grunt.log.error( error );
+ return done( false );
}
- done( !err );
+
+ done(
+ files.every(function( file ) {
+ try {
+ grunt.file.write( target + file.path, file.data );
+ } catch( err ) {
+ grunt.log.error( err );
+ return false;
+ }
+ return true;
+ }) && grunt.log.writeln( "Generated at " + target )
+ );
});
});