mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Tweaks on port definition.
Now port can be defined into the hostname.
This commit is contained in:
		
							parent
							
								
									e42a1f1193
								
							
						
					
					
						commit
						51e7de0676
					
				@ -71,6 +71,19 @@ class Mage_Config
 | 
				
			|||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    public function getHostName()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $info = explode(':', $this->_host);
 | 
				
			||||||
 | 
					        return $info[0];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    public function getHostPort()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $info = explode(':', $this->_host);
 | 
				
			||||||
 | 
					        $info[] = $this->deployment('port', '22');
 | 
				
			||||||
 | 
					        return $info[1];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    public function getHost()
 | 
					    public function getHost()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->_host;
 | 
					        return $this->_host;
 | 
				
			||||||
 | 
				
			|||||||
@ -36,7 +36,7 @@ class Mage_Task_BuiltIn_Deployment_Rsync
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $command = 'rsync -avz '
 | 
					        $command = 'rsync -avz '
 | 
				
			||||||
                 . '--rsh="ssh -p' . $this->_config->deployment('port', '22') . '" '
 | 
					                 . '--rsh="ssh -p' . $this->_config->getHostPort() . '" '
 | 
				
			||||||
                 . $this->_excludes(array_merge($excludes, $userExcludes)) . ' '
 | 
					                 . $this->_excludes(array_merge($excludes, $userExcludes)) . ' '
 | 
				
			||||||
                 . $this->_config->deployment('from') . ' '
 | 
					                 . $this->_config->deployment('from') . ' '
 | 
				
			||||||
                 . $this->_config->deployment('user') . '@' . $this->_config->getHost() . ':' . $deployToDirectory;
 | 
					                 . $this->_config->deployment('user') . '@' . $this->_config->getHost() . ':' . $deployToDirectory;
 | 
				
			||||||
 | 
				
			|||||||
@ -28,7 +28,7 @@ class Mage_Task_Deploy
 | 
				
			|||||||
                $tasks = 0;
 | 
					                $tasks = 0;
 | 
				
			||||||
                $completedTasks = 0;
 | 
					                $completedTasks = 0;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
                Mage_Console::output('Deploying to <dark_gray>' . $host . '</dark_gray>');
 | 
					                Mage_Console::output('Deploying to <dark_gray>' . $config->getHostName() . '</dark_gray>');
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                $tasksToRun = $config->getTasks();
 | 
					                $tasksToRun = $config->getTasks();
 | 
				
			||||||
                array_unshift($tasksToRun, 'deployment/rsync');
 | 
					                array_unshift($tasksToRun, 'deployment/rsync');
 | 
				
			||||||
@ -40,7 +40,7 @@ class Mage_Task_Deploy
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                if (count($tasksToRun) == 0) {
 | 
					                if (count($tasksToRun) == 0) {
 | 
				
			||||||
                    Mage_Console::output('<light_purple>Warning!</light_purple> <dark_gray>No </dark_gray><light_cyan>Deployment</light_cyan> <dark_gray>tasks defined.</dark_gray>', 2);
 | 
					                    Mage_Console::output('<light_purple>Warning!</light_purple> <dark_gray>No </dark_gray><light_cyan>Deployment</light_cyan> <dark_gray>tasks defined.</dark_gray>', 2);
 | 
				
			||||||
                    Mage_Console::output('Deployment to <dark_gray>' . $host . '</dark_gray> skipped!', 1, 3);
 | 
					                    Mage_Console::output('Deployment to <dark_gray>' . $config->getHostName() . '</dark_gray> skipped!', 1, 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    foreach ($tasksToRun as $taskName) {
 | 
					                    foreach ($tasksToRun as $taskName) {
 | 
				
			||||||
@ -65,7 +65,7 @@ class Mage_Task_Deploy
 | 
				
			|||||||
                        $tasksColor = 'red';                
 | 
					                        $tasksColor = 'red';                
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
                    Mage_Console::output('Deployment to <dark_gray>' . $host . '</dark_gray> compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
 | 
					                    Mage_Console::output('Deployment to <dark_gray>' . $config->getHostName() . '</dark_gray> compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -45,7 +45,7 @@ abstract class Mage_Task_TaskAbstract
 | 
				
			|||||||
            $releasesDirectory = '';
 | 
					            $releasesDirectory = '';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $localCommand = 'ssh -p ' . $this->_config->deployment('port', '22') . ' '
 | 
					        $localCommand = 'ssh -p ' . $this->_config->getHostPort() . ' '
 | 
				
			||||||
                      . '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
 | 
					                      . '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
 | 
				
			||||||
                      . $this->_config->deployment('user') . '@' . $this->_config->getHost() . ' '
 | 
					                      . $this->_config->deployment('user') . '@' . $this->_config->getHost() . ' '
 | 
				
			||||||
                      . '"cd ' . rtrim($this->_config->deployment('to'), '/') . $releasesDirectory . ' && '
 | 
					                      . '"cd ' . rtrim($this->_config->deployment('to'), '/') . $releasesDirectory . ' && '
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@ class Mage_Task_Update
 | 
				
			|||||||
        if ($result == true) {
 | 
					        if ($result == true) {
 | 
				
			||||||
            Mage_Console::output('OK' . PHP_EOL, 0);
 | 
					            Mage_Console::output('OK' . PHP_EOL, 0);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            Mage_Console::output( 'FAIL' . PHP_EOL, 0);
 | 
					            Mage_Console::output('FAIL' . PHP_EOL, 0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								bin/mage
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								bin/mage
									
									
									
									
									
								
							@ -1,5 +1,5 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
#VERSION:0.9.3
 | 
					#VERSION:0.9.4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SCRIPT=$(readlink -f $0)
 | 
					SCRIPT=$(readlink -f $0)
 | 
				
			||||||
DIR=$(dirname $SCRIPT)
 | 
					DIR=$(dirname $SCRIPT)
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@ date_default_timezone_set('UTC');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
$baseDir = dirname(dirname(__FILE__));
 | 
					$baseDir = dirname(dirname(__FILE__));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define('MAGALLANES_VERSION', '0.9.3');
 | 
					define('MAGALLANES_VERSION', '0.9.4');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require_once $baseDir . '/Mage/spyc.php';
 | 
					require_once $baseDir . '/Mage/spyc.php';
 | 
				
			||||||
require_once $baseDir . '/Mage/Autoload.php';
 | 
					require_once $baseDir . '/Mage/Autoload.php';
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ releases:
 | 
				
			|||||||
  symlink: current
 | 
					  symlink: current
 | 
				
			||||||
  directory: releases
 | 
					  directory: releases
 | 
				
			||||||
hosts:
 | 
					hosts:
 | 
				
			||||||
  - s01.example.com
 | 
					  - s01.example.com:22
 | 
				
			||||||
  - s02.example.com
 | 
					  - s02.example.com
 | 
				
			||||||
tasks:
 | 
					tasks:
 | 
				
			||||||
  pre-deploy:
 | 
					  pre-deploy:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user