Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Commit

Permalink
Coffeeify syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
sanemat committed Jun 30, 2014
1 parent 2649730 commit bee2656
Showing 1 changed file with 41 additions and 26 deletions.
67 changes: 41 additions & 26 deletions app/templates/gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,65 @@ $ = (require 'gulp-load-plugins') lazy: false
del = require 'del'
es = require 'event-stream'

paths = {
lint: ['./gulpfile.coffee', './src/**/*.coffee'],
watch: ['./gulpfile.coffee', './src/**/*.coffee', './test/**/*.coffee', '!test/{temp,temp/**}'],
tests: ['./test/**/*.coffee', '!test/{temp,temp/**}'],
source: ['./src/**/*.coffee']
}
paths =
lint: [
'./gulpfile.coffee'
'./src/**/*.coffee'
]
watch: [
'./gulpfile.coffee'
'./src/**/*.coffee'
'./test/**/*.coffee'
'!test/{temp,temp/**}'
]
tests: [
'./test/**/*.coffee'
'!test/{temp,temp/**}'
]
source: [
'./src/**/*.coffee'
]


gulp.task 'lint', ->
gulp.src(paths.lint)
.pipe($.coffeelint('./coffeelint.json'))
.pipe($.coffeelint.reporter())
gulp.src paths.lint
.pipe $.coffeelint('./coffeelint.json')
.pipe $.coffeelint.reporter()

gulp.task 'clean', del.bind(null, ['./compile'])
gulp.task 'clean:coverage', del.bind(null, ['./coverage'])

gulp.task 'compile', ['lint'], ->
es.merge(
gulp.src(paths.source)
.pipe($.sourcemaps.init())
.pipe($.coffee({ bare: true }).on('error', $.util.log))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('./compile/src'))
gulp.src(paths.tests)
.pipe($.sourcemaps.init())
gulp.src paths.source
.pipe $.sourcemaps.init()
.pipe($.coffee(bare: true).on('error', $.util.log))
.pipe $.sourcemaps.write()
.pipe gulp.dest('./compile/src')
gulp.src paths.tests
.pipe $.sourcemaps.init()
.pipe($.coffee({ bare: true }).on('error', $.util.log))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('./compile/test'))
.pipe $.sourcemaps.write()
.pipe gulp.dest('./compile/test')
)

gulp.task 'istanbul', ['clean:coverage', 'compile'], (cb) ->
gulp.src(['./compile/src/**/*.js'])
.pipe($.istanbul()) #Covering files
gulp.src ['./compile/src/**/*.js']
#Covering files
.pipe $.istanbul()
.on 'finish', ->
gulp.src(['./compile/test/**/*.js'], {cwd: __dirname})
.pipe($.plumber())
.pipe($.mocha())
.pipe($.istanbul.writeReports()) #Creating the reports after tests runned
gulp.src ['./compile/test/**/*.js'], {cwd: __dirname}
.pipe $.plumber()
.pipe $.mocha()
#Creating the reports after tests runned
.pipe $.istanbul.writeReports()
.on 'finish', ->
process.chdir(__dirname)
process.chdir __dirname
cb()
undefined

gulp.task 'watch', ['test'], ->
gulp.watch(paths.watch, ['test'])
gulp.watch paths.watch, ['test']

gulp.task 'default', ['test']
gulp.task 'test', ['lint', 'istanbul']

0 comments on commit bee2656

Please sign in to comment.