Permalink
Browse files

Merge remote-tracking branch 'upstream/master' into feature-dist

  • Loading branch information...
2 parents 7ad3185 + 0a55707 commit 926a36d04e760222b225ba5365f1ecc8f5f1ee77 @till till committed Jul 3, 2012
Showing with 2,701 additions and 673 deletions.
  1. +3 −2 doc/04-schema.md
  2. +37 −1 doc/05-repositories.md
  3. +6 −3 src/Composer/Autoload/AutoloadGenerator.php
  4. +1 −1 src/Composer/Command/CreateProjectCommand.php
  5. +10 −3 src/Composer/Command/ShowCommand.php
  6. +0 −1 src/Composer/Command/ValidateCommand.php
  7. +4 −6 src/Composer/Config.php
  8. +4 −0 src/Composer/DependencyResolver/Transaction.php
  9. +0 −52 src/Composer/Downloader/PearDownloader.php
  10. +90 −28 src/Composer/Downloader/PearPackageExtractor.php
  11. +22 −16 src/Composer/Factory.php
  12. +60 −7 src/Composer/Installer.php
  13. +0 −38 src/Composer/Installer/InstallationManager.php
  14. +8 −12 src/Composer/Installer/InstallerInstaller.php
  15. +43 −19 src/Composer/Installer/LibraryInstaller.php
  16. +137 −0 src/Composer/Installer/PearInstaller.php
  17. +12 −8 src/Composer/Json/JsonFile.php
  18. +2 −2 src/Composer/Json/JsonValidationException.php
  19. +1 −1 src/Composer/Package/Loader/JsonLoader.php
  20. +4 −1 src/Composer/Repository/ArrayRepository.php
  21. +81 −0 src/Composer/Repository/Pear/BaseChannelReader.php
  22. +67 −0 src/Composer/Repository/Pear/ChannelInfo.php
  23. +91 −0 src/Composer/Repository/Pear/ChannelReader.php
  24. +164 −0 src/Composer/Repository/Pear/ChannelRest10Reader.php
  25. +136 −0 src/Composer/Repository/Pear/ChannelRest11Reader.php
  26. +60 −0 src/Composer/Repository/Pear/DependencyConstraint.php
  27. +50 −0 src/Composer/Repository/Pear/DependencyInfo.php
  28. +314 −0 src/Composer/Repository/Pear/PackageDependencyParser.php
  29. +94 −0 src/Composer/Repository/Pear/PackageInfo.php
  30. +50 −0 src/Composer/Repository/Pear/ReleaseInfo.php
  31. +95 −307 src/Composer/Repository/PearRepository.php
  32. +11 −6 src/Composer/Repository/Vcs/GitBitbucketDriver.php
  33. +3 −2 src/Composer/Repository/Vcs/GitDriver.php
  34. +10 −6 src/Composer/Repository/Vcs/GitHubDriver.php
  35. +11 −6 src/Composer/Repository/Vcs/HgBitbucketDriver.php
  36. +1 −1 src/Composer/Repository/Vcs/HgDriver.php
  37. +3 −2 src/Composer/Repository/Vcs/SvnDriver.php
  38. +21 −18 tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
  39. +11 −1 tests/Composer/Test/Downloader/Fixtures/Package_v2.1/package.xml
  40. +0 −38 tests/Composer/Test/Downloader/PearDownloaderTest.php
  41. +62 −10 tests/Composer/Test/Downloader/PearPackageExtractorTest.php
  42. +55 −0 tests/Composer/Test/Fixtures/installer/update-alias-lock.test
  43. +37 −0 tests/Composer/Test/Fixtures/installer/update-alias.test
  44. +46 −0 tests/Composer/Test/Fixtures/installer/update-whitelist-reads-lock.test
  45. +0 −28 tests/Composer/Test/Installer/InstallationManagerTest.php
  46. +34 −12 tests/Composer/Test/Installer/InstallerInstallerTest.php
  47. +27 −12 tests/Composer/Test/Installer/LibraryInstallerTest.php
  48. +24 −3 tests/Composer/Test/InstallerTest.php
  49. +1 −0 tests/Composer/Test/Json/JsonFileTest.php
  50. +6 −1 tests/Composer/Test/Mock/FactoryMock.php
  51. +7 −2 tests/Composer/Test/Mock/InstallationManagerMock.php
  52. +40 −0 tests/Composer/Test/Mock/RemoteFilesystemMock.php
  53. +151 −0 tests/Composer/Test/Repository/Pear/ChannelReaderTest.php
  54. +41 −0 tests/Composer/Test/Repository/Pear/ChannelRest10ReaderTest.php
  55. +37 −0 tests/Composer/Test/Repository/Pear/ChannelRest11ReaderTest.php
  56. +167 −0 tests/Composer/Test/Repository/Pear/Fixtures/DependencyParserTestData.json
  57. +9 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.0/http_client_allreleases.xml
  58. +1 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.0/http_client_deps.1.2.1.txt
  59. +14 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.0/http_client_info.xml
  60. +9 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.0/http_request_allreleases.xml
  61. +1 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.0/http_request_deps.1.4.0.txt
  62. +12 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.0/http_request_info.xml
  63. +6 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.0/packages.xml
  64. +5 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.1/categories.xml
  65. +97 −0 tests/Composer/Test/Repository/Pear/Fixtures/Rest1.1/packagesinfo.xml
  66. +12 −0 tests/Composer/Test/Repository/Pear/Fixtures/channel.1.0.xml
  67. +12 −0 tests/Composer/Test/Repository/Pear/Fixtures/channel.1.1.xml
  68. +58 −0 tests/Composer/Test/Repository/Pear/PackageDependencyParserTest.php
  69. +11 −17 tests/Composer/Test/Repository/PearRepositoryTest.php
  70. +2 −0 tests/bootstrap.php
