Update JSON API
[src/app-framework-demo.git] / afm-client / bower_components / angular-ui-notification / gulpfile.js
1 var gulp = require('gulp');
2 var less = require('gulp-less');
3 var minifyCSS = require('gulp-minify-css');
4 var csscomb = require('gulp-csscomb');
5 var ngAnnotate = require('gulp-ng-annotate');
6 var uglify = require('gulp-uglify');
7 var jshint = require('gulp-jshint');
8 var rename = require('gulp-rename');
9 var header = require('gulp-header');
10 var templateCache = require('gulp-angular-templatecache');
11 var minifyHtml = require("gulp-minify-html");
12 var concat = require('gulp-concat');
13 var addsrc = require('gulp-add-src');
14 var order = require("gulp-order");
15 var protractor = require("gulp-protractor").protractor;
16
17 var pkg = require('./package.json');
18 var banner = ['/**',
19   ' * <%= pkg.name %> - <%= pkg.description %>',
20   ' * @author <%= pkg.author %>',
21   ' * @version v<%= pkg.version %>',
22   ' * @link <%= pkg.homepage %>',
23   ' * @license <%= pkg.license %>',
24   ' */',
25   ''].join('\n');
26
27   // ==== Styles
28 gulp.task('styles', function() {
29     gulp.src('src/angular-ui-notification.less')
30         .pipe(less({
31             strictMath: true
32         }))
33         .pipe(csscomb())
34         .pipe(minifyCSS())
35         .pipe(rename({
36             suffix: '.min'
37         }))
38         .pipe(header(banner, { pkg : pkg }))
39         .pipe(gulp.dest('dist'))
40         .pipe(gulp.dest('demo'));
41 });
42
43 // ====== Templates
44 gulp.task('templates', function() {
45     gulp.src(['*.html'], {cwd: 'src'})
46         .pipe(minifyHtml({
47             empty: true,
48             spare: true,
49             quotes: true
50         }))
51         .pipe(templateCache({
52             module: 'ui-notification',
53         }))
54         .pipe(rename('angular-ui-notification.templates.js'))
55         .pipe(gulp.dest("build"));
56 });
57
58 gulp.task('service', function() {
59     gulp.src(['src/*.js'])
60         .pipe(jshint())
61         .pipe(jshint.reporter('default'))
62         .pipe(jshint.reporter('fail'))
63         .pipe(ngAnnotate())
64         .pipe(addsrc('build/*.js'))
65         .pipe(order([
66             'src/*.js',
67             'build/angular-ui-notification.templates.js'
68         ]))
69         .pipe(concat('angular-ui-notification.js'))
70         .pipe(uglify())
71         .pipe(rename({
72             suffix: '.min'
73         }))
74         .pipe(header(banner, { pkg : pkg }))
75         .pipe(gulp.dest('dist'))
76         .pipe(gulp.dest('demo'));
77 });
78
79 // ======
80 gulp.task('e2eTest', function() {
81     gulp.src(['./test/**/*_spec.js'])
82         .pipe(protractor({
83             configFile: "protractor_conf.js",
84         }))
85         .on('error', function(e) {throw e});
86 });
87
88 gulp.task('tests', ['e2eTest']);
89 gulp.task('build', ['templates', 'service', 'styles']);
90 gulp.task('deploy', ['build', 'tests']);
91
92 gulp.task('default', ['deploy'], function() {});