-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathrun.ts
60 lines (51 loc) · 2.17 KB
/
run.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
export class RunCommandBase {
constructor(protected $platformService: IPlatformService,
protected $usbLiveSyncService: ILiveSyncService,
protected $options: IOptions) { }
public executeCore(args: string[]): IFuture<void> {
this.$platformService.deployPlatform(args[0]).wait();
if (this.$options.release) {
return this.$platformService.runPlatform(args[0]);
}
return this.$usbLiveSyncService.liveSync(args[0]);
}
}
export class RunIosCommand extends RunCommandBase implements ICommand {
constructor($platformService: IPlatformService,
private $platformsData: IPlatformsData,
$usbLiveSyncService: ILiveSyncService,
$options: IOptions,
private $injector: IInjector) {
super($platformService, $usbLiveSyncService, $options);
}
public allowedParameters: ICommandParameter[] = [];
public execute(args: string[]): IFuture<void> {
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
}
public canExecute(args: string[]): IFuture<boolean> {
return this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
}
}
$injector.registerCommand("run|ios", RunIosCommand);
export class RunAndroidCommand extends RunCommandBase implements ICommand {
constructor($platformService: IPlatformService,
private $platformsData: IPlatformsData,
$usbLiveSyncService: ILiveSyncService,
$options: IOptions,
private $errors: IErrors) {
super($platformService, $usbLiveSyncService, $options);
}
public allowedParameters: ICommandParameter[] = [];
public execute(args: string[]): IFuture<void> {
return this.executeCore([this.$platformsData.availablePlatforms.Android]);
}
public canExecute(args: string[]): IFuture<boolean> {
return (() => {
if (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.");
}
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
}).future<boolean>()();
}
}
$injector.registerCommand("run|android", RunAndroidCommand);