Skip to content

Commit

Permalink
fixup! When trying to use this tool on anything other than Travis it …
Browse files Browse the repository at this point in the history
…is harder to make ci script look lean because so many options have to be crammed in the install command line.
  • Loading branch information
stronk7 committed May 30, 2023
1 parent 8cf2908 commit b1e83f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ Path to Moodle plugin

#### `--db-type`

Database type, mysqli, pgsql or mariadb
Database type, mysqli, pgsql or mariadb (DB env var)

* Accept value: yes
* Is value required: yes
Expand All @@ -897,7 +897,7 @@ Database type, mysqli, pgsql or mariadb

#### `--db-user`

Database user
Database user (DB_USER env var)

* Accept value: yes
* Is value required: yes
Expand All @@ -907,7 +907,7 @@ Database user

#### `--db-pass`

Database pass
Database pass (DB_PASS env var)

* Accept value: yes
* Is value required: yes
Expand All @@ -917,7 +917,7 @@ Database pass

#### `--db-name`

Database name
Database name (DB_NAME env var)

* Accept value: yes
* Is value required: yes
Expand All @@ -927,7 +927,7 @@ Database name

#### `--db-host`

Database host
Database host (DB_HOST env var)

* Accept value: yes
* Is value required: yes
Expand All @@ -937,7 +937,7 @@ Database host

#### `--db-port`

Database port
Database port (DB_PORT env var)

* Accept value: yes
* Is value required: yes
Expand Down
22 changes: 11 additions & 11 deletions src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ protected function configure(): void
}

// Add more options mapped to environment variables.
$db_user = getenv('DB_USER') !== false ? getenv('DB_USER') : null;
$db_pass = getenv('DB_PASS') !== false ? getenv('DB_PASS') : '';
$db_name = getenv('DB_NAME') !== false ? getenv('DB_NAME') : 'moodle';
$db_host = getenv('DB_HOST') !== false ? getenv('DB_HOST') : 'localhost';
$db_port = getenv('DB_PORT') !== false ? getenv('DB_PORT') : '';
$dbUser = getenv('DB_USER') !== false ? getenv('DB_USER') : null;
$dbPass = getenv('DB_PASS') !== false ? getenv('DB_PASS') : '';
$dbName = getenv('DB_NAME') !== false ? getenv('DB_NAME') : 'moodle';
$dbHost = getenv('DB_HOST') !== false ? getenv('DB_HOST') : 'localhost';
$dbPort = getenv('DB_PORT') !== false ? getenv('DB_PORT') : '';

$this->setName('install')
->setDescription('Install everything required for CI testing')
Expand All @@ -81,12 +81,12 @@ protected function configure(): void
->addOption('repo', null, InputOption::VALUE_REQUIRED, 'Moodle repository to clone', $repo)
->addOption('branch', null, InputOption::VALUE_REQUIRED, 'Moodle git branch to clone, EG: MOODLE_29_STABLE', $branch)
->addOption('plugin', null, InputOption::VALUE_REQUIRED, 'Path to Moodle plugin', $plugin)
->addOption('db-type', null, InputOption::VALUE_REQUIRED, 'Database type, mysqli, pgsql or mariadb', $type)
->addOption('db-user', null, InputOption::VALUE_REQUIRED, 'Database user', $db_user)
->addOption('db-pass', null, InputOption::VALUE_REQUIRED, 'Database pass', $db_pass)
->addOption('db-name', null, InputOption::VALUE_REQUIRED, 'Database name', $db_name)
->addOption('db-host', null, InputOption::VALUE_REQUIRED, 'Database host', $db_host)
->addOption('db-port', null, InputOption::VALUE_REQUIRED, 'Database port', $db_port)
->addOption('db-type', null, InputOption::VALUE_REQUIRED, 'Database type, mysqli, pgsql or mariadb (DB env var)', $type)
->addOption('db-user', null, InputOption::VALUE_REQUIRED, 'Database user (DB_USER env var)', $dbUser)
->addOption('db-pass', null, InputOption::VALUE_REQUIRED, 'Database pass (DB_PASS env var)', $dbPass)
->addOption('db-name', null, InputOption::VALUE_REQUIRED, 'Database name (DB_NAME env var)', $dbName)
->addOption('db-host', null, InputOption::VALUE_REQUIRED, 'Database host (DB_HOST env var)', $dbHost)
->addOption('db-port', null, InputOption::VALUE_REQUIRED, 'Database port (DB_PORT env var)', $dbPort)
->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)
Expand Down

0 comments on commit b1e83f0

Please sign in to comment.