-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
87 lines (76 loc) · 2.04 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
"use strict";
/*jshint node: true */
/* global concat: true */
// ************************
// * Rise Vision Store UI *
// * build script *
// ************************
// Include gulp
var gulp = require("gulp"),
// Include Our Plugins
karma = require("gulp-karma"),
jshint = require("gulp-jshint"),
watch = require("gulp-watch"),
connect = require("gulp-connect"),
httpServer,
//Test files
testFiles = [
"components/jQuery/dist/jquery.js",
"components/q/q.js",
"components/angular/angular.js",
"components/angular-route/angular-route.js",
"components/angular-mocks/angular-mocks.js",
"components/angular-spinner/angular-spinner.js",
"components/spin.js/spin.js",
"components/spin.js/jquery.spin.js",
"loading.js",
"tests.js"
],
filesToLint = [
"loading.js",
"tests.js"
];
gulp.task("lint", function() {
return gulp.src(filesToLint)
.pipe(jshint())
.pipe(jshint.reporter("jshint-stylish"))
.pipe(jshint.reporter("fail"))
.on("error", function () {
process.exit(1);
});
});
gulp.task("watch", function() {
return gulp.watch(filesToLint, ["lint"]);
});
gulp.task("test", function() {
// Be sure to return the stream
return gulp.src(testFiles).pipe(
watch(function(files) {
return files.pipe(karma({
configFile: "karma.conf.js",
action: "start"
}))
.on("error", function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
}));
});
gulp.task("server", function() {
httpServer = connect.server({
root: "./",
port: 8000,
livereload: true
});
return httpServer;
});
gulp.task("default", [], function () {
console.log("\n***********************");
console.log("* Tell me what to do: *");
console.log("***********************");
console.log("* gulp lint *");
console.log("* gulp watch *");
console.log("* gulp test *");
console.log("***********************\n");
return true;
});