Skip to content

Commit d17afa9

Browse files
committed
Code review changes
1 parent 6cf93fd commit d17afa9

16 files changed

+109
-69
lines changed

lib/bootstrap.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ $injector.require("projectTemplatesService", "./services/project-templates-servi
99
$injector.require("platformService", "./services/platform-service");
1010

1111
$injector.requireCommand("create", "./commands/create-project-command");
12-
$injector.requireCommand("platform|*list", "./commands/platform-command");
13-
$injector.requireCommand("platform|add", "./commands/platform-command");
12+
$injector.requireCommand("platform|*list", "./commands/list-platforms-command");
13+
$injector.requireCommand("platform|add", "./commands/add-platform-command");
1414
$injector.requireCommand("run", "./commands/run-command");
15-
$injector.requireCommand("prepare", "./commands/run-command");
16-
$injector.requireCommand("build", "./commands/run-command");
15+
$injector.requireCommand("prepare", "./commands/prepare-command");
16+
$injector.requireCommand("build", "./commands/build-command");
1717

1818
$injector.require("npm", "./node-package-manager");
19+
$injector.require("propertiesParser", "./properties-parser");

lib/commands/add-platform-command.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
///<reference path="../.d.ts"/>
2+
3+
export class AddPlatformCommand implements ICommand {
4+
constructor(private $platformService: IPlatformService) { }
5+
6+
execute(args: string[]): IFuture<void> {
7+
return (() => {
8+
this.$platformService.addPlatforms(args).wait();
9+
}).future<void>()();
10+
}
11+
}
12+
$injector.registerCommand("platform|add", AddPlatformCommand);

lib/commands/build-command.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
///<reference path="../.d.ts"/>
2+
3+
export class BuildCommand implements ICommand {
4+
constructor(private $platformService: IPlatformService) { }
5+
6+
execute(args: string[]): IFuture<void> {
7+
return (() => {
8+
this.$platformService.buildPlatform(args[0]).wait();
9+
}).future<void>()();
10+
}
11+
}
12+
$injector.registerCommand("build", BuildCommand);

lib/commands/platform-command.ts renamed to lib/commands/list-platforms-command.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,4 @@ export class ListPlatformsCommand implements ICommand {
1717
}
1818
$injector.registerCommand("platform|*list", ListPlatformsCommand);
1919

20-
export class AddPlatformCommand implements ICommand {
21-
constructor(private $platformService: IPlatformService) { }
2220

23-
execute(args: string[]): IFuture<void> {
24-
return (() => {
25-
this.$platformService.addPlatforms(args).wait();
26-
}).future<void>()();
27-
}
28-
}
29-
$injector.registerCommand("platform|add", AddPlatformCommand);

lib/commands/prepare-command.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
///<reference path="../.d.ts"/>
2+
3+
export class PrepareCommand implements ICommand {
4+
constructor(private $platformService: IPlatformService) { }
5+
6+
execute(args: string[]): IFuture<void> {
7+
return (() => {
8+
this.$platformService.preparePlatform(args[0]).wait();
9+
}).future<void>()();
10+
}
11+
}
12+
$injector.registerCommand("prepare", PrepareCommand);

lib/commands/run-command.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,3 @@ export class RunCommand implements ICommand {
1010
}
1111
}
1212
$injector.registerCommand("run", RunCommand);
13-
14-
export class PrepareCommand implements ICommand {
15-
constructor(private $platformService: IPlatformService) { }
16-
17-
execute(args: string[]): IFuture<void> {
18-
return (() => {
19-
this.$platformService.preparePlatform(args[0]).wait();
20-
}).future<void>()();
21-
}
22-
}
23-
$injector.registerCommand("prepare", PrepareCommand);
24-
25-
export class BuildCommand implements ICommand {
26-
constructor(private $platformService: IPlatformService) { }
27-
28-
execute(args: string[]): IFuture<void> {
29-
return (() => {
30-
this.$platformService.buildPlatform(args[0]).wait();
31-
}).future<void>()();
32-
}
33-
}
34-
$injector.registerCommand("build", BuildCommand);

lib/common

lib/declarations.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
interface INodePackageManager {
2-
cache: string;
3-
load(config?: any): IFuture<void>;
4-
install(where: string, what: string): IFuture<any>;
2+
cache: string;
3+
load(config?: any): IFuture<void>;
4+
install(where: string, what: string): IFuture<any>;
5+
}
6+
7+
interface IPropertiesParser {
8+
createEditor(filePath: string): IFuture<any>;
59
}

lib/definitions/project.d.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ interface IProjectService {
77
projectData: IProjectData;
88
}
99

10-
interface IAndroidProjectService {
10+
interface IPlatformProjectService {
1111
createProject(projectData: IProjectData): IFuture<void>;
1212
buildProject(projectData: IProjectData): IFuture<void>;
1313
}
1414

15-
interface IiOSProjectService {
16-
createProject(projectData: IProjectData): IFuture<void>;
17-
}
18-
1915
interface IProjectData {
2016
projectDir: string;
2117
platformsDir: string;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module "properties-parser" {
2+
function createEditor(path: string, callback: (err: IErrors, data: any) => void);
3+
}

0 commit comments

Comments
 (0)