UNPKG

skinjs

Version:

skinjs is an AOP and COP (Contract Oriented Programming ) library which enables to create a more error prone and clean code

76 lines (66 loc) 2.13 kB
var gulp = require('gulp'); var args = require('yargs').argv; var config = require('./gulp.config')(); var del = require('del'); var path = require('path'); var $ = require('gulp-load-plugins')({lazy: true}); var port = process.env.PORT || config.defaultPort; gulp.task('help', $.taskListing); gulp.task('default', ['help']); gulp.task('vet', function () { log('Analyzing source with JSHint'); return gulp .src(config.alljs) .pipe($.if(args.verbose, $.print())) //.pipe($.jscs()) .pipe($.jshint()) .pipe($.jshint.reporter('jshint-stylish', {verbose: true})) .pipe($.jshint.reporter('fail')); }); /** * Bump the version * --type=pre will bump the prerelease version *.*.*-x * --type=patch or no flag will bump the patch version *.*.x * --type=minor will bump the minor version *.x.* * --type=major will bump the major version x.*.* * --version=1.2.3 will bump to a specific version and ignore other flags */ gulp.task('bump', function () { var msg = 'Bumping versions'; var type = args.type; var version = args.version; var options = {}; if (version) { options.version = version; msg += ' to ' + version; } else { options.type = type; msg += ' for a ' + type; } log(msg); return gulp .src(config.packages) .pipe($.print()) .pipe($.bump(options)) .pipe(gulp.dest(config.root)); }); gulp.task('test', ['vet'], function(done) { return gulp.src('./test/**/*.spec.js', {read: false}) // gulp-mocha needs filepaths so you can't have any plugins before it .pipe($.mocha(config.mocha)); }); function clean(path, done) { log('Cleaning: ' + $.util.colors.blue(path)); del(path, done); } function log(msg) { if (typeof(msg) === 'object') { for (var item in msg) { if (msg.hasOwnProperty(item)) { $.util.log($.util.colors.blue(msg[item])); } } } else { $.util.log($.util.colors.blue(msg)); } }