Add tests for RefTable
[tech-radar.git] / gulpfile.js
1 var gulp = require('gulp')
2 , pkg = require('./package.json')
3 , gutil = require('gulp-util')
4 , gkarma = require('gulp-karma')
5 , sass = require('gulp-sass')
6 , concat = require('gulp-concat')
7 , uglify = require('gulp-uglify')
8 , clean = require('gulp-clean')
9 , header = require('gulp-header')
10 , files;
11
12
13 banner = [
14 '/**',
15 ' * <%= pkg.name %>',
16 ' * @version v<%= pkg.version %>',
17 ' */',
18 ''
19 ].join('\n');
20
21 files = {
22 LIB: 'bower_components/d3/*.min.js',
23 NS: 'src/namespaces.js',
24 SOURCE: 'src/**/*.js',
25 SPEC: 'test/**/*-spec.js',
26 STYLESHEETS: 'src/stylesheets/**/*.scss'
27 };
28
29 gulp.task('sass', function () {
30 gulp.src(files.STYLESHEETS)
31 .pipe(sass())
32 .pipe(gulp.dest('./dist/'));
33 });
34
35 gulp.task('concat', function () {
36 gulp.src([files.NS, files.SOURCE])
37 .pipe(concat('tech-radar.js'))
38 .pipe(header(banner, { pkg: pkg }))
39 .pipe(gulp.dest('./dist/'));
40 });
41 var clean = require('gulp-clean');
42
43 gulp.task('clean', function() {
44 gulp.src('./dist/', {read: false})
45 .pipe(clean({force: true}));
46 });
47
48 gulp.task('compress', function() {
49 gulp.src([files.NS, files.SOURCE])
50 .pipe(concat('tech-radar.min.js'))
51 .pipe(uglify({outSourceMap: true}))
52 .pipe(header(banner, { pkg: pkg }))
53 .pipe(gulp.dest('./dist/'))
54 });
55
56 gulp.task('dist', ['clean', 'concat', 'compress', 'sass']);
57
58 gulp.task('test', function (){
59 var karma;
60
61 karma = gkarma({
62 configFile: 'karma.conf.js',
63 action: 'run'
64 });
65
66 return gulp.src(
67 [files.LIB, files.NS, files.SOURCE, files.SPEC]
68 ).pipe(karma);
69 });