Skip to content

Commit

Permalink
Merge pull request composer#1 from Seldaek/patches
Browse files Browse the repository at this point in the history
Patches
  • Loading branch information
naderman committed Apr 29, 2012
2 parents 1f0eef6 + 4b77612 commit 496fd0d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Composer/Downloader/FileDownloader.php
Expand Up @@ -64,7 +64,7 @@ public function download(PackageInterface $package, $path)

$fileName = $this->getFileName($package, $path);

$this->io->write(" - Package <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
$this->io->write(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");

$processUrl = $this->processUrl($url);

Expand Down Expand Up @@ -101,6 +101,7 @@ public function update(PackageInterface $initial, PackageInterface $target, $pat
*/
public function remove(PackageInterface $package, $path)
{
$this->io->write(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
if (!$this->filesystem->removeDirectory($path)) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
Expand Down
5 changes: 3 additions & 2 deletions src/Composer/Downloader/VcsDownloader.php
Expand Up @@ -50,7 +50,7 @@ public function download(PackageInterface $package, $path)
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
}

$this->io->write(" - Package <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
$this->io->write(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
$this->filesystem->removeDirectory($path);
$this->doDownload($package, $path);
$this->io->write('');
Expand All @@ -65,7 +65,7 @@ public function update(PackageInterface $initial, PackageInterface $target, $pat
throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
}

$this->io->write(" - Package <info>" . $target->getName() . "</info> (<comment>" . $target->getPrettyVersion() . "</comment>)");
$this->io->write(" - Installing <info>" . $target->getName() . "</info> (<comment>" . $target->getPrettyVersion() . "</comment>)");
$this->enforceCleanDirectory($path);
$this->doUpdate($initial, $target, $path);
$this->io->write('');
Expand All @@ -77,6 +77,7 @@ public function update(PackageInterface $initial, PackageInterface $target, $pat
public function remove(PackageInterface $package, $path)
{
$this->enforceCleanDirectory($path);
$this->io->write(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
if (!$this->filesystem->removeDirectory($path)) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
Expand Down
6 changes: 4 additions & 2 deletions src/Composer/Installer.php
Expand Up @@ -242,9 +242,11 @@ protected function doInstall($localRepo, $installedRepo, $aliases, $devMode = fa
}
}

// fix the version all installed packages that are not in the current local repo to prevent rogue updates
// fix the version of all installed packages (+ platform) that are not
// in the current local repo to prevent rogue updates (e.g. non-dev
// updating when in dev)
foreach ($installedRepo->getPackages() as $package) {
if ($package->getRepository() === $localRepo || $package->getRepository() instanceof PlatformRepository) {
if ($package->getRepository() === $localRepo) {
continue;
}

Expand Down
7 changes: 7 additions & 0 deletions src/Composer/Installer/LibraryInstaller.php
Expand Up @@ -127,6 +127,13 @@ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $
$this->downloadManager->remove($package, $downloadPath);
$this->removeBinaries($package);
$repo->removePackage($package);

if (strpos($package->getName(), '/')) {
$packageVendorDir = dirname($downloadPath);
if (is_dir($packageVendorDir) && !glob($packageVendorDir.'/*')) {
@rmdir($packageVendorDir);
}
}
}

/**
Expand Down

0 comments on commit 496fd0d

Please sign in to comment.