Adding missing instructions to load missing Apache2 modules for Fidelius to work!
[iotcloud.git] / version1 / src / js / iotjs / gulpfile.js
1 var gulp = require('gulp');
2 var gulpif = require('gulp-if');
3 var clean = require('gulp-clean');
4 var order = require('gulp-order');
5 var rename = require('gulp-rename');
6 var concat = require('gulp-concat');
7 var jshint = require('gulp-jshint');
8 var uglify = require('gulp-uglify');
9 var stylish = require('jshint-stylish');
10 var livereload = require('gulp-livereload');
11 var sourcemaps = require('gulp-sourcemaps');
12 var flags = require('minimist')(process.argv.slice(2));
13
14 // Gulp command line arguments
15 var production = flags.production || false;
16 var debug = flags.debug || !production;
17 var watch = flags.watch;
18
19 gulp.task('build',  ['clean'], function() {
20   // Single entry point to browserify
21   gulp.src(['src/*.js', 'vendor/*.js'])
22       .pipe(order([ // The order of concatenation
23         'src/main.js'
24       ], {base: '.'}))
25       .pipe(gulpif(debug, sourcemaps.init()))
26       .pipe(gulpif(production, uglify()))
27       .pipe(concat('iotjs.js'))
28       .pipe(gulpif(debug, sourcemaps.write()))
29       .pipe(gulp.dest('./build/'))
30       .pipe(gulpif(watch, livereload()));
31 });
32
33 gulp.task('lint', function() {
34   return gulp.src('src/*.js')
35     .pipe(jshint())
36     .pipe(jshint.reporter(stylish))
37 });
38
39 gulp.task('clean', function() {
40    return gulp.src(['./build'], {read: false})
41           .pipe(clean({force: true}));
42 });
43
44 gulp.task('watch', function() {
45   livereload.listen();
46   gulp.watch('src/*', ['lint', 'build']);
47 });
48
49 gulp.task('default', ['clean', 'lint', 'build']);