Skip to content

Refactor project and platform services #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 24, 2014
Merged

Conversation

Fatme
Copy link
Contributor

@Fatme Fatme commented Jul 19, 2014

We need this refactoring in order to reuse code for iOSProjectService

@Fatme
Copy link
Contributor Author

Fatme commented Jul 21, 2014

@ligaz @tailsu

@@ -32,5 +38,30 @@ export class NodePackageManager implements INodePackageManager {
});
return future;
}

public tryExecuteAction(action: any, args?: any[]): IFuture<void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action shouldn't be any. Rather, it should be, let's say, action: (...args: any[]) => void.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can simplify the signature for args by using open-ended arguments: ...args: any[]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree :) It looks better

@Fatme
Copy link
Contributor Author

Fatme commented Jul 21, 2014

@tailsu @ligaz


public buildProject(projectRoot: string): IFuture<void> {
return (() => {
var buildConfiguration = options.release || "--debug";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is odd. Isn't options.release a boolean value? Why would it have the value --release ?

@@ -2,6 +2,7 @@ interface INodePackageManager {
cache: string;
load(config?: any): IFuture<void>;
install(where: string, what: string): IFuture<any>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method can be made private in the implementation. The installSafe method can be renamed to just install, then.

@Fatme
Copy link
Contributor Author

Fatme commented Jul 22, 2014

@tailsu

@tailsu
Copy link
Contributor

tailsu commented Jul 22, 2014

👍

}).future<void>()();
}

public install(packageName: string, pathToSave?: string): IFuture<string> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move this after the other public method in this class.

@Fatme
Copy link
Contributor Author

Fatme commented Jul 23, 2014

@ligaz I did the folowings:

  • moved all logic from PlatformProjectService to PlatformService,
  • removed PlatformProjectService and IPlatformProjectService,
  • renamed IPlatformSpecificProjectService to IPlatformProjectService .

export var DEFAULT_PROJECT_ID = "com.telerik.tns.HelloWorld";
export var DEFAULT_PROJECT_NAME = "HelloNativescript";
export var APP_RESOURCES_FOLDER_NAME = "App_Resources";
export var PROJECT_FRAMEWORK_DIR = "framework";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already using the FOLDER_NAME convention so it looks better to name this PROJECT_FRAMEWORK_FOLDER_NAME.

@ligaz
Copy link

ligaz commented Jul 23, 2014

Yes, it looks much better after this refactoring. Good job 😉

@ligaz
Copy link

ligaz commented Jul 24, 2014

👍 well done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants