var CommonTasks,
    gulp = require('gulp'),
    gutil = require('gulp-util'),
    concat = require('gulp-concat'),
    coffee = require('gulp-coffee'),
    sourcemaps = require('gulp-sourcemaps'),
    clean = require('gulp-clean'),
    watch = require('gulp-watch'),
    less = require('gulp-less'),
    jscs = require('gulp-jscs'),
    jshint = require('gulp-jshint'),
    uglify = require('gulp-uglify'),
    mocha = require('gulp-mocha'),
    cover = require('gulp-coverage'),
    browserify = require('gulp-browserify'),
    stringify = require('stringify'),
    debug = require('gulp-debug');

config = {
	paths: {
		app: {
			views: './app/views/**/*.html',
			js: './app/js/**/*.js',
			less: './app/css/*.less',
			main: './app/js/main.js'
		},
		test: {
			coffee: './tests/**/*.coffee',
			js: './test/**/*Spec.js',
			runner: './test.html'
		},
		out: {
			bundle: './out/bundle'
		}
	}
};

CommonTasks = {
	compileSpecs: function () {
		return gulp.src(config.paths.test.coffee).pipe(sourcemaps.init()).pipe(coffee({
			bare: true
		}).on('error', gutil.log)).pipe(sourcemaps.write()).pipe(gulp.dest('./tests'));
	},
	runSpecs: function (silentMode) {
		return gulp.src(config.paths.test.runner).pipe(mocha({
			silentMode: Boolean(silentMode)
		}).on('error', gutil.log));
	}
};

gulp.task('test', ['lint'], function () {
	return gulp.src([config.paths.test.js], {
		read: false
	}).pipe(mocha());
});

gulp.task('test-cover', function () {
	return gulp.src([config.paths.test.js], {
		read: false
	}).pipe(cover.instrument({
		pattern: ['**/app/**']
	})).pipe(mocha()).pipe(cover.gather()).pipe(cover.format()).pipe(gulp.dest('./out/test-reports'));
});

gulp.task('lint', function () {
	return gulp.src([config.paths.app.js]).pipe(jshint('.jshintrc')).pipe(jshint.reporter('jshint-stylish')).pipe(jscs({
		configPath: '.jscsrc'
	}));
});

gulp.task('bundle', function () {
	gutil.log(gutil.colors.bgGreen('Start bundling...'));
	return gulp.src(config.paths.app.main, {
		read: false
	}).pipe(browserify({
		debug: true,
		transform: stringify({
			extensions: ['.html'],
			minify: false
		})
	})).pipe(gulp.dest(config.paths.out.bundle));
});

gulp.task('watch', function () {
	var app;
	app = config.paths.app;
	return gulp.watch([app.js, app.views], ['bundle']);
});

gulp.task('default', ['bundle', 'watch']);

@@ -1,2331 +1,66 @@
-var CommonTasks,%0A    gulp = require('gulp'),%0A    gutil = require('gulp-util'),%0A    concat = require('gulp-concat'),%0A    coffee = require('gulp-coffee'),%0A    sourcemaps = require('gulp-sourcemaps'),%0A    clean = require('gulp-clean'),%0A    watch = require('gulp-watch'),%0A    less = require('gulp-less'),%0A    jscs = require('gulp-jscs'),%0A    jshint = require('gulp-jshint'),%0A    uglify = require('gulp-uglify'),%0A    mocha = require('gulp-mocha'),%0A    cover = require('gulp-coverage'),%0A    browserify = require('gulp-browserify'),%0A    stringify = require('stringify'),%0A    debug = require('gulp-debug');%0A%0Aconfig = %7B%0A%09paths: %7B%0A%09%09app: %7B%0A%09%09%09views: './app/views/**/*.html',%0A%09%09%09js: './app/js/**/*.js',%0A%09%09%09less: './app/css/*.less',%0A%09%09%09main: './app/js/main.js'%0A%09%09%7D,%0A%09%09test: %7B%0A%09%09%09coffee: './tests/**/*.coffee',%0A%09%09%09js: './test/**/*Spec.js',%0A%09%09%09runner: './test.html'%0A%09%09%7D,%0A%09%09out: %7B%0A%09%09%09bundle: './out/bundle'%0A%09%09%7D%0A%09%7D%0A%7D;%0A%0ACommonTasks = %7B%0A%09compileSpecs: function () %7B%0A%09%09return gulp.src(config.paths.test.coffee).pipe(sourcemaps.init()).pipe(coffee(%7B%0A%09%09%09bare: true%0A%09%09%7D).on('error', gutil.log)).pipe(sourcemaps.write()).pipe(gulp.dest('./tests'));%0A%09%7D,%0A%09runSpecs: function (silentMode) %7B%0A%09%09return gulp.src(config.paths.test.runner).pipe(mocha(%7B%0A%09%09%09silentMode: Boolean(silentMode)%0A%09%09%7D).on('error', gutil.log));%0A%09%7D%0A%7D;%0A%0Agulp.task('test', %5B'lint'%5D, function () %7B%0A%09return gulp.src(%5Bconfig.paths.test.js%5D, %7B%0A%09%09read: false%0A%09%7D).pipe(mocha());%0A%7D);%0A%0Agulp.task('test-cover', function () %7B%0A%09return gulp.src(%5Bconfig.paths.test.js%5D, %7B%0A%09%09read: false%0A%09%7D).pipe(cover.instrument(%7B%0A%09%09pattern: %5B'**/app/**'%5D%0A%09%7D)).pipe(mocha()).pipe(cover.gather()).pipe(cover.format()).pipe(gulp.dest('./out/test-reports'));%0A%7D);%0A%0Agulp.task('lint', function () %7B%0A%09return gulp.src(%5Bconfig.paths.app.js%5D).pipe(jshint('.jshintrc')).pipe(jshint.reporter('jshint-stylish')).pipe(jscs(%7B%0A%09%09configPath: '.jscsrc'%0A%09%7D));%0A%7D);%0A%0Agulp.task('bundle', function () %7B%0A%09gutil.log(gutil.colors.bgGreen('Start bundling...'));%0A%09return gulp.src(config.paths.app.main, %7B%0A%09%09read: false%0A%09%7D).pipe(browserify(%7B%0A%09%09debug: true,%0A%09%09transform: stringify(%7B%0A%09%09%09extensions: %5B'.html'%5D,%0A%09%09%09minify: false%0A%09%09%7D)%0A%09%7D)).pipe(gulp.dest(config.paths.out.bundle));%0A%7D);%0A%0Agulp.task('watch', function () %7B%0A%09var app;%0A%09app = config.paths.app;%0A%09return gulp.watch(%5Bapp.js, app.views%5D, %5B'bundle'%5D);%0A%7D);%0A%0Agulp.task('default', %5B'bundle', 'watch'%5D);%0A
+require('coffee-script/register');%0Arequire('./gulp-tasks.coffee');

Return to coffee build tasks