1
0
Fork 0

Rename *-solve-dependencies to *-dependencies-solving

pull/2085/merge
Jordi Boggiano 2014-09-30 16:26:55 +01:00
parent 81fa284c9b
commit efcdb394d3
5 changed files with 19 additions and 17 deletions

View File

@ -26,6 +26,8 @@ Composer fires the following named events during its execution process:
- **post-update-cmd**: occurs after the `update` command is executed. - **post-update-cmd**: occurs after the `update` command is executed.
- **pre-status-cmd**: occurs before the `status` command is executed. - **pre-status-cmd**: occurs before the `status` command is executed.
- **post-status-cmd**: occurs after the `status` command is executed. - **post-status-cmd**: occurs after the `status` command is executed.
- **pre-dependencies-solving**: occurs before the dependencies are resolved.
- **post-dependencies-solving**: occurs after the dependencies are resolved.
- **pre-package-install**: occurs before a package is installed. - **pre-package-install**: occurs before a package is installed.
- **post-package-install**: occurs after a package is installed. - **post-package-install**: occurs after a package is installed.
- **pre-package-update**: occurs before a package is updated. - **pre-package-update**: occurs before a package is updated.

View File

@ -261,10 +261,10 @@ class Installer
$request->install($link->getTarget(), $link->getConstraint()); $request->install($link->getTarget(), $link->getConstraint());
} }
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_SOLVE_DEPENDENCIES, $policy, $pool, $installedRepo, $request); $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $policy, $pool, $installedRepo, $request);
$solver = new Solver($policy, $pool, $installedRepo); $solver = new Solver($policy, $pool, $installedRepo);
$ops = $solver->solve($request); $ops = $solver->solve($request);
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_SOLVE_DEPENDENCIES, $policy, $pool, $installedRepo, $request, $ops); $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $policy, $pool, $installedRepo, $request, $ops);
foreach ($ops as $op) { foreach ($ops as $op) {
if ($op->getJobType() === 'uninstall') { if ($op->getJobType() === 'uninstall') {
$devPackages[] = $op->getPackage(); $devPackages[] = $op->getPackage();
@ -467,11 +467,11 @@ class Installer
$this->processDevPackages($localRepo, $pool, $policy, $repositories, $lockedRepository, $installFromLock, 'force-links'); $this->processDevPackages($localRepo, $pool, $policy, $repositories, $lockedRepository, $installFromLock, 'force-links');
// solve dependencies // solve dependencies
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_SOLVE_DEPENDENCIES, $policy, $pool, $installedRepo, $request); $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $policy, $pool, $installedRepo, $request);
$solver = new Solver($policy, $pool, $installedRepo); $solver = new Solver($policy, $pool, $installedRepo);
try { try {
$operations = $solver->solve($request); $operations = $solver->solve($request);
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_SOLVE_DEPENDENCIES, $policy, $pool, $installedRepo, $request, $operations); $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $policy, $pool, $installedRepo, $request, $operations);
} catch (SolverProblemsException $e) { } catch (SolverProblemsException $e) {
$this->io->write('<error>Your requirements could not be resolved to an installable set of packages.</error>'); $this->io->write('<error>Your requirements could not be resolved to an installable set of packages.</error>');
$this->io->write($e->getMessage()); $this->io->write($e->getMessage());

View File

@ -20,7 +20,7 @@ namespace Composer\Installer;
class InstallerEvents class InstallerEvents
{ {
/** /**
* The PRE_SOLVE_DEPENDENCIES event occurs as a installer begins * The PRE_DEPENDENCIES_SOLVING event occurs as a installer begins
* resolve operations. * resolve operations.
* *
* The event listener method receives a * The event listener method receives a
@ -28,10 +28,10 @@ class InstallerEvents
* *
* @var string * @var string
*/ */
const PRE_SOLVE_DEPENDENCIES = 'pre-solve-dependencies'; const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
/** /**
* The POST_SOLVE_DEPENDENCIES event occurs as a installer after * The POST_DEPENDENCIES_SOLVING event occurs as a installer after
* resolve operations. * resolve operations.
* *
* The event listener method receives a * The event listener method receives a
@ -39,5 +39,5 @@ class InstallerEvents
* *
* @var string * @var string
*/ */
const POST_SOLVE_DEPENDENCIES = 'post-solve-dependencies'; const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
} }

View File

@ -182,5 +182,4 @@ class ScriptEvents
* @var string * @var string
*/ */
const POST_ARCHIVE_CMD = 'post-archive-cmd'; const POST_ARCHIVE_CMD = 'post-archive-cmd';
} }

