Move changeProjectDirectory outside the nested code

This commit is contained in:
Juan Cruz Viotti 2015-01-23 13:54:30 -04:00
parent ff0b513188
commit 4103a4195a

View File

@ -100,6 +100,12 @@ registerPlugin = (plugin) ->
return capitano.command(plugin) if not _.isArray(plugin)
return _.each(plugin, capitano.command)
changeProjectDirectory = (directory) ->
try
process.chdir(directory)
catch
errors.handle(new Error("Invalid project: #{directory}"))
nplugm.load 'resin-plugin-*', (error, plugin) ->
return console.error(error.message) if error?
registerPlugin(plugin.require())
@ -108,12 +114,6 @@ nplugm.load 'resin-plugin-*', (error, plugin) ->
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?