forked from mgcrea/angular-strap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
132 lines (122 loc) · 3.88 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
123
124
125
126
127
128
129
130
131
132
'use strict';
/* eslint node:true */
var gulp = require('gulp');
var config = require('ng-factory').use(gulp, {
cdn: true,
src: {
docsViews: '*/docs/{,*/}*.tpl.{html,jade}'
},
bower: {
exclude: /jquery|js\/bootstrap|\.less/
}
});
//
// Tasks
gulp.task('serve', gulp.series('ng:serve'));
var del = require('del');
var path = require('path');
gulp.task('build', gulp.series('ng:build', function afterBuild(done) {
var paths = config.paths;
// Delete useless module.* build files
del(path.join(paths.dest, 'module.*'), done);
}));
gulp.task('pages', gulp.series('ng:pages', function afterPages(done) {
var paths = config.docs;
return gulp.src(['bower_components/highlightjs/styles/github.css'], {cwd: paths.cwd, base: paths.cwd})
.pipe(gulp.dest(paths.dest));
}));
//
// Tests
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
gulp.task('jshint', function() {
var paths = config.paths;
return gulp.src(paths.scripts, {cwd: paths.cwd})
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
var Server = require('karma').Server;
var testTimezone = '';
gulp.task('karma:unit', gulp.series('ng:test/templates', function() {
// if testTimezone has value, set the environment timezone
// before starting karma, so PhantomJS picks up the
// timezone setting
if (testTimezone) {
console.log('Setting timezone to => [' + testTimezone + ']');
process.env.TZ = testTimezone;
}
new Server({
configFile: path.join(__dirname, 'test/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['dots'],
singleRun: true
}, function(code) {
gutil.log('Karma has exited with ' + code);
process.exit(code);
}).start();
}));
gulp.task('karma:server', gulp.series('ng:test/templates', function karmaServer() {
new Server({
configFile: path.join(__dirname, 'test/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['progress'],
autoWatch: true,
singleRun: false
}, function(code) {
gutil.log('Karma has exited with ' + code);
process.exit(code);
}).start();
}));
// codeclimate-test-reporter
gulp.task('karma:travis', gulp.series('ng:test/templates', function karmaTravis() {
new Server({
configFile: path.join(__dirname, 'test/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['dots', 'coverage'],
singleRun: true
}, function(code) {
gutil.log('Karma has exited with ' + code);
process.exit(code);
gulp.src('test/coverage/**/lcov.info')
.pipe(coveralls())
.on('end', function() {
process.exit(code);
});
}).start();
}));
gulp.task('karma:travis~1.2.0', gulp.series('ng:test/templates', function karmaTravis120() {
new Server({
configFile: path.join(__dirname, 'test/~1.2.0/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['dots'],
singleRun: true
}, function(code) {
gutil.log('Karma has exited with ' + code);
process.exit(code);
}).start();
}));
gulp.task('karma:travis~1.3.0', gulp.series('ng:test/templates', function karmaTravis130() {
new Server({
configFile: path.join(__dirname, 'test/~1.3.0/karma.conf.js'),
browsers: ['PhantomJS'],
reporters: ['dots'],
singleRun: true
// autoWatch: true,
// singleRun: false
}, function(code) {
gutil.log('Karma has exited with ' + code);
process.exit(code);
}).start();
}));
gulp.task('test', gulp.series('ng:test/templates', gulp.parallel('jshint', 'karma:unit')));
gulp.task('test:timezone', function() {
// parse command line argument for optional timezone
// invoke like this:
// gulp test:timezone --Europe/Paris
var timezone = process.argv[3] || '';
testTimezone = timezone.replace(/-/g, '');
return gulp.series('ng:test/templates', gulp.parallel('jshint', 'karma:unit'));
});
gulp.task('test:server', gulp.series('ng:test/templates', 'karma:server'));
gulp.task('default', gulp.task('build'));