2014-03-24 08:34:59 +01:00
|
|
|
var pkg = require("./package.json")
|
|
|
|
|
, gulp = require("gulp")
|
|
|
|
|
, plumber = require("gulp-plumber")
|
|
|
|
|
|
|
|
|
|
///
|
2014-04-03 07:07:34 +02:00
|
|
|
// JS Lint
|
2014-03-24 08:34:59 +01:00
|
|
|
///
|
|
|
|
|
var jshint = require("gulp-jshint")
|
2014-04-03 07:07:34 +02:00
|
|
|
, jsonFiles = [".jshintrc", "*.json"]
|
|
|
|
|
, jsFiles = ["*.js", "src/**/*.js"]
|
2014-03-24 08:34:59 +01:00
|
|
|
gulp.task("scripts.lint", function() {
|
2014-04-03 07:07:34 +02:00
|
|
|
gulp.src([].concat(jsonFiles).concat(jsFiles))
|
2014-03-24 08:34:59 +01:00
|
|
|
.pipe(plumber())
|
|
|
|
|
.pipe(jshint(".jshintrc"))
|
|
|
|
|
.pipe(jshint.reporter("jshint-stylish"))
|
|
|
|
|
})
|
|
|
|
|
|
2014-04-03 07:07:34 +02:00
|
|
|
///
|
|
|
|
|
// JS Code Sniffing
|
|
|
|
|
///
|
2014-03-24 08:34:59 +01:00
|
|
|
var jscs = require("gulp-jscs")
|
|
|
|
|
gulp.task("scripts.cs", function() {
|
2014-04-03 07:07:34 +02:00
|
|
|
gulp.src(jsFiles)
|
2014-03-24 08:34:59 +01:00
|
|
|
.pipe(plumber())
|
|
|
|
|
.pipe(jscs())
|
|
|
|
|
})
|
|
|
|
|
|
2014-04-03 07:07:34 +02:00
|
|
|
// JS Alias
|
2014-03-24 08:34:59 +01:00
|
|
|
gulp.task("scripts", ["scripts.lint", "scripts.cs"])
|
|
|
|
|
|
2014-04-03 07:07:34 +02:00
|
|
|
///
|
|
|
|
|
// Watch
|
|
|
|
|
///
|
2014-03-24 08:34:59 +01:00
|
|
|
gulp.task("watch", function() {
|
2014-04-03 07:07:34 +02:00
|
|
|
gulp.watch(jsFiles, ["scripts"])
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
// Publish gh-branch
|
|
|
|
|
///
|
|
|
|
|
var buildBranch = require("buildbranch")
|
|
|
|
|
gulp.task("publish", ["test"], function(cb) {
|
|
|
|
|
buildBranch({folder: "src"}
|
|
|
|
|
, function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
throw err
|
|
|
|
|
}
|
|
|
|
|
console.log(pkg.name + " published.")
|
|
|
|
|
cb()
|
|
|
|
|
})
|
2014-03-24 08:34:59 +01:00
|
|
|
})
|
|
|
|
|
|
2014-04-03 07:07:34 +02:00
|
|
|
// Aliases
|
|
|
|
|
gulp.task("build", ["scripts"])
|
|
|
|
|
gulp.task("test", ["build"])
|
|
|
|
|
gulp.task("default", ["test", "watch"])
|