1
0
Fork 0

refactored install command to use new Locker

pull/40/head
everzet 2011-10-01 15:33:43 +03:00
parent cc2f2b79ca
commit 96122aada8
3 changed files with 16 additions and 15 deletions

View File

@ -8,6 +8,7 @@ use Composer\Installer;
use Composer\Downloader;
use Composer\Repository;
use Composer\Package;
use Composer\Json\JsonFile;
use Composer\Console\Application as ComposerApplication;
// initialize repository manager
@ -29,10 +30,14 @@ $im->setInstaller('library', new Installer\LibraryInstaller('vendor', $dm, $rm->
$loader = new Package\Loader\JsonLoader();
$package = $loader->load('composer.json');
// init locker
$locker = new Package\Locker(new JsonFile('composer.lock'), $rm);
// initialize composer
$composer = new Composer();
$composer->setPackage($package);
$composer->setPackageLock(new Package\PackageLock('composer.lock'));
$composer->setLocker($locker);
$composer->setRepositoryManager($rm);
$composer->setDownloadManager($dm);
$composer->setInstallationManager($im);

View File

@ -47,11 +47,11 @@ EOT
{
$composer = $this->getComposer();
if ($composer->getPackageLock()->isLocked()) {
if ($composer->getLocker()->isLocked()) {
$output->writeln('<info>Found lockfile. Reading</info>');
$installationManager = $composer->getInstallationManager();
foreach ($composer->getPackageLock()->getLockedPackages() as $package) {
foreach ($composer->getLocker()->getLockedPackages() as $package) {
if (!$installationManager->isPackageInstalled($package)) {
$operation = new Operation\InstallOperation($package, 'lock resolving');
$installationManager->execute($operation);
@ -85,14 +85,10 @@ EOT
$installationManager->execute($operation);
}
// TODO implement lock
if (false) {
$composer->getPackageLock()->lock($localRepo->getPackages());
$composer->getLocker()->lockPackages($localRepo->getPackages());
$output->writeln('> Locked');
}
$localRepo->write();
$output->writeln('> Done');
}
}

View File

@ -13,7 +13,7 @@
namespace Composer;
use Composer\Package\PackageInterface;
use Composer\Package\PackageLock;
use Composer\Package\Locker;
use Composer\Repository\RepositoryManager;
use Composer\Installer\InstallationManager;
use Composer\Downloader\DownloadManager;
@ -27,7 +27,7 @@ class Composer
const VERSION = '1.0.0-DEV';
private $package;
private $lock;
private $locker;
private $repositoryManager;
private $downloadManager;
@ -43,14 +43,14 @@ class Composer
return $this->package;
}
public function setPackageLock($lock)
public function setLocker(Locker $locker)
{
$this->lock = $lock;
$this->locker = $locker;
}
public function getPackageLock()
public function getLocker()
{
return $this->lock;
return $this->locker;
}
public function setRepositoryManager(RepositoryManager $manager)