Skip to content

Commit

Permalink
Fix open-lms-open-source#65: Provide optional argument for install
Browse files Browse the repository at this point in the history
…to skip DB installation
  • Loading branch information
Dagefoerde authored and golenkovm committed May 5, 2020
1 parent fdddc34 commit cf6a480
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ protected function configure()
->addOption('db-host', null, InputOption::VALUE_REQUIRED, 'Database host', 'localhost')
->addOption('not-paths', null, InputOption::VALUE_REQUIRED, 'CSV of file paths to exclude', $paths)
->addOption('not-names', null, InputOption::VALUE_REQUIRED, 'CSV of file names to exclude', $names)
->addOption('extra-plugins', null, InputOption::VALUE_REQUIRED, 'Directory of extra plugins to install', $extra);
->addOption('extra-plugins', null, InputOption::VALUE_REQUIRED, 'Directory of extra plugins to install', $extra)
->addOption('skip-db-install', null, InputOption::VALUE_REQUIRED, 'Skip DB installation, e.g. if only static analyses are required', false);
}

protected function initialize(InputInterface $input, OutputInterface $output)
Expand Down Expand Up @@ -170,6 +171,7 @@ public function initializeInstallerFactory(InputInterface $input)
$input->getOption('db-pass'),
$input->getOption('db-host')
);
$factory->skipDbInstall = $input->getOption('skip-db-install');

return $factory;
}
Expand Down
9 changes: 8 additions & 1 deletion src/Installer/InstallerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ class InstallerFactory
*/
public $pluginsDir;

/**
* @var bool
*/
public $skipDbInstall;

/**
* Given a big bag of install options, add installers to the collection.
*
Expand All @@ -82,7 +87,9 @@ public function addInstallers(InstallerCollection $installers)
$installers->add(new PluginInstaller($this->moodle, $this->plugin, $this->pluginsDir, $this->dumper));
$installers->add(new VendorInstaller($this->moodle, $this->plugin, $this->execute));

if ($this->plugin->hasBehatFeatures() || $this->plugin->hasUnitTests()) {
if ($this->skipDbInstall) {
return;
} elseif ($this->plugin->hasBehatFeatures() || $this->plugin->hasUnitTests()) {
$installers->add(new TestSuiteInstaller($this->moodle, $this->plugin, $this->execute));
}
}
Expand Down

0 comments on commit cf6a480

Please sign in to comment.