Burgomaster::__construct PHP Method

__construct() public method

public __construct ( string $stageDir, string $projectRoot = null )
$stageDir string Staging base directory where your packaging takes place. This folder will be created for you if it does not exist. If it exists, it will be deleted and recreated to start fresh.
$projectRoot string Root directory of the project.
    public function __construct($stageDir, $projectRoot = null)
    {
        $this->startSection('setting_up');
        $this->stageDir = $stageDir;
        $this->projectRoot = $projectRoot;
        if (!$this->stageDir || $this->stageDir == '/') {
            throw new \InvalidArgumentException('Invalid base directory');
        }
        if (is_dir($this->stageDir)) {
            $this->debug("Removing existing directory: {$this->stageDir}");
            echo $this->exec("rm -rf {$this->stageDir}");
        }
        $this->debug("Creating staging directory: {$this->stageDir}");
        if (!mkdir($this->stageDir, 0777, true)) {
            throw new \RuntimeException("Could not create {$this->stageDir}");
        }
        $this->stageDir = realpath($this->stageDir);
        $this->debug("Creating staging directory at: {$this->stageDir}");
        if (!is_dir($this->projectRoot)) {
            throw new \InvalidArgumentException("Project root not found: {$this->projectRoot}");
        }
        $this->endSection();
        $this->startSection('staging');
        chdir($this->projectRoot);
    }