Load tasks from gulpfiles specified by the file `pattern`.
@param {string|array} pattern - A gulp-style file pattern to glob gulpfiles
function loadFiles(pattern, rootDir) {    
    // assert `pattern` is a valid glob (non-empty string) or array of globs
    var isString = typeof pattern === 'string';
    var isArray = Array.isArray(pattern);
    if ((!isString && !isArray) || (pattern.length === 0)) {
        throw new TypeError('A glob pattern or an array of glob patterns is required.');
    }

    // find all the gulpfiles - needs to happen synchronously so we create the tasks before gulp runs
    var filelist = resolveGlob(pattern, rootDir)
        .map(function(filename) {
            return path.relative(process.cwd(), path.join(rootDir, filename));
        });

    var subfiles = getSubfiles(filelist);

    // load all the gulpfiles
    subfiles.forEach(function (subfile) {
        util.log( 'Loading', util.colors.yellow(subfile.relativePath));
        loadSubfile(subfile, tasks);
    });
}