mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Merge pull request #473 from Seldaek/gzip
Automatic gzip encoding support
This commit is contained in:
commit
366e98288e
11 changed files with 102 additions and 51 deletions
|
@ -29,4 +29,12 @@ abstract class Command extends BaseCommand
|
|||
{
|
||||
return $this->getApplication()->getComposer($required);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\IO\ConsoleIO
|
||||
*/
|
||||
protected function getIO()
|
||||
{
|
||||
return $this->getApplication()->getIO();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
|
||||
/**
|
||||
* Install a package as new project into new directory.
|
||||
|
@ -86,7 +87,7 @@ EOT
|
|||
if (null === $repositoryUrl) {
|
||||
$sourceRepo = new ComposerRepository(array('url' => 'http://packagist.org'));
|
||||
} elseif (".json" === substr($repositoryUrl, -5)) {
|
||||
$sourceRepo = new FilesystemRepository(new JsonFile($repositoryUrl));
|
||||
$sourceRepo = new FilesystemRepository(new JsonFile($repositoryUrl, new RemoteFilesystem($io)));
|
||||
} elseif (0 === strpos($repositoryUrl, 'http')) {
|
||||
$sourceRepo = new ComposerRepository(array('url' => $repositoryUrl));
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Command;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Util\StreamContextFactory;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
|
@ -40,9 +40,8 @@ EOT
|
|||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$ctx = StreamContextFactory::getContext();
|
||||
|
||||
$latest = trim(file_get_contents('http://getcomposer.org/version', false, $ctx));
|
||||
$rfs = new RemoteFilesystem($this->getIO());
|
||||
$latest = trim($rfs->getContents('getcomposer.org', 'http://getcomposer.org/version', false));
|
||||
|
||||
if (Composer::VERSION !== $latest) {
|
||||
$output->writeln(sprintf("Updating to version <info>%s</info>.", $latest));
|
||||
|
@ -50,7 +49,7 @@ EOT
|
|||
$remoteFilename = 'http://getcomposer.org/composer.phar';
|
||||
$localFilename = $_SERVER['argv'][0];
|
||||
|
||||
copy($remoteFilename, $localFilename, $ctx);
|
||||
$rfs->copy('getcomposer.org', $remoteFilename, $localFilename);
|
||||
} else {
|
||||
$output->writeln("<info>You are using the latest composer version.</info>");
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Json\JsonValidationException;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
|
||||
/**
|
||||
* @author Robert Schönthal <seroscho@googlemail.com>
|
||||
|
@ -55,7 +56,7 @@ EOT
|
|||
|
||||
$laxValid = false;
|
||||
try {
|
||||
$json = new JsonFile($file);
|
||||
$json = new JsonFile($file, new RemoteFilesystem($this->getIO()));
|
||||
$json->read();
|
||||
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue