From 32cd0aff02e198fc9ec3643ce790530a18791c61 Mon Sep 17 00:00:00 2001 From: nlotzer Date: Tue, 14 Mar 2017 15:17:34 +0100 Subject: [PATCH] Adds from paramter for rsync and tar tasks --- docs/example-config.yml | 1 + src/Task/BuiltIn/Deploy/RsyncTask.php | 3 ++- src/Task/BuiltIn/Deploy/Tar/PrepareTask.php | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/example-config.yml b/docs/example-config.yml index a3036b7..e6ab14b 100644 --- a/docs/example-config.yml +++ b/docs/example-config.yml @@ -3,6 +3,7 @@ magephp: production: user: app branch: test + from: ./ host_path: /var/www/test releases: 4 exclude: diff --git a/src/Task/BuiltIn/Deploy/RsyncTask.php b/src/Task/BuiltIn/Deploy/RsyncTask.php index 1dce74e..c285378 100644 --- a/src/Task/BuiltIn/Deploy/RsyncTask.php +++ b/src/Task/BuiltIn/Deploy/RsyncTask.php @@ -45,7 +45,8 @@ class RsyncTask extends AbstractTask } $excludes = $this->getExcludes(); - $cmdRsync = sprintf('rsync -e "ssh -p %d %s" %s %s ./ %s@%s:%s', $sshConfig['port'], $sshConfig['flags'], $flags, $excludes, $user, $host, $targetDir); + $from = $this->runtime->getEnvOption('from', './'); + $cmdRsync = sprintf('rsync -e "ssh -p %d %s" %s %s %s %s@%s:%s', $sshConfig['port'], $sshConfig['flags'], $flags, $excludes, $from, $user, $host, $targetDir); /** @var Process $process */ $process = $this->runtime->runLocalCommand($cmdRsync, 600); diff --git a/src/Task/BuiltIn/Deploy/Tar/PrepareTask.php b/src/Task/BuiltIn/Deploy/Tar/PrepareTask.php index e694f8f..2e1586e 100644 --- a/src/Task/BuiltIn/Deploy/Tar/PrepareTask.php +++ b/src/Task/BuiltIn/Deploy/Tar/PrepareTask.php @@ -42,7 +42,8 @@ class PrepareTask extends AbstractTask $excludes = $this->getExcludes(); $flags = $this->runtime->getEnvOption('tar_create', 'cfzp'); - $cmdTar = sprintf('tar %s %s %s ./', $flags, $tarLocal, $excludes); + $from = $this->runtime->getEnvOption('from', './'); + $cmdTar = sprintf('tar %s %s %s %s', $flags, $tarLocal, $excludes, $from); /** @var Process $process */ $process = $this->runtime->runLocalCommand($cmdTar, 300);