Skip to content

Commit

Permalink
Allow the update command to overriden in Tugboat
Browse files Browse the repository at this point in the history
  • Loading branch information
justafish committed Aug 15, 2023
1 parent be9fa43 commit 789a8f8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .tugboat/steps/3-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set -eux
echo "Building..."

./vendor/bin/task build
./vendor/bin/task drupal:update
./vendor/bin/task update
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,14 @@ Additionally, Pantheon Terminus can be added:
```

It is assumed the following tasks exist:
- `build`
- `sync`
- `build`
- `update`

The `build` and `sync` tasks can be overridden with a `build:tugboat` and
`sync:tugboat` task if required (you will need to re-run `composer install` to
regenerate the Tugboat scripts if you are adding this task to your
`Taskfile.yml` for the first time).
The `build`, `sync`, and `update` tasks can be overridden with `sync:tugboat`,
`build:tugboat`, and `update:tugboat` tasks if required (you will need to re-run
`composer install` to regenerate the Tugboat scripts if you are adding this
task to your `Taskfile.yml` for the first time).

```
sync:
Expand Down
20 changes: 13 additions & 7 deletions scaffold/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,24 @@ silent: true
# web/themes/custom/mytheme/script.js:web/themes/custom/mytheme/script.min.js

tasks:
sync:
desc: "Sync a database from production and import it"
cmds:
# Replace this with a command to fetch your database.
- ./vendor/bin/drush site:install -y
- echo "🧹 Sanitising database"
- ./vendor/bin/drush sql:sanitize --yes

build:
desc: "Builds the project for production"
deps: [drupal:composer:production]
cmds:
- echo "Nothing to do"

update:
desc: "Runs the Drupal update process"
cmds:
- task: drupal:update
# assets:
# desc: "Builds assets such as CSS & JS"
# cmds:
Expand All @@ -35,11 +48,4 @@ tasks:
# assets:watch:
# desc: "Builds assets such as CSS & JS, and watches them for changes"
# deps: [sass:watch, javascript:watch]
sync:
desc: "Sync a database from production and import it"
cmds:
# Replace this with a command to fetch your database.
- ./vendor/bin/drush site:install -y
- echo "🧹 Sanitising database"
- ./vendor/bin/drush sql:sanitize --yes

2 changes: 1 addition & 1 deletion scaffold/tugboat/steps/3-build.sh.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set -eux
echo "Building..."

./vendor/bin/task {{ build_command }}
./vendor/bin/task drupal:update
./vendor/bin/task {{ update_command }}
10 changes: 7 additions & 3 deletions src/ScaffoldInstallerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,9 @@ private function installCICommands(): void
'database_type' => 'mariadb',
'database_version' => '10.6',
'php_version' => '8.1',
'build_command' => 'build',
'sync_command' => 'sync',
'build_command' => 'build',
'update_command' => 'update',
'init' => [],
'task_version' => $binaryInstallerPlugin->getBinaryVersion('task'),
'pantheon' => isset($this->extra['drainpipe']['tugboat']['pantheon']),
Expand Down Expand Up @@ -318,11 +319,14 @@ private function installCICommands(): void
if (file_exists('Taskfile.yml')) {
// Get steps out of the Taskfile.
$taskfile = Yaml::parseFile('./Taskfile.yml');
if (isset($taskfile['tasks']['sync:tugboat'])) {
$tugboatConfig['sync_command'] = 'sync:tugboat';
}
if (isset($taskfile['tasks']['build:tugboat'])) {
$tugboatConfig['build_command'] = 'build:tugboat';
}
if (isset($taskfile['tasks']['sync:tugboat'])) {
$tugboatConfig['sync_command'] = 'sync:tugboat';
if (isset($taskfile['tasks']['update:tugboat'])) {
$tugboatConfig['update_command'] = 'update:tugboat';
}
if (isset($taskfile['tasks']['tugboat:php:init'])) {
$tugboatConfig['init']['php'] = true;
Expand Down

0 comments on commit 789a8f8

Please sign in to comment.