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

chore(ignored/boilerplate files): minor cleanup #1646

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pubspec.lock
.DS_Store
**/*.iml
.idea
.vscode
**/js/latest/api
**/ts/latest/api
**/dart/latest/api
Expand All @@ -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
Expand Down
37 changes: 27 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ var _exampleProtractorBoilerplateFiles = [
'tsconfig.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'
Expand Down Expand Up @@ -165,7 +175,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)'; }
Expand Down Expand Up @@ -203,8 +212,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);
Expand Down Expand Up @@ -375,7 +383,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);
Expand All @@ -398,24 +406,26 @@ 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() {
var protractorSourceFiles =
_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);
});
}

Expand Down Expand Up @@ -789,16 +799,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);
});
});
Expand Down
18 changes: 6 additions & 12 deletions public/docs/_examples/.gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down