"description":"This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
"description":"This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
"additionalProperties":true
"additionalProperties":true
},
},
"recommend":{
"require-dev":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and version constraints (values) that this package recommends to be installed (typically this will be installed as well).",
"description":"This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
"additionalProperties":true
"additionalProperties":true
},
},
"suggest":{
"suggest":{
"type":"object",
"type":"object",
"description":"This is a hash of package name (keys) and version constraints (values) that this package suggests work well with it (typically this will only be suggested to the user).",
"description":"This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
@ -34,7 +37,7 @@ class DependsCommand extends Command
->setDescription('Shows which packages depend on the given package')
->setDescription('Shows which packages depend on the given package')
->setDefinition(array(
->setDefinition(array(
new InputArgument('package', InputArgument::REQUIRED, 'Package to inspect'),
new InputArgument('package', InputArgument::REQUIRED, 'Package to inspect'),
new InputOption('link-type', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Link types to show', $this->linkTypes)
new InputOption('link-type', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Link types to show (require, require-dev)', array_keys($this->linkTypes))
))
))
->setHelp(<<<EOT
->setHelp(<<<EOT
Displays detailed information about where a package is referenced.
Displays detailed information about where a package is referenced.
@ -81,10 +84,10 @@ EOT
foreach ($repository->getPackages() as $package) {
foreach ($repository->getPackages() as $package) {
foreach ($types as $type) {
foreach ($types as $type) {
$type = rtrim($type, 's');
$type = rtrim($type, 's');
if (!in_array($type, $this->linkTypes)) {
if (!isset($this->linkTypes[$type])) {
throw new \InvalidArgumentException('Unexpected link type: '.$type.', valid types: '.implode(', ', $this->linkTypes));
throw new \InvalidArgumentException('Unexpected link type: '.$type.', valid types: '.implode(', ', array_keys($this->linkTypes)));
}
}
foreach ($package->{'get'.$type.'s'}() as $link) {
foreach ($package->{'get'.$this->linkTypes[$type]}() as $link) {
@ -32,8 +32,7 @@ class InstallCommand extends Command
->setDefinition(array(
->setDefinition(array(
new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
new InputOption('no-install-recommends', null, InputOption::VALUE_NONE, 'Do not install recommended packages (ignored when installing from an existing lock file).'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of dev-require packages.'),
new InputOption('install-suggests', null, InputOption::VALUE_NONE, 'Also install suggested packages (ignored when installing from an existing lock file).'),
))
))
->setHelp(<<<EOT
->setHelp(<<<EOT
The <info>install</info> command reads the composer.json file from the
The <info>install</info> command reads the composer.json file from the
foreach ($repository->getPackages() as $package) {
foreach ($localRepositories as $repo) {
if ('composer-installer' === $package->getType()) {
foreach ($repo->getPackages() as $package) {
$this->registerInstaller($package);
if ('composer-installer' === $package->getType()) {
$this->registerInstaller($package);
}
}
}
}
}
}
}
@ -51,28 +54,28 @@ class InstallerInstaller extends LibraryInstaller
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
public function install(PackageInterface $package)
public function install(WritableRepositoryInterface $repo, PackageInterface $package)
{
{
$extra = $package->getExtra();
$extra = $package->getExtra();
if (empty($extra['class'])) {
if (empty($extra['class'])) {
throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-installer packages should have a class defined in their extra key to be usable.');
throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-installer packages should have a class defined in their extra key to be usable.');
}
}
parent::install($package);
parent::install($repo, $package);
$this->registerInstaller($package);
$this->registerInstaller($package);
}
}
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
public function update(PackageInterface $initial, PackageInterface $target)
public function update(WritableRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
{
$extra = $target->getExtra();
$extra = $target->getExtra();
if (empty($extra['class'])) {
if (empty($extra['class'])) {
throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-installer packages should have a class defined in their extra key to be usable.');
throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-installer packages should have a class defined in their extra key to be usable.');
}
}
parent::update($initial, $target);
parent::update($repo, $initial, $target);
$this->registerInstaller($target);
$this->registerInstaller($target);
}
}
@ -97,7 +100,7 @@ class InstallerInstaller extends LibraryInstaller
}
}
$extra = $package->getExtra();
$extra = $package->getExtra();
$installer = new $class($this->vendorDir, $this->binDir, $this->downloadManager, $this->repository, $this->io);
$installer = new $class($this->vendorDir, $this->binDir, $this->downloadManager, $this->io);