chore(ignored/boilerplate files): cleanup

closes #1646
This commit is contained in:
Patrice Chalin 2016-06-10 14:10:30 -07:00 committed by Ward Bell
parent b1419f48ba
commit 5adbfb9502
3 changed files with 35 additions and 24 deletions

4
.gitignore vendored
View File

@ -12,6 +12,7 @@ pubspec.lock
.DS_Store .DS_Store
**/*.iml **/*.iml
.idea .idea
.vscode
**/js/latest/api **/js/latest/api
**/ts/latest/api **/ts/latest/api
**/dart/latest/api **/dart/latest/api
@ -21,8 +22,7 @@ _.*
public/docs/xref-*.* public/docs/xref-*.*
_zip-output _zip-output
www www
npm-debug.log npm-debug*.log*
npm-debug.log.*
*.plnkr.html *.plnkr.html
plnkr.html plnkr.html
*plnkr.no-link.html *plnkr.no-link.html

View File

@ -91,6 +91,16 @@ var _exampleProtractorBoilerplateFiles = [
var _exampleConfigFilename = 'example-config.json'; var _exampleConfigFilename = 'example-config.json';
function isDartPath(path) {
// Testing via indexOf() for now. If we need to match only paths with folders
// named 'dart' vs 'dart*' then try: path.match('/dart(/|$)') != null;
return path.indexOf('/dart') > -1;
}
function excludeDartPaths(paths) {
return paths.filter(function (p) { return !isDartPath(p); });
}
/** /**
* Run Protractor End-to-End Specs for Doc Samples * Run Protractor End-to-End Specs for Doc Samples
* Alias for 'run-e2e-tests' * Alias for 'run-e2e-tests'
@ -167,7 +177,6 @@ function runE2e() {
// with the corresponding apps that they should run under. Then run // with the corresponding apps that they should run under. Then run
// each app/spec collection sequentially. // each app/spec collection sequentially.
function findAndRunE2eTests(filter, outputFile) { function findAndRunE2eTests(filter, outputFile) {
// create an output file with header. // create an output file with header.
var lang = (argv.lang || '(ts|js)').toLowerCase(); var lang = (argv.lang || '(ts|js)').toLowerCase();
if (lang === 'all') { lang = '(ts|js|dart)'; } if (lang === 'all') { lang = '(ts|js|dart)'; }
@ -205,8 +214,7 @@ function findAndRunE2eTests(filter, outputFile) {
var status = { passed: [], failed: [] }; var status = { passed: [], failed: [] };
return examplePaths.reduce(function (promise, examplePath) { return examplePaths.reduce(function (promise, examplePath) {
return promise.then(function () { return promise.then(function () {
var isDart = examplePath.indexOf('/dart') > -1; var runTests = isDartPath(examplePath) ? runE2eDartTests : runE2eTsTests;
var runTests = isDart ? runE2eDartTests : runE2eTsTests;
return runTests(examplePath, outputFile).then(function(ok) { return runTests(examplePath, outputFile).then(function(ok) {
var arr = ok ? status.passed : status.failed; var arr = ok ? status.passed : status.failed;
arr.push(examplePath); arr.push(examplePath);
@ -378,7 +386,7 @@ gulp.task('add-example-boilerplate', function() {
}); });
realPath = path.join(EXAMPLES_PATH, '/typings'); realPath = path.join(EXAMPLES_PATH, '/typings');
var typingsPaths = getTypingsPaths(EXAMPLES_PATH); var typingsPaths = excludeDartPaths(getTypingsPaths(EXAMPLES_PATH));
typingsPaths.forEach(function(linkPath) { typingsPaths.forEach(function(linkPath) {
gutil.log("symlinking " + linkPath + ' -> ' + realPath) gutil.log("symlinking " + linkPath + ' -> ' + realPath)
fsUtils.addSymlink(realPath, linkPath); fsUtils.addSymlink(realPath, linkPath);
@ -401,16 +409,18 @@ function copyExampleBoilerplate() {
var sourceFiles = _exampleBoilerplateFiles.map(function(fn) { var sourceFiles = _exampleBoilerplateFiles.map(function(fn) {
return path.join(EXAMPLES_PATH, fn); return path.join(EXAMPLES_PATH, fn);
}); });
var examplePaths = getExamplePaths(EXAMPLES_PATH); var examplePaths = excludeDartPaths(getExamplePaths(EXAMPLES_PATH));
var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles.map(function(fn){ var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles.map(function(fn){
return path.join(EXAMPLES_PATH, fn); return path.join(EXAMPLES_PATH, fn);
}); });
var dartExampleWebPaths = getDartExampleWebPaths(EXAMPLES_PATH); var dartExampleWebPaths = getDartExampleWebPaths(EXAMPLES_PATH);
return copyFiles(sourceFiles, examplePaths) // Make boilerplate files read-only to avoid that they be edited by mistake.
var destFileMode = '444';
return copyFiles(sourceFiles, examplePaths, destFileMode)
.then(function() { .then(function() {
return copyFiles(dartWebSourceFiles, dartExampleWebPaths); return copyFiles(dartWebSourceFiles, dartExampleWebPaths, destFileMode);
}) })
// copy certain files from _examples/_protractor dir to each subdir that contains an e2e-spec file. // copy certain files from _examples/_protractor dir to each subdir that contains an e2e-spec file.
.then(function() { .then(function() {
@ -418,7 +428,7 @@ function copyExampleBoilerplate() {
_exampleProtractorBoilerplateFiles _exampleProtractorBoilerplateFiles
.map(function(name) {return path.join(EXAMPLES_PROTRACTOR_PATH, name);});; .map(function(name) {return path.join(EXAMPLES_PROTRACTOR_PATH, name);});;
var e2eSpecPaths = getE2eSpecPaths(EXAMPLES_PATH); var e2eSpecPaths = getE2eSpecPaths(EXAMPLES_PATH);
return copyFiles(protractorSourceFiles, e2eSpecPaths); return copyFiles(protractorSourceFiles, e2eSpecPaths, destFileMode);
}); });
} }
@ -792,16 +802,23 @@ function showHideExampleNodeModules(showOrHide) {
} }
} }
// Copies fileNames into destPaths, setting the mode of the
// files at the destination as optional_destFileMode if given.
// returns a promise // returns a promise
function copyFiles(fileNames, destPaths) { function copyFiles(fileNames, destPaths, optional_destFileMode) {
var copy = Q.denodeify(fsExtra.copy); var copy = Q.denodeify(fsExtra.copy);
var chmod = Q.denodeify(fsExtra.chmod);
var copyPromises = []; var copyPromises = [];
destPaths.forEach(function(destPath) { destPaths.forEach(function(destPath) {
fileNames.forEach(function(fileName) { fileNames.forEach(function(fileName) {
var baseName = path.basename(fileName); var baseName = path.basename(fileName);
var destName = path.join(destPath, baseName); var destName = path.join(destPath, baseName);
var p = copy(fileName, destName, { clobber: true}); var p = copy(fileName, destName, { clobber: true});
if(optional_destFileMode !== undefined) {
p = p.then(function () {
return chmod(destName, optional_destFileMode);
});
}
copyPromises.push(p); copyPromises.push(p);
}); });
}); });

View File

@ -1,23 +1,17 @@
# _exampleBoilerplateFiles
.editorconfig .editorconfig
.idea
.vscode
styles.css
typings
typings.json
node_modules
jspm_packages
*.js.map
package.json
karma.conf.js karma.conf.js
karma-test-shim.js karma-test-shim.js
package.json
*/**/styles.css
systemjs.config.js
tsconfig.json tsconfig.json
tslint.json tslint.json
typings.json
wallaby.js wallaby.js
npm-debug*.
protractor.config.js protractor.config.js
systemjs.config.js
_test-output _test-output
_temp
**/ts/**/*.js **/ts/**/*.js
**/ts-snippets/**/*.js **/ts-snippets/**/*.js
*.d.ts *.d.ts