-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
65 lines (56 loc) · 1.49 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
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
mocha = require('gulp-mocha'),
shell = require('gulp-shell');
nodemon = require('gulp-nodemon'),
open = require('gulp-open');
var paths = {
scripts: ['server/**/*.js'],
specs: ['specs/*.js'],
client: ['']
}
gulp.task('serverBuild', ['lint','test']);
gulp.task('default',['serverBuild', 'dbConnect', 'nodemon']);
gulp.task('lint', function(){
return gulp.src(paths.scripts)
.pipe(plumber())
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(notify({message: 'Lint done'}));
});
gulp.task('test',function(){
return gulp.src(paths.specs)
.pipe(mocha());
});
gulp.task('dbConnect',function(){
return gulp.src('*.js', {read: false})
.pipe(shell([
'mongod'
]));
});
gulp.task('nodemon',function(){
nodemon({script:'server.js'})
.on('restart', 'serverBuild')
});
gulp.task('view',function(){
var options = {
url: 'http://localhost:8080',
app: 'google chrome'
}
gulp.src('server.js')
.pipe(open('',options))
});
gulp.task('emulateIOS',function(){
return gulp.src(paths.client)
.pipe(shell([
'cd client && ionic platform ios && ionic build ios && ionic emulate ios'
]));
});
gulp.task('emulateAndroid',function(){
return gulp.src(paths.client)
.pipe(shell([
'cd client && ionic platform android && ionic build android && ionic emulate android'
]));
});