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(2.0): Add ExtraDownloadsRepository #36

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

tienvx
Copy link
Collaborator

@tienvx tienvx commented Apr 17, 2024

This is the first PR that add code to use Composer's terms. This one use the term Repository.

  • Currently, when a package require (n) extra files, it need (n) tracking files, e.g.
    • path/to/files/text.txt need path/to/files/.composer-downloads/text-9a09b4dfda82e3e665e31092d1c3ec8d.json
    • path/to/files/executable.phar need path/to/files/.composer-downloads/executable-d0ea4c3608f59a037ffbb52f6cf742f5.json
    • path/to/files/extracted-zip/* need path/to/files/.composer-downloads/extracted-zip-78805a221a988e79ef3f42d7c5bfd418.json
  • This PR use the same approach with Composer: create vendor/composer/installed-extra-downloads.json, similar to, but much smaller than vendor/composer/installed.json (only contains tracking checksum, not able to re-construct package objects from data)
  • Implementing InstalledRepositoryInterface interface is required, but we only use half of its methods. Other methods just return null, 0 (zero), [] (empty array), or "a string". Hopefully it doesn't violate L (Liskov substitution principle) in SOLID
  • User need to deleted downloaded files manually before new files can be downloaded, because:
    • Old tracking files are not used, new tracking file is not created
    • Overwriting file protection: can't overwrite files that are not tracked. This info message will be displayed: <info>Extra file <comment>extra-file</comment> has been locally overriden in <comment>path/to/extra-file</comment>. To reset it, delete and reinstall.</info>

@tienvx tienvx requested a review from JP-Ellis April 17, 2024 04:02
@tienvx tienvx merged commit f0bf429 into main Apr 17, 2024
17 checks passed
@tienvx tienvx deleted the extra-download-repository branch April 17, 2024 04:47
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