1
0
mirror of https://github.com/hauke68/Magallanes.git synced 2025-08-25 21:00:18 +02:00
Magallanes/Mage/Task/BuiltIn/Scm/Update.php
Andrés Montañez 811c83e13a Major overhauling and refactoring of Magallanes Command and Tasks modulairty and workflow.
ADVICE: there is no Backwards Compatibility with custom tasks, those
using the _config instance will be broken or those using the
getEnvironmentName().
2012-09-21 00:23:07 -03:00

46 lines
991 B
PHP

<?php
class Mage_Task_BuiltIn_Scm_Update
extends Mage_Task_TaskAbstract
{
private $_name = 'SCM Update [built-in]';
public function getName()
{
return $this->_name;
}
public function init()
{
switch ($this->getConfig()->scm('type')) {
case 'git':
$this->_name = 'SCM Update (GIT) [built-in]';
break;
case 'svn':
$this->_name = 'SCM Update (Subversion) [built-in]';
break;
}
}
public function run()
{
switch ($this->getConfig()->scm('type')) {
case 'git':
$command = 'git pull';
break;
case 'svn':
$command = 'svn update';
break;
default:
return false;
break;
}
$result = $this->_runLocalCommand($command);
$this->getConfig()->reload();
return $result;
}
}