New config settings.

This commit is contained in:
Andrs Montaez 2012-01-03 23:54:57 -02:00
parent 9cf720c602
commit 9b27dd8ebe
3 changed files with 60 additions and 9 deletions

View file

@ -3,6 +3,7 @@ class Mage_Config
{
private $_environment = null;
private $_scm = null;
private $_general = null;
private $_host = 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()
{
return $this->_environment;
@ -30,6 +38,11 @@ class Mage_Config
return $this->_scm;
}
public function getGlobal()
{
return $this->_global;
}
public function getHosts()
{
$config = $this->getEnvironment();
@ -141,4 +154,24 @@ class Mage_Config
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;
}
}
}

View file

@ -8,6 +8,7 @@ class Mage_Console
private static $_log = null;
private static $_logEnabled = true;
private static $_screenBuffer = '';
private static $_commandsOutput = '';
public function setArgs($args)
{
@ -80,6 +81,7 @@ class Mage_Console
if (!$return) {
$output = trim($log);
}
self::$_commandsOutput .= PHP_EOL . trim($log) . PHP_EOL;
self::log($log);
self::log('---------------------------------');
@ -88,18 +90,23 @@ class Mage_Console
}
public function run()
{
// Disable Loging
if ($this->getAction() == 'install') {
self::$_logEnabled = false;
}
Mage_Console::output('Starting <blue>Magallanes</blue>', 0, 2);
{
// Load Config
$config = new Mage_Config;
$config->loadGeneral();
$config->loadEnvironment($this->getEnvironment());
$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()) {
case 'deploy':
$task = new Mage_Task_Deploy;
@ -148,7 +155,7 @@ class Mage_Console
Mage_Console::output('Finished <blue>Magallanes</blue>', 0, 2);
}
public static function log($message, $continuation = false)
{
if (self::$_logEnabled) {

View 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