mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-10-31 15:20:17 +01:00 
			
		
		
		
	New config settings.
This commit is contained in:
		
							parent
							
								
									9cf720c602
								
							
						
					
					
						commit
						9b27dd8ebe
					
				| @ -3,6 +3,7 @@ class Mage_Config | |||||||
| { | { | ||||||
|     private $_environment = null; |     private $_environment = null; | ||||||
|     private $_scm = null; |     private $_scm = null; | ||||||
|  |     private $_general = null; | ||||||
|     private $_host = null; |     private $_host = null; | ||||||
|     private $_releaseId = null; |     private $_releaseId = null; | ||||||
|      |      | ||||||
| @ -20,6 +21,13 @@ class Mage_Config | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     public function loadGeneral() | ||||||
|  |     { | ||||||
|  |         if (file_exists('.mage/config/general.yaml')) { | ||||||
|  |             $this->_general = @yaml_parse_file('.mage/config/general.yaml'); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |      | ||||||
|     public function getEnvironment() |     public function getEnvironment() | ||||||
|     { |     { | ||||||
|         return $this->_environment; |         return $this->_environment; | ||||||
| @ -30,6 +38,11 @@ class Mage_Config | |||||||
|         return $this->_scm; |         return $this->_scm; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public function getGlobal() | ||||||
|  |     { | ||||||
|  |         return $this->_global; | ||||||
|  |     } | ||||||
|  |      | ||||||
|     public function getHosts() |     public function getHosts() | ||||||
|     { |     { | ||||||
|         $config = $this->getEnvironment(); |         $config = $this->getEnvironment(); | ||||||
| @ -141,4 +154,24 @@ class Mage_Config | |||||||
|             return $default; |             return $default; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public function general($option, $default = false) | ||||||
|  |     { | ||||||
|  |         $options = $this->_general; | ||||||
|  |         if (isset($options[$option])) { | ||||||
|  |             return $options[$option]; | ||||||
|  |         } else { | ||||||
|  |             return $default; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     public function mail($option, $default = false) | ||||||
|  |     { | ||||||
|  |         $options = $this->_general; | ||||||
|  |         if (isset($options['mail'][$option])) { | ||||||
|  |             return $options['mail'][$option]; | ||||||
|  |         } else { | ||||||
|  |             return $default; | ||||||
|  |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
| @ -8,6 +8,7 @@ class Mage_Console | |||||||
|     private static $_log = null; |     private static $_log = null; | ||||||
|     private static $_logEnabled = true; |     private static $_logEnabled = true; | ||||||
|     private static $_screenBuffer = ''; |     private static $_screenBuffer = ''; | ||||||
|  |     private static $_commandsOutput = ''; | ||||||
|      |      | ||||||
|     public function setArgs($args) |     public function setArgs($args) | ||||||
|     { |     { | ||||||
| @ -80,6 +81,7 @@ class Mage_Console | |||||||
|         if (!$return) { |         if (!$return) { | ||||||
|             $output = trim($log);             |             $output = trim($log);             | ||||||
|         } |         } | ||||||
|  |         self::$_commandsOutput .= PHP_EOL . trim($log) . PHP_EOL;  | ||||||
|          |          | ||||||
|         self::log($log); |         self::log($log); | ||||||
|         self::log('---------------------------------'); |         self::log('---------------------------------'); | ||||||
| @ -88,18 +90,23 @@ class Mage_Console | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     public function run() |     public function run() | ||||||
|     { |     {                | ||||||
|         // Disable Loging
 |         // Load Config
 | ||||||
|         if ($this->getAction() == 'install') { |  | ||||||
|             self::$_logEnabled = false; |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         Mage_Console::output('Starting <blue>Magallanes</blue>', 0, 2); |  | ||||||
|          |  | ||||||
|         $config = new Mage_Config; |         $config = new Mage_Config; | ||||||
|  |         $config->loadGeneral(); | ||||||
|         $config->loadEnvironment($this->getEnvironment()); |         $config->loadEnvironment($this->getEnvironment()); | ||||||
|         $config->loadSCM(); |         $config->loadSCM(); | ||||||
| 
 | 
 | ||||||
|  |         // Logging
 | ||||||
|  |         if ($this->getAction() == 'install') { | ||||||
|  |             self::$_logEnabled = false; | ||||||
|  |         } else { | ||||||
|  |             self::$_logEnabled = $config->general('logging', false); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         // Grettings
 | ||||||
|  |         Mage_Console::output('Starting <blue>Magallanes</blue>', 0, 2); | ||||||
|  | 
 | ||||||
|         switch ($this->getAction()) { |         switch ($this->getAction()) { | ||||||
|             case 'deploy': |             case 'deploy': | ||||||
|                 $task = new Mage_Task_Deploy; |                 $task = new Mage_Task_Deploy; | ||||||
| @ -148,7 +155,7 @@ class Mage_Console | |||||||
|          |          | ||||||
|         Mage_Console::output('Finished <blue>Magallanes</blue>', 0, 2); |         Mage_Console::output('Finished <blue>Magallanes</blue>', 0, 2); | ||||||
|     } |     } | ||||||
| 
 |      | ||||||
|     public static function log($message, $continuation = false) |     public static function log($message, $continuation = false) | ||||||
|     { |     { | ||||||
|         if (self::$_logEnabled) { |         if (self::$_logEnabled) { | ||||||
|  | |||||||
							
								
								
									
										11
									
								
								docs/example-config/.mage/config/general.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								docs/example-config/.mage/config/general.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | |||||||
|  | #general settings | ||||||
|  | logging: true | ||||||
|  | mail: | ||||||
|  |   enabled: true | ||||||
|  |   from: andresmontanez@gmail.com | ||||||
|  |   password: xxxxxx | ||||||
|  |   smtp: smtp.gmail.com | ||||||
|  |   to: | ||||||
|  |     - andresmontanez@gmail.com | ||||||
|  |     - andres.montanez@zenreworks.com | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user