protected function Bootstrap() : self { // check that we have a place to dump our output. $OutputDir = $this->GetConfig()->GetOutputDir(); if (!$OutputDir) { throw new Exception("No OutputDir [{$OutputDir}] specified."); } if (!is_dir($OutputDir) && !@mkdir($OutputDir, 0777, TRUE)) { throw new Exception("Unable to create OutputDir [{$OutputDir}]"); } // check if we have compiled data, and can use it, or if we should // automatically kick off the build process as well. $OutputFile = $this->GetConfig()->GetOutputFile(); if (!$OutputFile) { throw new Exception('No OuputFile defined by project.'); } if (file_exists($OutputFile) && !is_readable($OutputFile)) { throw new Exception('Unable to read OutputFile'); } if (!file_exists($OutputFile)) { $Builder = Builder::GetFromFile($this->GetConfig()->GetFilename()); $Builder->Run(); } return $this; }
public function HandleBuild() : int { /*// this will handle the request to process the current project, generating the documentation and writing it out. //*/ $Filename = $this->GetFilename(); $File = basename($Filename); $Path = dirname($Filename); try { $Builder = Nether\Senpai\Builder::GetFromFile($Filename); } catch (Exception $Error) { $this::Message('Something Happened:'); $this::Message($Error->GetMessage()); return 1; } $this::Message("Building Project {$Filename}"); $Builder->Run(); return 0; }