-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (54 loc) · 1.29 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict';
var gulp = require('gulp'),
webpack = require('gulp-webpack'),
jshint = require('gulp-jshint'),
shell = require('gulp-shell');
gulp.task('default',
['serve']
);
gulp.task('compile-js',
function() {
var webpackConfig = require('./webpack.config.js');
return gulp.src(webpackConfig.entry)
.pipe(webpack(webpackConfig))
.pipe(gulp.dest('./'));
}
);
gulp.task('serve',
['compile-js'],
shell.task('sudo node app/main.js')
);
gulp.task('lint',
function() {
return gulp.src('app/**/*.js')
.pipe(jshint())
.pipe(
jshint.reporter(
'default',
{ verbose: true }
)
);
}
);
gulp.task('test',
['lint'],
shell.task('npm run test')
);
gulp.task('test-coverage',
shell.task('npm run coverage')
);
gulp.task('init-database',
function() {
var fs = require('fs');
var file = 'databases/charts.sqlite';
var exists = fs.existsSync(file);
if (exists === false) {
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(file);
db.serialize(function() {
db.run('CREATE TABLE "charts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE , "date" DATE, "time" TIME, "sensor" INTEGER NOT NULL DEFAULT 0)');
});
db.close();
}
}
);