View File

@ -14,8 +14,9 @@ namespace Composer\Test\EventDispatcher;
use Composer\EventDispatcher\Event; use Composer\EventDispatcher\Event;
use Composer\EventDispatcher\EventDispatcher; use Composer\EventDispatcher\EventDispatcher;
use Composer\Installer\InstallerEvents;
use Composer\TestCase; use Composer\TestCase;
use Composer\Script; use Composer\Script\ScriptEvents;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
class EventDispatcherTest extends TestCase class EventDispatcherTest extends TestCase
@ -34,7 +35,7 @@ class EventDispatcherTest extends TestCase
->method('write') ->method('write')
->with('<error>Script Composer\Test\EventDispatcher\EventDispatcherTest::call handling the post-install-cmd event terminated with an exception</error>'); ->with('<error>Script Composer\Test\EventDispatcher\EventDispatcherTest::call handling the post-install-cmd event terminated with an exception</error>');
$dispatcher->dispatchCommandEvent("post-install-cmd", false); $dispatcher->dispatchCommandEvent(ScriptEvents::POST_INSTALL_CMD, false);
} }
/** /**
@ -63,7 +64,7 @@ class EventDispatcherTest extends TestCase
->with($command) ->with($command)
->will($this->returnValue(0)); ->will($this->returnValue(0));
$dispatcher->dispatchCommandEvent("post-install-cmd", false); $dispatcher->dispatchCommandEvent(ScriptEvents::POST_INSTALL_CMD, false);
} }
public function testDispatcherCanExecuteCliAndPhpInSameEventScriptStack() public function testDispatcherCanExecuteCliAndPhpInSameEventScriptStack()
@ -99,7 +100,7 @@ class EventDispatcherTest extends TestCase
->with('Composer\Test\EventDispatcher\EventDispatcherTest', 'someMethod') ->with('Composer\Test\EventDispatcher\EventDispatcherTest', 'someMethod')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$dispatcher->dispatchCommandEvent("post-install-cmd", false); $dispatcher->dispatchCommandEvent(ScriptEvents::POST_INSTALL_CMD, false);
} }
private function getDispatcherStubForListenersTest($listeners, $io) private function getDispatcherStubForListenersTest($listeners, $io)
@ -145,7 +146,7 @@ class EventDispatcherTest extends TestCase
->will($this->returnValue($listener)); ->will($this->returnValue($listener));
ob_start(); ob_start();
$dispatcher->dispatchCommandEvent("post-install-cmd", false); $dispatcher->dispatchCommandEvent(ScriptEvents::POST_INSTALL_CMD, false);
$this->assertEquals('foo', trim(ob_get_clean())); $this->assertEquals('foo', trim(ob_get_clean()));
} }
@ -171,7 +172,7 @@ class EventDispatcherTest extends TestCase
->with($this->equalTo('<error>Script '.$code.' handling the post-install-cmd event returned with an error</error>')); ->with($this->equalTo('<error>Script '.$code.' handling the post-install-cmd event returned with an error</error>'));
$this->setExpectedException('RuntimeException'); $this->setExpectedException('RuntimeException');
$dispatcher->dispatchCommandEvent("post-install-cmd", false); $dispatcher->dispatchCommandEvent(ScriptEvents::POST_INSTALL_CMD, false);
} }
public function testDispatcherInstallerEvents() public function testDispatcherInstallerEvents()
@ -195,8 +196,8 @@ class EventDispatcherTest extends TestCase
$installedRepo = $this->getMockBuilder('Composer\Repository\CompositeRepository')->disableOriginalConstructor()->getMock(); $installedRepo = $this->getMockBuilder('Composer\Repository\CompositeRepository')->disableOriginalConstructor()->getMock();
$request = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock(); $request = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock();
$dispatcher->dispatchInstallerEvent("pre-solve-dependencies", $policy, $pool, $installedRepo, $request); $dispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $policy, $pool, $installedRepo, $request);
$dispatcher->dispatchInstallerEvent("post-solve-dependencies", $policy, $pool, $installedRepo, $request, array()); $dispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $policy, $pool, $installedRepo, $request, array());
} }
public static function call() public static function call()