deployer/recipe/deploy/copy_dirs.php
2016-11-19 15:13:32 +07:00

22 lines
630 B
PHP

<?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');
foreach ($dirs as $dir) {
// Delete directory if exists.
run("if [ -d $(echo {{release_path}}/$dir) ]; then rm -rf {{release_path}}/$dir; fi");
// Copy directory.
run("if [ -d $(echo {{deploy_path}}/current/$dir) ]; then cp -rpf {{deploy_path}}/current/$dir {{release_path}}/$dir; fi");
}
});