Skip to content

Commit

Permalink
add missing spaces into function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chnoboy committed Mar 4, 2014
1 parent dad808a commit ed69aeb
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 123 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var paths = {
images: 'client/img/**/*'
};

gulp.task('scripts', function() {
gulp.task('scripts', function () {
// Minify and copy all JavaScript (except vendor scripts)
return gulp.src(paths.scripts)
.pipe(coffee())
Expand All @@ -42,7 +42,7 @@ gulp.task('scripts', function() {
});

// Copy all static images
gulp.task('images', function() {
gulp.task('images', function () {
return gulp.src(paths.images)
// Pass in options to the task
.pipe(imagemin({optimizationLevel: 5}))
Expand Down
16 changes: 8 additions & 8 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The path (folder) to write files to.
Define a task using [Orchestrator].

```javascript
gulp.task('somename', function() {
gulp.task('somename', function () {
// Do stuff
});
```
Expand All @@ -74,7 +74,7 @@ Type: `Array`
An array of tasks to be executed and completed before your task will run.

```javascript
gulp.task('mytask', ['array', 'of', 'task', 'names'], function() {
gulp.task('mytask', ['array', 'of', 'task', 'names'], function () {
// Do stuff
});
```
Expand All @@ -93,7 +93,7 @@ Tasks can be made asynchronous if its `fn` does one of the following:
##### Accept a callback

```javascript
gulp.task('somename', function(cb) {
gulp.task('somename', function (cb) {
// Do stuff
cb(err);
});
Expand All @@ -102,7 +102,7 @@ gulp.task('somename', function(cb) {
##### Return a stream

```javascript
gulp.task('somename', function() {
gulp.task('somename', function () {
var stream = gulp.src('./client/**/*.js')
.pipe(minify())
.pipe(gulp.dest('/build'));
Expand All @@ -115,11 +115,11 @@ gulp.task('somename', function() {
```javascript
var Q = require('q');

gulp.task('somename', function() {
gulp.task('somename', function () {
var deferred = Q.defer();

// Do async stuff
setTimeout(function() {
setTimeout(function () {
deferred.resolve();
}, 1);

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 All @@ -206,7 +206,7 @@ Type: `Function`
Callback to be called on each change.

```javascript
gulp.watch('js/**/*.js', function(event) {
gulp.watch('js/**/*.js', function (event) {
console.log('File '+event.path+' was '+event.type+', running tasks...');
});
```
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 deletions docs/recipes/combining-streams-to-handle-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var Combine = require('stream-combiner');
var uglify = require('gulp-uglify');
var gulp = require('gulp');

gulp.task('test', function() {
gulp.task('test', function () {
var combined = Combine(
gulp.src('bootstrap/js/*.js'),
uglify(),
Expand All @@ -24,10 +24,10 @@ gulp.task('test', function() {
// any errors in the above streams
// will get caught by this listener,
// instead of being thrown:
combined.on('error', function(err) {
combined.on('error', function (err) {
console.warn(err.message)
});

return combined;
});
```
```
8 changes: 4 additions & 4 deletions docs/recipes/mocha-test-runner-with-gulp.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var gulp = require('gulp');
var mocha = require('gulp-mocha');

gulp.task('tests', function() {
gulp.task('tests', function () {
return gulp.src(['test/test-*.js'], { read: false })
.pipe(mocha({
reporter: 'spec',
Expand Down Expand Up @@ -35,7 +35,7 @@ gulp.task('mocha', function () {
.on('error', gutil.log);
});

gulp.watch(['lib/**', 'test/**'], batch(function(events, cb) {
gulp.watch(['lib/**', 'test/**'], batch(function (events, cb) {
gulp.run('mocha', cb);
}));
```
Expand All @@ -56,9 +56,9 @@ gulp.task('mocha', function () {
.on('error', gutil.log);
});

gulp.task('watch', function() {
gulp.task('watch', function () {
return gulp.src(['lib/**', 'test/**'], { read: false })
.pipe(watch(function(events, cb) {
.pipe(watch(function (events, cb) {
gulp.run('mocha', cb);
}));
});
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/rebuild-only-files-that-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var gulp = require('gulp');
var sass = require('gulp-sass');
var watch = require('gulp-watch');

gulp.task('default', function() {
gulp.task('default', function () {
return gulp.src('./sass/*.scss')
.pipe(watch())
.pipe(sass())
Expand Down
8 changes: 4 additions & 4 deletions docs/recipes/running-task-steps-per-folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ 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();
});
}

gulp.task('scripts', function() {
gulp.task('scripts', function () {
var folders = getFolders(scriptsPath);

var tasks = folders.map(function(folder) {
var tasks = folders.map(function (folder) {
// concat into foldername.js
// write to output
// minify
Expand Down
10 changes: 5 additions & 5 deletions docs/recipes/sharing-streams-with-stream-factories.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ var coffee = require('gulp-coffee');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');

gulp.task('bootstrap', function() {
gulp.task('bootstrap', function () {
return gulp.src('bootstrap/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(uglify())
.pipe(gulp.dest('public/bootstrap'));
});

gulp.task('coffee', function() {
gulp.task('coffee', function () {
return gulp.src('lib/js/*.coffee')
.pipe(coffee())
.pipe(jshint())
Expand All @@ -51,18 +51,18 @@ var jsTransform = lazypipe()
.pipe(jshint.reporter, stylish)
.pipe(uglify);

gulp.task('bootstrap', function() {
gulp.task('bootstrap', function () {
return gulp.src('bootstrap/js/*.js')
.pipe(jsTransform())
.pipe(gulp.dest('public/bootstrap'));
});

gulp.task('coffee', function() {
gulp.task('coffee', function () {
return gulp.src('lib/js/*.coffee')
.pipe(coffee())
.pipe(jsTransform())
.pipe(gulp.dest('public/js'));
});
```

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.
4 changes: 2 additions & 2 deletions docs/recipes/using-multiple-sources-in-one-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var gulp = require('gulp');
var es = require('event-stream');

gulp.task('test', function(cb) {
gulp.task('test', function (cb) {
return es.concat(
gulp.src('bootstrap/js/*.js')
.pipe(gulp.dest('public/bootstrap')),
Expand Down Expand Up @@ -44,4 +44,4 @@ gulp.task('default', function () {
.pipe(concat('result.txt'))
.pipe(gulp.dest('build'));
});
```
```
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
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 @@ -32,7 +32,7 @@ Gulp.prototype.watch = function (glob, opt, fn) {

// 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/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var fs = require('fs');
var path = require('path');

module.exports = function(name) {
module.exports = function (name) {
if (typeof name !== 'string') throw new Error('Missing completion type');
var file = path.join(__dirname, '../completion', name);
try {
Expand Down
6 changes: 3 additions & 3 deletions lib/taskTree.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

module.exports = function(tasks) {
return Object.keys(tasks).reduce(function(prev, task) {
module.exports = function (tasks) {
return Object.keys(tasks).reduce(function (prev, task) {
prev.nodes.push({
label: task,
nodes: tasks[task].dep
});
return prev;
}, {nodes: []});
};
};
Loading

0 comments on commit ed69aeb

Please sign in to comment.