Closed AydinHassan closed 7 years ago
Maybe we could check the root composer json requires, and if it doesn't contain ocramius/package-versions
then we don't generate? Basically if this tool hasn't been specifically required, then we don't generate versions.
file_put_contents(/Users/aydin/package-versions-test/vendor/ocramius/package-versions/src/PackageVersions/Versions.php): failed to open stream: No such file or directory
Is the directory missing? That's indeed a weird scenario (package-versions being removed). The correct solution would probably be to check whether the composer.lock
contains package-versions, before trying to generate anything.
This needs a proper e2e test too, by the way... Not sure how to write it yet.
The directory is missing, because the local project doesn't specifically require ocramius/package-versions
, the plugin executes because it is installed globally. Yeah thats what I thought about checking composer.lock
before generating. I'll have a play after work and push something up, then we can figure how to do some e2e tests.
@AydinHassan thanks if you can figure out the e2e stuff! Tricky one...
I found this issue when installing a tool globally which depended on
ocramius/package-versions
.It will then try to write package versions for any other composer project when an update is performed, it will subsequently fail because the folder structure it expects to exist, doesn't.
To reproduce:
The output will be something along the lines of:
Note that for my use-case I do not actually install the tool globally, but another tool which depends on
package-versions
. I just directly installed here to ease the test case.I'm not sure what we could do about this, any ideas?