2015-06-04 18:44:08 +02:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var rename = require('gulp-rename');
|
|
|
|
var gutil = require('gulp-util');
|
|
|
|
var path = require('path');
|
|
|
|
var config = require('../config');
|
2016-01-14 16:13:10 +01:00
|
|
|
var normalizePath = require('../lib/normalize-path');
|
2015-06-04 18:44:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Simple copy task - just copoes files from the source to the destination,
|
|
|
|
* with no compilation, minification, or other intelligence
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
var renameSrcToDest = function() {
|
|
|
|
return rename(function(filePath) {
|
2016-01-14 16:13:10 +01:00
|
|
|
filePath.dirname = normalizePath(filePath.dirname).replace(
|
2015-06-04 18:44:08 +02:00
|
|
|
'/' + config.srcDir + '/',
|
|
|
|
'/' + config.destDir + '/');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var simpleCopyTask = function(glob) {
|
|
|
|
return function() {
|
|
|
|
var sources = config.apps.map(function(app) {
|
|
|
|
return path.join(app.sourceFiles, app.appName, glob);
|
|
|
|
});
|
|
|
|
|
|
|
|
return gulp.src(sources, {base: '.'})
|
|
|
|
.pipe(renameSrcToDest())
|
|
|
|
.pipe(gulp.dest('.'))
|
|
|
|
.on('error', gutil.log);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-07-09 13:36:34 +02:00
|
|
|
module.exports = simpleCopyTask;
|