From d5d6cb69e288fd1048dfce6ecb1cd4861727c9d6 Mon Sep 17 00:00:00 2001 From: jaumeprat-twt Date: Wed, 4 Jun 2014 09:53:42 +0200 Subject: [PATCH 1/3] Feature: Add target directory option: (https://github.com/lightwerk/typo3cms-installers/issues/4) --- .../TYPO3CMSCoreInstaller.php | 28 +++++++++++++++++-- .../TYPO3CMSExtensionInstaller.php | 27 +++++++++++------- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php b/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php index a8437c6..d17a5c3 100644 --- a/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php +++ b/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php @@ -14,20 +14,42 @@ * * @author Felix Oertel */ -class TYPO3CMSCoreInstaller extends LibraryInstaller { +class TYPO3CMSExtensionInstaller extends LibraryInstaller { + + const DEFAULT_INSTALL_EXTENSION_PATH = 'typo3conf/ext/'; + + public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null) { + parent::__construct($io, $composer, $type, $filesystem); + + $composer->getDownloadManager()->setDownloader('t3x', new T3xDownloader($io, $composer->getConfig())); + } /** * {@inheritDoc} */ public function getPackageBasePath(PackageInterface $package) { - return 'typo3_src'; + $extensionName = explode('/', $package->getName()); + return $this->getInstallationPath() . array_pop($extensionName); } /** * {@inheritDoc} */ public function supports($packageType) { - return ('typo3cms-core' === $packageType); + return ('typo3cms-extension' === $packageType); + } + + /** + * Get the installation path from composer.json "extra" section + * or the default path 'typo3conf/ext/' + * + * @return string + */ + protected function getInstallationPath() { + $extra = $this->composer->getPackage()->getExtra(); + + return isset($extra['typo3-cms-extension-installer-path']) ? + $extra['typo3-cms-extension-installer-path'] : self::DEFAULT_INSTALL_EXTENSION_PATH; } } ?> \ No newline at end of file diff --git a/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php b/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php index 56eb974..ab0460a 100644 --- a/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php +++ b/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php @@ -8,33 +8,40 @@ use Composer\Util\Filesystem; use Dkd\Downloader\T3xDownloader; - /** * Installer for TYPO3 CMS * * @author Felix Oertel */ -class TYPO3CMSExtensionInstaller extends LibraryInstaller { - - public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null) { - parent::__construct($io, $composer, $type, $filesystem); +class TYPO3CMSCoreInstaller extends LibraryInstaller { - $composer->getDownloadManager()->setDownloader('t3x', new T3xDownloader($io, $composer->getConfig())); - } + const DEFAULT_INSTALL_CORE_PATH = 'typo3_src'; /** * {@inheritDoc} */ public function getPackageBasePath(PackageInterface $package) { - $extensionName = explode('/', $package->getName()); - return 'typo3conf/ext/' . array_pop($extensionName); + return $this->getInstallationPath(); } /** * {@inheritDoc} */ public function supports($packageType) { - return ('typo3cms-extension' === $packageType); + return ('typo3cms-core' === $packageType); + } + + /** + * Get the installation path from composer.json "extra" section + * or the default path 'typo3conf/ext/' + * + * @return string + */ + protected function getInstallationPath() { + $extra = $this->composer->getPackage()->getExtra(); + + return isset($extra['typo3-cms-core-installer-path']) ? + $extra['typo3-cms-core-installer-path'] : self::DEFAULT_INSTALL_CORE_PATH; } } ?> \ No newline at end of file From 8138f14ca75cce0b5a0440e2f475221ef3bd6ca7 Mon Sep 17 00:00:00 2001 From: Jaume Prat Date: Wed, 4 Jun 2014 10:05:01 +0200 Subject: [PATCH 2/3] Update TYPO3CMSCoreInstaller.php --- .../TYPO3CMSCoreInstaller.php | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php b/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php index d17a5c3..f8dca03 100644 --- a/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php +++ b/src/Lw/TYPO3CMSInstallers/TYPO3CMSCoreInstaller.php @@ -14,29 +14,22 @@ * * @author Felix Oertel */ -class TYPO3CMSExtensionInstaller extends LibraryInstaller { +class TYPO3CMSCoreInstaller extends LibraryInstaller { - const DEFAULT_INSTALL_EXTENSION_PATH = 'typo3conf/ext/'; - - public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null) { - parent::__construct($io, $composer, $type, $filesystem); - - $composer->getDownloadManager()->setDownloader('t3x', new T3xDownloader($io, $composer->getConfig())); - } + const DEFAULT_INSTALL_CORE_PATH = 'typo3_src'; /** * {@inheritDoc} */ public function getPackageBasePath(PackageInterface $package) { - $extensionName = explode('/', $package->getName()); - return $this->getInstallationPath() . array_pop($extensionName); + return $this->getInstallationPath(); } /** * {@inheritDoc} */ public function supports($packageType) { - return ('typo3cms-extension' === $packageType); + return ('typo3cms-core' === $packageType); } /** @@ -48,8 +41,8 @@ public function supports($packageType) { protected function getInstallationPath() { $extra = $this->composer->getPackage()->getExtra(); - return isset($extra['typo3-cms-extension-installer-path']) ? - $extra['typo3-cms-extension-installer-path'] : self::DEFAULT_INSTALL_EXTENSION_PATH; + return isset($extra['typo3-cms-core-installer-path']) ? + $extra['typo3-cms-core-installer-path'] : self::DEFAULT_INSTALL_CORE_PATH; } } -?> \ No newline at end of file +?> From 4fb5cb5beb1af0f541a8ba1017edf5501f3d61b2 Mon Sep 17 00:00:00 2001 From: Jaume Prat Date: Wed, 4 Jun 2014 10:05:40 +0200 Subject: [PATCH 3/3] Update TYPO3CMSExtensionInstaller.php --- .../TYPO3CMSExtensionInstaller.php | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php b/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php index ab0460a..84b6fd2 100644 --- a/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php +++ b/src/Lw/TYPO3CMSInstallers/TYPO3CMSExtensionInstaller.php @@ -13,22 +13,29 @@ * * @author Felix Oertel */ -class TYPO3CMSCoreInstaller extends LibraryInstaller { +class TYPO3CMSExtensionInstaller extends LibraryInstaller { - const DEFAULT_INSTALL_CORE_PATH = 'typo3_src'; + const DEFAULT_INSTALL_EXTENSION_PATH = 'typo3conf/ext/'; + + public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null) { + parent::__construct($io, $composer, $type, $filesystem); + + $composer->getDownloadManager()->setDownloader('t3x', new T3xDownloader($io, $composer->getConfig())); + } /** * {@inheritDoc} */ public function getPackageBasePath(PackageInterface $package) { - return $this->getInstallationPath(); + $extensionName = explode('/', $package->getName()); + return $this->getInstallationPath() . array_pop($extensionName); } /** * {@inheritDoc} */ public function supports($packageType) { - return ('typo3cms-core' === $packageType); + return ('typo3cms-extension' === $packageType); } /** @@ -40,8 +47,8 @@ public function supports($packageType) { protected function getInstallationPath() { $extra = $this->composer->getPackage()->getExtra(); - return isset($extra['typo3-cms-core-installer-path']) ? - $extra['typo3-cms-core-installer-path'] : self::DEFAULT_INSTALL_CORE_PATH; + return isset($extra['typo3-cms-extension-installer-path']) ? + $extra['typo3-cms-extension-installer-path'] : self::DEFAULT_INSTALL_EXTENSION_PATH; } } -?> \ No newline at end of file +?>