mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	fixed a bug: if deploy strategy was set to "disable", release was still trying to do remote stuff. Now release step respects strategy.
This commit is contained in:
		
							parent
							
								
									5ce3394b3c
								
							
						
					
					
						commit
						d495d10aca
					
				@ -298,33 +298,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
 | 
			
		||||
 | 
			
		||||
    			$tasksToRun = $this->getConfig()->getTasks();
 | 
			
		||||
 | 
			
		||||
    			// Guess a Deploy Strategy
 | 
			
		||||
    			switch ($this->getConfig()->deployment('strategy', 'guess')) {
 | 
			
		||||
    			    case 'disabled':
 | 
			
		||||
    			    	$deployStrategy = 'deployment/strategy/disabled';
 | 
			
		||||
    			    	break;
 | 
			
		||||
 | 
			
		||||
    			    case 'rsync':
 | 
			
		||||
    			    	$deployStrategy = 'deployment/strategy/rsync';
 | 
			
		||||
    			    	break;
 | 
			
		||||
 | 
			
		||||
    			    case 'targz':
 | 
			
		||||
    			    	$deployStrategy = 'deployment/strategy/tar-gz';
 | 
			
		||||
    			    	break;
 | 
			
		||||
 | 
			
		||||
                            case 'git-rebase':
 | 
			
		||||
    			    	$deployStrategy = 'deployment/strategy/git-rebase';
 | 
			
		||||
    			    	break;
 | 
			
		||||
 | 
			
		||||
    			    case 'guess':
 | 
			
		||||
    			    default:
 | 
			
		||||
    			    	if ($this->getConfig()->release('enabled', false) == true) {
 | 
			
		||||
    			    		$deployStrategy = 'deployment/strategy/tar-gz';
 | 
			
		||||
    			    	} else {
 | 
			
		||||
    			    		$deployStrategy = 'deployment/strategy/rsync';
 | 
			
		||||
    			    	}
 | 
			
		||||
    			    	break;
 | 
			
		||||
    			}
 | 
			
		||||
                $deployStrategy = $this->chooseDeployStrategy();
 | 
			
		||||
 | 
			
		||||
                array_unshift($tasksToRun, $deployStrategy);
 | 
			
		||||
 | 
			
		||||
@ -381,7 +355,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
 | 
			
		||||
    				$this->getConfig()->setHost($host);
 | 
			
		||||
    				$this->getConfig()->setHostConfig($hostConfig);
 | 
			
		||||
 | 
			
		||||
    				$task = Factory::get('deployment/release', $this->getConfig(), false, AbstractTask::STAGE_DEPLOY);
 | 
			
		||||
    				$task = Factory::get($this->chooseReleaseStrategy(), $this->getConfig(), false, AbstractTask::STAGE_DEPLOY);
 | 
			
		||||
 | 
			
		||||
    				if ($this->runTask($task, 'Releasing on host <purple>' . $host . '</purple> ... ')) {
 | 
			
		||||
    					$completedTasks++;
 | 
			
		||||
@ -543,4 +517,54 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    protected function chooseDeployStrategy()
 | 
			
		||||
    {
 | 
			
		||||
        // Guess a Deploy Strategy
 | 
			
		||||
        switch ($this->getConfig()->deployment('strategy', 'guess')) {
 | 
			
		||||
        case 'disabled':
 | 
			
		||||
            $deployStrategy = 'deployment/strategy/disabled';
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case 'rsync':
 | 
			
		||||
            $deployStrategy = 'deployment/strategy/rsync';
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case 'targz':
 | 
			
		||||
            $deployStrategy = 'deployment/strategy/tar-gz';
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case 'git-rebase':
 | 
			
		||||
            $deployStrategy = 'deployment/strategy/git-rebase';
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case 'guess':
 | 
			
		||||
        default:
 | 
			
		||||
            if ($this->getConfig()->release('enabled', false) == true) {
 | 
			
		||||
                $deployStrategy = 'deployment/strategy/tar-gz';
 | 
			
		||||
            } else {
 | 
			
		||||
                $deployStrategy = 'deployment/strategy/rsync';
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        return $deployStrategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    protected function chooseReleaseStrategy()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        if ($this->getConfig()->release('enabled', false) === true) {
 | 
			
		||||
            $strategy = 'deployment/strategy/disabled';
 | 
			
		||||
        } else {
 | 
			
		||||
            $strategy = 'deployment/release';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $strategy;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user