MCPcopy
hub / github.com/mgechev/angularjs-in-patterns / genericTask

Function genericTask

gulp/modules/generic-task.js:3–34  ·  view source on GitHub ↗
(lang)

Source from the content-addressed store, hash-verified

1module.exports = function (gulp, markdownpdf, path, log, chalk, rename, TITLE) {
2
3 function genericTask(lang){
4
5 gulp.task('generate:pdf:' + lang, function() {
6
7 var files = ['./temp/*.md'];
8 if (lang === 'eng'){
9 files = './temp/README.md';
10 }
11 else if(lang !== 'all'){
12 files = ['./temp/*-'+lang+'.md'];
13 }
14
15 return gulp.src(files)
16 .pipe(markdownpdf({
17 cwd: path.resolve('./temp/'),
18 layout: 'github'
19 }))
20 .on('error', function(err){
21 log(chalk.red('doc task failed'), err);
22 })
23 .pipe(rename(function (path) {
24 var lang = 'ENG';
25 if(path.basename.indexOf('-') >= 0){
26 lang = path.basename.replace('README-', '').toUpperCase();
27 }
28 path.basename = TITLE + ' ('+lang+')';
29 path.extname = '.pdf';
30 }))
31 .pipe(gulp.dest('./build/'));
32 });
33
34 }
35
36 return genericTask;
37

Callers 1

i18n.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected