Fix --type option taking no effect in app create

This commit is contained in:
Juan Cruz Viotti 2015-10-19 13:07:23 -04:00
parent b6ebd0631a
commit ad68dcf692
2 changed files with 6 additions and 2 deletions

View File

@ -36,7 +36,9 @@
if (hasApplication) { if (hasApplication) {
throw new Error('You already have an application with that name!'); throw new Error('You already have an application with that name!');
} }
}).then(patterns.selectDeviceType).then(function(deviceType) { }).then(function() {
return options.type || patterns.selectDeviceType();
}).then(function(deviceType) {
return resin.models.application.create(params.name, deviceType); return resin.models.application.create(params.name, deviceType);
}).then(function(application) { }).then(function(application) {
console.info("Application created: " + application.app_name + " (" + application.device_type + ", id " + application.id + ")"); console.info("Application created: " + application.app_name + " (" + application.device_type + ", id " + application.id + ")");

View File

@ -44,7 +44,9 @@ exports.create =
if hasApplication if hasApplication
throw new Error('You already have an application with that name!') throw new Error('You already have an application with that name!')
.then(patterns.selectDeviceType).then (deviceType) -> .then ->
return options.type or patterns.selectDeviceType()
.then (deviceType) ->
return resin.models.application.create(params.name, deviceType) return resin.models.application.create(params.name, deviceType)
.then (application) -> .then (application) ->
console.info("Application created: #{application.app_name} (#{application.device_type}, id #{application.id})") console.info("Application created: #{application.app_name} (#{application.device_type}, id #{application.id})")