Multiple fixes

* Implemented ScriptRunner with environment expansion and cleaner
  code.
* Added ApiClient plugin (com.noccy.apiclient)
* Renamed CHANGELOG.md to VERSIONS.md
* Shuffled buildtools
* Added first unittests
This commit is contained in:
2021-12-11 01:44:01 +01:00
parent 8c6f7c1e93
commit 8cc1eac7a4
33 changed files with 1976 additions and 891 deletions

View File

@ -65,7 +65,7 @@ class DockerDbExportCommand extends Command
$cmd = sprintf("mysqldump -u%s -p%s %s", $dbuser, $dbpass, $database);
break;
}
$this->exportFromService($service, $cmd, $output);
$this->exportFromService($service, $cmd, $output, $input->getOption("output"));
} elseif ($dsn) {
$url = parse_url($dsn);
if (empty($url)) {
@ -77,9 +77,13 @@ class DockerDbExportCommand extends Command
return Command::SUCCESS;
}
private function exportFromService(string $service, string $command, OutputInterface $output)
private function exportFromService(string $service, string $command, OutputInterface $output, ?string $outfile=null)
{
$cmd = sprintf("docker-compose exec -T %s %s", $service, $command);
if ($outfile) {
$cmd .= " > ".escapeshellarg($outfile);
}
$output->writeln(sprintf("→ <info>%s</>", $cmd));
passthru($cmd);
}
}