-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
80 lines (68 loc) · 2.16 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
/* jshint node: true */
var gulp = require('gulp')
, concat = require('gulp-concat')
, sourcemaps = require('gulp-sourcemaps')
, uglify = require('gulp-uglify')
, newer = require('gulp-newer')
, jshint = require('gulp-jshint')
, config = require('./gulp.config.js')
, unzip = require('gulp-unzip')
, rename = require('gulp-rename')
, shell = require('gulp-shell')
, del = require('del');
//TASKS DEFINITION
gulp.task('clean', function (cb)
{
del([config.outputPath + '/*'], cb);
});
gulp.task('build-concat', ['clean'], function ()
{
config = require('./gulp.config.js');
return gulp.src(config.javascriptFiles)
.pipe(newer(config.outputPath +'/'+ config.packageFileName))
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(sourcemaps.init())
.pipe(concat(config.packageFileName))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(config.outputPath));
});
gulp.task('build', ['clean'], function ()
{
return gulp.src(config.javascriptFiles)
.pipe(concat(config.packageFileNameMin))
.pipe(jshint())
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write('./'))
//ADD TESTS HERE TOO!
.pipe(gulp.dest(config.outputPath));
});
gulp.task('gen-tests', ['clean'], function ()
{
config = require('./gulp.config.js');
return gulp.src(config.specFiles)
.pipe(newer(config.outputPath +'/'+ config.specsContainer))
.pipe(concat(config.specsContainer))
.pipe(gulp.dest(config.outputPath));
});
gulp.task('default', ['build-concat', 'gen-tests'], function ()
{
gulp.watch(config.allFiles, ['build-concat', 'gen-tests']);
});
gulp.task('install-jasmine', ['install-bower'], function ()
{
var jasmine_path = 'bower_components/jasmine/dist/jasmine-standalone-2.0.0.zip';
return gulp.src(jasmine_path)
.pipe(unzip({
filter : function(entry)
{
return !!(/lib\/jasmine.+\/.+/.test(entry.path));
}
}))
.pipe(rename({
dirname: '/lib/jasmine'
}))
.pipe(gulp.dest('.'));
});
gulp.task('install-bower', shell.task(['bower install']));