From 32ba6fdbe9962f23d711c9f32d7ffef330daaffc Mon Sep 17 00:00:00 2001 From: Garion Herman Date: Thu, 5 Sep 2019 17:23:38 +1200 Subject: [PATCH 1/2] FIX Skip expose calls when 'none' mode is enabled --- src/VendorExposeTask.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/VendorExposeTask.php b/src/VendorExposeTask.php index 8f88144..64eacbe 100644 --- a/src/VendorExposeTask.php +++ b/src/VendorExposeTask.php @@ -75,6 +75,10 @@ public function process(IOInterface $io, array $libraries, $methodKey = null) } $method = $this->getMethod($methodKey); + if ($methodKey === VendorPlugin::METHOD_NONE) { + return; + } + // Update all modules foreach ($libraries as $module) { // Skip this module if no exposure required @@ -138,8 +142,8 @@ protected function getMethod($key) case JunctionMethod::NAME: return new JunctionMethod(); case VendorPlugin::METHOD_NONE: - // 'none' is forced to an empty chain - return new ChainedMethod([]); + // 'none' is forced to an empty chain (and doesn't run anyway) + return new ChainedMethod(); case VendorPlugin::METHOD_AUTO: // Default to safe-failover method if (Platform::isWindows()) { From fc0a43ea607e57d1deaf1b484ca35816ced30872 Mon Sep 17 00:00:00 2001 From: Garion Herman Date: Fri, 20 Sep 2019 09:29:46 +1200 Subject: [PATCH 2/2] Stop completion message from displaying when no action is taken --- src/Console/VendorExposeCommand.php | 7 ++++--- src/VendorExposeTask.php | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Console/VendorExposeCommand.php b/src/Console/VendorExposeCommand.php index c316b0a..d198557 100644 --- a/src/Console/VendorExposeCommand.php +++ b/src/Console/VendorExposeCommand.php @@ -50,10 +50,11 @@ public function execute(InputInterface $input, OutputInterface $output) // Expose all modules $method = $input->getArgument('method'); $task = new VendorExposeTask($this->getProjectPath(), new Filesystem(), $basePublicPath); - $task->process($io, $modules, $method); - // Success - $io->write("All modules updated!"); + if ($task->process($io, $modules, $method)) { + // Success + $io->write("All modules updated!"); + } } /** diff --git a/src/VendorExposeTask.php b/src/VendorExposeTask.php index 64eacbe..450b8aa 100644 --- a/src/VendorExposeTask.php +++ b/src/VendorExposeTask.php @@ -63,7 +63,7 @@ public function process(IOInterface $io, array $libraries, $methodKey = null) { // No-op if (empty($libraries)) { - return; + return false; } // Setup root folder @@ -76,7 +76,7 @@ public function process(IOInterface $io, array $libraries, $methodKey = null) $method = $this->getMethod($methodKey); if ($methodKey === VendorPlugin::METHOD_NONE) { - return; + return false; } // Update all modules @@ -100,6 +100,8 @@ public function process(IOInterface $io, array $libraries, $methodKey = null) // On success, write `.method` token to persist for subsequent updates $this->saveMethodKey($methodKey); + + return true; }