-
Notifications
You must be signed in to change notification settings - Fork 46
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
Display information when downloading a file. #65
Display information when downloading a file. #65
Conversation
Also, it would be great if we can respect |
I've checked the output. I my opinion it generates too much noise (and new lines). Suggestions:
|
Hi, i think the proposed changes by @T2L are valid. @FlorentTorregrosa do you want to change the PR accordingly? |
Hello, Thanks both for your feedback. I will try to change the pull request accordingly. I also think that it would be nice to add colors and to do as composer does, I currently don't know how to do that. That's why I didn't do that before. I will search for that. I don't know when I would have time to update my PR. Also if I can have a feedback on #58 because all concerns where addressed, it would be nice so if something needs to be changed I will do it when I will (re-)dig into composer. |
Hello, I have updated the pull request with the suggestions and fixed the tests. Is it ok now to be merged? |
src/PrestissimoFileFetcher.php
Outdated
@@ -43,7 +37,16 @@ protected function fetchWithPrestissimo($version, $destination) { | |||
array_walk($this->filenames, function ($filename) use ($version, $destination, &$requests) { | |||
$url = $this->getUri($filename, $version); | |||
$this->fs->ensureDirectoryExists($destination . '/' . dirname($filename)); | |||
$requests[] = new CopyRequest($url, $destination . '/' . $filename, false, $this->io, $this->config); | |||
if ($this->progress) { |
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.
I think, we can skip this hunk and add the information in line 65.
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.
@webflo Thanks for your review.
At line 65, the $filename variable is not defined. So should I remove lines 40 to 49 and use the previous line 46? And leave line 65 as it is?
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.
Seen with @greg-1-anderson. Will update the pull request.
Saw with @greg-1-anderson, I will refactor FileFetcher, InitialFileFetcher and PrestissimoFileFetcher to avoid code duplication and to use Prestissimo for initial file fetching. |
I was about to submit a PR way worse then this one. 👍 I learned drupal-scaffold is fetching the d.o. files and it's good to know these are fetched and when refetching with |
Hello, The refactoring has been done. Thanks for the review. |
src/FileFetcher.php
Outdated
public function fetch($version, $destination, $erase) { | ||
foreach ($this->filenames as $sourceFilename => $filename) { | ||
$target = "$destination/$filename"; | ||
if ($erase || !file_exists($target)) { |
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.
So this does not fetch a file when already existing.
That sounds bad to me. Ie a new default.settings.php or .htaccess fixing a security issue I definitely want that downloaded when updating a project.
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.
It fetches a file even if it already exists because in https://github.com/drupal-composer/drupal-scaffold/pull/65/files#diff-bb433a78829fe2e46d711575194d4f50R140 we use the $erase parameter to TRUE and only $erase to FALSE when using it for the initial fetch https://github.com/drupal-composer/drupal-scaffold/pull/65/files#diff-bb433a78829fe2e46d711575194d4f50R143
In the README.md:
The initial hash lists files that should be copied over only if they do not exist in the destination. The key specifies the path to the source file, and the value indicates the path to the destination file.
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.
I was referring @ the code lines changed. I should have dug deeper. Sorry
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.
No problem. Thanks for the review.
…-progress option into account.
…n if not in verbose mode.
3f1a173
to
027cc50
Compare
Hello, I have rebased my changes to followup the last code changes in drupal-scaffold. Would it be possible to have a review please? |
The |
Hello, The $erase is not a new feature, it was introduced to refactor the FileFetcher and the initialFileFetcher classes. Therefore the initial fetch also benefits from the PrestissimoFileFetcher. |
Alright, i understand it has been a while since i looked at the code. Lets rename it to |
OK. I have changed the name of the variable. |
Merged. @FlorentTorregrosa thanks 👍 |
\o/ Thanks!!! Finally merged 🎁 🎄 🎁. It's Christmas magic :D Next steps: |
Currently when downloading files, the command line displays a concatenated string of "Downloading: 100%" which is not helpful to see which file is downloaded where and which file fails downloading in case of failure.
Here is some code to improve the output of the command line.
Thanks for the review.