betajs/betajs-compile

View on GitHub
grunt/multicopy.js

Summary

Maintainability
A
0 mins
Test Coverage
module.exports = function (taskname, files) {
    this.grunt.loadNpmTasks('grunt-contrib-copy');
    taskname = taskname || "multicopy";
    var mapped = [];
    var process = function (target, source) {
        var sourcePath = source.split("/");
        var sourceFile = sourcePath.pop();
        sourcePath = sourcePath.join("/");
        mapped.push({
            expand: true,
            cwd: sourcePath,
            src: sourceFile,
            dest: target
        });
    };
    for (var source in files)
        process(files[source], source);
    return this.registerTask(taskname, [
        this.addConfigTask("copy", taskname, {
            files: mapped
        })
    ]);
};