Skip to content

Commit b88659e

Browse files
committed
+ cloud foundry simulator
1 parent 4b7a96c commit b88659e

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
],
1313
"require": {
1414
"arhframe/iocart": "1.0.1",
15-
"filp/whoops": "1.1.1"
15+
"filp/whoops": "1.1.1",
16+
"symfony/yaml": "2.5.3"
1617
},
1718
"autoload": {
1819
"psr-0": {
1920
"orange\\cfhelper\\services": "src/",
2021
"orange\\cfhelper\\application": "src/",
2122
"orange\\cfhelper\\configuration": "src/",
23+
"orange\\cfhelper\\simulator": "src/",
2224
"orange\\cfhelper": "src"
2325
}
2426
}

src/orange/cfhelper/CfHelper.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace orange\cfhelper;
1313

14+
use orange\cfhelper\simulator\CloudFoundrySimulator;
1415
use Symfony\Component\Yaml\Yaml;
1516

1617
class CfHelper
@@ -55,4 +56,9 @@ public function getApplicationInfo()
5556
{
5657
return $this->beanLoader->getBean('cfhelper.applicationInfo');
5758
}
59+
60+
public function simulateCloudFoundry($manifestYml = "manifest.yml")
61+
{
62+
CloudFoundrySimulator::simulate($manifestYml);
63+
}
5864
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright (C) 2014 Orange
4+
*
5+
* This software is distributed under the terms and conditions of the 'MIT'
6+
* license which can be found in the file 'LICENSE' in this package distribution
7+
* or at 'http://opensource.org/licenses/MIT'.
8+
*
9+
* Author: Arthur Halet
10+
* Date: 19/08/2014
11+
*/
12+
namespace orange\cfhelper\simulator;
13+
class CloudFoundrySimulator
14+
{
15+
16+
public static function simulate($manifestYml)
17+
{
18+
CloudFoundrySimulator::loadEnv($manifestYml);
19+
}
20+
21+
public static function loadEnv($manifestYml)
22+
{
23+
$manifestUnparse = \Symfony\Component\Yaml\Yaml::parse($manifestYml);
24+
$applications = $manifestUnparse['applications'];
25+
foreach ($applications as $application) {
26+
CloudFoundrySimulator::loadVarEnv($application['env']);
27+
}
28+
}
29+
30+
public static function loadVarEnv(array $envVars)
31+
{
32+
foreach ($envVars as $key => $value) {
33+
$_ENV[$key] = $value;
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)