@@ -595,7 +595,7 @@ gulp.task('build-dart-api-docs', ['_shred-api-examples', 'dartdoc'], function()
595595} ) ;
596596
597597gulp . 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 } ) ;
599599} ) ;
600600
601601gulp . task ( 'build-dart-cheatsheet' , [ ] , function ( ) {
@@ -604,20 +604,19 @@ gulp.task('build-dart-cheatsheet', [], function() {
604604
605605gulp . task ( 'dartdoc' , [ 'pub upgrade' ] , function ( ) {
606606 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' ) ;
609609 return true ;
610610 }
611611 checkAngularProjectPath ( ngRepoPath ) ;
612612 const topLevelLibFilePath = path . resolve ( ngRepoPath , 'lib' , 'angular2.dart' ) ;
613613 const tmpPath = topLevelLibFilePath + '.disabled' ;
614- if ( ! fs . existsSync ( topLevelLibFilePath ) ) throw new Error ( `Missing file: ${ topLevelLibFilePath } ` ) ;
615- fs . renameSync ( topLevelLibFilePath , tmpPath ) ;
614+ renameIfExistsSync ( topLevelLibFilePath , tmpPath ) ;
616615 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 } ) ;
618617 return dartdoc . promise . finally ( ( ) => {
619618 gutil . log ( `Restoring top-level angular2 library: ${ topLevelLibFilePath } ` ) ;
620- fs . renameSync ( tmpPath , topLevelLibFilePath ) ;
619+ renameIfExistsSync ( tmpPath , topLevelLibFilePath ) ;
621620 } )
622621} ) ;
623622
@@ -1235,15 +1234,14 @@ function buildDartCheatsheet() {
12351234
12361235
12371236function buildApiDocsForDart ( ) {
1238- const apiDir = 'api' ;
12391237 const vers = 'latest' ;
12401238 const dab = require ( './tools/dart-api-builder/dab' ) ( ANGULAR_IO_PROJECT_PATH ) ;
12411239 const log = dab . log ;
12421240
12431241 log . level = _dgeniLogLevel ;
12441242 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' ) ;
12471245 // Exclude API entries for developer/internal libraries. Also exclude entries for
12481246 // the top-level catch all "angular2" library (otherwise every entry appears twice).
12491247 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) {
14551453 if ( fs . existsSync ( ngPath ) ) return ;
14561454 throw new Error ( 'API related tasks require the angular2 repo to be at ' + ngPath ) ;
14571455}
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