Skip to content

Commit a88bb5b

Browse files
committed
adding an option for a user to say where the starterkit to watch is
1 parent 9c05805 commit a88bb5b

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/PatternLab/Watcher.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use \PatternLab\Data;
2424
use \PatternLab\Dispatcher;
2525
use \PatternLab\FileUtil;
26+
use \PatternLab\InstallerUtil;
2627
use \PatternLab\PatternData;
2728
use \PatternLab\Util;
2829
use \PatternLab\Timer;
@@ -324,22 +325,28 @@ private function updateSite($fileName,$message,$verbose = true) {
324325

325326
}
326327

327-
public function watchStarterKit() {
328-
329-
// double-checks options was properly set
330-
/*$starterKit = Config::getOption("starterKit");
331-
if (!$starterKit) {
332-
Console::writeError("need to have a starterkit set in the config...");
333-
}*/
328+
protected function starterKitPathPrompt() {
329+
330+
// need to figure this out long-term
331+
InstallerUtil::$isInteractive = true;
332+
$input = Console::promptInput("Tell me the path to the starterkit you want to watch.","e.g. vendor/pattern-lab/starterkit-mustache-demo/dist","baz",false);
334333

335334
// set-up the full starterkit path
336-
$starterKitPath = Config::getOption("baseDir")."vendor/pattern-lab/starterkit-mustache-demo/dist";
335+
$starterKitPath = Config::getOption("baseDir").$input;
337336
if (!is_dir($starterKitPath)) {
338-
Console::writeError("the starterkit doesn't seem to exist...");
337+
Console::writeWarning("that doesn't seem to be a real directory. let's try again...");
338+
$starterKitPath = $this->starterKitPathPrompt();
339339
}
340340

341+
return $starterKitPath;
342+
343+
}
344+
345+
public function watchStarterKit() {
346+
341347
// default vars
342-
$sourceDir = Config::getOption("sourceDir");
348+
$starterKitPath = $this->starterKitPathPrompt();
349+
$sourceDir = Config::getOption("sourceDir");
343350

344351
$fs = new Filesystem();
345352

0 commit comments

Comments
 (0)