1
0
mirror of https://github.com/hauke68/Magallanes.git synced 2025-09-13 12:40:18 +02:00
Magallanes/Mage/Task/BuiltIn/Scm/Update.php

55 lines
1.2 KiB
PHP
Raw Normal View History

<?php
2013-11-05 17:12:09 +01:00
/*
* This file is part of the Magallanes package.
*
* (c) Andrés Montañez <andres@andresmontanez.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Mage_Task_BuiltIn_Scm_Update
extends Mage_Task_TaskAbstract
{
private $_name = 'SCM Update [built-in]';
2012-09-20 00:26:10 +02:00
public function getName()
{
return $this->_name;
}
2012-09-20 00:26:10 +02:00
public function init()
{
2013-07-07 01:46:19 +02:00
switch ($this->getConfig()->general('scm')) {
case 'git':
$this->_name = 'SCM Update (GIT) [built-in]';
break;
case 'svn':
$this->_name = 'SCM Update (Subversion) [built-in]';
break;
}
}
2012-09-20 00:26:10 +02:00
public function run()
{
2013-07-07 01:52:39 +02:00
switch ($this->getConfig()->general('scm')) {
case 'git':
$command = 'git pull';
break;
case 'svn':
$command = 'svn update';
break;
default:
2013-07-07 01:46:19 +02:00
throw new Mage_Task_SkipException;
break;
}
$result = $this->_runLocalCommand($command);
$this->getConfig()->reload();
2012-09-20 00:26:10 +02:00
return $result;
}
}