Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #18 from johnny-bit/rsync_callable
Browse files Browse the repository at this point in the history
Fix rsync behaviour with callable environment vars
  • Loading branch information
gordalina committed Jun 19, 2015
2 parents 1ea9a16 + e3bd756 commit 06790c8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion recipes/rsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,21 @@

$config = get('rsync');

$src = env('rsync_src');
while(is_callable($src)){
$src = $src();
}
$dst = env('rsync_dest');
while(is_callable($dst)){
$dst = $dst();
}

$server = \Deployer\Task\Context::get()->getServer()->getConfiguration();
$host = $server->getHost();
$port = $server->getPort() ? ' -p'.$server->getPort(): '';
$user = !$server->getUser() ? '' : $server->getUser().'@';

runLocally("rsync -{$config['flags']} -e 'ssh$port' {{rsync_options}}{{rsync_excludes}}{{rsync_includes}}{{rsync_filter}} {{rsync_src}}/ $user$host:{{rsync_dest}}/");
runLocally("rsync -{$config['flags']} -e 'ssh$port' {{rsync_options}}{{rsync_excludes}}{{rsync_includes}}{{rsync_filter}} '$src' '$user$host:$dst/'");


})->desc('Rsync local->remote');

0 comments on commit 06790c8

Please sign in to comment.