forked from arvindr21/generator-bangular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
91 lines (78 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
88
89
90
91
var gulp = require('gulp'),
chalk = require('chalk'),
spritesmith = require('gulp.spritesmith'),
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs'),
jscsStylish = require('gulp-jscs-stylish'),
fs = require('fs');
gulp.task('default', ['control']);
gulp.task('logos', function (done) {
log('Building logos sprite ...');
log('Done');
gulp.src([
'logos/yeoman.png',
'logos/gulp.png',
'logos/angular.png',
'logos/node.png',
'logos/socket.png',
'logos/passport.png',
'logos/express.png',
'logos/mongo.png',
'logos/sass.png',
'logos/karma.png',
'logos/protractor.png',
'logos/jscs.png',
'logos/bower.png'
])
.pipe(spritesmith({
imgName : 'logos-sprite.png',
cssName : 'sprite.css',
algorithm : 'left-right',
algorithmOpts : { sort: false },
padding : 10
}))
.pipe(gulp.dest('logos/'))
.on('end', function () {
fs.unlinkSync('logos/sprite.css');
done();
});
});
gulp.task('control', function (done) {
var paths = [
'!./node_modules/**',
'!./**/templates/**/index.js',
'./**/index.js',
'./test/*.js',
'!./test/mock/**'
];
gulp.src(paths)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.on('finish', function () {
gulp.src(paths)
.pipe(jscs())
.on('error', function () {})
.pipe(jscsStylish())
.on('end', done);
});
});
gulp.task('changelog', function (done) {
require('conventional-changelog')({
repository: 'https://github.com/42Zavattas/generator-bangular',
version: require('./package.json').version,
from: '0.10.2',
to: '0.11.0'
}, function (err, log) {
fs.writeFile('CHANGELOG.md', log, done);
});
});
// utils
// =====
function log (str) {
console.log(chalk.blue(' >>> [ ') + chalk.green(pad(str, 30, ' ')) + chalk.blue(' ]'));
}
function pad (n, w, z) {
z = z || '0';
n = n + '';
return n.length >= w ? n : n + new Array(w - n.length + 1).join(z);
}