Skip to content

Commit

Permalink
Merge pull request #29 from creative-commoners/pulls/1/fix-none-option
Browse files Browse the repository at this point in the history
FIX Skip expose calls when 'none' mode is enabled
  • Loading branch information
dnsl48 authored Oct 18, 2019
2 parents fbe71db + fc0a43e commit a4811f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/Console/VendorExposeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
}

/**
Expand Down
12 changes: 9 additions & 3 deletions src/VendorExposeTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function process(IOInterface $io, array $libraries, $methodKey = null)
{
// No-op
if (empty($libraries)) {
return;
return false;
}

// Setup root folder
Expand All @@ -75,6 +75,10 @@ public function process(IOInterface $io, array $libraries, $methodKey = null)
}
$method = $this->getMethod($methodKey);

if ($methodKey === VendorPlugin::METHOD_NONE) {
return false;
}

// Update all modules
foreach ($libraries as $module) {
// Skip this module if no exposure required
Expand All @@ -96,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;
}


Expand Down Expand Up @@ -138,8 +144,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()) {
Expand Down

0 comments on commit a4811f2

Please sign in to comment.