-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
122 lines (108 loc) · 2.8 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
var gulp = require('gulp');
var broweserify = require('browserify');
var uglify = require('gulp-uglify');
var source = require('vinyl-source-stream');
var del = require('del');
var karma = require('gulp-karma');
var serve = require('gulp-serve');
var shell = require('gulp-shell');
gulp.task('clean', function(cb) {
del(['build'], cb);
});
gulp.task('build', ['clean'], function() {
return broweserify('./src/lookie.js').bundle().
pipe(source('lookie.js')).
pipe(gulp.dest('./build/'));
});
gulp.task('compile', ['build'], function() {
return gulp.src('build/*.js').
pipe(uglify()).
pipe(gulp.dest('.'));
});
gulp.task('test', ['compile'], function() {
return gulp.src('test/*.js').
pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
})).
on('error', function(err) {
throw err;
});
});
gulp.task('ci-modern', ['test'], function() {
return gulp.src('test/*.js').
pipe(karma({
configFile: 'karma.conf-ci.js',
browsers: ['SL_Chrome_Mac', 'SL_Firefox_Mac', 'SL_Safari_7'],
action: 'run'
})).
on('error', function(err) {
throw err;
});
});
gulp.task('ci-ie-modern', ['ci-modern'], function() {
return gulp.src('test/*.js').
pipe(karma({
configFile: 'karma.conf-ci.js',
browsers: ['SL_IE_9', 'SL_IE_10', 'SL_IE_11'],
action: 'run'
})).
on('error', function(err) {
throw err;
});
});
gulp.task('ci-ie-legacy', ['ci-ie-modern'], function() {
return gulp.src('test/*.js').
pipe(karma({
configFile: 'karma.conf-ci.js',
browsers: ['SL_IE_7', 'SL_IE_8'],
action: 'run'
})).
on('error', function(err) {
throw err;
});
});
gulp.task('ci-mobile', ['ci-ie-legacy'], function() {
return gulp.src('test/*.js').
pipe(karma({
configFile: 'karma.conf-ci.js',
browsers: ['SL_iOS_7', 'SL_Android_4_4'],
action: 'run'
})).
on('error', function(err) {
throw err;
});
});
gulp.task('ci-opera', ['ci-mobile'], function() {
return gulp.src('test/*.js').
pipe(karma({
configFile: 'karma.conf-ci.js',
browsers: ['SL_Opera'],
action: 'run'
})).
on('error', function(err) {
throw err;
});
});
if(process.env.TRAVIS_PULL_REQUEST == 'false') {
gulp.task('ci', ['test', 'ci-modern', 'ci-ie-modern', 'ci-ie-legacy', 'ci-mobile', 'ci-opera']);
} else {
gulp.task('ci', ['test']);
};
gulp.task('serve', ['compile'], serve({
root: __dirname,
port: 8080
}));
gulp.task('open', shell.task([
'open "http://localhost:8080/example/index.html"'
]));
gulp.task('watch', ['compile'], function() {
gulp.watch('src/*.js', ['compile']);
gulp.src('test/*.js').
pipe(karma({
configFile: 'karma.conf.js',
action: 'watch'
}));
});
gulp.task('example', ['serve', 'open']);
gulp.task('default', ['watch']);