untangle
Version:
Untangle is a library meant to create highly uncoupled code
35 lines (28 loc) • 1.03 kB
text/coffeescript
# Load all required libraries.
gulp = require 'gulp'
gutil = require 'gulp-util'
coffee = require 'gulp-coffee'
istanbul = require 'gulp-istanbul'
mocha = require 'gulp-mocha'
plumber = require 'gulp-plumber'
gulp.on 'err', (e) ->
gutil.beep()
gutil.log e.err.stack
gulp.task 'coffee', ->
gulp.src './src/**/*.coffee'
.pipe plumber() # Pevent pipe breaking caused by errors from gulp plugins
.pipe coffee({bare: true})
.pipe gulp.dest './lib/'
gulp.task 'test', ['coffee'], ->
gulp.src ['lib/**/*.js']
.pipe(istanbul()) # Covering files
.pipe(istanbul.hookRequire()) # Overwrite require so it returns the covered files
.on 'finish', ->
gulp.src(['test/**/*.spec.coffee'])
.pipe mocha reporter: 'spec', compilers: 'coffee:coffee-script'
.pipe istanbul.writeReports() # Creating the reports after tests run
gulp.task 'watch', ->
gulp.watch './src/**/*.coffee', ['coffee']
gulp.task 'testwatch', ->
gulp.watch './src/**/*.coffee', ['test']
gulp.task 'default', ['coffee']