From ff0b51318804f135c1243c364f027b73ea6fddbe Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 23 Jan 2015 13:24:57 -0400 Subject: [PATCH] Make use of nplugm.load --- lib/app.coffee | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/app.coffee b/lib/app.coffee index 2fe970d9..3a1547d2 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -100,28 +100,28 @@ registerPlugin = (plugin) -> return capitano.command(plugin) if not _.isArray(plugin) return _.each(plugin, capitano.command) -try - for plugin in nplugm.getPluginsByGlob('resin-plugin-*') - registerPlugin(plugin.require()) -catch error - errors.handle(error) - -cli = capitano.parse(process.argv) - -changeProjectDirectory = (directory) -> - try - process.chdir(directory) - catch - errors.handle(new Error("Invalid project: #{directory}")) - -resin.data.prefix.set resin.settings.get('dataPrefix'), (error) -> +nplugm.load 'resin-plugin-*', (error, plugin) -> + return console.error(error.message) if error? + registerPlugin(plugin.require()) +, (error, loadedPlugins) -> errors.handle(error) if error? - if cli.global.quiet - console.info = _.noop + cli = capitano.parse(process.argv) - if cli.global.project? - changeProjectDirectory(cli.global.project) + changeProjectDirectory = (directory) -> + try + process.chdir(directory) + catch + errors.handle(new Error("Invalid project: #{directory}")) - capitano.execute cli, (error) -> + resin.data.prefix.set resin.settings.get('dataPrefix'), (error) -> errors.handle(error) if error? + + if cli.global.quiet + console.info = _.noop + + if cli.global.project? + changeProjectDirectory(cli.global.project) + + capitano.execute cli, (error) -> + errors.handle(error) if error?