From 4bbb168d44d878567d6316dbc1a96502ab6cb49f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 19 Jun 2012 23:06:40 +0200 Subject: [PATCH] Remove BC code --- src/Composer/Autoload/AutoloadGenerator.php | 16 +--------------- src/Composer/Downloader/GitDownloader.php | 3 --- src/Composer/Factory.php | 17 ----------------- src/Composer/Installer.php | 2 +- src/Composer/Package/Locker.php | 6 ------ .../Test/Downloader/GitDownloaderTest.php | 8 -------- 6 files changed, 2 insertions(+), 50 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index d3ed8f337..5ae4491a5 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -24,7 +24,7 @@ use Composer\Util\Filesystem; */ class AutoloadGenerator { - public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $bcLinks = false) + public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir) { $filesystem = new Filesystem(); $filesystem->ensureDirectoryExists($installationManager->getVendorPath()); @@ -134,20 +134,6 @@ EOF; } file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, true, true, (Boolean) $includePathFile, $targetDirLoader, $filesCode)); copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); - - // TODO BC feature, remove after June 15th - if ($bcLinks) { - $filesystem->ensureDirectoryExists($vendorPath.'/.composer'); - $deprecated = "// Deprecated file, use the one in root of vendor dir\n". - "trigger_error(__FILE__.' is deprecated, please use vendor/autoload.php or vendor/composer/autoload_* instead'.PHP_EOL.'See https://groups.google.com/forum/#!msg/composer-dev/fWIs3KocwoA/nU3aLko9LhQJ for details', E_USER_DEPRECATED);\n"; - file_put_contents($vendorPath.'/.composer/autoload_namespaces.php', "io->setAuthorization('github.com', $match[1], $match[2]); } - // TODO: BC for the composer remote that didn't exist, to be remove after May 18th. - $this->process->execute(sprintf('cd %s && git remote add composer %s', escapeshellarg($path), escapeshellarg($initial->getSourceUrl())), $ignoredOutput); - $commandCallable = function($url) use ($ref, $path, $command) { return sprintf($command, escapeshellarg($path), escapeshellarg($url), escapeshellarg($ref)); }; diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 21a6c9a69..43d805b79 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -167,23 +167,6 @@ class Factory protected function addLocalRepository(RepositoryManager $rm, $vendorDir) { - // TODO BC feature, remove after June 15th - if (file_exists($vendorDir.'/.composer/installed.json')) { - if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); } - rename($vendorDir.'/.composer/installed.json', $vendorDir.'/composer/installed.json'); - } - if (file_exists($vendorDir.'/.composer/installed_dev.json')) { - if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); } - rename($vendorDir.'/.composer/installed_dev.json', $vendorDir.'/composer/installed_dev.json'); - } - if (file_exists($vendorDir.'/installed.json')) { - if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); } - rename($vendorDir.'/installed.json', $vendorDir.'/composer/installed.json'); - } - if (file_exists($vendorDir.'/installed_dev.json')) { - if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); } - rename($vendorDir.'/installed_dev.json', $vendorDir.'/composer/installed_dev.json'); - } $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json'))); $rm->setLocalDevRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed_dev.json'))); } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 6aab0eb6a..074dfc399 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -201,7 +201,7 @@ class Installer // write autoloader $this->io->write('Generating autoload files'); $localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories()); - $this->autoloadGenerator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath() . '/composer', true); + $this->autoloadGenerator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath() . '/composer'); if ($this->runScripts) { // dispatch post event diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index daa24ddde..54a9deea3 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -89,12 +89,6 @@ class Locker $repo = $dev ? $this->repositoryManager->getLocalDevRepository() : $this->repositoryManager->getLocalRepository(); foreach ($lockedPackages as $info) { - // TODO BC remove this after June 10th - if (isset($info['alias']) && empty($warned)) { - $warned = true; - echo 'BC warning: your lock file appears to be of an older format than this composer version, it is recommended to run composer update'.PHP_EOL; - } - $resolvedVersion = !empty($info['alias-version']) ? $info['alias-version'] : $info['version']; // try to find the package in the local repo (best match) diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index 1381c7b0d..81a7172e3 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -159,10 +159,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v"))) ->will($this->returnValue(0)); $processExecutor->expects($this->at(2)) - ->method('execute') - ->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote add composer 'https://github.com/composer/composer'"))) - ->will($this->returnValue(0)); - $processExecutor->expects($this->at(3)) ->method('execute') ->with($this->equalTo($expectedGitUpdateCommand)) ->will($this->returnValue(0)); @@ -196,10 +192,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v"))) ->will($this->returnValue(0)); $processExecutor->expects($this->at(2)) - ->method('execute') - ->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote add composer 'https://github.com/composer/composer'"))) - ->will($this->returnValue(0)); - $processExecutor->expects($this->at(3)) ->method('execute') ->with($this->equalTo($expectedGitUpdateCommand)) ->will($this->returnValue(1));