From 74a6f61f6f67ecfc37ac1bd57c9dffd61ec0ed67 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 26 Jun 2017 11:12:10 -0700 Subject: [PATCH 1/2] [console] Add new methods to DrupalFinder. --- src/Utils/DrupalFinder.php | 65 +++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/src/Utils/DrupalFinder.php b/src/Utils/DrupalFinder.php index 77caffa..208e8ac 100644 --- a/src/Utils/DrupalFinder.php +++ b/src/Utils/DrupalFinder.php @@ -8,6 +8,7 @@ namespace Drupal\Console\Core\Utils; use DrupalFinder\DrupalFinder as DrupalFinderBase; +use Webmozart\PathUtil\Path; /** * Class DrupalFinder @@ -16,25 +17,57 @@ */ class DrupalFinder extends DrupalFinderBase { + + /** + * @var string + */ + protected $consoleCorePath; + + /** + * @var string + */ + protected $consolePath; + + /** + * @var string + */ + protected $consoleLanguagePath; + public function locateRoot($start_path) { $vendorDir = 'vendor'; if (parent::locateRoot($start_path)) { - $composerRoot = $this->getComposerRoot(); - $vendorDir = str_replace( - $composerRoot .'/', '', $this->getVendorDir() +// $composerRoot = $this->getComposerRoot(); +// $vendorDir = str_replace( +// $composerRoot .'/', '', $this->getVendorDir() +// ); + + $vendorDir = Path::makeRelative( + $this->getVendorDir(), + $this->getComposerRoot() ); + $this->definePaths($vendorDir); $this->defineConstants($vendorDir); return true; } + $this->definePaths($vendorDir); $this->defineConstants($vendorDir); + return false; } - protected function defineConstants($vendorDir) { + protected function definePaths($vendorDir) + { + $this->consoleCorePath = "/{$vendorDir}/drupal/console-core/"; + $this->consolePath = "/{$vendorDir}/drupal/console/"; + $this->consoleLanguagePath = "/{$vendorDir}/drupal/console-%s/translations/"; + } + + protected function defineConstants($vendorDir) + { if (!defined("DRUPAL_CONSOLE_CORE")) { define( "DRUPAL_CONSOLE_CORE", @@ -51,4 +84,28 @@ protected function defineConstants($vendorDir) { ); } } + + /** + * @return string + */ + public function getConsoleCorePath() + { + return $this->consoleCorePath; + } + + /** + * @return string + */ + public function getConsolePath() + { + return $this->consolePath; + } + + /** + * @return string + */ + public function getConsoleLanguagePath() + { + return $this->consoleLanguagePath; + } } From 739d4c8e69d8fd40d2641903ef24fd809550f52b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 26 Jun 2017 11:15:33 -0700 Subject: [PATCH 2/2] [console] Remove commented code. --- src/Utils/DrupalFinder.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Utils/DrupalFinder.php b/src/Utils/DrupalFinder.php index 208e8ac..6a69367 100644 --- a/src/Utils/DrupalFinder.php +++ b/src/Utils/DrupalFinder.php @@ -37,11 +37,6 @@ public function locateRoot($start_path) { $vendorDir = 'vendor'; if (parent::locateRoot($start_path)) { -// $composerRoot = $this->getComposerRoot(); -// $vendorDir = str_replace( -// $composerRoot .'/', '', $this->getVendorDir() -// ); - $vendorDir = Path::makeRelative( $this->getVendorDir(), $this->getComposerRoot()