-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
53 lines (46 loc) · 1.32 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
var gulp = require('gulp');
var args = require('yargs').argv;
var expand = require('./lib/src/utils/util').expand;
var replace = require('gulp-ext-replace');
var compile = require('./lib/gulp_plugins/compiler');
var jasmine = require('gulp-jasmine');
var exec = require('child_process').exec;
var glob = require('glob');
gulp.task('compile', function() {
var path = expand('specs/${which}.spec', { which: args.spec });
return gulp.src(path)
.pipe(compile())
.pipe(replace('.js'))
.pipe(gulp.dest('lib/scripts'));
});
gulp.task('run', function() {
var cmd = 'slimerjs ${path} --ssl-protocol=any';
var cb = function(e, so, se) {
if (e) console.log(e);
else {
so && console.log(so);
se && console.log(se);
}
};
var path;
if (args.spec) {
path = expand('lib/scripts/${which}.js', { which: args.spec });
exec(expand(cmd, { path: path }), cb);
} else {
glob('lib/scripts/*.js', function(e, files) {
if (e) console.log(e);
else {
files.forEach(function(file) {
exec(expand(cmd, { path: file }), cb);
});
}
});
}
});
gulp.task('jasmine', function() {
var str = 'lib/tests/${which}.js';
var data = { which: args.spec ? args.spec : '*' };
var path = expand(str, data);
return gulp.src(path)
.pipe(jasmine({verbose: true}));
});