@@ -595,7 +595,7 @@ gulp.task('build-dart-api-docs', ['_shred-api-examples', 'dartdoc'], function()
595
595
} ) ;
596
596
597
597
gulp . task ( 'build-plunkers' , [ '_copy-example-boilerplate' ] , function ( ) {
598
- return plunkerBuilder . buildPlunkers ( EXAMPLES_PATH , LIVE_EXAMPLES_PATH , { errFn : gutil . log } ) ;
598
+ return plunkerBuilder . buildPlunkers ( EXAMPLES_PATH , LIVE_EXAMPLES_PATH , { errFn : gutil . log , build : argv . build } ) ;
599
599
} ) ;
600
600
601
601
gulp . task ( 'build-dart-cheatsheet' , [ ] , function ( ) {
@@ -604,20 +604,19 @@ gulp.task('build-dart-cheatsheet', [], function() {
604
604
605
605
gulp . task ( 'dartdoc' , [ 'pub upgrade' ] , function ( ) {
606
606
const ngRepoPath = ngPathFor ( 'dart' ) ;
607
- if ( argv . fast && fs . existsSync ( path . resolve ( ngRepoPath , 'doc ' ) ) ) {
608
- gutil . log ( 'Skipping dartdoc: --fast flag enabled and "doc " dir exists' ) ;
607
+ if ( argv . fast && fs . existsSync ( path . resolve ( ngRepoPath , 'docs' , 'api ') ) ) {
608
+ gutil . log ( 'Skipping dartdoc: --fast flag enabled and "docs/api " dir exists' ) ;
609
609
return true ;
610
610
}
611
611
checkAngularProjectPath ( ngRepoPath ) ;
612
612
const topLevelLibFilePath = path . resolve ( ngRepoPath , 'lib' , 'angular2.dart' ) ;
613
613
const tmpPath = topLevelLibFilePath + '.disabled' ;
614
- if ( ! fs . existsSync ( topLevelLibFilePath ) ) throw new Error ( `Missing file: ${ topLevelLibFilePath } ` ) ;
615
- fs . renameSync ( topLevelLibFilePath , tmpPath ) ;
614
+ renameIfExistsSync ( topLevelLibFilePath , tmpPath ) ;
616
615
gutil . log ( `Hiding top-level angular2 library: ${ topLevelLibFilePath } ` ) ;
617
- const dartdoc = spawnExt ( 'dartdoc' , [ '--output' , 'doc /api' , '--add-crossdart' ] , { cwd : ngRepoPath } ) ;
616
+ const dartdoc = spawnExt ( 'dartdoc' , [ '--output' , 'docs /api' , '--add-crossdart' ] , { cwd : ngRepoPath } ) ;
618
617
return dartdoc . promise . finally ( ( ) => {
619
618
gutil . log ( `Restoring top-level angular2 library: ${ topLevelLibFilePath } ` ) ;
620
- fs . renameSync ( tmpPath , topLevelLibFilePath ) ;
619
+ renameIfExistsSync ( tmpPath , topLevelLibFilePath ) ;
621
620
} )
622
621
} ) ;
623
622
@@ -1235,15 +1234,14 @@ function buildDartCheatsheet() {
1235
1234
1236
1235
1237
1236
function buildApiDocsForDart ( ) {
1238
- const apiDir = 'api' ;
1239
1237
const vers = 'latest' ;
1240
1238
const dab = require ( './tools/dart-api-builder/dab' ) ( ANGULAR_IO_PROJECT_PATH ) ;
1241
1239
const log = dab . log ;
1242
1240
1243
1241
log . level = _dgeniLogLevel ;
1244
1242
const dabInfo = dab . dartPkgConfigInfo ;
1245
- dabInfo . ngIoDartApiDocPath = path . join ( DOCS_PATH , 'dart' , vers , apiDir ) ;
1246
- dabInfo . ngDartDocPath = path . join ( ngPathFor ( 'dart' ) , 'doc ' , apiDir ) ;
1243
+ dabInfo . ngIoDartApiDocPath = path . join ( DOCS_PATH , 'dart' , vers , 'api' ) ;
1244
+ dabInfo . ngDartDocPath = path . join ( ngPathFor ( 'dart' ) , 'docs ' , 'api' ) ;
1247
1245
// Exclude API entries for developer/internal libraries. Also exclude entries for
1248
1246
// the top-level catch all "angular2" library (otherwise every entry appears twice).
1249
1247
dabInfo . excludeLibRegExp = new RegExp ( / ^ (? ! a n g u l a r 2 ) | \. t e s t i n g | _ | c o d e g e n | ^ a n g u l a r 2 $ / ) ;
@@ -1455,3 +1453,11 @@ function checkAngularProjectPath(_ngPath) {
1455
1453
if ( fs . existsSync ( ngPath ) ) return ;
1456
1454
throw new Error ( 'API related tasks require the angular2 repo to be at ' + ngPath ) ;
1457
1455
}
1456
+
1457
+ function renameIfExistsSync ( oldPath , newPath ) {
1458
+ if ( fs . existsSync ( oldPath ) ) {
1459
+ fs . renameSync ( oldPath , newPath ) ;
1460
+ } else {
1461
+ gutil . log ( `renameIfExistsSync cannot find file to rename: ${ oldPath } ` ) ;
1462
+ }
1463
+ }
0 commit comments