public function generate()
    {
        if (!is_dir($this->getInputDirectory())) {
            throw new \RuntimeException('The MakeDocs input directory does not exist.');
        }

        if (!$this->builders) {
            throw new \RuntimeException('No MakeDocs builders present.');
        }

        // First we change the working directory to the input, this makes rendering easier since
        // all paths are relative to source directory:
        $workingDirectory = getcwd();
        chdir($this->getInputDirectory());

        foreach ($this->builders as $builder) {
            $builder->build($this);
        }

        // Restore the working directory to its original form:
        chdir($workingDirectory);
    }