From 5da021ffa74d3997e1f9b5431cf3e2d04d0d514a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 9 Feb 2012 18:45:28 +0100 Subject: [PATCH] Moved Filesystem to base Util namespace --- src/Composer/Autoload/AutoloadGenerator.php | 2 +- src/Composer/Downloader/DownloadManager.php | 5 +++-- src/Composer/Downloader/FileDownloader.php | 5 +++-- src/Composer/Downloader/VcsDownloader.php | 3 ++- src/Composer/Installer/LibraryInstaller.php | 2 +- src/Composer/{Downloader => }/Util/Filesystem.php | 4 +--- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 2 +- tests/Composer/Test/Downloader/Util/FilesystemTest.php | 2 +- tests/Composer/Test/Installer/LibraryInstallerTest.php | 2 +- 9 files changed, 14 insertions(+), 13 deletions(-) rename src/Composer/{Downloader => }/Util/Filesystem.php (98%) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 37b305640..8b60e50f1 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -17,7 +17,7 @@ use Composer\Json\JsonFile; use Composer\Package\Loader\JsonLoader; use Composer\Package\PackageInterface; use Composer\Repository\RepositoryInterface; -use Composer\Downloader\Util\Filesystem; +use Composer\Util\Filesystem; /** * @author Igor Wiedler diff --git a/src/Composer/Downloader/DownloadManager.php b/src/Composer/Downloader/DownloadManager.php index a279e6e23..e466bbb09 100644 --- a/src/Composer/Downloader/DownloadManager.php +++ b/src/Composer/Downloader/DownloadManager.php @@ -14,6 +14,7 @@ namespace Composer\Downloader; use Composer\Package\PackageInterface; use Composer\Downloader\DownloaderInterface; +use Composer\Util\Filesystem; /** * Downloaders manager. @@ -134,9 +135,9 @@ class DownloadManager ); } - $fs = new Util\Filesystem(); + $fs = new Filesystem(); $fs->ensureDirectoryExists($targetDir); - + $downloader = $this->getDownloaderForInstalledPackage($package); $downloader->download($package, $targetDir); } diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index e3ccc1773..ae2b199b2 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -13,6 +13,7 @@ namespace Composer\Downloader; use Composer\IO\IOInterface; use Composer\Package\PackageInterface; +use Composer\Util\Filesystem; /** * Base downloader for file packages @@ -142,7 +143,7 @@ abstract class FileDownloader implements DownloaderInterface */ public function update(PackageInterface $initial, PackageInterface $target, $path) { - $fs = new Util\Filesystem(); + $fs = new Filesystem(); $fs->removeDirectory($path); $this->download($target, $path); } @@ -152,7 +153,7 @@ abstract class FileDownloader implements DownloaderInterface */ public function remove(PackageInterface $package, $path) { - $fs = new Util\Filesystem(); + $fs = new Filesystem(); $fs->removeDirectory($path); } diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 8af2ce48e..4bcc79d0c 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -15,6 +15,7 @@ namespace Composer\Downloader; use Composer\Package\PackageInterface; use Composer\Util\ProcessExecutor; use Composer\IO\IOInterface; +use Composer\Util\Filesystem; /** * @author Jordi Boggiano @@ -73,7 +74,7 @@ abstract class VcsDownloader implements DownloaderInterface public function remove(PackageInterface $package, $path) { $this->enforceCleanDirectory($path); - $fs = new Util\Filesystem(); + $fs = new Filesystem(); $fs->removeDirectory($path); } diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index b1bdfa60d..db2fe535b 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -17,7 +17,7 @@ use Composer\Downloader\DownloadManager; use Composer\Repository\WritableRepositoryInterface; use Composer\DependencyResolver\Operation\OperationInterface; use Composer\Package\PackageInterface; -use Composer\Downloader\Util\Filesystem; +use Composer\Util\Filesystem; /** * Package installation manager. diff --git a/src/Composer/Downloader/Util/Filesystem.php b/src/Composer/Util/Filesystem.php similarity index 98% rename from src/Composer/Downloader/Util/Filesystem.php rename to src/Composer/Util/Filesystem.php index 6d044e40e..4f6e324ac 100644 --- a/src/Composer/Downloader/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -10,9 +10,7 @@ * file that was distributed with this source code. */ -namespace Composer\Downloader\Util; - -use Composer\Util\ProcessExecutor; +namespace Composer\Util; /** * @author Jordi Boggiano diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index f7eee0d69..a4e8b9449 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -13,7 +13,7 @@ namespace Composer\Test\Installer; use Composer\Autoload\AutoloadGenerator; -use Composer\Downloader\Util\Filesystem; +use Composer\Util\Filesystem; use Composer\Package\MemoryPackage; class AutoloadGeneratorTest extends \PHPUnit_Framework_TestCase diff --git a/tests/Composer/Test/Downloader/Util/FilesystemTest.php b/tests/Composer/Test/Downloader/Util/FilesystemTest.php index 243dfa7aa..9605a111c 100644 --- a/tests/Composer/Test/Downloader/Util/FilesystemTest.php +++ b/tests/Composer/Test/Downloader/Util/FilesystemTest.php @@ -12,7 +12,7 @@ namespace Composer\Test\Repository; -use Composer\Downloader\Util\Filesystem; +use Composer\Util\Filesystem; use Composer\Test\TestCase; class FilesystemTest extends TestCase diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php index ed655f983..561143db2 100644 --- a/tests/Composer/Test/Installer/LibraryInstallerTest.php +++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php @@ -14,7 +14,7 @@ namespace Composer\Test\Installer; use Composer\Installer\LibraryInstaller; use Composer\DependencyResolver\Operation; -use Composer\Downloader\Util\Filesystem; +use Composer\Util\Filesystem; class LibraryInstallerTest extends \PHPUnit_Framework_TestCase {