Skip to content

Commit 84995a4

Browse files
Merge branch '4.x' into pr2665
2 parents 9d2aaba + f61cb52 commit 84995a4

File tree

694 files changed

+1421
-71675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

694 files changed

+1421
-71675
lines changed

.env.dist

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
11
export PROJECT_PATH=$(realpath .)
2-
## Note: The terminus test site must have some quicksilver scripts enabled
3-
## in order for tests to pass.
4-
## Needed for unit test fixutures
5-
export TERMINUS_PROJECT_ROOT=${PROJECT_PATH}
6-
7-
## This is the site that will be used for testing
8-
export TERMINUS_SITE="ci-terminus-composer"
9-
10-
## This is the site that will be used for testing wordpress commands
2+
export TERMINUS_SITE="terminus-test-site"
113
export TERMINUS_SITE_WP="terminus-test-site-wordpress"
12-
13-
## This is the site that will be used for testing wordpress network
144
export TERMINUS_SITE_WP_NETWORK="terminus-test-site-wp-network"
15-
16-
## This is the site that will be used for cloning a test environment on which to run tests
175
export TERMINUS_ENV="dev"
18-
19-
## this is the org that will be used. The site(s) above need to be in this org
206
export TERMINUS_ORG="Agency"
21-
22-
## This is the user that will be used for testing Should be attached the token below
237
export TERMINUS_USER="[email protected]"
24-
258
## To Autoload your token from your local machine, change the TERMINUS_TOKEN to the following command:
269
## export TERMINUS_TOKEN=$(cat $HOME/.terminus/cache/tokens/[email protected] | jq -r .token)
2710
export TERMINUS_TOKEN="{TERMINUS TOKEN}"
28-
29-
## this is the folder that terminus will use to store its data during the tests
3011
export TERMINUS_BASE_DIR="/tmp/terminus-data"
31-
32-
## this is the folder that terminus will use to store its plugins during the tests
3312
export TERMINUS_PLUGINS2_DIR="${TERMINUS_BASE_DIR}/plugins"
34-
35-
## this is the folder that terminus will use to store its plugins during the tests
3613
export TERMINUS_PLUGINS_DIR="${TERMINUS_BASE_DIR}/plugins-3.x"
37-
38-
## Used for testing plugins
3914
export TERMINUS_DEPENDENCIES_BASE_DIR="${TERMINUS_BASE_DIR}/dependencies-1"
40-
41-
## this will prevent the tests from creating a test environment for the run
4215
export TERMINUS_TESTING_RUNTIME_ENV=
43-
44-
## this will prevent tests from reinstalling the development packages once a phar is built
4516
export TERMINUS_ON_PHAR_COMPLETE_REINSTALL_COMPOSER_WITH_DEV=1

.github/workflows/3x.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Terminus 4.x
22
on:
33
push:
4-
schedule:
5-
- cron: '0 6 * * *'
64
workflow_dispatch:
75
inputs:
86
functional_tests_group:
@@ -28,14 +26,14 @@ jobs:
2826
name: Checkout & build Phar
2927
steps:
3028
- name: Checkout
31-
uses: actions/checkout@v4
29+
uses: actions/checkout@v3
3230
- name: Save repo content as artifact
3331
uses: actions/upload-artifact@v4
3432
with:
3533
name: full-workspace
3634
path: ${{ github.workspace }}
3735
- name: Full Composer Install
38-
run: composer install --dev
36+
run: composer install
3937
- name: Validate Code
4038
run: composer code:lint
4139
- name: Phar Build

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
# Change Log
22
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org)
33

