Fix for no target configs

This commit is contained in:
Kyle Robinson Young 2014-03-19 12:30:53 -07:00
parent c92448d418
commit e140e1a997

View File

@ -17,6 +17,9 @@ var async = require('async');
// Track which targets to run after reload // Track which targets to run after reload
var reloadTargets = []; var reloadTargets = [];
// A default target name for config where targets are not used (keep this unique)
var defaultTargetName = '_$_default_$_';
module.exports = function(grunt) { module.exports = function(grunt) {
var TaskRun = require('./taskrun')(grunt); var TaskRun = require('./taskrun')(grunt);
@ -130,7 +133,7 @@ module.exports = function(grunt) {
var cfg = { var cfg = {
files: config.files, files: config.files,
tasks: config.tasks, tasks: config.tasks,
name: 'default', name: defaultTargetName,
options: self._options(config.options || {}, self.options), options: self._options(config.options || {}, self.options),
}; };
targets.push(cfg); targets.push(cfg);
@ -223,7 +226,10 @@ module.exports = function(grunt) {
// Private method for getting latest config for a watch target // Private method for getting latest config for a watch target
target._getConfig = function(name) { target._getConfig = function(name) {
return grunt.config([self.name, target.name, name || '']); var cfgPath = [self.name];
if (target.name !== defaultTargetName) { cfgPath.push(target.name); }
if (name) { cfgPath.push(name); }
return grunt.config(cfgPath);
}; };
// Create a new TaskRun instance // Create a new TaskRun instance