docs: function files(specs, category) {
          var ret = [];
          var src, dst, file;
          var i, j, k;
          var ignoreDirs = cog.getOption('ignore_dirs');
  
          if (specs) {
              if (typeof(specs) === 'string') {
                  // Handle known file collections.
                  if (db.known[category] && specs in db.known[category]) {
                      var spec = db.known[category][specs];
                      spec.required = true;
                      ret = ret.concat(files(spec, category));
                  // All strings containing non-alpha characters are direct file patterns.
                  } else if (/[^a-zA-Z]/.test(specs) || fs.existsSync(specs)) {
                      src = grunt.file.expand(specs);
                      for (i=0; i < src.length; i++) {
                          var skip = false;
                          if (ignoreDirs) {
                              for (k=0; k < ignoreDirs.length; k++) {
                                  if (src[i].substr(0, ignoreDirs[k].length) === ignoreDirs[k]) {
                                      skip = true;
                                      break;
                                  }
                              }
                          }
                          if (!skip && !grunt.file.isDir(src[i])) {
                              ret.push({src: src[i], dst: src[i], drop: ''});
                          }
                      }
                  } else {
                      grunt.fail.fatal("Unknown build file specification '" + specs +"' for '" + category + "'.");
                  }
              } else if (specs instanceof Array) {
                  // Handle array of specs one by one.
                  for (i = 0; i < specs.length; i++) {
                      ret = ret.concat(files(specs[i], category));
                  }
              } else if (typeof(specs) === 'object') {
  
                  // Collect dependencies.
                  if (specs.needs) {
                      ret = files(specs.needs, category);
                  }
  
                  // Calculate path prefix for file sources.
                  var srcPrefix = '';
                  if (specs.src.substr(0,12) === 'node_modules') {
                      srcPrefix = cog.prefix(specs.src);
                      if (srcPrefix.substr(-13) === 'node_modules/') {
                          srcPrefix = srcPrefix.substr(0, srcPrefix.length - 13);
                      }
                  }
  
                  // Here we expand pattens from 'src' and combine them with 'dst'.
                  src = grunt.file.expand(srcPrefix + specs.src);
  
                  // Check required files.
                  if (src.length === 0 && specs.required) {
                      grunt.fail.fatal("Cannot find required files '" + specs.src + "'.");
                  }
  
                  // Calculate resulting specifications.
                  for (j=0; j < src.length; j++) {
                      var drop = specs.drop;
                      if (!drop && drop !=='') {
                          // If dst is null, then we keep the file where it is originally.
                          if (specs.dst === null) {
                              drop = '';
                          } else {
                              // Otherwise look for the last directory not having wild-cards.
                              drop = specs.src;
                              while (drop.indexOf('*') >= 0) {
                                  drop = path.dirname(drop);
                              }
                          }
                      }
  
                      // Construct final file description.
                      file = {};
                      // Use source path as is and we can skip directories.
                      file.src = src[j];
                      if (grunt.file.isDir(file.src)) {
                          continue;
                      }
  
                      // Destination path is calculated.
                      var dstPrefix = specs.dst === null ? srcPrefix : specs.dst;
                      if (dstPrefix.substr(0, 7) === 'CONFIG:') {
                          dstPrefix = cog.getConfig(dstPrefix.substr(7), 'lib');
                      }
  
                      // Drop source prefix.
                      dst = src[j].substr(srcPrefix.length);
                      // Drop explicit dropping.
                      if (dst.substr(0, drop.length) === drop) {
                          dst = dst.substr(drop.length);
                      }
  
                      // Add explicit destination.
                      file.dst = path.join(dstPrefix, dst);
  
                      ret.push(file);
                  }
              }
          }
  
          // Drop duplicates.
          var seen = {};
          var results = [];
          for(i=0; i < ret.length; i++) {
              var name = ret[i].src + ' => ' + ret[i].dst;
              if (seen[name]) {
                  continue;
              }
              seen[name] = true;
              results.push(ret[i]);
          }
          return results;
      }