diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-03-08 14:52:50 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-03-08 14:52:50 +0100 |
commit | 6aa41bf4aee738ddeb2acbb85e5b12ce36798a2c (patch) | |
tree | 266e83c5392ebe155d240e9cebfa8de6162bd9e9 | |
parent | face6de0b6a6f9651a3ea7bd5c0d73f432c63be8 (diff) | |
download | jquery-ui-6aa41bf4aee738ddeb2acbb85e5b12ce36798a2c.tar.gz jquery-ui-6aa41bf4aee738ddeb2acbb85e5b12ce36798a2c.zip |
Build/grunt: Partial download_themes task. Extracting currently fails with crc32 checksum failure
-rw-r--r-- | grunt.js | 27 | ||||
-rw-r--r-- | package.json | 3 |
2 files changed, 26 insertions, 4 deletions
@@ -301,12 +301,33 @@ task.registerTask('default', 'lint qunit'); task.registerTask('build', 'concat min css_min'); task.registerTask('release', 'build copy:dist copy:dist_min copy:dist_min_images copy:dist_css_min zip:dist'); task.registerTask('release_themes', 'build download_themes zip:themes'); -// TODO includes other themes in cdn release +// TODO include other themes in cdn release task.registerTask('release_cdn', 'build copy:cdn copy:cdn_min copy:cdn_i18n copy:cdn_i18n_min copy:cdn_css_min md5 zip:cdn'); task.registerTask('download_themes', function() { - // TODO use request.get to download the files specified in build/themes + var AdmZip = require('adm-zip'); + var done = this.async(); + var fs = require('fs'); + var request = require('request'); + var themes = file.read('build/themes').split(',').slice(0, 1); + var requests = 0; + file.mkdir('dist/tmp'); + themes.forEach(function(theme, index) { + requests += 1; + file.mkdir('dist/tmp/' + index); + var zipFileName = 'dist/tmp/' + index + '.zip'; + var out = fs.createWriteStream(zipFileName); + out.on('close', function() { + log.writeln("done downloading " + zipFileName); + var zip = new AdmZip(zipFileName); + zip.extractAllTo('dist/tmp/' + index + '/'); + requests -= 1; + if (requests === 0) { + done(); + } + }); + request('http://ui-dev.jquery.com/download/?' + theme).pipe(out); + }); }); // TODO add size task, see also build/sizer.js - copy from core grunt.js -// TODO add themes download task, part of release_cdn task diff --git a/package.json b/package.json index 37cb6d035..2d473076a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "devDependencies": { "grunt": "0.2.x", "adm-zip": "0.1.x", - "sqwish": "0.2.x" + "sqwish": "0.2.x", + "request": "0.2.x" }, "keywords": [] }
\ No newline at end of file |