From 72a1f66b7a04469a704bf3054222a69d3a612c1d Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 16 Oct 2011 18:52:08 +0200 Subject: [PATCH] rename installAs to target-dir --- doc/composer-schema.json | 2 +- src/Composer/Command/InstallCommand.php | 4 ++-- src/Composer/Installer/LibraryInstaller.php | 4 ++-- src/Composer/Package/Dumper/ArrayDumper.php | 2 +- src/Composer/Package/Loader/ArrayLoader.php | 4 ++-- src/Composer/Package/MemoryPackage.php | 12 ++++++------ src/Composer/Package/PackageInterface.php | 6 +++--- src/Composer/Repository/GitRepository.php | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/composer-schema.json b/doc/composer-schema.json index 750eb85db..b05360029 100644 --- a/doc/composer-schema.json +++ b/doc/composer-schema.json @@ -13,7 +13,7 @@ "type": "string", "optional": true }, - "installAs": { + "target-dir": { "description": "Override install location of package", "type": "string" }, diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index a376d017b..203a41237 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -134,8 +134,8 @@ EOT foreach ($installPaths as $item) { list($package, $installPath) = $item; - if (null !== $package->getInstallAs()) { - $installPath = substr($installPath, 0, -strlen('/'.$package->getInstallAs())); + if (null !== $package->getTargetDir()) { + $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir())); } foreach ($package->getAutoload() as $type => $mapping) { diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 5ea30023d..b9a240058 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -126,10 +126,10 @@ class LibraryInstaller implements InstallerInterface public function getInstallPath(PackageInterface $package) { - if (null === $package->getInstallAs()) { + if (null === $package->getTargetDir()) { return ($this->directory ? $this->directory.'/' : '').$package->getName(); } - return ($this->directory ? $this->directory.'/' : '').$package->getInstallAs(); + return ($this->directory ? $this->directory.'/' : '').$package->getTargetDir(); } } diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 4d980f278..370ab5000 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -40,11 +40,11 @@ class ArrayDumper 'recommends', 'suggests', 'autoload', - 'installAs', ); $data = array(); $data['name'] = $package->getPrettyName(); + $data['target-dir'] = $package->getTargetDir(); foreach ($keys as $key) { $getter = 'get'.ucfirst($key); $value = $package->$getter(); diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 76f83a1a4..3c43649db 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -46,8 +46,8 @@ class ArrayLoader $package->setType(isset($config['type']) ? $config['type'] : 'library'); - if (isset($config['installAs'])) { - $package->setInstallAs($config['installAs']); + if (isset($config['target-dir'])) { + $package->setTargetDir($config['target-dir']); } if (isset($config['extra'])) { diff --git a/src/Composer/Package/MemoryPackage.php b/src/Composer/Package/MemoryPackage.php index 618cb3db8..2eea5c2b0 100644 --- a/src/Composer/Package/MemoryPackage.php +++ b/src/Composer/Package/MemoryPackage.php @@ -20,7 +20,7 @@ namespace Composer\Package; class MemoryPackage extends BasePackage { protected $type; - protected $installAs; + protected $targetDir; protected $installationSource; protected $sourceType; protected $sourceUrl; @@ -74,19 +74,19 @@ class MemoryPackage extends BasePackage } /** - * @param string $installAs + * @param string $targetDir */ - public function setInstallAs($installAs) + public function setTargetDir($targetDir) { - $this->installAs = $installAs; + $this->targetDir = $targetDir; } /** * {@inheritDoc} */ - public function getInstallAs() + public function getTargetDir() { - return $this->installAs; + return $this->targetDir; } /** diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index e23340dbc..1bad85f51 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -76,11 +76,11 @@ interface PackageInterface function getType(); /** - * Returns the package installAs property + * Returns the package targetDir property * - * @return string The package installAs + * @return string The package targetDir */ - function getInstallAs(); + function getTargetDir(); /** * Returns the package extra data diff --git a/src/Composer/Repository/GitRepository.php b/src/Composer/Repository/GitRepository.php index cad9e20d7..52426f402 100644 --- a/src/Composer/Repository/GitRepository.php +++ b/src/Composer/Repository/GitRepository.php @@ -67,8 +67,8 @@ class GitRepository extends ArrayRepository $package->setSourceType('git'); $package->setSourceUrl($this->url); - if (isset($data['installAs'])) { - $package->setInstallAs($data['installAs']); + if (isset($data['target-dir'])) { + $package->setTargetDir($data['target-dir']); } if (isset($data['license'])) {