@@ -104,7 +104,7 @@ function log( callback, successMsg, errorMsg ) {
104
104
105
105
function cloneOrFetch ( callback ) {
106
106
async . series ( [
107
- function ( callback ) {
107
+ function ( ) {
108
108
if ( fs . existsSync ( "tmp/jquery-ui" ) ) {
109
109
grunt . log . writeln ( "Fetch updates for jquery-ui repo" ) ;
110
110
async . series ( [
@@ -141,31 +141,6 @@ function cloneOrFetch( callback ) {
141
141
}
142
142
} , log ( callback , "Cloned repo" , "Error cloning repo" ) ) ;
143
143
}
144
- } ,
145
- function ( ) {
146
- if ( fs . existsSync ( "tmp/api.jqueryui.com" ) ) {
147
- grunt . log . writeln ( "Fetch updates for api.jqueryui.com repo" ) ;
148
- grunt . util . spawn ( {
149
- cmd : "git" ,
150
- args : [ "fetch" ] ,
151
- opts : {
152
- cwd : "tmp/api.jqueryui.com"
153
- }
154
- } , log ( callback , "Fetched repo" , "Error fetching repo" ) ) ;
155
- } else {
156
- grunt . log . writeln ( "Cloning api.jqueryui.com repo" ) ;
157
- grunt . util . spawn ( {
158
- cmd : "git" ,
159
- args : [
160
- "clone" ,
161
- "https://github.com/jquery/api.jqueryui.com.git" ,
162
- "api.jqueryui.com"
163
- ] ,
164
- opts : {
165
- cwd : "tmp"
166
- }
167
- } , log ( callback , "Cloned repo" , "Error cloning repo" ) ) ;
168
- }
169
144
}
170
145
] ) ;
171
146
}
@@ -176,123 +151,15 @@ function checkout( jqueryUi ) {
176
151
async . series ( [
177
152
178
153
// Check out jquery-ui
179
- function ( next ) {
154
+ function ( ) {
180
155
grunt . log . writeln ( "Checking out jquery-ui branch/tag: " + ref ) ;
181
156
grunt . util . spawn ( {
182
157
cmd : "git" ,
183
158
args : [ "checkout" , "-f" , ref ] ,
184
159
opts : {
185
160
cwd : "tmp/jquery-ui"
186
161
}
187
- } , log ( jqueryUi . docs ? next : callback , "Done with checkout" , "Error checking out" ) ) ;
188
- } ,
189
-
190
- // Check out api.jqueryui.com
191
- function ( ) {
192
- var docRef = "origin/master" ;
193
- async . series ( [
194
-
195
- // Get the correct documentation for jquery-ui version
196
- function ( callback ) {
197
-
198
- // If ref is a branch, then get documentation "master" branch.
199
- if ( ! ( / ^ \d + .\d + / ) . test ( ref ) ) {
200
- return callback ( ) ;
201
- }
202
-
203
- // If ref is a tag, then get its corresponding <major>-<minor> branch, if available or "master".
204
- grunt . util . spawn ( {
205
- cmd : "git" ,
206
- args : [ "branch" , "-a" ] ,
207
- opts : {
208
- cwd : "tmp/api.jqueryui.com"
209
- }
210
- } , function ( error , docBranches ) {
211
- docBranches = String ( docBranches ) ;
212
- if ( error ) {
213
- grunt . log . error ( "Error listing branches: " + error . stderr ) ;
214
- } else {
215
- var correspondingBranch = ref . replace ( / ^ ( \d + ) .( \d + ) .* / , "$1-$2" ) ,
216
- isCorrespondingBranch = function ( branch ) {
217
- return ( new RegExp ( "origin/" + correspondingBranch + "$" ) ) . test ( branch ) ;
218
- } ;
219
- if ( docBranches . split ( "\n" ) . some ( isCorrespondingBranch ) ) {
220
- docRef = correspondingBranch ;
221
- } else {
222
- grunt . log . writeln ( "Did not find a \"" + correspondingBranch + "\" branch, using \"master\"" ) ;
223
- }
224
- callback ( ) ;
225
- }
226
- } ) ;
227
- } ,
228
- function ( ) {
229
- grunt . log . writeln ( "Checking out api.jqueryui.com branch/tag: " + docRef ) ;
230
- grunt . util . spawn ( {
231
- cmd : "git" ,
232
- args : [ "checkout" , "-f" , docRef ] ,
233
- opts : {
234
- cwd : "tmp/api.jqueryui.com"
235
- }
236
- } , log ( callback , "Done with checkout" , "Error checking out" ) ) ;
237
- }
238
- ] ) ;
239
- }
240
- ] ) ;
241
- } ;
242
- }
243
-
244
- function install ( jqueryUi ) {
245
- return function ( callback ) {
246
- async . series ( [
247
- function ( next ) {
248
- if ( ! jqueryUi . docs ) {
249
- return next ( ) ;
250
- }
251
- grunt . log . writeln ( "Installing api.jqueryui.com npm modules" ) ;
252
- grunt . util . spawn ( {
253
- cmd : "npm" ,
254
- args : [ "prune" ] ,
255
- opts : {
256
- cwd : "tmp/api.jqueryui.com"
257
- }
258
- } , log ( next , null , "Error pruning npm modules" ) ) ;
259
- } ,
260
- function ( ) {
261
- if ( ! jqueryUi . docs ) {
262
- return callback ( ) ;
263
- }
264
- grunt . util . spawn ( {
265
- cmd : "npm" ,
266
- args : [ "install" ] ,
267
- opts : {
268
- cwd : "tmp/api.jqueryui.com"
269
- }
270
- } , log ( callback , "Installed npm modules" , "Error installing npm modules" ) ) ;
271
- }
272
- ] ) ;
273
- } ;
274
- }
275
-
276
- function prepare ( jqueryUi ) {
277
- return function ( callback ) {
278
- async . series ( [
279
- function ( ) {
280
- if ( ! jqueryUi . docs ) {
281
- return callback ( ) ;
282
- }
283
- grunt . log . writeln ( "Building API documentation for jQuery UI" ) ;
284
- if ( ! fs . existsSync ( "tmp/api.jqueryui.com/config.json" ) ) {
285
- grunt . file . copy ( "tmp/api.jqueryui.com/config-sample.json" , "tmp/api.jqueryui.com/config.json" ) ;
286
- grunt . log . writeln ( "Copied config-sample.json to config.json" ) ;
287
- }
288
- fs . rmSync ( "tmp/api.jqueryui.com/dist" , { recursive : true , force : true } ) ;
289
- grunt . util . spawn ( {
290
- cmd : "node_modules/.bin/grunt" ,
291
- args : [ "build" , "--stack" ] ,
292
- opts : {
293
- cwd : "tmp/api.jqueryui.com"
294
- }
295
- } , log ( callback , "Done building documentation" , "Error building documentation" ) ) ;
162
+ } , log ( callback , "Done with checkout" , "Error checking out" ) ) ;
296
163
}
297
164
] ) ;
298
165
} ;
@@ -319,7 +186,7 @@ function copy( jqueryUi ) {
319
186
next ( ) ;
320
187
}
321
188
} ,
322
- function ( next ) {
189
+ function ( ) {
323
190
var from = "tmp/jquery-ui" ,
324
191
to = "jquery-ui/" + ref ;
325
192
grunt . log . writeln ( "Copying jQuery UI " + version + " over to jquery-ui/" + ref ) ;
@@ -335,35 +202,10 @@ function copy( jqueryUi ) {
335
202
} ) ;
336
203
} catch ( e ) {
337
204
grunt . log . error ( "Error copying" , e . toString ( ) ) ;
338
- return ( jqueryUi . docs ? next : callback ) ( e ) ;
205
+ return callback ( e ) ;
339
206
}
340
207
grunt . log . ok ( "Done copying" ) ;
341
- ( jqueryUi . docs ? next : callback ) ( ) ;
342
- } ,
343
- function ( callback ) {
344
- var srcpath = "tmp/api.jqueryui.com/dist/wordpress" ,
345
- destpath = "jquery-ui/" + ref + "/docs/" ;
346
- grunt . log . writeln ( "Copying API documentation for jQuery UI over to " + destpath ) ;
347
- [ srcpath + "/posts/post" , srcpath + "/posts/page" ] . forEach ( function ( srcpath ) {
348
- grunt . file . expand ( { filter : "isFile" } , srcpath + "/**" ) . forEach ( function ( file ) {
349
-
350
- // OBS: No overwrite check is needed, because the posts/pages basenames must be unique among themselves.
351
- grunt . file . copy ( file , file . replace ( srcpath , destpath ) ) ;
352
- } ) ;
353
- } ) ;
354
208
callback ( ) ;
355
- } ,
356
- function ( ) {
357
- var removePath = ref + "/node_modules" ;
358
- grunt . log . writeln ( "Cleaning up copied jQuery UI" ) ;
359
- const rmCallback = log ( callback , `Removed jquery-ui/${ removePath } ` , `Error removing jquery-ui/${ removePath } ` ) ;
360
- fsp . rm ( `jquery-ui/${ removePath } ` , { recursive : true , force : true } )
361
- . then ( ( ) => {
362
- rmCallback ( null , "OK" , 0 ) ;
363
- } )
364
- . catch ( error => {
365
- rmCallback ( error , null , 1 ) ;
366
- } ) ;
367
209
}
368
210
] ) ;
369
211
} ;
@@ -375,8 +217,6 @@ function prepareAll( callback ) {
375
217
async . forEachSeries ( config . jqueryUi , function ( jqueryUi , callback ) {
376
218
async . series ( [
377
219
checkout ( jqueryUi ) ,
378
- install ( jqueryUi ) ,
379
- prepare ( jqueryUi ) ,
380
220
copy ( jqueryUi )
381
221
] , function ( err ) {
382
222
@@ -420,77 +260,33 @@ function packagerZip( packageModule, zipBasedir, themeVars, folder, jqueryUi, ca
420
260
}
421
261
422
262
function buildPackages ( folder , callback ) {
423
- var Builder = require ( "./lib/builder" ) ,
424
- fs = require ( "fs" ) ,
425
- path = require ( "path" ) ,
426
- JqueryUi = require ( "./lib/jquery-ui" ) ,
427
- Packer = require ( "./lib/packer" ) ,
428
- ThemeGallery = require ( "./lib/themeroller-themegallery" ) ,
429
- ThemesPacker = require ( "./lib/themes-packer" ) ;
263
+ var JqueryUi = require ( "./lib/jquery-ui" ) ,
264
+ ThemeGallery = require ( "./lib/themeroller-themegallery" ) ;
430
265
431
266
// For each jQuery UI release specified in the config file:
432
267
async . forEachSeries ( JqueryUi . all ( ) , function ( jqueryUi , callback ) {
433
- var builder = new Builder ( jqueryUi , ":all:" ) ;
434
-
435
268
async . series ( [
436
269
437
270
// (a) Build jquery-ui-[VERSION].zip;
438
271
function ( callback ) {
439
272
if ( semver . gte ( jqueryUi . pkg . version , "1.13.0-a" ) ) {
440
273
packagerZip ( "./lib/package-1-13" , "jquery-ui-" + jqueryUi . pkg . version ,
441
274
new ThemeGallery ( jqueryUi ) [ 0 ] . vars , folder , jqueryUi , callback ) ;
442
- return ;
443
- }
444
- if ( semver . gte ( jqueryUi . pkg . version , "1.12.0-a" ) ) {
275
+ } else {
445
276
packagerZip ( "./lib/package-1-12" , "jquery-ui-" + jqueryUi . pkg . version ,
446
277
new ThemeGallery ( jqueryUi ) [ 0 ] . vars , folder , jqueryUi , callback ) ;
447
- return ;
448
- }
449
- var stream ,
450
- theme = new ThemeGallery ( jqueryUi ) [ 0 ] ,
451
- packer = new Packer ( builder , theme , { bundleSuffix : "" } ) ,
452
- filename = path . join ( folder , packer . filename ( ) ) ;
453
- grunt . log . ok ( "Building \"" + filename + "\"" ) ;
454
- if ( fs . existsSync ( filename ) ) {
455
- grunt . log . warn ( filename + "\" already exists. Skipping..." ) ;
456
- return callback ( ) ;
457
278
}
458
- stream = fs . createWriteStream ( filename ) ;
459
- packer . zipTo ( stream , function ( error ) {
460
- if ( error ) {
461
- return callback ( error ) ;
462
- }
463
- return callback ( ) ;
464
- } ) ;
465
279
} ,
466
280
467
281
// (b) Build themes package jquery-ui-themes-[VERSION].zip;
468
282
function ( callback ) {
469
283
if ( semver . gte ( jqueryUi . pkg . version , "1.13.0-a" ) ) {
470
284
packagerZip ( "./lib/package-1-13-themes" , "jquery-ui-themes-" + jqueryUi . pkg . version ,
471
285
null , folder , jqueryUi , callback ) ;
472
- return ;
473
- }
474
- if ( semver . gte ( jqueryUi . pkg . version , "1.12.0-a" ) ) {
286
+ } else {
475
287
packagerZip ( "./lib/package-1-12-themes" , "jquery-ui-themes-" + jqueryUi . pkg . version ,
476
288
null , folder , jqueryUi , callback ) ;
477
- return ;
478
289
}
479
- var stream ,
480
- packer = new ThemesPacker ( builder ) ,
481
- filename = path . join ( folder , packer . filename ( ) ) ;
482
- grunt . log . ok ( "Building \"" + filename + "\"" ) ;
483
- if ( fs . existsSync ( filename ) ) {
484
- grunt . log . warn ( filename + "\" already exists. Skipping..." ) ;
485
- return callback ( ) ;
486
- }
487
- stream = fs . createWriteStream ( filename ) ;
488
- packer . zipTo ( stream , function ( error , result ) {
489
- if ( error ) {
490
- return callback ( error ) ;
491
- }
492
- return callback ( ) ;
493
- } ) ;
494
290
}
495
291
496
292
] , function ( error ) {
0 commit comments