From 231fb1c7a814e2105a26a8a07bca92b75f28aefd Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Thu, 14 Aug 2014 18:49:19 +0300 Subject: [PATCH] Throw error if commands are executed without platform --- lib/services/platform-service.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 6f78df5b0b..11db8751ee 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -131,9 +131,8 @@ export class PlatformService implements IPlatformService { public preparePlatform(platform: string): IFuture { return (() => { - platform = platform.toLowerCase(); - this.validatePlatformInstalled(platform); + platform = platform.toLowerCase(); var platformData = this.$platformsData.getPlatformData(platform); var platformProjectService = platformData.platformProjectService; @@ -156,8 +155,8 @@ export class PlatformService implements IPlatformService { public buildPlatform(platform: string): IFuture { return (() => { - platform = platform.toLowerCase(); this.validatePlatformInstalled(platform); + platform = platform.toLowerCase(); var platformData = this.$platformsData.getPlatformData(platform); platformData.platformProjectService.buildProject(platformData.projectRoot).wait(); @@ -167,9 +166,8 @@ export class PlatformService implements IPlatformService { public runPlatform(platform: string): IFuture { return (() => { - platform = platform.toLowerCase(); - this.validatePlatformInstalled(platform); + platform = platform.toLowerCase(); this.preparePlatform(platform).wait(); this.buildPlatform(platform).wait(); @@ -193,6 +191,12 @@ export class PlatformService implements IPlatformService { } private validatePlatform(platform: string): void { + if(!platform) { + this.$errors.fail("No platform specified.") + } + + platform = platform.toLowerCase(); + if (!this.isValidPlatform(platform)) { this.$errors.fail("Invalid platform %s. Valid platforms are %s.", platform, helpers.formatListOfNames(this.$platformsData.platformsNames)); }