Merge branch 'master' into develop

This commit is contained in:
Julian Lam
2017-02-23 12:32:03 -05:00
51 changed files with 1297 additions and 771 deletions

View File

@@ -39,6 +39,7 @@ module.exports = function (Plugins) {
Plugins.lessFiles.length = 0;
Plugins.clientScripts.length = 0;
Plugins.acpScripts.length = 0;
Plugins.soundpacks.length = 0;
async.waterfall([
async.apply(Plugins.getPluginPaths),
@@ -55,6 +56,7 @@ module.exports = function (Plugins) {
async.apply(mapClientSideScripts, pluginData),
async.apply(mapClientModules, pluginData),
async.apply(mapStaticDirectories, pluginData, pluginData.path),
async.apply(mapSoundpack, pluginData),
], next);
}, next);
}
@@ -90,7 +92,10 @@ module.exports = function (Plugins) {
},
function (next) {
mapClientModules(pluginData, next);
}
},
function (next) {
mapSoundpack(pluginData, next);
},
], function (err) {
if (err) {
winston.verbose('[plugins] Could not load plugin : ' + pluginData.id);
@@ -249,6 +254,35 @@ module.exports = function (Plugins) {
callback();
}
function mapSoundpack(pluginData, callback) {
var soundpack = pluginData.soundpack;
if (!soundpack || !soundpack.dir || !soundpack.sounds) {
return callback();
}
soundpack.name = soundpack.name || pluginData.name;
soundpack.id = pluginData.id;
soundpack.dir = path.join(pluginData.path, soundpack.dir);
async.each(Object.keys(soundpack.sounds), function (key, next) {
file.exists(path.join(soundpack.dir, soundpack.sounds[key]), function (exists) {
if (!exists) {
delete soundpack.sounds[key];
}
next();
});
}, function (err) {
if (err) {
return callback(err);
}
if (Object.keys(soundpack.sounds).length) {
Plugins.soundpacks.push(soundpack);
}
callback();
});
}
function resolveModulePath(fullPath, relPath) {
/**
* With npm@3, dependencies can become flattened, and appear at the root level.