2015-06-04 16:44:08 +00: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 15:13:10 +00:00
|
|
|
var normalizePath = require('../lib/normalize-path');
|
2015-06-04 16:44:08 +00: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 15:13:10 +00:00
|
|
|
filePath.dirname = normalizePath(filePath.dirname).replace(
|
2015-06-04 16:44:08 +00: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 11:36:34 +00:00
|
|
|
module.exports = simpleCopyTask;
|