pull/10517/head
parent
88171e409d
commit
8053d794a8
|
@ -21,6 +21,8 @@ use Composer\Package\BasePackage;
|
||||||
use Composer\Pcre\Preg;
|
use Composer\Pcre\Preg;
|
||||||
use Composer\Plugin\CommandEvent;
|
use Composer\Plugin\CommandEvent;
|
||||||
use Composer\Plugin\PluginEvents;
|
use Composer\Plugin\PluginEvents;
|
||||||
|
use Composer\Script\ScriptEvents;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
@ -127,7 +129,8 @@ EOT
|
||||||
});
|
});
|
||||||
|
|
||||||
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'reinstall', $input, $output);
|
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'reinstall', $input, $output);
|
||||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
$eventDispatcher = $composer->getEventDispatcher();
|
||||||
|
$eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
|
||||||
|
|
||||||
$config = $composer->getConfig();
|
$config = $composer->getConfig();
|
||||||
list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
|
list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
|
||||||
|
@ -146,8 +149,13 @@ EOT
|
||||||
$downloadManager->setPreferSource($preferSource);
|
$downloadManager->setPreferSource($preferSource);
|
||||||
$downloadManager->setPreferDist($preferDist);
|
$downloadManager->setPreferDist($preferDist);
|
||||||
|
|
||||||
$installationManager->execute($localRepo, $uninstallOperations, true);
|
$devMode = $localRepo->getDevMode() !== null ? $localRepo->getDevMode() : true;
|
||||||
$installationManager->execute($localRepo, $installOperations, true);
|
|
||||||
|
Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
|
||||||
|
$eventDispatcher->dispatchScript(ScriptEvents::PRE_INSTALL_CMD, $devMode);
|
||||||
|
|
||||||
|
$installationManager->execute($localRepo, $uninstallOperations, $devMode);
|
||||||
|
$installationManager->execute($localRepo, $installOperations, $devMode);
|
||||||
|
|
||||||
if (!$input->getOption('no-autoloader')) {
|
if (!$input->getOption('no-autoloader')) {
|
||||||
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
|
$optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
|
||||||
|
@ -162,6 +170,8 @@ EOT
|
||||||
$generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
|
$generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$eventDispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, $devMode);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ class FilesystemRepository extends WritableArrayRepository
|
||||||
private $rootPackage;
|
private $rootPackage;
|
||||||
/** @var Filesystem */
|
/** @var Filesystem */
|
||||||
private $filesystem;
|
private $filesystem;
|
||||||
|
/** @var bool|null */
|
||||||
|
private $devMode = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes filesystem repository.
|
* Initializes filesystem repository.
|
||||||
|
@ -56,6 +58,14 @@ class FilesystemRepository extends WritableArrayRepository
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool|null true if dev requirements were installed, false if --no-dev was used, null if yet unknown
|
||||||
|
*/
|
||||||
|
public function getDevMode()
|
||||||
|
{
|
||||||
|
return $this->devMode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes repository (reads file, or remote address).
|
* Initializes repository (reads file, or remote address).
|
||||||
*/
|
*/
|
||||||
|
@ -78,6 +88,9 @@ class FilesystemRepository extends WritableArrayRepository
|
||||||
if (isset($data['dev-package-names'])) {
|
if (isset($data['dev-package-names'])) {
|
||||||
$this->setDevPackageNames($data['dev-package-names']);
|
$this->setDevPackageNames($data['dev-package-names']);
|
||||||
}
|
}
|
||||||
|
if (isset($data['dev'])) {
|
||||||
|
$this->devMode = $data['dev'];
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_array($packages)) {
|
if (!is_array($packages)) {
|
||||||
throw new \UnexpectedValueException('Could not parse package list from the repository');
|
throw new \UnexpectedValueException('Could not parse package list from the repository');
|
||||||
|
|
|
@ -21,6 +21,11 @@ namespace Composer\Repository;
|
||||||
*/
|
*/
|
||||||
interface InstalledRepositoryInterface extends WritableRepositoryInterface
|
interface InstalledRepositoryInterface extends WritableRepositoryInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return bool|null true if dev requirements were installed, false if --no-dev was used, null if yet unknown
|
||||||
|
*/
|
||||||
|
public function getDevMode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool true if packages were never installed in this repository
|
* @return bool true if packages were never installed in this repository
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,6 +27,17 @@ class WritableArrayRepository extends ArrayRepository implements WritableReposit
|
||||||
*/
|
*/
|
||||||
protected $devPackageNames = array();
|
protected $devPackageNames = array();
|
||||||
|
|
||||||
|
/** @var bool|null */
|
||||||
|
private $devMode = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool|null true if dev requirements were installed, false if --no-dev was used, null if yet unknown
|
||||||
|
*/
|
||||||
|
public function getDevMode()
|
||||||
|
{
|
||||||
|
return $this->devMode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
@ -48,6 +59,7 @@ class WritableArrayRepository extends ArrayRepository implements WritableReposit
|
||||||
*/
|
*/
|
||||||
public function write($devMode, InstallationManager $installationManager)
|
public function write($devMode, InstallationManager $installationManager)
|
||||||
{
|
{
|
||||||
|
$this->devMode = $devMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,6 +67,7 @@ class WritableArrayRepository extends ArrayRepository implements WritableReposit
|
||||||
*/
|
*/
|
||||||
public function reload()
|
public function reload()
|
||||||
{
|
{
|
||||||
|
$this->devMode = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue