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

Use vendor/composer/installed.json and fallback to using composer.lock #82

Merged
merged 13 commits into from
Jun 30, 2019
Merged

Use vendor/composer/installed.json and fallback to using composer.lock #82

merged 13 commits into from
Jun 30, 2019

Conversation

d42ohpaz
Copy link
Contributor

@d42ohpaz d42ohpaz commented Apr 8, 2019

Also be more clear in the messages why the exceptions are being thrown so that developers understand what files are being looked in for package versions. In other words, we know to deploy the vendor/composer/installed.json and/or the composer.lock for the project.

Copy link
Owner

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

This needs an added integration test in which composer.lock is explicitly removed

@Ocramius
Copy link
Owner

Ocramius commented Apr 8, 2019

I'm wondering if relying on installed.json is reliable enough to get rid of the reliance on composer.lock entirely: what is your thought on that?

@d42ohpaz
Copy link
Contributor Author

d42ohpaz commented Apr 8, 2019

I left the composer.lock checks in for backward compatibility in case someone out there is excluding the installed.json. I wanted to add trigger_error() when paths are not found, but didn't want to cause a failure (more like a deprecation-style notice).

@Ocramius
Copy link
Owner

Ocramius commented Apr 8, 2019

I'd say this is fine as-is, then. We can focus on getting rid of the exceptions completely in a 2.x release later on, if you are interested.

@Ocramius Ocramius added this to the 1.5.0 milestone Apr 8, 2019
@Ocramius Ocramius self-assigned this Apr 8, 2019
src/PackageVersions/FallbackVersions.php Show resolved Hide resolved
src/PackageVersions/FallbackVersions.php Outdated Show resolved Hide resolved
src/PackageVersions/FallbackVersions.php Outdated Show resolved Hide resolved
@Ocramius
Copy link
Owner

This requires a rebase to see if newer changes clash with it

kstanley-UNCC and others added 10 commits June 30, 2019 07:43
Also use getcwd() when the expectation is to look in the project directory.
Rename test method to reflect ambiguity.
Add test validating missing installed.json
Refactor to remove ambiguity of versions data
Rename FallbackVersions::getComposerLockPath() to FallbackVersions::getPackageData().
Instead of returning a string, FallbackVersions::getPackageData() will return the expected data structure needed for FallbackVersions::getVersions().
Cleanup FallbackVersions::getVersions() so it parses the given data structure.
Rename variables to allow for ambiguity.
@Ocramius
Copy link
Owner

@9ae8sdf76 think this is ready then, or still working on it?

The `installed.json` could contain an empty array for packages (like this one) that only use `require-dev` and have nothing in `require`. This will address that by merging both the json and lock files.

As a consequence, the FallbackVersionsTest::testValidVersionsWithoutComposerLock() will need to be skipped when the installed.json is empty.
@d42ohpaz
Copy link
Contributor Author

@Ocramius just finished up addressing your feedback. ready for another review round.

src/PackageVersions/FallbackVersions.php Outdated Show resolved Hide resolved
test/PackageVersionsTest/FallbackVersionsTest.php Outdated Show resolved Hide resolved
@d42ohpaz
Copy link
Contributor Author

d42ohpaz commented Jun 30, 2019 via email

Copy link
Owner

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

🚢 thanks @9ae8sdf76! Excellent work!

@Ocramius Ocramius merged commit 08fb5f1 into Ocramius:master Jun 30, 2019
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.

None yet

3 participants