mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-09-13 12:40:18 +02:00
exclude from file added.
rebased by upstream
This commit is contained in:
parent
861a823f7e
commit
a66478b3ab
@ -52,6 +52,7 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||||||
$this->checkOverrideRelease();
|
$this->checkOverrideRelease();
|
||||||
|
|
||||||
$excludes = $this->getExcludes();
|
$excludes = $this->getExcludes();
|
||||||
|
$excludesListFilePath = $this->getExcludesListFile();
|
||||||
|
|
||||||
// If we are working with releases
|
// If we are working with releases
|
||||||
$deployToDirectory = $this->getConfig()->deployment('to');
|
$deployToDirectory = $this->getConfig()->deployment('to');
|
||||||
@ -95,6 +96,7 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||||||
. $strategyFlags . ' '
|
. $strategyFlags . ' '
|
||||||
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
|
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
|
||||||
. $this->excludes($excludes) . ' '
|
. $this->excludes($excludes) . ' '
|
||||||
|
. $this->excludesListFile($excludesListFilePath) . ' '
|
||||||
. $this->getConfig()->deployment('from') . ' '
|
. $this->getConfig()->deployment('from') . ' '
|
||||||
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
|
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
|
||||||
$result = $this->runCommandLocal($command);
|
$result = $this->runCommandLocal($command);
|
||||||
@ -117,4 +119,18 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||||||
$excludesRsync = trim($excludesRsync);
|
$excludesRsync = trim($excludesRsync);
|
||||||
return $excludesRsync;
|
return $excludesRsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the Exclude from file for rsync
|
||||||
|
* @param string $excludesFilePath
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function excludesListFile($excludesFilePath)
|
||||||
|
{
|
||||||
|
$excludesListFileRsync = '';
|
||||||
|
if(!empty($excludesFilePath)) {
|
||||||
|
$excludesListFileRsync = ' --exclude-from=' . $excludesFilePath;
|
||||||
|
}
|
||||||
|
return $excludesListFileRsync;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||||||
$this->checkOverrideRelease();
|
$this->checkOverrideRelease();
|
||||||
|
|
||||||
$excludes = $this->getExcludes();
|
$excludes = $this->getExcludes();
|
||||||
|
$excludesListFilePath = $this->getExcludesListFile();
|
||||||
|
|
||||||
// If we are working with releases
|
// If we are working with releases
|
||||||
$deployToDirectory = $this->getConfig()->deployment('to');
|
$deployToDirectory = $this->getConfig()->deployment('to');
|
||||||
@ -66,6 +67,8 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||||||
$excludeCmd .= ' --exclude=' . $excludeFile;
|
$excludeCmd .= ' --exclude=' . $excludeFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$excludeFromFileCmd = $this->excludesListFile($excludesListFilePath);
|
||||||
|
|
||||||
// Strategy Flags
|
// Strategy Flags
|
||||||
$strategyFlags = $this->getConfig()->deployment('strategy_flags', $this->getConfig()->general('strategy_flags', array()));
|
$strategyFlags = $this->getConfig()->deployment('strategy_flags', $this->getConfig()->general('strategy_flags', array()));
|
||||||
if (isset($strategyFlags['targz']) && isset($strategyFlags['targz']['create'])) {
|
if (isset($strategyFlags['targz']) && isset($strategyFlags['targz']['create'])) {
|
||||||
@ -74,7 +77,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||||||
$strategyFlags = '';
|
$strategyFlags = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$command = 'tar cfzh' . $strategyFlags . ' ' . $localTarGz . '.tar.gz ' . $excludeCmd . ' -C ' . $this->getConfig()->deployment('from') . ' .';
|
$command = 'tar cfzh' . $strategyFlags . ' ' . $localTarGz . '.tar.gz ' . $excludeCmd . $excludeFromFileCmd . ' -C ' . $this->getConfig()->deployment('from') . ' .';
|
||||||
$result = $this->runCommandLocal($command);
|
$result = $this->runCommandLocal($command);
|
||||||
|
|
||||||
// Strategy Flags
|
// Strategy Flags
|
||||||
@ -112,4 +115,18 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the Exclude from file for TarGz
|
||||||
|
* @param string $excludesFilePath
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function excludesListFile($excludesFilePath)
|
||||||
|
{
|
||||||
|
$excludesListFileRsync = '';
|
||||||
|
if(!empty($excludesFilePath)) {
|
||||||
|
$excludesListFileRsync = ' --exclude-from=' . $excludesFilePath;
|
||||||
|
}
|
||||||
|
return $excludesListFileRsync;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user