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

Show the current project's Magento version in settings window #81

Merged
merged 6 commits into from
Apr 2, 2020

Conversation

vasilii-b
Copy link

Description (*)

This PR adds a new util class that retrieves the Project's Magento version from the composer.json file in the project's root.

image

Fixed Issues (if relevant)

  1. Magento Versioning. Create a Util class for defining a Magento version #51: Magento Versioning. Create a Util class for defining a Magento version

Questions or comments

  • Is the util file/class naming OK?
  • Is the util method naming OK?
  • Is there any other way to get the currently active project in the IDE other than the code below?
    (uses deprecated methods)
DataContext dataContext = DataManager.getInstance().getDataContext();
this.project = (Project) dataContext.getData(DataConstants.PROJECT);

ℹ️ Instead of using a hard dependency on https://plugins.jetbrains.com/plugin/7631-php-composer-json-support as mentioned in the issue comments, I've used the existing class com.magento.idea.magento2plugin.php.module.ComposerPackageModelImpl in the project to get information from a composer.json file.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages

@vasilii-b vasilii-b changed the title [WIP] Show the current project's Magento version in settings window Show the current project's Magento version in settings window Apr 2, 2020
@VitaliyBoyko VitaliyBoyko self-assigned this Apr 2, 2020
@VitaliyBoyko VitaliyBoyko self-requested a review April 2, 2020 09:26

private String getFilePath() {
String fileName = "composer.json";
return this.project.getBasePath() + "/" + fileName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use File.separator instead "/" string literal.

}

private String getFilePath() {
String fileName = "composer.json";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't use literals. In this case we already have com.magento.idea.magento2plugin.magento.files.ComposerJson#FILE_NAME . In case there no existing constant - feel free to add a new one. Thank you!

@vasilii-b
Copy link
Author

Hi @VitaliyBoyko,
Thank you very much for the review! Those suggestions really make sense!
Can you please have a look at the applied changes?

@vasilii-b vasilii-b requested a review from VitaliyBoyko April 2, 2020 17:26
@VitaliyBoyko
Copy link
Contributor

Hi @vasilii-b
Works for Magento installed from composer ✅
image

But still, we need to make up something for Magento installed from the GitHub. Maybe add some custom input to fill the version manually.

Thank you for collaboration!

@VitaliyBoyko
Copy link
Contributor

This PR includes reward labels for #59.
The Reward system was not configured for March, so we adjusted points for April.

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

Successfully merging this pull request may close these issues.

3 participants