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
Console::writeError("please make sure sourceDir is set in <path>./config/config.yml</path> by adding 'sourceDir=some/path'. sorry, stopping pattern lab... :(");
225
-
} elseif (!is_dir(self::$options["sourceDir"])) {
226
-
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... :(");
227
-
}
228
-
if (!isset(self::$options["publicDir"])) {
229
-
Console::writeError("please make sure publicDir is set in <path>./config/config.yml</path> by adding 'publicDir=some/path'. sorry, stopping pattern lab... :(");
230
-
} elseif (!is_dir(self::$options["publicDir"])) {
231
-
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... :(");
232
-
}
233
-
if (isset(self::$options["styleguideKitPath"]) && !is_dir(self::$options["styleguideKitPath"])) {
234
-
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... :(");
235
-
}
236
-
222
+
// double-check a few directories are real and set-up
Copy file name to clipboardExpand all lines: src/PatternLab/Console/Commands/ServerCommand.php
+14-2
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,9 @@ public function __construct() {
26
26
Console::setCommand($this->command,"Start the PHP-based server","The server command will start PHP's web server for you.","s");
27
27
Console::setCommandOption($this->command,"host:","Provide a custom hostname. Default value is <path>localhost</path>.","To use a custom hostname and the default port:","","<host>");
28
28
Console::setCommandOption($this->command,"port:","Provide a custom port. Default value is <path>8080</path>.","To use a custom port and the default hostname:","","<port>");
29
+
Console::setCommandOption($this->command,"quiet","Turn on quiet mode for the server.","To turn on quiet mode:");
29
30
Console::setCommandSample($this->command,"To provide both a custom hostname and port:","--host <host> --port <port>");
Console::writeError("please make sure ".$configOption." is set in <path>".Console::getHumanReadablePath($configPath)."</path> by adding '".$configOption."=some/path'. sorry, stopping pattern lab... :(");
34
+
} elseif (!is_dir($path)) {
35
+
Console::writeWarning("i can't seem to find the directory <path>".Console::getHumanReadablePath($path)."</path>...");
36
+
self::makeDir($path);
37
+
Console::writeWarning("i created <path>".Console::getHumanReadablePath($path)."</path> just in case. you can edit this in <path>".Console::getHumanReadablePath($configPath)."</path> by editing ".$configOption."...");
38
+
}
39
+
40
+
}
41
+
42
+
/**
43
+
* Make a directory
44
+
* @param {String} directory to be made
45
+
*/
46
+
publicstaticfunctionmakeDir($dir) {
47
+
$fs = newFilesystem();
48
+
try {
49
+
$fs->mkdir($dir);
50
+
} catch (IOExceptionInterface$e) {
51
+
Console::writeError("an error occurred while creating your directory at <path>".$e->getPath()."</path>...");
52
+
}
53
+
unset($fs);
54
+
}
55
+
24
56
/**
25
57
* Copies a file from the given source path to the given public path.
0 commit comments