Skip to content
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

Refactor the Wine Engine Object #1066

Merged
merged 3 commits into from
Jul 9, 2019

Conversation

madoar
Copy link
Collaborator

@madoar madoar commented Jul 7, 2019

This PR refactors the Wine engine object with newer JS language features like class and streams

Engines/Wine/Engine/Object/script.js Show resolved Hide resolved
var containerConfiguration = configFactory.open(this.prefixDirectory() + "/phoenicis.cfg");
var architecture = containerConfiguration.readValue("wineArchitecture", "x86");
const containerConfiguration = this.configFactory.open(this.prefixDirectory() + "/phoenicis.cfg");
const architecture = containerConfiguration.readValue("wineArchitecture", "x86");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would like to move the "extraction" of the three value wineArchitecture, wineDistribution and wineVersion to a dedicated method that returns a json containing the three values.

What do you think?

Copy link
Collaborator

@plata plata Jul 7, 2019

Choose a reason for hiding this comment

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

I'm not sure that a json is clearer compared to readValue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The main issue for me is the extraction code and the access to containerConfiguration which I would like to hide behind a method.

In addition it is quite easy to access the values:

const { architecture, distribution, version } = fetchContainerConfiguration(this.prefixDirectory() + "/phoenicis.cfg");

Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion, the architecture method already encapsulates this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't understand? The architecture() method only returns a single value, while I suggest to return three wine related values at once.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know. However, your point is that you want to hide something in a method. In my opinion the architecture() method already does so. Therefore I do not see the need for additional encapsulation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let me demonstrate what I want to do in a different (new) PR. This is out of scope anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok.

Engines/Wine/Engine/Object/script.js Outdated Show resolved Hide resolved
Engines/Wine/Engine/Object/script.js Outdated Show resolved Hide resolved
Engines/Wine/Engine/Object/script.js Show resolved Hide resolved
Engines/Wine/Engine/Object/script.js Show resolved Hide resolved
@madoar
Copy link
Collaborator Author

madoar commented Jul 7, 2019

Additionally we should really add some more comments to this class!

@madoar
Copy link
Collaborator Author

madoar commented Jul 7, 2019

About the Codacy error: I don't want to fix the issue because it seems suspect to me

@plata
Copy link
Collaborator

plata commented Jul 8, 2019

You're right about the Codacy error.

@madoar madoar merged commit 472b4ba into PhoenicisOrg:master Jul 9, 2019
@madoar madoar deleted the refactor-wine-engine-object branch July 9, 2019 04:54
petermetz pushed a commit to petermetz/scripts that referenced this pull request Jun 7, 2020
- refactor the wine engine object
- add some more error messages
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.

2 participants