Skip to content

Commit

Permalink
remove spaces before '(' to follow style guide
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chnoboy committed Mar 4, 2014
1 parent ed69aeb commit eb4abfc
Show file tree
Hide file tree
Showing 28 changed files with 171 additions and 171 deletions.
6 changes: 3 additions & 3 deletions README.md
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,15 +42,15 @@ 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}))
.pipe(gulp.dest('build/img'));
});

// 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
20 changes: 10 additions & 10 deletions docs/API.md
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 All @@ -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 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
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
4 changes: 2 additions & 2 deletions docs/recipes/combining-streams-to-handle-errors.md
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,7 +24,7 @@ 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)
});

Expand Down
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
12 changes: 6 additions & 6 deletions docs/recipes/mocha-test-runner-with-gulp.md
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 All @@ -29,13 +29,13 @@ 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);
});

gulp.watch(['lib/**', 'test/**'], batch(function (events, cb) {
gulp.watch(['lib/**', 'test/**'], batch(function(events, cb) {
gulp.run('mocha', cb);
}));
```
Expand All @@ -50,15 +50,15 @@ 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);
});

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/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
2 changes: 1 addition & 1 deletion docs/recipes/rebuild-only-files-that-change.md
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
6 changes: 3 additions & 3 deletions docs/recipes/running-task-steps-per-folder.md
Expand Up @@ -27,15 +27,15 @@ var scriptsPath = './src/scripts/';

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
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
8 changes: 4 additions & 4 deletions docs/recipes/sharing-streams-with-stream-factories.md
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,13 +51,13 @@ 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())
Expand Down
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 @@ -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 All @@ -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,7 +36,7 @@ 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/*'));
Expand Down
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

2 comments on commit eb4abfc

@tomasdev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the styleguide?

@yocontra
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomasdev felixge's

Please sign in to comment.