Merge branch '1.3'

main
Jordi Boggiano 7 years ago
commit c61a1c7523

@ -84,7 +84,7 @@ class FileDownloader implements DownloaderInterface
} }
if ($output) { if ($output) {
$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);
} }
$urls = $package->getDistUrls(); $urls = $package->getDistUrls();
@ -153,6 +153,10 @@ class FileDownloader implements DownloaderInterface
} }
} }
if (!$this->outputProgress) {
$this->io->writeError(' (<comment>100%</comment>)', false);
}
if ($this->cache) { if ($this->cache) {
$this->lastCacheWrites[$package->getName()] = $cacheKey; $this->lastCacheWrites[$package->getName()] = $cacheKey;
$this->cache->copyFrom($cacheKey, $fileName); $this->cache->copyFrom($cacheKey, $fileName);
@ -206,7 +210,7 @@ class FileDownloader implements DownloaderInterface
$from = $initial->getPrettyVersion(); $from = $initial->getPrettyVersion();
$to = $target->getPrettyVersion(); $to = $target->getPrettyVersion();
$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->remove($initial, $path, false); $this->remove($initial, $path, false);
$this->download($target, $path, false); $this->download($target, $path, false);

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

@ -60,7 +60,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information'); 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); $this->filesystem->emptyDirectory($path);
$urls = $package->getSourceUrls(); $urls = $package->getSourceUrls();
@ -130,7 +130,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
$to = $target->getFullPrettyVersion(); $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); $this->cleanChanges($initial, $path, true);
$urls = $target->getSourceUrls(); $urls = $target->getSourceUrls();

@ -1316,7 +1316,7 @@ class Installer
} }
} }
if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock'))) { if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
$this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>'); $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
} }

@ -276,7 +276,7 @@ class RemoteFilesystem
} }
if ($this->progress && !$isRedirect) { if ($this->progress && !$isRedirect) {
$this->io->writeError(" Downloading: <comment>Connecting...</comment>", false); $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
} }
$errorMessage = ''; $errorMessage = '';
@ -367,7 +367,7 @@ class RemoteFilesystem
if ($statusCode && $statusCode >= 400 && $statusCode <= 599) { if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
if (!$this->retry) { if (!$this->retry) {
if ($this->progress && !$this->retry && !$isRedirect) { 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); $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) { 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 // decode gzip
@ -568,7 +568,7 @@ class RemoteFilesystem
if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) { if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
$this->lastProgress = $progression; $this->lastProgress = $progression;
$this->io->overwriteError(" Downloading: <comment>$progression%</comment>", false); $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
} }
} }
break; break;
@ -591,6 +591,11 @@ class RemoteFilesystem
} elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) { } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
$message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit'); $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
$gitLabUtil = new GitLab($this->io, $this->config, null); $gitLabUtil = new GitLab($this->io, $this->config, null);
if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
}
if (!$gitLabUtil->authorizeOAuth($this->originUrl) if (!$gitLabUtil->authorizeOAuth($this->originUrl)
&& (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message)) && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
) { ) {

@ -2,7 +2,7 @@
create-project seld/jsonlint %testDir% 1.0.0 --prefer-source -n create-project seld/jsonlint %testDir% 1.0.0 --prefer-source -n
--EXPECT-ERROR-- --EXPECT-ERROR--
Installing seld/jsonlint (1.0.0) 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% Created project in %testDir%
Loading composer repositories with package information Loading composer repositories with package information
Updating dependencies (including require-dev) Updating dependencies (including require-dev)

Loading…
Cancel
Save