Source: tasks/javascript/timestamp.js

'use strict';

/**
 * @module tasks/javascript/timestamp
 */

/**
 * taskFactory
 * @param sources {Array} glob
 * @param options {Object} glob
 * @returns {Function}
 * gulp stream
 */
module.exports = function taskFactory (sources, options) {

    return function task () {

        var gulp = require('gulp');
        var header = require('gulp-header');
        var headerComment = '/*Generated on:' + new Date() + '*/';
        var destinationsHelper = require('../helpers/build-destinations');
        var destination;

        if (options && options.destination) {
            destination = options.destination;
        }

        return gulp.src(sources)
            .pipe(header(headerComment))
            .pipe(gulp.dest(function (file) {
                return destinationsHelper.getDestination(file.base, destination);
            }));
    };
};