Skip to content

Commit

Permalink
Making a few tweaks to the normalized this.files object.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy committed Oct 1, 2012
1 parent fb506d2 commit 6ddcb31
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/grunt/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ task.normalizeMultiTaskFiles = function(data, target) {
if (grunt.util.kindOf(data) === 'object') {
if ('src' in data || 'dest' in data) {
obj = {};
if ('src' in data) { obj.src = data.src; }
if ('dest' in data) { obj.dest = data.dest; }
for (prop in data) {
if (prop !== 'options') {
obj[prop] = data[prop];
}
}
files.push(obj);
} else if (grunt.util.kindOf(data.files) === 'object') {
for (prop in data.files) {
Expand All @@ -111,7 +114,7 @@ task.normalizeMultiTaskFiles = function(data, target) {
});
}
} else {
files.push({src: data, dest: target});
files.push({src: Array.isArray(data) ? data : [data], dest: target});
}

// Process each normalized file object as a template.
Expand Down Expand Up @@ -157,9 +160,10 @@ task.registerMultiTask = function(name, info, fn) {
// Return an options object with the specified defaults overriden by task-
// and/or target-specific overrides, via the "options" property.
this.options = function() {
var targetObj = grunt.config([name, target]);
var args = [{}].concat(grunt.util.toArray(arguments)).concat([
grunt.config([name, 'options']),
grunt.config([name, target, 'options'])
grunt.util.kindOf(targetObj) === 'object' ? targetObj.options : {}
]);
return grunt.util._.extend.apply(null, args);
};
Expand Down

0 comments on commit 6ddcb31

Please sign in to comment.