4-
## 4.0.0-dev -
4+
## 4.0.2-dev
5+
6+
## 4.0.1 - 2025-05-19
7+
8+
### Fixed
9+
10+
- env:code-rebuild command should no longer throw a fatal error (#2694)
11+
12+
## 4.0.0 - 2025-05-07
13+
14+
### Added
15+
16+
- Readd update check and prompt to update when running an old Terminus version (#2669)
17+
- Prompt for missing required arguments when in interactive mode (#2684)
18+
19+
### Fixed
20+
21+
- Response json_decode should fallback to original body text (#2687)
22+
- Simplify env:wake command (#2689)
23+
24+
## 4.0.0-alpha1 - 2025-03-06
525

626
### Added
727

@@ -11,6 +31,10 @@ All notable changes to this project will be documented in this file. This projec
1131

1232
- Support for PHP versions prior to 8.2
1333

34+
## 3.6.2 - 2025-03-03
35+
- Pass verbose flag to ssh if terminus is in verbose mode (#2663)
36+
- Bug fix: backup:restore with --file parameter restores backups multiple ties (#2664)
37+
1438
## 3.6.1 - 2024-12-04
1539

1640
### Added

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ Our documentation is kept in the Terminus Manual, located here: https://pantheon
2222
|------------------------|------------|
2323
| MacOS | 10.14+ |
2424
| Ubuntu | Latest LTS |
25-
| Windows + WSL + Ubuntu | TBD |
25+
| Windows + WSL + Ubuntu | 20.0+ |
2626

2727
### Package Manager
2828

29-
- [apt](https://ubuntu.com/server/docs/package-management) for Ubuntu/WinWSL-Ubuntu
30-
3129
- [Homebrew](https://brew.sh) for mac
3230

3331
#### Required Packages
@@ -59,10 +57,20 @@ Terminus is published as a package under pantheon-systems/external. To install i
5957
brew install pantheon-systems/external/terminus
6058
```
6159

62-
### Ubuntu / WinWSL+Ubuntu:
60+
### Standalone Terminus PHAR
6361

64-
`*** TBD ***`
62+
The commands below will:
6563

66-
### Other installation methods
64+
- Create a `terminus` folder in your home directory (`~/`)
65+
- Get the latest release tag of Terminus
66+
- Download and save the release as `~/terminus/terminus`
67+
- Make the file executable
68+
- Add a symlink to your local `bin` directory for the Terminus executable
6769

68-
Refer to the [Terminus manual](https://pantheon.io/docs/terminus/install#install-terminus) for other installation methods.
70+
```bash
71+
mkdir -p ~/terminus && cd ~/terminus
72+
curl -L https://github.com/pantheon-systems/terminus/releases/download/3.6.1/terminus.phar --output terminus
73+
chmod +x terminus
74+
./terminus self:update
75+
sudo ln -s ~/terminus/terminus /usr/local/bin/terminus
76+
```

RoboFile.php

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
use CzProject\GitPhp\Git;
4-
use CzProject\GitPhp\GitException;
53
use Pantheon\Terminus\Config\ConfigAwareTrait;
64
use Pantheon\Terminus\Helpers\CommandCoverageReport;
75
use Pantheon\Terminus\Terminus;
@@ -208,124 +206,6 @@ public function setTerminus(Terminus $terminus): void
208206
$this->terminus = $terminus;
209207
}
210208

211-
/**
212-
* Generates a test commit.
213-
*
214-
* @throws \Pantheon\Terminus\Exceptions\TerminusException
215-
* @throws GitException
216-
*/
217-
public function generateTestCommit()
218-
{
219-
$this->output()->writeln('Getting the Site Repo');
220-
// get the git host and port from terminus
221-
$commandResponse = $this->getTerminus()->execute(
222-
'%s connection:info %s.dev --fields=git_host,git_port --format=json',
223-
[
224-
$this->getProjectPath() . "/terminus.phar",
225-
$this->getSiteName(),
226-
]
227-
);
228-
229-
// check if the command was successful
230-
if ($commandResponse[1] !== 0) {
231-
$this->output()->writeln('Failed to retrieve git host and port');
232-
exit(1);
233-
}
234-
235-
// decode the json response
236-
$gitInfo = json_decode($commandResponse[0], true);
237-
$this->output()->writeln('Retrieved git host and port' . print_r($gitInfo, true));
238-
239-
// check if the git host and port were retrieved
240-
if (!isset($gitInfo['git_host']) || !isset($gitInfo['git_port'])) {
241-
$this->output()->writeln('Failed to retrieve git host and port');
242-
exit(1);
243-
}
244-
245-
// Does the known_hosts file exist?
246-
if (!file_exists(sprintf("%s/.ssh/known_hosts", getenv("HOME")))) {
247-
// if not, create one
248-
touch(sprintf("%s/.ssh/known_hosts", getenv("HOME")));
249-
}
250-
251-
// get the contents of the known_hosts file
252-
$knownHosts = file_get_contents(sprintf("%s/.ssh/known_hosts", getenv("HOME")));
253-
// check if the git host is already in the known_hosts file
254-
if (!str_contains($knownHosts, $gitInfo['git_host'])) {
255-
// if not, add it
256-
$this->output()->writeln('Adding the git host to known hosts file');
257-
$addGitHostToKnownHostsCommand = sprintf(
258-
'ssh-keyscan -p %d %s >> ~/.ssh/known_hosts',
259-
$gitInfo['git_port'],
260-
$gitInfo['git_host']
261-
);
262-
$this->output()->writeln($addGitHostToKnownHostsCommand);
263-
exec($addGitHostToKnownHostsCommand);
264-
}
265-
266-
// checkout the branch related to this test run
267-
$clonedPath = sprintf(
268-
"%s/pantheon-local-copies/%s",
269-
getenv("HOME"),
270-
$this->getSiteName()
271-
);
272-
if (is_dir($clonedPath)) {
273-
// make sure you're working with a clean copy of the repo
274-
exec("rm -rf {$clonedPath}");
275-
}
276-
$this->output()->writeln(sprintf('Cloning the site repository to %s', $clonedPath));
277-
// get the git host and port from terminus
278-
$commandResponse = $this->getTerminus()->execute(
279-
'%s local:clone %s',
280-
[
281-
$this->getProjectPath() . "/terminus.phar",
282-
$this->getSiteName(),
283-
]
284-
);
285-
286-
$response = "";
287-
try {
288-
$git = new Git();
289-
$repo = $git->open($clonedPath);
290-
chdir($clonedPath);
291-
$branches = $repo->getBranches();
292-
if (!in_array($this->getSiteEnv(), $branches)) {
293-
$this->output()->writeln(sprintf('Creating the %s branch', $this->getSiteEnv()));
294-
// Create the branch
295-
$repo->createBranch($this->getSiteEnv());
296-
}
297-
// Check out the branch in question
298-
$repo->checkout($this->getSiteEnv());
299-
// create a text file
300-
$testFilePath = sprintf('%s/test.txt', $clonedPath);
301-
file_put_contents($testFilePath, 'test');
302-
// add the file to the repository
303-
$repo->addFile("test.txt");
304-
// commit the file
305-
$repo->commit('Test commit');
306-
// push the commit
307-
$response = $repo->execute(
308-
'push',
309-
'origin',
310-
$this->getSiteEnv(),
311-
);
312-
} catch (GitException $e) {
313-
$this->output()->writeln(["Git Exception:", $e->getMessage()]);
314-
$this->output()->writeln(print_r($response, true));
315-
exit(1);
316-
} catch (Exception $e) {
317-
$this->output()->writeln($e->getMessage());
318-
$this->output()->writeln(print_r($response, true));
319-
exit(1);
320-
}
321-
322-
// get the last commit
323-
$commit = $repo->getLastCommit();
324-
// output the commit id
325-
$this->output()->writeln($commit->getId());
326-
return $commit->getId();
327-
}
328-
329209
/**
330210
* Returns the absolute path to the project.
331211
*
@@ -335,21 +215,4 @@ private function getProjectPath(): string
335215
{
336216
return dirname(__FILE__);
337217
}
338-
339-
340-
/**
341-
* @return string
342-
*/
343-
private function getSiteName(): string
344-
{
345-
return getenv('TERMINUS_SITE') ?? 'ci-terminus-composer';
346-
}
347-
348-
/**
349-
* @return string
350-
*/
351-
private function getSiteEnv(): string
352-
{
353-
return getenv('TERMINUS_ENV') ?? 'dev';
354-
}
355218
}

bin/terminus

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSI
3232

3333
// This variable is automatically managed via updateDependenciesversion() in /RoboFile.php,
3434
// which is run after every call to composer update.
35-
$terminusPluginsDependenciesVersion = '51e2c517dd';
35+
$terminusPluginsDependenciesVersion = 'b17f504e52';
3636

3737
// Cannot use $_SERVER superglobal since that's empty during phpunit testing
3838
// getenv('HOME') isn't set on Windows and generates a Notice.

composer.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@
9191
],
9292
"code:fix": [
9393
"@php-cs-fixer",
94-
"vendor/bin/phpcbf ./src ./tests/Functional ./tests/unit_tests --standard=psr12 -v"
94+
"vendor/bin/phpcbf ./src ./tests/Functional --standard=psr12 -v"
9595
],
9696
"cs": [
97-
"vendor/bin/phpcs --standard=phpcs_ruleset.xml src tests/Functional tests/unit_tests"
97+
"vendor/bin/phpcs --standard=phpcs_ruleset.xml src tests/Functional"
9898
],
9999
"code:lint": [
100100
"@cs"
@@ -110,17 +110,14 @@
110110
"test:behat": [
111111
"SHELL_INTERACTIVE=true TERMINUS_TEST_MODE=1 behat --colors --config tests/config/behat.yml --stop-on-failure --suite=default"
112112
],
113-
"tests:unit": [
114-
"vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite unit --do-not-cache-result --verbose --stop-on-failure"
115-
],
116113
"test:short": [
117-
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite functional --group=short --do-not-cache-result --verbose --stop-on-failure"
114+
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=short --do-not-cache-result --verbose --stop-on-failure"
118115
],
119116
"test:long": [
120-
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite functional --group=long --do-not-cache-result --verbose"
117+
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=long --do-not-cache-result --verbose"
121118
],
122119
"test:functional": [
123-
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite functional --group=short,long --do-not-cache-result --verbose",
120+
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=short,long --do-not-cache-result --verbose",
124121
"@coverage"
125122
],
126123
"test:all": [
@@ -153,8 +150,7 @@
153150
],
154151
"php-cs-fixer": [
155152
"vendor/bin/php-cs-fixer fix ./src --rules=@PSR12",
156-
"vendor/bin/php-cs-fixer fix ./tests/Functional --rules=@PSR12",
157-
"vendor/bin/php-cs-fixer fix ./tests/Unit --rules=@PSR12"
153+
"vendor/bin/php-cs-fixer fix ./tests/Functional --rules=@PSR12"
158154
]
159155
},
160156
"config": {

0 commit comments

Comments
 (0)