var gulp = require('gulp');

var browserify = require('gulp-browserify');
var less = require('gulp-less');
var coffee = require('gulp-coffee');
var mocha = require('gulp-mocha');
var path = require('path');

function clearConsole() {
  process.stdout.write('\u001B[2J\u001B[0;0f');
}

gulp.task('browserify', function() {
    // Single entry point to browserify
    gulp.src('runner/dependencies.js')
        .pipe(browserify({
          insertGlobals : true,
          debug : !gulp.env.production
        }))
        .pipe(gulp.dest('build'))
});

gulp.task('less', function () {
  gulp.src('runner/runner.less')
    .pipe(less({
      paths: [ path.join(__dirname, 'less', 'includes') ]
    }))
    .pipe(gulp.dest('build'));
});

gulp.task('coffee', function() {
  gulp.src('./server/*.coffee')
    .pipe(coffee({bare: true}))
    .pipe(gulp.dest('./build/'))
});


gulp.task('spec', function() {
  gulp.src('pretty-thing/test.js')
    .pipe(mocha({reporter: 'spec'}));
})

gulp.task('watch-spec', function() {
  gulp.watch(['pretty-thing/*.js', 'runner/*.js'])
    .on('change', function(event) {
      clearConsole()
      gulp.start('spec')
    });
})

gulp.task('watch-browser', function() {
  gulp.start('browserify', 'less');
  gulp.watch(['pretty-thing/*.js', 'runner/*.js'], ['browserify']).on('change', function(event) {
    console.log('Browserifying JavaScript...');
  });
  gulp.watch('**/*.less', ['less']).on('change', function(event) {
    console.log('Recompiling LESS...');
  });
})

gulp.task('default', function() {
    gulp.start('browserify', 'less', 'coffee');
});

@@ -21,17 +21,16 @@
 gulp');%0A
-%0A
 var brow
@@ -198,16 +198,88 @@
 'path');
+%0Avar insert = require('gulp-insert');%0Avar chmod = require('gulp-chmod');
 %0A%0Afuncti
@@ -891,24 +891,97 @@
 re: true%7D))%0A
+    .pipe(insert.prepend('#!/usr/bin/env node%5Cn'))%0A    .pipe(chmod(755))%0A
     .pipe(gu

Make executable