-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathclean-app.ts
65 lines (53 loc) · 2.47 KB
/
clean-app.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
61
62
63
64
65
export class CleanAppCommandBase implements ICommand {
public allowedParameters: ICommandParameter[] = [];
protected platform: string;
constructor(protected $options: IOptions,
protected $projectData: IProjectData,
protected $platformService: IPlatformService,
protected $errors: IErrors,
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
protected $platformsData: IPlatformsData) {
this.$projectData.initializeProjectData();
}
public async execute(args: string[]): Promise<void> {
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
return this.$platformService.cleanDestinationApp(this.platform.toLowerCase(), appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options);
}
public async canExecute(args: string[]): Promise<boolean> {
if (!this.$platformService.isPlatformSupportedForOS(this.platform, this.$projectData)) {
this.$errors.fail(`Applications for platform ${this.platform} can not be built on this OS`);
}
let platformData = this.$platformsData.getPlatformData(this.platform, this.$projectData);
let platformProjectService = platformData.platformProjectService;
await platformProjectService.validate(this.$projectData);
return true;
}
}
export class CleanAppIosCommand extends CleanAppCommandBase implements ICommand {
constructor(protected $options: IOptions,
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
protected $platformsData: IPlatformsData,
protected $errors: IErrors,
$platformService: IPlatformService,
$projectData: IProjectData) {
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData);
}
protected get platform(): string {
return this.$devicePlatformsConstants.iOS;
}
}
$injector.registerCommand("clean-app|ios", CleanAppIosCommand);
export class CleanAppAndroidCommand extends CleanAppCommandBase implements ICommand {
constructor(protected $options: IOptions,
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
protected $platformsData: IPlatformsData,
protected $errors: IErrors,
$platformService: IPlatformService,
$projectData: IProjectData) {
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData);
}
protected get platform(): string {
return this.$devicePlatformsConstants.Android;
}
}
$injector.registerCommand("clean-app|android", CleanAppAndroidCommand);