-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Use vendor/composer/installed.json and fallback to using composer.lock #82
Conversation
There was a problem hiding this 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
I'm wondering if relying on |
I left the |
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. |
This requires a rebase to see if newer changes clash with it |
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.
@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.
@Ocramius just finished up addressing your feedback. ready for another review round. |
I’m okay with it if you are.
On Sun, Jun 30, 2019 at 10:19 AM Marco Pivetta ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In test/PackageVersionsTest/FallbackVersionsTest.php
<#82 (comment)>
:
> @@ -54,9 +54,15 @@ public function testValidVersions() : void
public function testValidVersionsWithoutComposerLock() : void
{
+ // This test will always fail if there is nothing in the installed.json
+ // due to this package being installed with `composer install --no-dev`.
+ if (json_decode(file_get_contents(getcwd() . '/vendor/composer/installed.json', true)) === []) {
+ $this->markTestSkipped('Empty installed.json (possible --no-dev)');
I'd say that the composer.lock is correct here, even if the packages
aren't installed.
We can roll with the patch as-is, if you are happy with it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#82?email_source=notifications&email_token=AATJJT2EQ3HYZA4U3ZWQAILP5C6FJA5CNFSM4HEKNAW2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5BWZOI#discussion_r298836490>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATJJT7H6H6RLYHT47YFZE3P5C6FJANCNFSM4HEKNAWQ>
.
--
"Do not go gentle into that good night. Rage, rage against the dying of the
light." — Dylan Thomas
|
There was a problem hiding this 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!
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 thecomposer.lock
for the project.