Skip to content

Commit fc388d3

Browse files
committed
Merge branch 'develop'
Merge details: commit e400ff3 Author: Jelle Sebreghts <sebreghts.jelle@gmail.com> Date: Mon Mar 11 08:39:16 2019 Fix codestyle, do not test PHP5. commit b3d5a28 Author: Jelle Sebreghts <sebreghts.jelle@gmail.com> Date: Thu Feb 28 15:40:15 2019 Add filechecks to allow deploys to check if certain files are present.
2 parents 9559181 + f51099e commit fc388d3

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ language: php
55
php:
66
- 7.1
77
- 7.0
8-
- 5.6
9-
- 5.5
108
before_script:
119
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
1210
- chmod +x ./cc-test-reporter
@@ -18,4 +16,4 @@ script:
1816
- vendor/bin/phpunit
1917
after_script:
2018
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
21-
19+

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"digipolisgent/robo-digipolis-package": "^0.1",
99
"digipolisgent/robo-digipolis-deploy": "^0.1.4",
1010
"digipolisgent/robo-digipolis-general": "^0.1",
11-
"gordalina/cachetool": "^3|^2.1|^1.11"
11+
"gordalina/cachetool": "^3|^2.1|^1.11",
12+
"digipolisgent/command-builder": "^1.0"
1213
},
1314
"require-dev": {
1415
"phpunit/phpunit": "~4.4"

src/AbstractRoboFile.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace DigipolisGent\Robo\Helpers;
44

5+
use DigipolisGent\CommandBuilder\CommandBuilder;
56
use DigipolisGent\Robo\Task\Deploy\Ssh\Auth\AbstractAuth;
67
use DigipolisGent\Robo\Task\Deploy\Ssh\Auth\KeyFile;
78
use DigipolisGent\Robo\Task\General\Common\DigipolisPropertiesAwareInterface;
@@ -330,6 +331,29 @@ protected function buildTask($archivename = null)
330331
*/
331332
protected function postSymlinkTask($worker, AbstractAuth $auth, $remote)
332333
{
334+
if (isset($remote['postsymlink_filechecks']) && $remote['postsymlink_filechecks']) {
335+
$projectRoot = $remote['rootdir'];
336+
$collection = $this->collectionBuilder();
337+
$collection->taskSsh($worker, $auth)
338+
->remoteDirectory($projectRoot, true)
339+
->timeout($this->getTimeoutSetting('postsymlink_filechecks'));
340+
foreach ($remote['postsymlink_filechecks'] as $file) {
341+
// If this command fails, the collection will fail, which will
342+
// trigger a rollback.
343+
$builder = CommandBuilder::create('ls')
344+
->addArgument($file)
345+
->pipeOutputTo('grep')
346+
->addArgument($file)
347+
->onFailure(
348+
CommandBuilder::create('echo')
349+
->addArgument('[ERROR] ' . $file . ' was not found.')
350+
->onFinished('exit')
351+
->addArgument('1')
352+
);
353+
$collection->exec((string) $builder);
354+
}
355+
return $collection;
356+
}
333357
return false;
334358
}
335359

0 commit comments

Comments
 (0)