deployer/recipe/deploy/copy_dirs.php

30 lines
763 B
PHP
Raw Normal View History

2016-11-19 15:13:32 +07:00
<?php
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
desc('Copy directories');
task('deploy:copy_dirs', function () {
$dirs = get('copy_dirs');
2017-01-27 20:54:21 +07:00
$releases = get('releases_list');
2016-11-19 15:13:32 +07:00
2017-01-27 20:54:21 +07:00
if (isset($releases[0])) {
foreach ($dirs as $dir) {
$path = "{{deploy_path}}/releases/{$releases[0]}/$dir";
2016-11-19 15:13:32 +07:00
2017-01-27 20:54:21 +07:00
// Copy if dir exists.
if (test("[ -d $path ]")) {
2017-03-09 19:09:28 +01:00
// Create destination dir(needed for nested dirs)
run("mkdir -p {{release_path}}/$dir");
2017-03-08 13:42:37 +01:00
run("rsync -av $path/ {{release_path}}/$dir");
2017-01-27 20:54:21 +07:00
}
}
2016-11-19 15:13:32 +07:00
}
});