You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/PatternLab/Config.php
+36-80Lines changed: 36 additions & 80 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@
15
15
use \PatternLab\Console;
16
16
use \PatternLab\FileUtil;
17
17
use \PatternLab\Timer;
18
+
use \Shudrum\Component\ArrayFinder\ArrayFinder;
18
19
use \Symfony\Component\Yaml\Yaml;
19
20
use \Symfony\Component\Yaml\Exception\ParseException;
20
21
@@ -53,14 +54,11 @@ protected static function cleanDir($dir) {
53
54
*
54
55
* @return {String/Boolean} the value of the get or false if it wasn't found
55
56
*/
56
-
publicstaticfunctiongetOption($optionName = "") {
57
+
publicstaticfunctiongetOption($key = "") {
57
58
58
-
if (empty($optionName)) {
59
-
returnfalse;
60
-
}
61
-
62
-
if (array_key_exists($optionName,self::$options)) {
63
-
returnself::$options[$optionName];
59
+
if (!empty($key)) {
60
+
$arrayFinder = newArrayFinder(self::$options);
61
+
return$arrayFinder->get($key);
64
62
}
65
63
66
64
returnfalse;
@@ -138,46 +136,44 @@ public static function init($baseDir = "", $verbose = true) {
138
136
mkdir(self::$userConfigDir);
139
137
}
140
138
139
+
// check to see if the user config exists, if not create it
140
+
if ($verbose) {
141
+
Console::writeLine("configuring pattern lab...");
142
+
}
143
+
141
144
// make sure migrate doesn't happen by default
142
-
$migrate = false;
143
-
$diffVersion = false;
145
+
$migrate = false;
146
+
$diffVersion = false;
147
+
$defaultOptions = array();
148
+
$userOptions = array();
144
149
145
150
// double-check the default config file exists
146
151
if (!file_exists(self::$plConfigPath)) {
147
-
Console::writeError("make sure <path>".self::$plConfigPath."</path> exists before trying to have Pattern Lab build the config.yml file automagically...");
152
+
Console::writeError("the default options for Pattern Lab don't seem to exist at <path>".Console::getHumanReadablePath(self::$plConfigPath)."</path>. please check on the install location of pattern lab...");
148
153
}
149
154
150
155
// set the default config using the pattern lab config
0 commit comments