2014-12-30 17:12:18 +00:00
|
|
|
mkdirp = require('mkdirp')
|
2014-10-31 13:48:53 +00:00
|
|
|
path = require('path')
|
2014-10-31 13:37:29 +00:00
|
|
|
gulp = require('gulp')
|
|
|
|
mocha = require('gulp-mocha')
|
2014-12-30 13:44:03 +00:00
|
|
|
coffee = require('gulp-coffee')
|
2014-12-24 19:12:31 +00:00
|
|
|
markedMan = require('gulp-marked-man')
|
2014-10-31 13:48:53 +00:00
|
|
|
coffeelint = require('gulp-coffeelint')
|
2014-12-30 17:12:18 +00:00
|
|
|
shell = require('gulp-shell')
|
2014-10-31 13:37:29 +00:00
|
|
|
mochaNotifierReporter = require('mocha-notifier-reporter')
|
2014-12-30 17:12:18 +00:00
|
|
|
packageJSON = require('./package.json')
|
2014-10-31 13:37:29 +00:00
|
|
|
|
|
|
|
OPTIONS =
|
2014-10-31 13:50:50 +00:00
|
|
|
config:
|
|
|
|
coffeelint: path.join(__dirname, 'coffeelint.json')
|
|
|
|
files:
|
|
|
|
coffee: [ 'lib/**/*.coffee', 'gulpfile.coffee' ]
|
2014-11-26 13:20:36 +00:00
|
|
|
app: [ 'lib/**/*.coffee', '!lib/**/*.spec.coffee' ]
|
2015-02-10 15:38:19 +00:00
|
|
|
tests: 'tests/**/*.spec.coffee'
|
2014-12-30 16:26:19 +00:00
|
|
|
json: [ 'lib/**/*.json', 'package.json' ]
|
2014-12-24 19:12:31 +00:00
|
|
|
man: 'man/**/*.md'
|
|
|
|
directories:
|
|
|
|
man: 'man/'
|
2014-12-30 13:44:03 +00:00
|
|
|
build: 'build/'
|
2014-12-24 19:12:31 +00:00
|
|
|
|
|
|
|
gulp.task 'man', ->
|
|
|
|
gulp.src(OPTIONS.files.man)
|
|
|
|
.pipe(markedMan())
|
|
|
|
.pipe(gulp.dest(OPTIONS.directories.man))
|
2014-10-31 13:37:29 +00:00
|
|
|
|
|
|
|
gulp.task 'test', ->
|
2014-10-31 13:50:50 +00:00
|
|
|
gulp.src(OPTIONS.files.tests, read: false)
|
|
|
|
.pipe(mocha({
|
2014-11-14 17:40:18 +00:00
|
|
|
reporter: mochaNotifierReporter.decorate('landing')
|
2014-10-31 13:50:50 +00:00
|
|
|
}))
|
2014-10-31 13:37:29 +00:00
|
|
|
|
2014-12-30 17:12:18 +00:00
|
|
|
gulp.task 'coffee', [ 'test', 'lint' ], ->
|
2014-12-30 13:44:03 +00:00
|
|
|
gulp.src(OPTIONS.files.app)
|
|
|
|
.pipe(coffee())
|
|
|
|
.pipe(gulp.dest(OPTIONS.directories.build))
|
|
|
|
|
|
|
|
gulp.task 'json', ->
|
|
|
|
gulp.src(OPTIONS.files.json)
|
|
|
|
.pipe(gulp.dest(OPTIONS.directories.build))
|
|
|
|
|
2014-10-31 13:48:53 +00:00
|
|
|
gulp.task 'lint', ->
|
2014-10-31 13:50:50 +00:00
|
|
|
gulp.src(OPTIONS.files.coffee)
|
|
|
|
.pipe(coffeelint({
|
|
|
|
optFile: OPTIONS.config.coffeelint
|
|
|
|
}))
|
|
|
|
.pipe(coffeelint.reporter())
|
2014-10-31 13:48:53 +00:00
|
|
|
|
2014-12-30 17:12:18 +00:00
|
|
|
gulp.task 'release', [ 'coffee', 'json' ], ->
|
|
|
|
mkdirp.sync('build/Release')
|
|
|
|
gulp.src('')
|
|
|
|
.pipe(shell "jx package app.js Release/#{packageJSON.name} -native", {
|
|
|
|
cwd: path.join(process.cwd(), OPTIONS.directories.build)
|
|
|
|
})
|
2014-12-30 13:44:03 +00:00
|
|
|
|
2014-12-24 19:12:31 +00:00
|
|
|
gulp.task 'build', [
|
|
|
|
'lint'
|
|
|
|
'test'
|
|
|
|
'man'
|
|
|
|
]
|
|
|
|
|
2014-10-31 13:48:53 +00:00
|
|
|
gulp.task 'watch', [ 'test', 'lint' ], ->
|
2014-11-19 12:45:40 +00:00
|
|
|
gulp.watch([ OPTIONS.files.coffee, OPTIONS.files.json ], [ 'test', 'lint' ])
|
2014-12-24 19:12:31 +00:00
|
|
|
gulp.watch([ OPTIONS.files.man ], [ 'man' ])
|