2011-11-23 01:17:06 -02:00
|
|
|
<?php
|
|
|
|
|
class Mage_Task_BuiltIn_Scm_Update
|
|
|
|
|
extends Mage_Task_TaskAbstract
|
|
|
|
|
{
|
2011-11-23 09:38:52 -02:00
|
|
|
private $_name = 'SCM Update [built-in]';
|
2012-09-19 19:26:10 -03:00
|
|
|
|
2011-11-23 01:17:06 -02:00
|
|
|
public function getName()
|
|
|
|
|
{
|
2011-11-23 09:38:52 -02:00
|
|
|
return $this->_name;
|
|
|
|
|
}
|
2012-09-19 19:26:10 -03:00
|
|
|
|
2011-11-23 09:38:52 -02:00
|
|
|
public function init()
|
|
|
|
|
{
|
2013-07-06 20:46:19 -03:00
|
|
|
switch ($this->getConfig()->general('scm')) {
|
2011-11-23 09:38:52 -02:00
|
|
|
case 'git':
|
|
|
|
|
$this->_name = 'SCM Update (GIT) [built-in]';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'svn':
|
|
|
|
|
$this->_name = 'SCM Update (Subversion) [built-in]';
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-11-23 01:17:06 -02:00
|
|
|
}
|
2012-09-19 19:26:10 -03:00
|
|
|
|
2011-11-23 09:38:52 -02:00
|
|
|
public function run()
|
2011-11-23 01:17:06 -02:00
|
|
|
{
|
2013-07-06 20:52:39 -03:00
|
|
|
switch ($this->getConfig()->general('scm')) {
|
2011-11-23 01:17:06 -02:00
|
|
|
case 'git':
|
|
|
|
|
$command = 'git pull';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'svn':
|
|
|
|
|
$command = 'svn update';
|
|
|
|
|
break;
|
2012-09-21 00:23:07 -03:00
|
|
|
|
|
|
|
|
default:
|
2013-07-06 20:46:19 -03:00
|
|
|
throw new Mage_Task_SkipException;
|
2012-09-21 00:23:07 -03:00
|
|
|
break;
|
2011-11-23 01:17:06 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result = $this->_runLocalCommand($command);
|
2012-09-21 00:23:07 -03:00
|
|
|
$this->getConfig()->reload();
|
2012-09-19 19:26:10 -03:00
|
|
|
|
2011-11-23 01:17:06 -02:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|