var dep = new Dependency(name, dependency);
var bower = [];
var bowerExclude = this.bowerExclude(dependencies);
if (dependency.bower) {
bower = bower.concat(
this.filterByType(
this.filterByPackage(bowerFiles, dependency.bower),
type
)
);
} else {
if (dependency.main) {
bower = bower.concat(
this.filterByType(
this.rejectByPackage(bowerFiles, bowerExclude),
type
)
);
}
}
dep.prependGlobs(bower);
result.push(dep);
}, [], this);
return outputFiles;
};
buildGlobs.prototype.filterByPackage = function(files, names, reject) {
var method = reject ? 'reject' : 'filter';
if (!_.isArray(names)) {
names = [names];
}
return _[method](files, function(file) {
return _.some(names, function(name) {
return file.indexOf(
path.normalize('/bower_components/' + name + '/')
) > -1;
});
});
};
buildGlobs.prototype.rejectByPackage = function(files, names) {
return buildGlobs.prototype.filterByPackage(files, names, true);
};
buildGlobs.prototype.filterByType = function(files, type) {
return _.filter(files, minimatch.filter(types[type], {matchBase: true}));
};
buildGlobs.prototype.bowerExclude = function(dependencies) {