From 776b21ce080cd26b577fb0ce5edbbb52ab08d4fb Mon Sep 17 00:00:00 2001 From: Andrs Montaez Date: Sat, 4 Feb 2012 16:37:34 -0200 Subject: [PATCH] Feature for declaring the Hosts for reading from a URI (file, url). --- Mage/Config.php | 9 ++++++++- .../example-config/.mage/config/environment/staging.yaml | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Mage/Config.php b/Mage/Config.php index 9411470..854527b 100644 --- a/Mage/Config.php +++ b/Mage/Config.php @@ -49,7 +49,14 @@ class Mage_Config $hosts = array(); if (isset($config['hosts'])) { - $hosts = (array) $config['hosts']; + if (is_array($config['hosts'])) { + $hosts = (array) $config['hosts']; + } else if (is_string($config['hosts'])) { + $fileContent = fopen($config['hosts'], 'r'); + while (($host = fgets($fileContent)) == true) { + $hosts[] = trim($host); + } + } } return $hosts; diff --git a/docs/example-config/.mage/config/environment/staging.yaml b/docs/example-config/.mage/config/environment/staging.yaml index 139669a..901107b 100644 --- a/docs/example-config/.mage/config/environment/staging.yaml +++ b/docs/example-config/.mage/config/environment/staging.yaml @@ -3,8 +3,7 @@ deployment: user: stg_user from: ./ to: /var/www/vhosts/example.com/staging -hosts: - - staging.example.com +hosts: /tmp/current-staging-hosts.txt tasks: pre-deploy: - scm/update