@@ -38,6 +38,7 @@ var DOCS_PATH = path.join(PUBLIC_PATH, 'docs');
38
38
39
39
var EXAMPLES_PATH = path . join ( DOCS_PATH , '_examples' ) ;
40
40
var EXAMPLES_PROTRACTOR_PATH = path . join ( EXAMPLES_PATH , '_protractor' ) ;
41
+ var EXAMPLES_TESTING_PATH = path . join ( EXAMPLES_PATH , 'testing/ts' ) ;
41
42
var NOT_API_DOCS_GLOB = path . join ( PUBLIC_PATH , './{docs/*/latest/!(api),!(docs)}/**/*.*' ) ;
42
43
var RESOURCES_PATH = path . join ( PUBLIC_PATH , 'resources' ) ;
43
44
var LIVE_EXAMPLES_PATH = path . join ( RESOURCES_PATH , 'live-examples' ) ;
@@ -97,14 +98,19 @@ var _exampleBoilerplateFiles = [
97
98
'tsconfig.json' ,
98
99
'tslint.json' ,
99
100
'typings.json'
100
- ] ;
101
+ ] ;
101
102
102
103
var _exampleDartWebBoilerPlateFiles = [ 'a2docs.css' , 'styles.css' ] ;
103
104
104
105
var _exampleProtractorBoilerplateFiles = [
105
106
'tsconfig.json'
106
107
] ;
107
108
109
+ var _exampleUnitTestingBoilerplateFiles = [
110
+ 'karma-test-shim.js' ,
111
+ 'karma.conf.js'
112
+ ] ;
113
+
108
114
var _exampleConfigFilename = 'example-config.json' ;
109
115
110
116
var _styleLessName = 'a2docs.less' ;
@@ -497,9 +503,17 @@ function copyExampleBoilerplate() {
497
503
. then ( function ( ) {
498
504
var protractorSourceFiles =
499
505
_exampleProtractorBoilerplateFiles
500
- . map ( function ( name ) { return path . join ( EXAMPLES_PROTRACTOR_PATH , name ) ; } ) ; ;
506
+ . map ( function ( name ) { return path . join ( EXAMPLES_PROTRACTOR_PATH , name ) ; } ) ;
501
507
var e2eSpecPaths = getE2eSpecPaths ( EXAMPLES_PATH ) ;
502
508
return copyFiles ( protractorSourceFiles , e2eSpecPaths , destFileMode ) ;
509
+ } )
510
+ // copy the unit test boilerplate
511
+ . then ( function ( ) {
512
+ var unittestSourceFiles =
513
+ _exampleUnitTestingBoilerplateFiles
514
+ . map ( function ( name ) { return path . join ( EXAMPLES_TESTING_PATH , name ) ; } ) ;
515
+ var unittestPaths = getUnitTestingPaths ( EXAMPLES_PATH ) ;
516
+ return copyFiles ( unittestSourceFiles , unittestPaths , destFileMode ) ;
503
517
} ) ;
504
518
}
505
519
@@ -894,7 +908,7 @@ function harpCompile() {
894
908
} else {
895
909
gutil . log ( `Harp full site compile, including API docs for all languages.` ) ;
896
910
if ( skipLangs )
897
- gutil . log ( `Ignoring API docs skip set (${ skipLangs } ) because full ` +
911
+ gutil . log ( `Ignoring API docs skip set (${ skipLangs } ) because full ` +
898
912
`site has not been built yet or some API HTML files are missing.` ) ;
899
913
}
900
914
@@ -1130,6 +1144,14 @@ function getDartExampleWebPaths(basePath) {
1130
1144
return paths ;
1131
1145
}
1132
1146
1147
+ function getUnitTestingPaths ( basePath ) {
1148
+ var examples = getPaths ( basePath , _exampleConfigFilename , true ) ;
1149
+ return examples . filter ( ( example ) => {
1150
+ var exampleConfig = fs . readJsonSync ( `${ example } /${ _exampleConfigFilename } ` , { throws : false } ) ;
1151
+ return exampleConfig && ! ! exampleConfig . unittesting ;
1152
+ } ) ;
1153
+ }
1154
+
1133
1155
function getPaths ( basePath , filename , includeBase ) {
1134
1156
var filenames = getFilenames ( basePath , filename , includeBase ) ;
1135
1157
var paths = filenames . map ( function ( fileName ) {
@@ -1164,7 +1186,7 @@ function watchAndSync(options, cb) {
1164
1186
1165
1187
// When using the --focus=name flag, only **/name/**/*.* example files and
1166
1188
// **/name.jade files are watched. This is useful for performance reasons.
1167
- // Example: gulp serve-and-sync --focus=architecture
1189
+ // Example: gulp serve-and-sync --focus=architecture
1168
1190
var focus = argv . focus ;
1169
1191
1170
1192
if ( options . devGuide ) {
0 commit comments