Skip to content

Commit 6fa1882

Browse files
committed
Merge pull request #49 from NativeScript/fatme/fix-commnands-executed-without-params
Throw error if commands are executed without platform
2 parents 3a072ec + 231fb1c commit 6fa1882

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/services/platform-service.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ export class PlatformService implements IPlatformService {
131131

132132
public preparePlatform(platform: string): IFuture<void> {
133133
return (() => {
134-
platform = platform.toLowerCase();
135-
136134
this.validatePlatformInstalled(platform);
135+
platform = platform.toLowerCase();
137136

138137
var platformData = this.$platformsData.getPlatformData(platform);
139138
var platformProjectService = platformData.platformProjectService;
@@ -156,8 +155,8 @@ export class PlatformService implements IPlatformService {
156155

157156
public buildPlatform(platform: string): IFuture<void> {
158157
return (() => {
159-
platform = platform.toLowerCase();
160158
this.validatePlatformInstalled(platform);
159+
platform = platform.toLowerCase();
161160

162161
var platformData = this.$platformsData.getPlatformData(platform);
163162
platformData.platformProjectService.buildProject(platformData.projectRoot).wait();
@@ -167,9 +166,8 @@ export class PlatformService implements IPlatformService {
167166

168167
public runPlatform(platform: string): IFuture<void> {
169168
return (() => {
170-
platform = platform.toLowerCase();
171-
172169
this.validatePlatformInstalled(platform);
170+
platform = platform.toLowerCase();
173171

174172
this.preparePlatform(platform).wait();
175173
this.buildPlatform(platform).wait();
@@ -193,6 +191,12 @@ export class PlatformService implements IPlatformService {
193191
}
194192

195193
private validatePlatform(platform: string): void {
194+
if(!platform) {
195+
this.$errors.fail("No platform specified.")
196+
}
197+
198+
platform = platform.toLowerCase();
199+
196200
if (!this.isValidPlatform(platform)) {
197201
this.$errors.fail("Invalid platform %s. Valid platforms are %s.", platform, helpers.formatListOfNames(this.$platformsData.platformsNames));
198202
}

0 commit comments

Comments
 (0)