From ed7dd14ef8c8549d2e95c55e4a3b1b4d71352985 Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Wed, 20 Jan 2016 11:50:19 +0200 Subject: [PATCH] Don't print incorrect message when `tns deploy ios --release` command is executed FIxes https://github.com/NativeScript/nativescript-cli/issues/1403 --- lib/commands/deploy.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/commands/deploy.ts b/lib/commands/deploy.ts index 138f91ecbe..1e23fad314 100644 --- a/lib/commands/deploy.ts +++ b/lib/commands/deploy.ts @@ -5,7 +5,8 @@ export class DeployOnDeviceCommand implements ICommand { constructor(private $platformService: IPlatformService, private $platformCommandParameter: ICommandParameter, private $options: IOptions, - private $errors: IErrors) { } + private $errors: IErrors, + private $mobileHelper: Mobile.IMobileHelper) { } execute(args: string[]): IFuture { let config = this.$options.staticBindings ? { runSbGenerator: true } : undefined; @@ -14,11 +15,19 @@ export class DeployOnDeviceCommand implements ICommand { public canExecute(args: string[]): IFuture { return (() => { - if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) { + if (!args || !args.length || args.length > 1) { + return false; + } + + if (!this.$platformCommandParameter.validate(args[0]).wait()) { + return false; + } + + if (this.$mobileHelper.isAndroidPlatform(args[0]) && this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) { this.$errors.fail("When producing a release build, you need to specify all --key-store-* options."); } - let res = (args.length === 1) && this.$platformCommandParameter.validate(args[0]).wait(); - return res; + + return true; }).future()(); }