Make use of nplugm.load

This commit is contained in:
Juan Cruz Viotti 2015-01-23 13:24:57 -04:00
parent ff9558ab32
commit ff0b513188

View File

@ -100,28 +100,28 @@ registerPlugin = (plugin) ->
return capitano.command(plugin) if not _.isArray(plugin) return capitano.command(plugin) if not _.isArray(plugin)
return _.each(plugin, capitano.command) return _.each(plugin, capitano.command)
try nplugm.load 'resin-plugin-*', (error, plugin) ->
for plugin in nplugm.getPluginsByGlob('resin-plugin-*') return console.error(error.message) if error?
registerPlugin(plugin.require()) registerPlugin(plugin.require())
catch error , (error, loadedPlugins) ->
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) ->
errors.handle(error) if error? errors.handle(error) if error?
if cli.global.quiet cli = capitano.parse(process.argv)
console.info = _.noop
if cli.global.project? changeProjectDirectory = (directory) ->
changeProjectDirectory(cli.global.project) 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? 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?