Skip to content

Commit

Permalink
Merge pull request #326 from t3chnoboy/master
Browse files Browse the repository at this point in the history
add missing spaces into function declarations
  • Loading branch information
yocontra committed Mar 4, 2014
2 parents 67ce329 + eb4abfc commit 4618b32
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -50,7 +50,7 @@ gulp.task('images', function() {
});

// Rerun the task when a file changes
gulp.task('watch', function () {
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.images, ['images']);
});
Expand Down
16 changes: 8 additions & 8 deletions bin/gulp.js
Expand Up @@ -14,11 +14,11 @@ var cli = new Liftoff({
completions: require('../lib/completion')
});

cli.on('require', function (name) {
cli.on('require', function(name) {
gutil.log('Requiring external module', chalk.magenta(name));
});

cli.on('requireFail', function (name) {
cli.on('requireFail', function(name) {
gutil.log(chalk.red('Failed to load external module'), chalk.magenta(name));
});

Expand Down Expand Up @@ -70,7 +70,7 @@ function handleArguments(env) {
gutil.log('Working directory changed to', chalk.magenta(env.cwd));
}

process.nextTick(function () {
process.nextTick(function() {
if (tasksFlag) {
return logTasks(gulpFile, gulpInst);
}
Expand All @@ -81,7 +81,7 @@ function handleArguments(env) {
function logTasks(gulpFile, localGulp) {
var tree = taskTree(localGulp.tasks);
tree.label = 'Tasks for ' + chalk.magenta(gulpFile);
archy(tree).split('\n').forEach(function (v) {
archy(tree).split('\n').forEach(function(v) {
if (v.trim().length === 0) return;
gutil.log(v);
});
Expand All @@ -96,22 +96,22 @@ function formatError(e) {

// wire up logging events
function logEvents(gulpInst) {
gulpInst.on('task_start', function (e) {
gulpInst.on('task_start', function(e) {
gutil.log('Starting', "'" + chalk.cyan(e.task) + "'...");
});

gulpInst.on('task_stop', function (e) {
gulpInst.on('task_stop', function(e) {
var time = prettyTime(e.hrDuration);
gutil.log('Finished', "'" + chalk.cyan(e.task) + "'", 'after', chalk.magenta(time));
});

gulpInst.on('task_err', function (e) {
gulpInst.on('task_err', function(e) {
var msg = formatError(e);
var time = prettyTime(e.hrDuration);
gutil.log("'" + chalk.cyan(e.task) + "'", 'errored after', chalk.magenta(time), chalk.red(msg));
});

gulpInst.on('task_not_found', function (err) {
gulpInst.on('task_not_found', function(err) {
gutil.log(chalk.red("Task '" + err.task + "' was not defined in your gulpfile but you tried to run it."));
gutil.log('Please check the documentation for proper gulpfile formatting.');
process.exit(1);
Expand Down
6 changes: 3 additions & 3 deletions docs/API.md
Expand Up @@ -146,13 +146,13 @@ So this example would look like this:
var gulp = require('gulp');

// takes in a callback so the engine knows when it'll be done
gulp.task('one', function (cb) {
gulp.task('one', function(cb) {
// do stuff -- async or otherwise
cb(err); // if err is not null and not undefined, the run will stop, and note that it failed
});

// identifies a dependent task must be complete before this one begins
gulp.task('two', ['one'], function () {
gulp.task('two', ['one'], function() {
// task 'one' is done now
});

Expand Down Expand Up @@ -183,7 +183,7 @@ Names of task(s) to run when a file changes, added with `gulp.task()`

```javascript
var watcher = gulp.watch('js/**/*.js', ['uglify','reload']);
watcher.on('change', function(event){
watcher.on('change', function(event) {
console.log('File '+event.path+' was '+event.type+', running tasks...');
});
```
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Expand Up @@ -17,7 +17,7 @@ npm install --save-dev gulp
```javascript
var gulp = require('gulp');

gulp.task('default', function(){
gulp.task('default', function() {
// place code for your default task here
});
```
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/combining-streams-to-handle-errors.md
Expand Up @@ -30,4 +30,4 @@ gulp.task('test', function() {

return combined;
});
```
```
2 changes: 1 addition & 1 deletion docs/recipes/fast-browserify-builds-with-watchify.md
Expand Up @@ -20,7 +20,7 @@ var gulp = require('gulp')
var source = require('vinyl-source-stream')
var watchify = require('watchify')

gulp.task('watch', function () {
gulp.task('watch', function() {
var bundler = watchify('./src/index.js');

// Optionally, you can apply transforms
Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/mocha-test-runner-with-gulp.md
Expand Up @@ -29,7 +29,7 @@ var mocha = require('gulp-mocha');
var batch = require('gulp-batch');
var gutil = require('gulp-util');

gulp.task('mocha', function () {
gulp.task('mocha', function() {
return gulp.src(['test/*.js'], { read: false })
.pipe(mocha({ reporter: 'list' }))
.on('error', gutil.log);
Expand All @@ -50,7 +50,7 @@ var mocha = require('gulp-mocha');
var watch = require('gulp-watch');
var gutil = require('gulp-util')

gulp.task('mocha', function () {
gulp.task('mocha', function() {
return gulp.src(['test/*.js'], { read: false })
.pipe(mocha({ reporter: 'list' }))
.on('error', gutil.log);
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/only-pass-through-changed-files.md
Expand Up @@ -14,7 +14,7 @@ var uglify = require('gulp-uglify');
var SRC = 'src/*.js';
var DEST = 'dist';

gulp.task('default', function () {
gulp.task('default', function() {
return gulp.src(SRC)
// the `changed` task needs to know the destination directory
// upfront to be able to figure out which files changed
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/pass-params-from-cli.md
Expand Up @@ -14,7 +14,7 @@ var uglify = require('gulp-uglify');

var isProduction = args.type === 'production';

gulp.task('scripts', function () {
gulp.task('scripts', function() {
return gulp.src('**/*.js')
.pipe(gulpif(isProduction, uglify())) // only minify if production
.pipe(gulp.dest('dist'));
Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/running-task-steps-per-folder.md
Expand Up @@ -25,9 +25,9 @@ var uglify = require('gulp-uglify');

var scriptsPath = './src/scripts/';

function getFolders(dir){
function getFolders(dir) {
return fs.readdirSync(dir)
.filter(function(file){
.filter(function(file) {
return fs.statSync(path.join(dir, file)).isDirectory();
});
}
Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/running-tasks-in-series.md
Expand Up @@ -19,13 +19,13 @@ So this example would look like this:
var gulp = require('gulp');

// takes in a callback so the engine knows when it'll be done
gulp.task('one', function (cb) {
gulp.task('one', function(cb) {
// do stuff -- async or otherwise
cb(err); // if err is not null and not undefined, the orchestration will stop, and 'two' will not run
});

// identifies a dependent task must be complete before this one begins
gulp.task('two', ['one'], function () {
gulp.task('two', ['one'], function() {
// task 'one' is done now
});

Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/sharing-streams-with-stream-factories.md
Expand Up @@ -65,4 +65,4 @@ gulp.task('coffee', function() {
});
```

You can see we split out our javascript pipeline (jshint + uglify) that was being reused in multiple tasks into a factory. These factories can be reused in as many tasks as you want. You can also nest factories and you can chain factories together for great effect. Splitting out each shared pipeline also gives you one central location to modify if you decide to change up your workflow.
You can see we split out our javascript pipeline (jshint + uglify) that was being reused in multiple tasks into a factory. These factories can be reused in as many tasks as you want. You can also nest factories and you can chain factories together for great effect. Splitting out each shared pipeline also gives you one central location to modify if you decide to change up your workflow.
2 changes: 1 addition & 1 deletion docs/recipes/using-external-config-file.md
Expand Up @@ -41,7 +41,7 @@ function doStuff(cfg) {
.pipe(gulp.dest(cfg.dest));
}

gulp.task('dry', function () {
gulp.task('dry', function() {
doStuff(config.desktop);
doStuff(config.mobile);
});
Expand Down
6 changes: 3 additions & 3 deletions docs/recipes/using-multiple-sources-in-one-task.md
Expand Up @@ -25,7 +25,7 @@ var gulp = require('gulp');
var concat = require('gulp-concat');
var streamqueue = require('streamqueue');

gulp.task('default', function () {
gulp.task('default', function() {
return streamqueue({ objectMode: true },
gulp.src('foo/*'),
gulp.src('bar/*')
Expand All @@ -36,12 +36,12 @@ gulp.task('default', function () {

// ... or ...

gulp.task('default', function () {
gulp.task('default', function() {
var stream = streamqueue({ objectMode: true });
stream.queue(gulp.src('foo/*'));
stream.queue(gulp.src('bar/*'));
return stream.done()
.pipe(concat('result.txt'))
.pipe(gulp.dest('build'));
});
```
```
4 changes: 2 additions & 2 deletions docs/writing-a-plugin/dealing-with-streams.md
Expand Up @@ -24,7 +24,7 @@ function prefixStream(prefixText) {
return stream;
}

// Plugin level function (dealing with files)
// Plugin level function(dealing with files)
function gulpPrefixer(prefixText) {

if (!prefixText) {
Expand All @@ -33,7 +33,7 @@ function gulpPrefixer(prefixText) {
prefixText = new Buffer(prefixText); // allocate ahead of time

// Creating a stream through which each file will pass
var stream = through.obj(function (file, enc, callback) {
var stream = through.obj(function(file, enc, callback) {
if (file.isNull()) {
this.push(file); // Do nothing if no contents
return callback();
Expand Down
4 changes: 2 additions & 2 deletions docs/writing-a-plugin/guidelines.md
Expand Up @@ -59,7 +59,7 @@ function prefixStream(prefixText) {
return stream;
}

// Plugin level function (dealing with files)
// Plugin level function(dealing with files)
function gulpPrefixer(prefixText) {

if (!prefixText) {
Expand All @@ -68,7 +68,7 @@ function gulpPrefixer(prefixText) {
prefixText = new Buffer(prefixText); // allocate ahead of time

// Creating a stream through which each file will pass
var stream = through.obj(function (file, enc, callback) {
var stream = through.obj(function(file, enc, callback) {
if (file.isNull()) {
// Do nothing if no contents
}
Expand Down
18 changes: 9 additions & 9 deletions docs/writing-a-plugin/testing.md
Expand Up @@ -16,10 +16,10 @@ var es = require('event-stream');
var File = require('vinyl');
var prefixer = require('../index');

describe('gulp-prefixer', function () {
describe('in streaming mode', function () {
describe('gulp-prefixer', function() {
describe('in streaming mode', function() {

it('should prepend text', function (done) {
it('should prepend text', function(done) {

// create the fake file
var fakeFile = new File({
Expand All @@ -33,12 +33,12 @@ describe('gulp-prefixer', function () {
myPrefixer.write(fakeFile);

// wait for the file to come back out
myPrefixer.once('data', function (file) {
myPrefixer.once('data', function(file) {
// make sure it came out the same way it went in
assert(file.isStream());

// buffer the contents to make sure it got prepended to
file.contents.pipe(es.wait(function (err, data) {
file.contents.pipe(es.wait(function(err, data) {
// check the contents
assert.equal(data, 'prependthistostreamwiththosecontents');
done();
Expand All @@ -59,10 +59,10 @@ var es = require('event-stream');
var File = require('vinyl');
var prefixer = require('../index');

describe('gulp-prefixer', function () {
describe('in buffer mode', function () {
describe('gulp-prefixer', function() {
describe('in buffer mode', function() {

it('should prepend text', function (done) {
it('should prepend text', function(done) {

// create the fake file
var fakeFile = new File({
Expand All @@ -76,7 +76,7 @@ describe('gulp-prefixer', function () {
myPrefixer.write(fakeFile);

// wait for the file to come back out
myPrefixer.once('data', function (file) {
myPrefixer.once('data', function(file) {
// make sure it came out the same way it went in
assert(file.isBuffer());

Expand Down
4 changes: 2 additions & 2 deletions docs/writing-a-plugin/using-buffers.md
Expand Up @@ -15,7 +15,7 @@ var PluginError = gutil.PluginError;
// Consts
const PLUGIN_NAME = 'gulp-prefixer';

// Plugin level function (dealing with files)
// Plugin level function(dealing with files)
function gulpPrefixer(prefixText) {

if (!prefixText) {
Expand All @@ -24,7 +24,7 @@ function gulpPrefixer(prefixText) {
prefixText = new Buffer(prefixText); // allocate ahead of time

// Creating a stream through which each file will pass
var stream = through.obj(function (file, enc, callback) {
var stream = through.obj(function(file, enc, callback) {
if (file.isNull()) {
this.push(file); // Do nothing if no contents
return callback();
Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js
Expand Up @@ -7,14 +7,14 @@ var jshint = require('gulp-jshint');

var codeFiles = ['**/*.js', '!node_modules/**'];

gulp.task('lint', function(){
gulp.task('lint', function() {
log('Linting Files');
return gulp.src(codeFiles)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter());
});

gulp.task('watch', function(){
gulp.task('watch', function() {
log('Watching Files');
gulp.watch(codeFiles, ['lint']);
});
Expand Down
8 changes: 4 additions & 4 deletions index.js
Expand Up @@ -6,13 +6,13 @@ var gutil = require('gulp-util');
var deprecated = require('deprecated');
var vfs = require('vinyl-fs');

function Gulp(){
function Gulp() {
Orchestrator.call(this);
}
util.inherits(Gulp, Orchestrator);

Gulp.prototype.task = Gulp.prototype.add;
Gulp.prototype.run = function(){
Gulp.prototype.run = function() {
// run() is deprecated as of 3.5 and will be removed in 4.0
// use task dependencies instead

Expand All @@ -24,15 +24,15 @@ Gulp.prototype.run = function(){

Gulp.prototype.src = vfs.src;
Gulp.prototype.dest = vfs.dest;
Gulp.prototype.watch = function (glob, opt, fn) {
Gulp.prototype.watch = function(glob, opt, fn) {
if (!fn) {
fn = opt;
opt = null;
}

// array of tasks given
if (Array.isArray(fn)) {
return vfs.watch(glob, opt, function(){
return vfs.watch(glob, opt, function() {
this.start.apply(this, fn);
}.bind(this));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/taskTree.js
Expand Up @@ -8,4 +8,4 @@ module.exports = function(tasks) {
});
return prev;
}, {nodes: []});
};
};

0 comments on commit 4618b32

Please sign in to comment.