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 committed Oct 23, 2017
1 parent 173764f commit 8c5910e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format of this change log follows the advice given at [Keep a CHANGELOG](htt
## [Unreleased]
### Fixed
- `moodle-plugin-ci validate` now only regards required language strings as present if they are assigned to the `$string` array. Before, other array variables were accepted although Moodle would not recognise them.
- `moodle-plugin-ci install` now provides an option `--skip-db-install` to skip DB installation if execution of unit tests and behat test will not be required.

## [2.1.1]
### Fixed
Expand Down
4 changes: 3 additions & 1 deletion src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,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 @@ -163,6 +164,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 @@ -68,6 +68,11 @@ class InstallerFactory
*/
public $pluginsDir;

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

/**
* Given a big bag of install options, add installers to the collection.
*
Expand All @@ -79,7 +84,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 8c5910e

Please sign in to comment.