public function build($directory, $targetDirectory = 'output', $verbose = true)
{
$this->verbose = $verbose;
$this->directory = $directory;
$this->targetDirectory = $targetDirectory;
// Creating output directory if doesn't exists
if (!is_dir($targetDirectory)) {
mkdir($targetDirectory, 0755, true);
}
// Try to load metas, if it does not exists, create it
$this->display('* Loading metas');
$this->metas = new Metas($this->loadMetas());
// Scan all the metas and the index
$this->display('* Pre-scanning files');
$this->scan($this->getIndexName());
$this->scanMetas();
// Parses all the documents
$this->parseAll();
// Renders all the documents
$this->render();
// Saving the meta
$this->display('* Writing metas');
$this->saveMetas();
// Copy the files
$this->display('* Running the copies');
$this->doMkdir();
$this->doCopy();
}