1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | var combiner = require('stream-combiner2');
|
8 | var moment = require('moment');
|
9 |
|
10 | module.exports = function(gulp, $, conf) {
|
11 |
|
12 |
|
13 | gulp.task('pack', function() {
|
14 | var version = $.util.env.v ? $.util.env.v : moment().format('YYMMDDHHmm');
|
15 | var packageName = [conf.name, version].join('_');
|
16 |
|
17 | var combined = combiner.obj([
|
18 | gulp.src([
|
19 | conf.parsePwd([conf.dist, '/**/*'].join(''))
|
20 | ]),
|
21 | $.zip([packageName, 'zip'].join('.')),
|
22 | gulp.dest(conf.parsePwd(conf.package))
|
23 | ]);
|
24 |
|
25 | combined.on('error', console.error.bind(console));
|
26 |
|
27 | combined.on('end', function() {
|
28 | $.util.log(['Package Success: ', packageName, '.zip has been created on ', conf.package].join(''));
|
29 | });
|
30 |
|
31 | return combined;
|
32 | });
|
33 | }
|