View
@@ -280,10 +280,11 @@ Example:
Lists packages required by this package. The package will not be installed
unless those requirements can be met.
-#### require-dev
+#### require-dev <span>(root-only)</span>
Lists packages required for developing this package, or running
-tests, etc. They are installed if install or update is ran with `--dev`.
+tests, etc. The dev requirements of the root package only will be installed
+if `install` or `update` is ran with `--dev`.
Packages listed here and their dependencies can not overrule the resolution
found with the packages listed in require. This is even true if a different
View
@@ -202,7 +202,7 @@ should you need to specify one for whatever reason, you can use `git`, `svn` or
It is possible to install packages from any PEAR channel by using the `pear`
repository. Composer will prefix all package names with `pear-{channelName}/` to
-avoid conflicts.
+avoid conflicts. All packages are also aliased with prefix `pear-{channelAlias}/`
Example using `pear2.php.net`:
@@ -214,6 +214,7 @@ Example using `pear2.php.net`:
}
],
"require": {
+ "pear-pear2.php.net/PEAR2_Text_Markdown": "*",
"pear-pear2/PEAR2_HTTP_Request": "*"
}
}
@@ -224,6 +225,41 @@ In this case the short name of the channel is `pear2`, so the
> **Note:** The `pear` repository requires doing quite a few requests per
> package, so this may considerably slow down the installation process.
+#### Custom channel alias
+It is possible to alias all pear channel packages with custom name.
+
+Example:
+You own private pear repository and going to use composer abilities to bring dependencies from vcs or transit to composer repository scheme.
+Your repository list of packages:
+ * BasePackage, requires nothing
+ * IntermediatePackage, depends on BasePackage
+ * TopLevelPackage1 and TopLevelPackage2 both dependth on IntermediatePackage.
+
+For composer it looks like:
+ * "pear-pear.foobar.repo/IntermediatePackage" depends on "pear-pear.foobar.repo/BasePackage",
+ * "pear-pear.foobar.repo/TopLevelPackage1" depends on "pear-pear.foobar.repo/IntermediatePackage",
+ * "pear-pear.foobar.repo/TopLevelPackage2" depends on "pear-pear.foobar.repo/IntermediatePackage"
+
+When you update one of your packages to composer naming scheme or made it available through vcs, your older dependencies would not see new version, cause it would be named like "foobar/IntermediatePackage". Specifying 'vendor-alias' for pear repository, you will get all its packages aliased with composer-like names. Following example would take BasePackage, TopLevelPackage1 and TopLevelPackage2 packages from pear repository and IntermediatePackage from github repository:
+
+ {
+ "repositories": [
+ {
+ "type": "git",
+ "https://github.com/foobar/intermediate.git"
+ },
+ {
+ "type": "pear",
+ "url": "http://pear.foobar.repo",
+ "vendor-alias": "foobar"
+ }
+ ],
+ "require": {
+ "foobar/TopLevelPackage1": "*",
+ "foobar/TopLevelPackage2": "*"
+ }
+ }
+
### Package
If you want to use a project that does not support composer through any of the
@@ -12,6 +12,7 @@
namespace Composer\Autoload;
+use Composer\Config;
use Composer\Installer\InstallationManager;
use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
@@ -24,12 +25,14 @@
*/
class AutoloadGenerator
{
- public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir)
+ public function dump(Config $config, RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir)
{
$filesystem = new Filesystem();
- $filesystem->ensureDirectoryExists($installationManager->getVendorPath());
+ $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
+ $vendorPath = strtr(realpath($config->get('vendor-dir')), '\\', '/');
+ $targetDir = $vendorPath.'/'.$targetDir;
$filesystem->ensureDirectoryExists($targetDir);
- $vendorPath = strtr(realpath($installationManager->getVendorPath()), '\\', '/');
+
$relVendorPath = $filesystem->findShortestPath(getcwd(), $vendorPath, true);
$vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
$vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
@@ -119,11 +119,11 @@ public function installProject(IOInterface $io, $packageName, $directory = null,
}
}
+ $io->write('<info>Installing ' . $package->getName() . ' (' . VersionParser::formatVersion($package, false) . ')</info>', true);
if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
$package->setSourceReference(substr($package->getPrettyVersion(), 4));
}
- $io->write('<info>Installing ' . $package->getName() . ' (' . VersionParser::formatVersion($package, false) . ')</info>', true);
$projectInstaller = new ProjectInstaller($directory, $dm);
$projectInstaller->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), $package);
if ($package->getRepository() instanceof NotifiableRepositoryInterface) {
@@ -19,6 +19,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use Composer\Repository\ArrayRepository;
use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface;
@@ -39,6 +40,7 @@ protected function configure()
new InputArgument('version', InputArgument::OPTIONAL, 'Version to inspect'),
new InputOption('installed', null, InputOption::VALUE_NONE, 'List installed packages only'),
new InputOption('platform', null, InputOption::VALUE_NONE, 'List platform packages only'),
+ new InputOption('self', null, InputOption::VALUE_NONE, 'Show the root package information'),
))
->setHelp(<<<EOT
The show command displays detailed information about a package, or
@@ -53,7 +55,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
// init repos
$platformRepo = new PlatformRepository;
- if ($input->getOption('platform')) {
+ if ($input->getOption('self')) {
+ $package = $this->getComposer(false)->getPackage();
+ $repos = $installedRepo = new ArrayRepository(array($package));
+ } elseif ($input->getOption('platform')) {
$repos = $installedRepo = $platformRepo;
} elseif ($input->getOption('installed')) {
$composer = $this->getComposer();
@@ -70,8 +75,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
// show single package or single version
- if ($input->getArgument('package')) {
- $package = $this->getPackage($input, $output, $installedRepo, $repos);
+ if ($input->getArgument('package') || !empty($package)) {
+ if (empty($package)) {
+ $package = $this->getPackage($input, $output, $installedRepo, $repos);
+ }
if (!$package) {
throw new \InvalidArgumentException('Package '.$input->getArgument('package').' not found');
}
@@ -91,7 +91,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}
} catch (\Exception $e) {
- $output->writeln('<error>' . $file . ' contains a JSON Syntax Error:</error>');
$output->writeln('<error>' . $e->getMessage() . '</error>');
return 1;
View
@@ -64,11 +64,9 @@ public function merge(array $config)
}
// disable a repository with an anonymous {"name": false} repo
- foreach ($this->repositories as $repoName => $repoSpec) {
- if (isset($repository[$repoName]) && false === $repository[$repoName]) {
- unset($this->repositories[$repoName]);
- continue 2;
- }
+ if (1 === count($repository) && false === current($repository)) {
+ unset($this->repositories[key($repository)]);
+ continue;
}
// store repo
@@ -105,7 +103,7 @@ public function get($key)
// convert foo-bar to COMPOSER_FOO_BAR and check if it exists since it overrides the local config
$env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
- return $this->process(getenv($env) ?: $this->config[$key]);
+ return rtrim($this->process(getenv($env) ?: $this->config[$key]), '/\\');
case 'home':
return rtrim($this->process($this->config[$key]), '/\\');
@@ -183,6 +183,10 @@ protected function findUpdates()
$literal = $decision[Decisions::DECISION_LITERAL];
$package = $this->pool->literalToPackage($literal);
+ if ($package instanceof AliasPackage) {
+ continue;
+ }
+
// !wanted & installed
if ($literal <= 0 && isset($this->installedMap[$package->getId()])) {
$updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
@@ -1,52 +0,0 @@
-<?php
-
-/*
- * This file is part of Composer.
- *
- * (c) Nils Adermann <naderman@naderman.de>
- * Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Composer\Downloader;
-
-use Composer\Package\PackageInterface;
-
-/**
- * Downloader for pear packages
- *
- * @author Jordi Boggiano <j.boggiano@seld.be>
- * @author Kirill chEbba Chebunin <iam@chebba.org>
- */
-class PearDownloader extends FileDownloader
-{
- /**
- * {@inheritDoc}
- */
- public function download(PackageInterface $package, $path)
- {
- parent::download($package, $path);
-
- $fileName = $this->getFileName($package, $path);
- if ($this->io->isVerbose()) {
- $this->io->write(' Installing PEAR package');
- }
- try {
- $pearExtractor = new PearPackageExtractor($fileName);
- $pearExtractor->extractTo($path);
-
- if ($this->io->isVerbose()) {
- $this->io->write(' Cleaning up');
- }
- unlink($fileName);
- } catch (\Exception $e) {
- // clean up
- $this->filesystem->removeDirectory($path);
- throw $e;
- }
-
- $this->io->write('');
- }
-}
Oops, something went wrong.

0 comments on commit 926a36d

Please sign in to comment.