|
1 | 1 | ///<reference path="../.d.ts"/> |
2 | 2 | "use strict"; |
3 | 3 |
|
4 | | -export class RunCommand implements ICommand { |
5 | | - constructor(private $platformService: IPlatformService, |
6 | | - private $platformCommandParameter: ICommandParameter) { } |
7 | | - |
8 | | - execute(args: string[]): IFuture<void> { |
9 | | - return (() => { |
10 | | - this.$platformService.runPlatform(args[0]).wait(); |
11 | | - }).future<void>()(); |
| 4 | +export class RunCommandBase { |
| 5 | + constructor(private $platformService: IPlatformService) { } |
| 6 | + |
| 7 | + public executeCore(args: string[]): IFuture<void> { |
| 8 | + return this.$platformService.runPlatform(args[0]); |
| 9 | + } |
| 10 | +} |
| 11 | + |
| 12 | +export class RunIosCommand extends RunCommandBase implements ICommand { |
| 13 | + constructor($platformService: IPlatformService, |
| 14 | + private $platformsData: IPlatformsData) { |
| 15 | + super($platformService); |
| 16 | + } |
| 17 | + |
| 18 | + public allowedParameters: ICommandParameter[] = []; |
| 19 | + |
| 20 | + public execute(args: string[]): IFuture<void> { |
| 21 | + return this.executeCore([this.$platformsData.availablePlatforms.iOS]); |
| 22 | + } |
| 23 | +} |
| 24 | +$injector.registerCommand("run|ios", RunIosCommand); |
| 25 | + |
| 26 | +export class RunAndroidCommand extends RunCommandBase implements ICommand { |
| 27 | + constructor($platformService: IPlatformService, |
| 28 | + private $platformsData: IPlatformsData) { |
| 29 | + super($platformService); |
12 | 30 | } |
13 | 31 |
|
14 | | - allowedParameters = [this.$platformCommandParameter]; |
| 32 | + public allowedParameters: ICommandParameter[] = []; |
| 33 | + |
| 34 | + public execute(args: string[]): IFuture<void> { |
| 35 | + return this.executeCore([this.$platformsData.availablePlatforms.Android]); |
| 36 | + } |
15 | 37 | } |
16 | | -$injector.registerCommand("run", RunCommand); |
| 38 | +$injector.registerCommand("run|android", RunAndroidCommand); |
0 commit comments