[Nostromo] Refactor Deployment, add Strategies.

This commit is contained in:
Andrés Montañez
2017-01-10 21:28:32 -03:00
parent bd5c2de798
commit cec0bc1255
7 changed files with 334 additions and 113 deletions
+30
View File
@@ -10,6 +10,9 @@
namespace Mage\Runtime;
use Mage\Deploy\Strategy\ReleasesStrategy;
use Mage\Deploy\Strategy\RsyncStrategy;
use Mage\Deploy\Strategy\StrategyInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Symfony\Component\Process\Process;
@@ -472,4 +475,31 @@ class Runtime
$userData = posix_getpwuid(posix_geteuid());
return $userData['name'];
}
/**
* Shortcut for getting Branch information
*
* @return boolean|string
*/
public function getBranch()
{
return $this->getEnvironmentConfig('branch', false);
}
/**
* Guesses the Deploy Strategy to use
*
* @return StrategyInterface
*/
public function guessStrategy()
{
$strategy = new RsyncStrategy();
if ($this->getEnvironmentConfig('releases', false)) {
$strategy = new ReleasesStrategy();
}
$strategy->setRuntime($this);
return $strategy;
}
}