Skip to content

Commit c35e02c

Browse files
committed
Code review changes
1 parent 6b9dc0f commit c35e02c

11 files changed

+17
-16
lines changed

lib/bootstrap.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ $injector.require("iOSProjectService", "./services/project-service");
88
$injector.require("projectTemplatesService", "./services/project-templates-service");
99
$injector.require("platformService", "./services/platform-service");
1010

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

1818
$injector.require("npm", "./node-package-manager");
1919
$injector.require("propertiesParser", "./properties-parser");
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/definitions/project.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ interface IProjectData {
2222

2323
interface IProjectTemplatesService {
2424
defaultTemplatePath: IFuture<string>;
25-
getAndroidFrameworkPath(whereToInstall: string): IFuture<string>
25+
installAndroidFramework(whereToInstall: string): IFuture<string>
2626
}

lib/services/platform-service.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export class PlatformService implements IPlatformService {
2727

2828
public addPlatforms(platforms: string[]): IFuture<void> {
2929
return (() => {
30-
this.$projectService.ensureProject();
31-
3230
if(!platforms || platforms.length === 0) {
3331
this.$errors.fail("No platform specified. Please specify a platform to add");
3432
}
3533

34+
this.$projectService.ensureProject();
35+
3636
var platformsDir = this.$projectService.projectData.platformsDir;
3737
this.$fs.ensureDirectoryExists(platformsDir).wait();
3838

@@ -46,12 +46,13 @@ export class PlatformService implements IPlatformService {
4646
private addPlatform(platform: string): IFuture<void> {
4747
return(() => {
4848
platform = platform.split("@")[0];
49+
50+
this.validatePlatform(platform);
51+
4952
var platformPath = path.join(this.$projectService.projectData.platformsDir, platform);
5053

5154
// TODO: Check for version compatability if the platform is in format platform@version. This should be done in PR for semanting versioning
5255

53-
this.validatePlatform(platform);
54-
5556
if (this.$fs.exists(platformPath).wait()) {
5657
this.$errors.fail("Platform %s already added", platform);
5758
}

lib/services/project-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class AndroidProjectService implements IPlatformProjectService {
357357

358358
private getFrameworkDir(projectData: IProjectData): IFuture<string> {
359359
return(() => {
360-
var androidFrameworkPath = this.$projectTemplatesService.getAndroidFrameworkPath(path.join(projectData.platformsDir, "android")).wait();
360+
var androidFrameworkPath = this.$projectTemplatesService.installAndroidFramework(path.join(projectData.platformsDir, "android")).wait();
361361
return path.join(androidFrameworkPath, "framework");
362362
}).future<string>()();
363363
}

lib/services/project-templates-service.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ export class ProjectTemplatesService implements IProjectTemplatesService {
1919
private $npm: INodePackageManager) { }
2020

2121
public get defaultTemplatePath(): IFuture<string> {
22-
return this.downloadNpmPackage(ProjectTemplatesService.NPM_DEFAULT_TEMPLATE_NAME);
22+
return this.installNpmPackage(ProjectTemplatesService.NPM_DEFAULT_TEMPLATE_NAME);
2323
}
2424

25-
public getAndroidFrameworkPath(where?: string): IFuture<string> {
26-
return this.downloadNpmPackage(ProjectTemplatesService.NPM_ANDROID_BRIDGE_NAME, where);
25+
public installAndroidFramework(where?: string): IFuture<string> {
26+
return this.installNpmPackage(ProjectTemplatesService.NPM_ANDROID_BRIDGE_NAME, where);
2727
}
2828

29-
private downloadNpmPackage(packageName: string, where?: string): IFuture<string> {
29+
private installNpmPackage(packageName: string, where?: string): IFuture<string> {
3030
return (() => {
3131
try {
3232
this.$npm.load().wait();

0 commit comments

Comments
 (0)