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
**/*.iml
.idea
.vscode
**/js/latest/api
**/ts/latest/api
**/dart/latest/api
@ -21,8 +22,7 @@ _.*
public/docs/xref-*.*
_zip-output
www
npm-debug.log
npm-debug.log.*
npm-debug*.log*
*.plnkr.html
plnkr.html
*plnkr.no-link.html

View File

@ -91,6 +91,16 @@ var _exampleProtractorBoilerplateFiles = [
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
* Alias for 'run-e2e-tests'
@ -167,7 +177,6 @@ function runE2e() {
// with the corresponding apps that they should run under. Then run
// each app/spec collection sequentially.
function findAndRunE2eTests(filter, outputFile) {
// create an output file with header.
var lang = (argv.lang || '(ts|js)').toLowerCase();
if (lang === 'all') { lang = '(ts|js|dart)'; }
@ -205,8 +214,7 @@ function findAndRunE2eTests(filter, outputFile) {
var status = { passed: [], failed: [] };
return examplePaths.reduce(function (promise, examplePath) {
return promise.then(function () {
var isDart = examplePath.indexOf('/dart') > -1;
var runTests = isDart ? runE2eDartTests : runE2eTsTests;
var runTests = isDartPath(examplePath) ? runE2eDartTests : runE2eTsTests;
return runTests(examplePath, outputFile).then(function(ok) {
var arr = ok ? status.passed : status.failed;
arr.push(examplePath);
@ -378,7 +386,7 @@ gulp.task('add-example-boilerplate', function() {
});
realPath = path.join(EXAMPLES_PATH, '/typings');
var typingsPaths = getTypingsPaths(EXAMPLES_PATH);
var typingsPaths = excludeDartPaths(getTypingsPaths(EXAMPLES_PATH));
typingsPaths.forEach(function(linkPath) {
gutil.log("symlinking " + linkPath + ' -> ' + realPath)
fsUtils.addSymlink(realPath, linkPath);
@ -401,16 +409,18 @@ function copyExampleBoilerplate() {
var sourceFiles = _exampleBoilerplateFiles.map(function(fn) {
return path.join(EXAMPLES_PATH, fn);
});
var examplePaths = getExamplePaths(EXAMPLES_PATH);
var examplePaths = excludeDartPaths(getExamplePaths(EXAMPLES_PATH));
var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles.map(function(fn){
return path.join(EXAMPLES_PATH, fn);
});
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() {
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.
.then(function() {
@ -418,7 +428,7 @@ function copyExampleBoilerplate() {
_exampleProtractorBoilerplateFiles
.map(function(name) {return path.join(EXAMPLES_PROTRACTOR_PATH, name);});;
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
function copyFiles(fileNames, destPaths) {
function copyFiles(fileNames, destPaths, optional_destFileMode) {
var copy = Q.denodeify(fsExtra.copy);
var chmod = Q.denodeify(fsExtra.chmod);
var copyPromises = [];
destPaths.forEach(function(destPath) {
fileNames.forEach(function(fileName) {
var baseName = path.basename(fileName);
var destName = path.join(destPath, baseName);
var p = copy(fileName, destName, { clobber: true});
if(optional_destFileMode !== undefined) {
p = p.then(function () {
return chmod(destName, optional_destFileMode);
});
}
copyPromises.push(p);
});
});

View File

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