Added support for standard YAML key/value pairs

This commit is contained in:
Steve Kamerman 2013-05-19 16:54:35 -04:00
parent 3b72e12491
commit e04e49bb32

View file

@ -32,9 +32,14 @@ class Env implements \PHPCI\Plugin
public function execute()
{
$success = true;
foreach ($this->env_vars as $value) {
// This allows the developer to specify env vars like " - FOO=bar" or " - FOO: bar"
$env_var = is_array($value)? key($value).'='.current($value): $value;
foreach ($this->env_vars as $key => $value) {
if (is_numeric($key)) {
// This allows the developer to specify env vars like " - FOO=bar" or " - FOO: bar"
$env_var = is_array($value)? key($value).'='.current($value): $value;
} else {
// This allows the standard syntax: "FOO: bar"
$env_var = "$key=$value";
}
if (!putenv($env_var)) {
$success = false;