2011-11-23 04:17:06 +01:00
|
|
|
<?php
|
|
|
|
class Mage_Task_BuiltIn_Scm_Update
|
|
|
|
extends Mage_Task_TaskAbstract
|
|
|
|
{
|
2011-11-23 12:38:52 +01:00
|
|
|
private $_name = 'SCM Update [built-in]';
|
2012-09-20 00:26:10 +02:00
|
|
|
|
2011-11-23 04:17:06 +01:00
|
|
|
public function getName()
|
|
|
|
{
|
2011-11-23 12:38:52 +01:00
|
|
|
return $this->_name;
|
|
|
|
}
|
2012-09-20 00:26:10 +02:00
|
|
|
|
2011-11-23 12:38:52 +01:00
|
|
|
public function init()
|
|
|
|
{
|
2012-01-01 18:46:05 +01:00
|
|
|
switch ($this->_config->scm('type')) {
|
2011-11-23 12:38:52 +01:00
|
|
|
case 'git':
|
|
|
|
$this->_name = 'SCM Update (GIT) [built-in]';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'svn':
|
|
|
|
$this->_name = 'SCM Update (Subversion) [built-in]';
|
|
|
|
break;
|
|
|
|
}
|
2011-11-23 04:17:06 +01:00
|
|
|
}
|
2012-09-20 00:26:10 +02:00
|
|
|
|
2011-11-23 12:38:52 +01:00
|
|
|
public function run()
|
2011-11-23 04:17:06 +01:00
|
|
|
{
|
2012-01-01 18:46:05 +01:00
|
|
|
switch ($this->_config->scm('type')) {
|
2011-11-23 04:17:06 +01:00
|
|
|
case 'git':
|
|
|
|
$command = 'git pull';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'svn':
|
|
|
|
$command = 'svn update';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = $this->_runLocalCommand($command);
|
2012-09-20 00:26:10 +02:00
|
|
|
$this->_config->reloadConfig();
|
|
|
|
|
2011-11-23 04:17:06 +01:00
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|