Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface IProjectDataService {
initialize(projectDir: string): void;
getValue(propertyName: string): IFuture<any>;
setValue(key: string, value: any): IFuture<void>;
removeProperty(propertyName: string): IFuture<void>;
}

interface IProjectTemplatesService {
Expand Down
5 changes: 5 additions & 0 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,16 @@ export class PlatformService implements IPlatformService {

public removePlatforms(platforms: string[]): IFuture<void> {
return (() => {
this.$projectDataService.initialize(this.$projectData.projectDir);

_.each(platforms, platform => {
this.validatePlatformInstalled(platform);
let platformData = this.$platformsData.getPlatformData(platform);

var platformDir = path.join(this.$projectData.platformsDir, platform);
this.$fs.deleteDirectory(platformDir).wait();
this.$projectDataService.removeProperty(platformData.frameworkPackageName).wait();

this.$logger.out(`Platform ${platform} successfully removed.`);
});

Expand Down
8 changes: 8 additions & 0 deletions lib/services/project-data-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export class ProjectDataService implements IProjectDataService {
this.$fs.writeJson(this.projectFilePath, this.projectData, "\t").wait();
}).future<void>()();
}

public removeProperty(propertyName: string): IFuture<void> {
return (() => {
this.loadProjectFile().wait();
delete this.projectData[this.$staticConfig.CLIENT_NAME_KEY_IN_PROJECT_FILE][propertyName];
this.$fs.writeJson(this.projectFilePath, this.projectData, "\t").wait();
}).future<void>()();
}

private loadProjectFile(): IFuture<void> {
return (() => {
Expand Down
4 changes: 4 additions & 0 deletions test/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ export class ProjectDataService implements IProjectDataService {
setValue(key: string, value: any): IFuture<void> {
return Future.fromResult();
}

removeProperty(propertyName: string): IFuture<void> {
return Future.fromResult();
}
}

export class ProjectHelperStub implements IProjectHelper {
Expand Down