Skip to content

Commit

Permalink
Tweaks for issue #45
Browse files Browse the repository at this point in the history
- Issue #45 - Adds "ssh_needs_tty" which appends "-t" to the ssh.
- Issue #45 - Rsync is incremental if there are previous releases.
  • Loading branch information
andres-montanez committed Mar 16, 2014
1 parent 8b43a13 commit 7c883d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Mage/Task/AbstractTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ protected final function runCommandRemote($command, &$output = null)
} else {
$releasesDirectory = '';
}

// if general.yml includes "ssy_needs_tty: true", then add "-t" to the ssh command
$needs_tty = ($this->getConfig()->general('ssh_needs_tty',false) ? "-t" : "");
$needs_tty = ($this->getConfig()->general('ssh_needs_tty',false) ? '-t' : '');

$localCommand = 'ssh ' . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
Expand Down
11 changes: 6 additions & 5 deletions Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ public function run()
if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');

$currentRelease = false;
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
$resultFetch = $this->runCommandRemote('ls -ld current | cut -d"/" -f2', $releaseToOverride);
if ( $resultFetch ) {
$resultFetch = $this->runCommandRemote('ls -ld current | cut -d"/" -f2', $currentRelease);

if ($resultFetch && $currentRelease) {
// If deployment configuration is rsync, include a flag to simply sync the deltas between the prior release
// rsync: { copy: yes }
$rsync_copy = $this->getConfig()->deployment("rsync");
$rsync_copy = $this->getConfig()->deployment('rsync');
if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $releaseToOverride . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
} else {
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
}
Expand Down

0 comments on commit 7c883d2

Please sign in to comment.