/**
  * Pulls together a bunch of functions from builder.lib.php in an order that makes sense
  * @param  {Boolean}       decide if CSS should be parsed and saved. performance hog.
  * @param  {Boolean}       decide if static files like CSS and JS should be moved
  */
 public function generate($options = array())
 {
     // double-checks options was properly set
     if (empty($options)) {
         Console::writeError("need to pass options to generate...");
     }
     // set the default vars
     $moveStatic = isset($options["moveStatic"]) ? $options["moveStatic"] : true;
     $noCacheBuster = isset($options["noCacheBuster"]) ? $options["noCacheBuster"] : false;
     $exportFiles = isset($options["exportFiles"]) ? $options["exportFiles"] : false;
     $exportClean = isset($options["exportClean"]) ? $options["exportClean"] : false;
     $watchMessage = isset($options["watchMessage"]) ? $options["watchMessage"] : false;
     $watchVerbose = isset($options["watchVerbose"]) ? $options["watchVerbose"] : false;
     $update = isset($options["update"]) ? $options["update"] : false;
     Config::setOption("update", $update);
     if ($noCacheBuster) {
         Config::updateOption("cacheBuster", 0);
     }
     FileChangeList::init(Config::getOption("publicDir") . DIRECTORY_SEPARATOR . "fileChangeList.csv");
     // gather up all of the data to be used in patterns
     Data::gather();
     // gather all of the various pattern info
     $options = array();
     $options["exportClean"] = $exportClean;
     $options["exportFiles"] = $exportFiles;
     PatternData::gather($options);
     // gather the annotations
     Annotations::gather();
     // clean the public directory to remove old files
     if (Config::getOption("cleanPublic") == "true" && $moveStatic) {
         FileUtil::cleanPublic();
     }
     // render out the index and style guide
     $this->generateIndex();
     $this->generateStyleguide();
     $this->generateViewAllPages();
     // render out the patterns and move them to public/patterns
     $options = array();
     $options["exportFiles"] = $exportFiles;
     $this->generatePatterns($options);
     // render the annotations as a js file
     $this->generateAnnotations();
     // move all of the files unless pattern only is set
     if ($moveStatic) {
         $this->moveStatic();
     }
     // update the change time so the auto-reload will fire (doesn't work for the index and style guide)
     Util::updateChangeTime();
     FileChangeList::write();
     if ($watchVerbose && $watchMessage) {
         Console::writeLine($watchMessage);
     } else {
         Console::writeLine("your site has been generated...");
         Timer::stop();
     }
 }
 /**
  * Common init sequence
  */
 protected static function init()
 {
     // start the timer
     Timer::start();
     // initialize the console to print out any issues
     Console::init();
     // initialize the config for the pluginDir
     $baseDir = __DIR__ . "/../../../../../";
     Config::init($baseDir, false);
     Dispatcher::init();
 }
 /**
  * Common init sequence
  */
 protected static function init()
 {
     // start the timer
     Timer::start();
     // initialize the console to print out any issues
     Console::init();
     // initialize the config for the pluginDir
     $baseDir = __DIR__ . "/../../../../../";
     Config::init($baseDir, false);
     // make sure the source dir is set-up
     $sourceDir = Config::getOption("sourceDir");
     if (!is_dir($sourceDir)) {
         FileUtil::makeDir($sourceDir);
     }
     // make sure the public dir is set-up
     $publicDir = Config::getOption("publicDir");
     if (!is_dir($publicDir)) {
         FileUtil::makeDir($publicDir);
     }
     Dispatcher::init();
 }