Skip to content

Commit

Permalink
Fixing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hansl committed Aug 19, 2016
1 parent 7800a52 commit 8b056e6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tools/gulp/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ import './tasks/e2e';
import './tasks/lint';
import './tasks/release';
import './tasks/serve';
import './tasks/spec';
import './tasks/unit-test';
26 changes: 17 additions & 9 deletions tools/gulp/task_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ export function sassBuildTask(dest: string, root: string, includePaths: string[]
}


/** Create a Gulp task that executes a process. */
/** Options that can be passed to execTask or execNodeTask. */
export interface ExecTaskOptions {
// Whether to output to STDERR and STDOUT.
silent?: boolean;
// If an error happens, this will replace the standard error.
errMessage?: string;
}

/** Create a task that executes a binary as if from the command line. */
export function execTask(binPath: string, args: string[], options: ExecTaskOptions = {}) {
return (done: (err?: string) => void) => {
const childProcess = child_process.spawn(binPath, args);
Expand All @@ -95,14 +98,20 @@ export function execTask(binPath: string, args: string[], options: ExecTaskOptio
} else {
done(options.errMessage);
}
return;
} else {
done();
}
done();
});
}
}

export function execNodeTask(packageName: string, executable: string[] | string, args?: string[]) {
/**
* Create a task that executes an NPM Bin, by resolving the binary path then executing it. These are
* binaries that are normally in the `./node_modules/.bin` directory, but their name might differ
* from the package. Examples are typescript, ngc and gulp itself.
*/
export function execNodeTask(packageName: string, executable: string | string[], args?: string[],
options: ExecTaskOptions = {}) {
if (!args) {
args = <string[]>executable;
executable = undefined;
Expand All @@ -111,12 +120,11 @@ export function execNodeTask(packageName: string, executable: string[] | string,
return (done: (err: any) => void) => {
resolveBin(packageName, { executable: executable }, (err: any, binPath: string) => {
if (err) {
console.error(err);
return done(err);
done(err);
} else {
// Forward to execTask.
execTask(binPath, args, options)(done);
}

// Forward to execTask.
execTask(binPath, args)(done);
});
}
}
Expand Down
8 changes: 6 additions & 2 deletions tools/gulp/tasks/ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import {task} from 'gulp';


task('ci:lint', ['ci:forbidden-identifiers', 'lint']);
task('ci:test', ['test:single-run']);
task('ci:e2e', ['e2e']);

task('ci:extract-metadata', [':build:components:ngc']);
task('ci:forbidden-identifiers', function() {
require('../../../scripts/ci/forbidden-identifiers.js');
});

// Travis sometimes does not exit the process and times out. This is to prevent that.
task('ci:test', ['test:single-run'], () => process.exit(0));
// Travis sometimes does not exit the process and times out. This is to prevent that.
task('ci:e2e', ['e2e'], () => process.exit(0));
4 changes: 3 additions & 1 deletion tools/gulp/tasks/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ task(':publish:whoami', execTask('npm', ['whoami'], {
task(':publish:logout', execTask('npm', ['logout']));

task(':publish', function() {
const label = process.argv.slice(2)[1]; // [0] would be ':publish'
const labelArg = label ? `--tag ${label}` : '';
const currentDir = process.cwd();

readdirSync(DIST_COMPONENTS_ROOT)
Expand All @@ -40,7 +42,7 @@ task(':publish', function() {
}

process.chdir(componentPath);
execSync('npm publish');
execSync(`npm publish --access public ${labelArg}`);
});
process.chdir(currentDir);
});
Expand Down
File renamed without changes.

0 comments on commit 8b056e6

Please sign in to comment.