1
0
Fork 0

streamline install progress messages

pull/6099/head
David Zuelke 2017-01-24 19:45:16 +01:00
parent 65a5727315
commit 2d36324e99
9 changed files with 23 additions and 18 deletions

View File

@ -132,6 +132,7 @@ class FileDownloader implements DownloaderInterface
// download if we don't have it in cache or the cache is invalidated
if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
$this->io->writeError(': ', false);
if (!$this->outputProgress) {
$this->io->writeError('Downloading', false);
}
@ -153,12 +154,16 @@ class FileDownloader implements DownloaderInterface
}
}
if (!$this->outputProgress) {
$this->io->writeError(' (<comment>100%</comment>)', false);
}
if ($this->cache) {
$this->lastCacheWrites[$package->getName()] = $cacheKey;
$this->cache->copyFrom($cacheKey, $fileName);
}
} else {
$this->io->writeError(' Loading from cache', false);
$this->io->writeError(' from cache', false);
}
if (!file_exists($fileName)) {

View File

@ -77,7 +77,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
if ($output) {
$this->io->writeError(sprintf(
' - Installing <info>%s</info> (<comment>%s</comment>)',
' - Installing <info>%s</info> (<comment>%s</comment>): ',
$package->getName(),
$package->getFullPrettyVersion()
), false);
@ -88,8 +88,8 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
try {
if (Platform::isWindows()) {
// Implement symlinks as NTFS junctions on Windows
$this->io->writeError(sprintf('Junctioning from %s', $url), false);
$this->filesystem->junction($realUrl, $path);
$this->io->writeError(sprintf(' Junctioned from %s', $url), false);
} else {
$absolutePath = $path;
if (!$this->filesystem->isAbsolutePath($absolutePath)) {
@ -97,8 +97,8 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
}
$shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
$path = rtrim($path, "/");
$this->io->writeError(sprintf('Symlinking from %s', $url), false);
$fileSystem->symlink($shortestPath, $path);
$this->io->writeError(sprintf(' Symlinked from %s', $url), false);
}
} catch (IOException $e) {
if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
@ -114,8 +114,8 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
// Fallback if symlink failed or if symlink is not allowed for the package
if (self::STRATEGY_MIRROR == $currentStrategy) {
$this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
$fileSystem->mirror($realUrl, $path);
$this->io->writeError(sprintf('%s Mirrored from %s', $isFallback ? ' ' : '', $url), false);
}
$this->io->writeError('');

View File

@ -60,7 +60,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
}
$this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)", false);
$this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
$this->filesystem->emptyDirectory($path);
$urls = $package->getSourceUrls();
@ -130,7 +130,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
$to = $target->getFullPrettyVersion();
}
$this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)", false);
$this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
$this->cleanChanges($initial, $path, true);
$urls = $target->getSourceUrls();

View File

@ -276,7 +276,7 @@ class RemoteFilesystem
}
if ($this->progress && !$isRedirect) {
$this->io->writeError(" Downloading: <comment>Connecting...</comment>", false);
$this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
}
$errorMessage = '';
@ -367,7 +367,7 @@ class RemoteFilesystem
if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
if (!$this->retry) {
if ($this->progress && !$this->retry && !$isRedirect) {
$this->io->overwriteError(" Downloading: <error>Failed</error>", false);
$this->io->overwriteError("Downloading (<error>failed</error>)", false);
}
$e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
@ -380,7 +380,7 @@ class RemoteFilesystem
}
if ($this->progress && !$this->retry && !$isRedirect) {
$this->io->overwriteError(" Downloading: ".($result === false ? '<error>Failed</error>' : '<comment>100%</comment>'), false);
$this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>)'), false);
}
// decode gzip
@ -567,7 +567,7 @@ class RemoteFilesystem
if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
$this->lastProgress = $progression;
$this->io->overwriteError(" Downloading: <comment>$progression%</comment>", false);
$this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
}
}
break;

View File

@ -2,7 +2,7 @@
create-project seld/jsonlint %testDir% 1.0.0 --prefer-source -n
--EXPECT-ERROR--
Installing seld/jsonlint (1.0.0)
- Installing seld/jsonlint (1.0.0) Cloning 3b4bc2a96f
- Installing seld/jsonlint (1.0.0): Cloning 3b4bc2a96f
Created project in %testDir%
Loading composer repositories with package information
Updating dependencies (including require-dev)