Skip to content

Commit 81a1bc2

Browse files
committed
double-checking some important directories exist before running PL
1 parent 4eba993 commit 81a1bc2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/PatternLab/Config.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ protected static function getStyleguideKitPath($styleguideKitPath) {
9393
$styleguideKitPathFinal = "vendor".DIRECTORY_SEPARATOR.$parts[1];
9494
Console::writeInfo("Please double-check the styleguideKitPath option in <path>./config/config.yml</path>. It should be a path relative to the root of your Pattern Lab project...");
9595
}
96+
} else {
97+
$styleguideKitPathFinal = $styleguideKitPath; // fingers crossed everything is fine
9698
}
9799

98100
return $styleguideKitPathFinal;
@@ -212,6 +214,18 @@ public static function init($baseDir = "", $verbose = true) {
212214
// handle a pre-2.1.0 styleguideKitPath before saving it
213215
self::$options["styleguideKitPath"] = self::$options["baseDir"].self::cleanDir(self::getStyleguideKitPath(self::$options["styleguideKitPath"]));
214216

217+
// double-check a few directories are real
218+
if (!is_dir(self::$options["sourceDir"])) {
219+
Console::writeError("hrm... i can't seem to find the directory with your source files. are you sure they're at <path>".Console::getHumanReadablePath(self::$options["sourceDir"])."</path>? you can fix this in <path>./config/config.yml</path> by editing sourceDir. sorry, stopping pattern lab... :(");
220+
}
221+
if (!is_dir(self::$options["publicDir"])) {
222+
Console::writeError("hrm... i can't seem to find the directory where you want to write your styleguide. are you sure it's at <path>".Console::getHumanReadablePath(self::$options["sourceDir"])."</path>? you can fix this in <path>./config/config.yml</path> by editing publicDir. sorry, stopping pattern lab... :(");
223+
}
224+
if (!is_dir(self::$options["styleguideKitPath"])) {
225+
Console::writeError("hrm... i can't seem to find the directory where your styleguide files are located. are you sure it's at <path>".Console::getHumanReadablePath(self::$options["styleguideKitPath"])."</path>? you can fix this in <path>./config/config.yml</path> by editing styleguideKitPath. sorry, stopping pattern lab... :(");
226+
}
227+
228+
215229
// make sure styleguideExcludes is set to an array even if it's empty
216230
if (is_string(self::$options["styleGuideExcludes"])) {
217231
self::$options["styleGuideExcludes"] = array();

0 commit comments

Comments
 (0)