@@ -84,26 +84,23 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
8484} ) ;
8585
8686var _exampleBoilerplateFiles = [
87- 'a2docs.css' ,
87+ 'src/styles.css' ,
88+ 'src/systemjs.config.js' ,
89+ 'src/tsconfig.json' ,
90+ 'bs-config.json' ,
91+ 'bs-config.e2e.json' ,
8892 'package.json' ,
89- 'styles.css' ,
90- 'systemjs.config.js' ,
91- 'tsconfig.json' ,
9293 'tslint.json'
9394] ;
9495
95- var _exampleDartWebBoilerPlateFiles = [ 'a2docs.css' , 'styles.css' ] ;
96-
9796var _exampleUnitTestingBoilerplateFiles = [
98- 'browser-test-shim.js' ,
97+ 'src/ browser-test-shim.js' ,
9998 'karma-test-shim.js' ,
10099 'karma.conf.js'
101100] ;
102101
103102var _exampleConfigFilename = 'example-config.json' ;
104103
105- var _styleLessName = 'a2docs.less' ;
106-
107104// Gulp flags:
108105//
109106// --lang=[all | ts | js | dart | 'ts|js' | 'ts|js|dart' | ...]
@@ -182,21 +179,12 @@ function runE2e() {
182179 // fast; skip all setup
183180 promise = Promise . resolve ( true ) ;
184181 } else {
185- /*
186- // Not 'fast'; do full setup
187- var spawnInfo = spawnExt('npm', ['install'], { cwd: EXAMPLES_PATH});
188- promise = spawnInfo.promise.then(function() {
189- copyExampleBoilerplate();
190- spawnInfo = spawnExt('npm', ['run', 'webdriver:update'], {cwd: EXAMPLES_PATH});
191- return spawnInfo.promise;
192- });
193- */
194182 // Not 'fast'; do full setup
195183 gutil . log ( 'runE2e: install _examples stuff' ) ;
196184 var spawnInfo = spawnExt ( 'npm' , [ 'install' ] , { cwd : EXAMPLES_PATH } ) ;
197185 promise = spawnInfo . promise
186+ . then ( copyExampleBoilerplate )
198187 . then ( function ( ) {
199- buildStyles ( copyExampleBoilerplate , _ . noop ) ;
200188 gutil . log ( 'runE2e: update webdriver' ) ;
201189 spawnInfo = spawnExt ( 'npm' , [ 'run' , 'webdriver:update' ] , { cwd : EXAMPLES_PATH } ) ;
202190 return spawnInfo . promise ;
@@ -283,8 +271,8 @@ function runE2eTsTests(appDir, outputFile) {
283271 }
284272
285273 var config = {
286- build : exampleConfig . build || 'tsc ' ,
287- run : exampleConfig . run || 'http-server :e2e'
274+ build : exampleConfig . build || 'build ' ,
275+ run : exampleConfig . run || 'serve :e2e'
288276 } ;
289277
290278 var appBuildSpawnInfo = spawnExt ( 'npm' , [ 'run' , config . build ] , { cwd : appDir } ) ;
@@ -350,7 +338,7 @@ function runProtractorAoT(appDir, outputFile) {
350338 promise = promise . then ( ( ) =>
351339 spawnExt ( 'node' , [ copyFileCmd ] , { cwd : appDir } ) . promise ) ;
352340 }
353- var aotRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'http-server:e2e' , ' aot' , '--' , '-s '] , { cwd : appDir } ) ;
341+ var aotRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'serve: aot' ] , { cwd : appDir } ) ;
354342 return runProtractor ( promise , appDir , aotRunSpawnInfo , outputFile ) ;
355343}
356344
@@ -364,7 +352,7 @@ function runE2eDartTests(appDir, outputFile) {
364352 gutil . log ( 'AppDir for Dart e2e: ' + appDir ) ;
365353 gutil . log ( 'Deploying from: ' + deployDir ) ;
366354
367- var appRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'http-server :e2e' , '--' , deployDir , '-s' ] , { cwd : httpLaunchDir } ) ;
355+ var appRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , 'serve :e2e' , '--' , deployDir , '-s' ] , { cwd : httpLaunchDir } ) ;
368356 if ( ! appRunSpawnInfo . proc . pid ) {
369357 gutil . log ( 'http-server failed to launch over ' + deployDir ) ;
370358 return false ;
@@ -448,7 +436,7 @@ gulp.task('help', taskListing.withFilters(function(taskName) {
448436} ) ) ;
449437
450438// requires admin access because it adds symlinks
451- gulp . task ( 'add-example-boilerplate' , function ( done ) {
439+ gulp . task ( 'add-example-boilerplate' , function ( ) {
452440 var realPath = path . join ( EXAMPLES_PATH , '/node_modules' ) ;
453441 var nodeModulesPaths = excludeDartPaths ( getNodeModulesPaths ( EXAMPLES_PATH ) ) ;
454442
@@ -457,55 +445,31 @@ gulp.task('add-example-boilerplate', function(done) {
457445 fsUtils . addSymlink ( realPath , linkPath ) ;
458446 } ) ;
459447
460- return buildStyles ( copyExampleBoilerplate , done ) ;
448+ return copyExampleBoilerplate ( ) ;
461449} ) ;
462450
463451
464452// copies boilerplate files to locations
465453// where an example app is found
466454gulp . task ( '_copy-example-boilerplate' , function ( done ) {
467- return argv . fast ? done ( ) : buildStyles ( copyExampleBoilerplate , done ) ;
455+ return argv . fast ? done ( ) : copyExampleBoilerplate ( ) ;
468456} ) ;
469457
470- //Builds Angular Docs CSS file from Bootstrap npm LESS source
471- //and copies the result to the _examples folder to be included as
472- //part of the example boilerplate.
473- function buildStyles ( cb , done ) {
474- gulp . src ( path . join ( STYLES_SOURCE_PATH , _styleLessName ) )
475- . pipe ( less ( ) )
476- . pipe ( gulp . dest ( BOILERPLATE_PATH ) ) . on ( 'end' , function ( ) {
477- cb ( ) . then ( function ( ) { done ( ) ; } ) ;
478- } ) ;
479- }
480-
481458// copies boilerplate files to locations
482459// where an example app is found
483460// also copies certain web files (e.g., styles.css) to ~/_examples/**/dart/**/web
484461function copyExampleBoilerplate ( ) {
485462 gutil . log ( 'Copying example boilerplate files' ) ;
486- var sourceFiles = _exampleBoilerplateFiles . map ( function ( fn ) {
487- return path . join ( BOILERPLATE_PATH , fn ) ;
488- } ) ;
489463 var examplePaths = excludeDartPaths ( getExamplePaths ( EXAMPLES_PATH ) ) ;
490464
491- var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles . map ( function ( fn ) {
492- return path . join ( BOILERPLATE_PATH , fn ) ;
493- } ) ;
494- var dartExampleWebPaths = getDartExampleWebPaths ( EXAMPLES_PATH ) ;
495-
496465 // Make boilerplate files read-only to avoid that they be edited by mistake.
497466 var destFileMode = '444' ;
498- return copyFiles ( sourceFiles , examplePaths , destFileMode )
499- . then ( function ( ) {
500- return copyFiles ( dartWebSourceFiles , dartExampleWebPaths , destFileMode ) ;
501- } )
467+ return copyFiles ( _exampleBoilerplateFiles , BOILERPLATE_PATH , examplePaths , destFileMode )
502468 // copy the unit test boilerplate
503469 . then ( function ( ) {
504- var unittestSourceFiles =
505- _exampleUnitTestingBoilerplateFiles
506- . map ( function ( name ) { return path . join ( EXAMPLES_TESTING_PATH , name ) ; } ) ;
507470 var unittestPaths = getUnitTestingPaths ( EXAMPLES_PATH ) ;
508- return copyFiles ( unittestSourceFiles , unittestPaths , destFileMode ) ;
471+ return copyFiles ( _exampleUnitTestingBoilerplateFiles ,
472+ EXAMPLES_TESTING_PATH , unittestPaths , destFileMode ) ;
509473 } )
510474 . catch ( function ( err ) {
511475 gutil . log ( err ) ;
@@ -582,9 +546,6 @@ function deleteExampleBoilerPlate() {
582546 var unittestPaths = getUnitTestingPaths ( EXAMPLES_PATH ) ;
583547
584548 return deleteFiles ( _exampleBoilerplateFiles , examplePaths )
585- . then ( function ( ) {
586- return deleteFiles ( _exampleDartWebBoilerPlateFiles , dartExampleWebPaths ) ;
587- } )
588549 . then ( function ( ) {
589550 return deleteFiles ( _exampleUnitTestingBoilerplateFiles , unittestPaths ) ;
590551 } ) ;
@@ -1053,15 +1014,15 @@ function harpJsonSetJade2NgTo(v) {
10531014// Copies fileNames into destPaths, setting the mode of the
10541015// files at the destination as optional_destFileMode if given.
10551016// returns a promise
1056- function copyFiles ( fileNames , destPaths , optional_destFileMode ) {
1017+ function copyFiles ( fileNames , originPath , destPaths , optional_destFileMode ) {
10571018 var copy = Q . denodeify ( fsExtra . copy ) ;
10581019 var chmod = Q . denodeify ( fsExtra . chmod ) ;
10591020 var copyPromises = [ ] ;
10601021 destPaths . forEach ( function ( destPath ) {
10611022 fileNames . forEach ( function ( fileName ) {
1062- var baseName = path . basename ( fileName ) ;
1063- var destName = path . join ( destPath , baseName ) ;
1064- var p = copy ( fileName , destName , { clobber : true } ) ;
1023+ var originName = path . join ( originPath , fileName ) ;
1024+ var destName = path . join ( destPath , fileName ) ;
1025+ var p = copy ( originName , destName , { clobber : true } ) ;
10651026 if ( optional_destFileMode !== undefined ) {
10661027 p = p . then ( function ( ) {
10671028 return chmod ( destName , optional_destFileMode ) ;
0 commit comments