Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 92d9ce8

Browse files
committed
chore(ignored/boilerplate files): cleanup
1 parent 074a33a commit 92d9ce8

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pubspec.lock
1212
.DS_Store
1313
**/*.iml
1414
.idea
15+
.vscode
1516
**/js/latest/api
1617
**/ts/latest/api
1718
**/dart/latest/api
@@ -21,8 +22,7 @@ _.*
2122
public/docs/xref-*.*
2223
_zip-output
2324
www
24-
npm-debug.log
25-
npm-debug.log.*
25+
npm-debug*.log*
2626
*.plnkr.html
2727
plnkr.html
2828
*plnkr.no-link.html

gulpfile.js

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ var _exampleProtractorBoilerplateFiles = [
8989
'tsconfig.json'
9090
];
9191

92+
function isDartPath(path) {
93+
// Testing via indexOf() for now. If we need to match only paths with folders
94+
// named 'dart' vs 'dart*' then try: path.match('/dart(/|$)') != null;
95+
return path.indexOf('/dart') > -1;
96+
}
97+
98+
function excludeDartPaths(paths) {
99+
return paths.filter(function (p) { return !isDartPath(p); });
100+
}
101+
92102
/**
93103
* Run Protractor End-to-End Specs for Doc Samples
94104
* Alias for 'run-e2e-tests'
@@ -165,7 +175,6 @@ function runE2e() {
165175
// with the corresponding apps that they should run under. Then run
166176
// each app/spec collection sequentially.
167177
function findAndRunE2eTests(filter, outputFile) {
168-
169178
// create an output file with header.
170179
var lang = (argv.lang || '(ts|js)').toLowerCase();
171180
if (lang === 'all') { lang = '(ts|js|dart)'; }
@@ -203,8 +212,7 @@ function findAndRunE2eTests(filter, outputFile) {
203212
var status = { passed: [], failed: [] };
204213
return examplePaths.reduce(function (promise, examplePath) {
205214
return promise.then(function () {
206-
var isDart = examplePath.indexOf('/dart') > -1;
207-
var runTests = isDart ? runE2eDartTests : runE2eTsTests;
215+
var runTests = isDartPath(examplePath) ? runE2eDartTests : runE2eTsTests;
208216
return runTests(examplePath, outputFile).then(function(ok) {
209217
var arr = ok ? status.passed : status.failed;
210218
arr.push(examplePath);
@@ -375,7 +383,7 @@ gulp.task('add-example-boilerplate', function() {
375383
});
376384

377385
realPath = path.join(EXAMPLES_PATH, '/typings');
378-
var typingsPaths = getTypingsPaths(EXAMPLES_PATH);
386+
var typingsPaths = excludeDartPaths(getTypingsPaths(EXAMPLES_PATH));
379387
typingsPaths.forEach(function(linkPath) {
380388
gutil.log("symlinking " + linkPath + ' -> ' + realPath)
381389
fsUtils.addSymlink(realPath, linkPath);
@@ -398,24 +406,26 @@ function copyExampleBoilerplate() {
398406
var sourceFiles = _exampleBoilerplateFiles.map(function(fn) {
399407
return path.join(EXAMPLES_PATH, fn);
400408
});
401-
var examplePaths = getExamplePaths(EXAMPLES_PATH);
409+
var examplePaths = excludeDartPaths(getExamplePaths(EXAMPLES_PATH));
402410

403411
var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles.map(function(fn){
404412
return path.join(EXAMPLES_PATH, fn);
405413
});
406414
var dartExampleWebPaths = getDartExampleWebPaths(EXAMPLES_PATH);
407415

408-
return copyFiles(sourceFiles, examplePaths)
416+
// Make boilerplate files read-only to avoid that they be edited by mistake.
417+
var destFileMode = '444';
418+
return copyFiles(sourceFiles, examplePaths, destFileMode)
409419
.then(function() {
410-
return copyFiles(dartWebSourceFiles, dartExampleWebPaths);
420+
return copyFiles(dartWebSourceFiles, dartExampleWebPaths, destFileMode);
411421
})
412422
// copy certain files from _examples/_protractor dir to each subdir that contains an e2e-spec file.
413423
.then(function() {
414424
var protractorSourceFiles =
415425
_exampleProtractorBoilerplateFiles
416426
.map(function(name) {return path.join(EXAMPLES_PROTRACTOR_PATH, name);});;
417427
var e2eSpecPaths = getE2eSpecPaths(EXAMPLES_PATH);
418-
return copyFiles(protractorSourceFiles, e2eSpecPaths);
428+
return copyFiles(protractorSourceFiles, e2eSpecPaths, destFileMode);
419429
});
420430
}
421431

@@ -789,16 +799,23 @@ function showHideExampleNodeModules(showOrHide) {
789799
}
790800
}
791801

792-
802+
// Copies fileNames into destPaths, setting the mode of the
803+
// files at the destination as optional_destFileMode if given.
793804
// returns a promise
794-
function copyFiles(fileNames, destPaths) {
805+
function copyFiles(fileNames, destPaths, optional_destFileMode) {
795806
var copy = Q.denodeify(fsExtra.copy);
807+
var chmod = Q.denodeify(fsExtra.chmod);
796808
var copyPromises = [];
797809
destPaths.forEach(function(destPath) {
798810
fileNames.forEach(function(fileName) {
799811
var baseName = path.basename(fileName);
800812
var destName = path.join(destPath, baseName);
801813
var p = copy(fileName, destName, { clobber: true});
814+
if(optional_destFileMode !== undefined) {
815+
p = p.then(function () {
816+
return chmod(destName, optional_destFileMode);
817+
});
818+
}
802819
copyPromises.push(p);
803820
});
804821
});

public/docs/_examples/.gitignore

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1+
# _exampleBoilerplateFiles
12
.editorconfig
2-
.idea
3-
.vscode
4-
styles.css
5-
typings
6-
typings.json
7-
node_modules
8-
jspm_packages
9-
*.js.map
10-
package.json
113
karma.conf.js
124
karma-test-shim.js
5+
package.json
6+
*/**/styles.css
7+
systemjs.config.js
138
tsconfig.json
149
tslint.json
10+
typings.json
1511
wallaby.js
16-
npm-debug*.
12+
1713
protractor.config.js
18-
systemjs.config.js
1914
_test-output
20-
_temp
2115
**/ts/**/*.js
2216
**/ts-snippets/**/*.js
2317
*.d.ts

0 commit comments

Comments
 (0)