public function run()
 {
     if (Console::findCommandOption("list")) {
         // get all of the options
         $options = Config::getOptions();
         // sort 'em alphabetically
         ksort($options);
         // find length of longest option
         $lengthLong = 0;
         foreach ($options as $optionName => $optionValue) {
             $lengthLong = strlen($optionName) > $lengthLong ? strlen($optionName) : $lengthLong;
         }
         // iterate over each option and spit it out
         foreach ($options as $optionName => $optionValue) {
             $optionValue = is_array($optionValue) ? implode(", ", $optionValue) : $optionValue;
             $optionValue = !$optionValue ? "false" : $optionValue;
             $spacer = Console::getSpacer($lengthLong, strlen($optionName));
             Console::writeLine("<info>" . $optionName . ":</info>" . $spacer . $optionValue);
         }
     } else {
         if (Console::findCommandOption("get")) {
             // figure out which optino was passed
             $searchOption = Console::findCommandOptionValue("get");
             $optionValue = Config::getOption($searchOption);
             // write it out
             if (!$optionValue) {
                 Console::writeError("the --get value you provided, <info>" . $searchOption . "</info>, does not exists in the config...");
             } else {
                 $optionValue = is_array($optionValue) ? implode(", ", $optionValue) : $optionValue;
                 $optionValue = !$optionValue ? "false" : $optionValue;
                 Console::writeInfo($searchOption . ": <ok>" . $optionValue . "</ok>");
             }
         } else {
             if (Console::findCommandOption("set")) {
                 // find the value that was passed
                 $updateOption = Console::findCommandOptionValue("set");
                 $updateOptionBits = explode("=", $updateOption);
                 if (count($updateOptionBits) == 1) {
                     Console::writeError("the --set value should look like <info>optionName=\"optionValue\"</info>. nothing was updated...");
                 }
                 // set the name and value that were passed
                 $updateName = $updateOptionBits[0];
                 $updateValue = $updateOptionBits[1][0] == "\"" || $updateOptionBits[1][0] == "'" ? substr($updateOptionBits[1], 1, strlen($updateOptionBits[1]) - 1) : $updateOptionBits[1];
                 // make sure the option being updated already exists
                 $currentValue = Config::getOption($updateName);
                 if (!$currentValue) {
                     Console::writeError("the --set option you provided, <info>" . $updateName . "</info>, does not exists in the config. nothing will be updated...");
                 } else {
                     Config::updateConfigOption($updateName, $updateValue);
                 }
             } else {
                 // no acceptable options were passed so write out the help
                 Console::writeHelpCommand($this->command);
             }
         }
     }
 }
 /**
  * Set the given option to the given value
  */
 protected function setOption()
 {
     // find the value that was passed
     $updateOption = Console::findCommandOptionValue("set");
     $updateOptionBits = explode("=", $updateOption);
     if (count($updateOptionBits) == 1) {
         Console::writeError("the --set value should look like <info>optionName=\"optionValue\"</info>. nothing was updated...");
     }
     // set the name and value that were passed
     $updateName = $updateOptionBits[0];
     $updateValue = $updateOptionBits[1][0] == "\"" || $updateOptionBits[1][0] == "'" ? substr($updateOptionBits[1], 1, strlen($updateOptionBits[1]) - 1) : $updateOptionBits[1];
     // make sure the option being updated already exists
     $currentValue = Config::getOption($updateName);
     if (!$currentValue) {
         Console::writeError("the --set option you provided, <info>" . $updateName . "</info>, does not exists in the config. nothing will be updated...");
     } else {
         Config::updateConfigOption($updateName, $updateValue);
         Console::writeInfo("config option updated...");
     }
 }
 /**
  * Handle some Pattern Lab specific tasks based on what's found in the package's composer.json file
  * @param  {Object}     a script event object from composer
  * @param  {String}     the type of event starting the runTasks command
  */
 protected static function runTasks($event, $type)
 {
     // get package info
     $package = $type == "install" ? $event->getOperation()->getPackage() : $event->getOperation()->getTargetPackage();
     $extra = $package->getExtra();
     $type = $package->getType();
     $name = $package->getName();
     $pathBase = Config::getOption("packagesDir") . "/" . $name;
     $pathDist = $pathBase . "/dist/";
     // make sure we're only evaluating pattern lab packages
     if (strpos($type, "patternlab-") !== false) {
         // make sure that it has the name-spaced section of data to be parsed. if it exists parse it
         if (isset($extra["patternlab"])) {
             self::parseComposerExtraList($extra["patternlab"], $name, $pathDist);
         }
         // see if the package has a listener
         self::scanForListener($pathBase);
         // address other specific needs based on type
         if ($type == "patternlab-patternengine") {
             self::scanForPatternEngineRule($pathBase);
         } else {
             if ($type == "patternlab-starterkit") {
                 Config::updateConfigOption("starterKit", $name);
             } else {
                 if ($type == "patternlab-styleguidekit" && strpos($name, "-assets-") === false) {
                     Config::updateConfigOption("styleguideKit", $name);
                 }
             }
         }
     }
 }
 /**
  * Handle some Pattern Lab specific tasks based on what's found in the package's composer.json file on install
  * @param  {Array}      the info culled from installing various pattern lab-related packages
  */
 protected static function packagesInstall($installerInfo, $event)
 {
     // mark if this is an interactive call or not
     self::$isInteractive = $event->getIO()->isInteractive();
     // initialize a bunch of stuff like config and console
     self::init();
     // reorder packages so the starterkit is first if it's being installed as a package
     if (isset($installerInfo["packages"])) {
         $packages = $installerInfo["packages"];
         $packages = array_merge(array_filter($packages, "self::includeStarterKit"), array_filter($packages, "self::excludeStarterKit"));
         foreach ($packages as $package) {
             // set-up package info
             $extra = $package["extra"];
             $type = $package["type"];
             $name = $package["name"];
             $pathBase = $package["pathBase"];
             $pathDist = $package["pathDist"];
             // make sure that it has the name-spaced section of data to be parsed. if it exists parse it
             if (!empty($extra)) {
                 self::parseComposerExtraList($extra, $name, $pathDist);
             }
             // see if the package has a listener
             self::scanForListener($pathBase);
             // address other specific needs based on type
             if ($type == "patternlab-patternengine") {
                 self::scanForPatternEngineRule($pathBase);
             } else {
                 if ($type == "patternlab-styleguidekit" && strpos($name, "-assets-") === false) {
                     $dir = str_replace(Config::getOption("baseDir"), "", $pathBase);
                     $dir = $dir[strlen($dir) - 1] == DIRECTORY_SEPARATOR ? rtrim($dir, DIRECTORY_SEPARATOR) : $dir;
                     Config::updateConfigOption("styleguideKit", $name);
                     Config::updateConfigOption("styleguideKitPath", $dir);
                 }
             }
         }
     }
     // make sure user is prompted to install starterkit
     if (!empty($installerInfo["suggestedStarterKits"])) {
         self::promptStarterKitInstall($installerInfo["suggestedStarterKits"]);
     }
     // override any configs that have been set-up
     if (!empty($installerInfo["configOverrides"])) {
         foreach ($installerInfo["configOverrides"] as $option => $value) {
             Config::updateConfigOption($option, $value, true);
             // forces the update
         }
     }
     if ($installerInfo["projectInstall"]) {
         Console::writeLine("");
         Console::writeLine("<h1><fire3>Thank you for installing...</fire3></h1>", false, true);
         Console::writeLine("<fire1>(                               (             </fire1>");
         Console::writeLine("<fire2>)\\ )        )   )               )\\ )         )</fire2>");
         Console::writeLine("<fire3>(()/(   ) ( /(( /(  (  (        (()/(    ) ( /(</fire3>");
         Console::writeLine("<fire4>/(_)| /( )\\())\\())))\\ )(   (    /(_))( /( )\\())</fire4>");
         Console::writeLine("<fire5>(</fire5><cool>_</cool><fire5>)) )(_)|</fire5><cool>_</cool><fire5>))(</fire5><cool>_</cool><fire5>))//((_|()\\  )\\ )(</fire5><cool>_</cool><fire5>))  )(_)|(_)\\</fire5>");
         Console::writeLine("<cool>| _ </cool><fire6>((</fire6><cool>_</cool><fire6>)</fire6><cool>_| |_| |_</cool><fire6>(</fire6><cool>_</cool><fire6>))  ((</fire6><cool>_</cool><fire6>)</fire6><cool>_</cool><fire6>(</fire6><cool>_</cool><fire6>/(</fire6><cool>| |  </cool><fire6>((</fire6><cool>_</cool><fire6>)</fire6><cool>_| |</cool><fire6>(</fire6><cool>_</cool><fire6>)</fire6>");
         Console::writeLine("<cool>|  _/ _` |  _|  _/ -_)| '_| ' \\</cool><fire6>))</fire6><cool> |__/ _` | '_ \\  </cool>");
         Console::writeLine("<cool>|_| \\__,_|\\__|\\__\\___||_| |_||_||____\\__,_|_.__/  </cool>", false, true);
     }
 }