Source of file AddUpgradeStarterBranch.php

Size: 1,406 Bytes - Last Modified: 2020-07-03T12:08:09+00:00

/var/www/docs.ssmods.com/process/src/src/Tasks/IndividualTasks/AddUpgradeStarterBranch.php

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
<?php

namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks;

use Sunnysideup\UpgradeToSilverstripe4\Tasks\Helpers\Git;
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task;

/**
 * This task adds a legacy branch to the git repo of the original to act as a backup/legacy version for
 * holding a version of the module before it was changed
 */
class AddUpgradeStarterBranch extends Task
{
    protected $taskStep = 's10';

    public function getTitle()
    {
        return 'Creates a start branch for upgrading';
    }

    public function getDescription()
    {
        return '
            Creates a starter branch: "' . $this->mu()->getNameOfUpgradeStarterBranch() . '" of your module/app
            from the "' . $this->mu()->getNameOfBranchForBaseCode() . '" branch.
            If it does not exist.
            These branch names can be customised with setNameOfUpgradeStarterBranch and setNameOfBranchForBaseCode.
            ';
    }

    /**
     * @param  array  $params not currently used for this task
     */
    public function runActualTask($params = [])
    {
        Git::inst($this->mu())->createNewBranchIfItDoesNotExist(
            $this->mu()->getGitRootDir(),
            $this->mu()->getNameOfUpgradeStarterBranch(),
            $this->mu()->getNameOfBranchForBaseCode()
        );
    }

    protected function hasCommitAndPush()
    {
        return false;
    }
}