/** * Clear temp. storage directory if exists */ protected function clearTempDir() { // Remove storage dir if (!empty($this->tempDir) && is_dir($this->tempDir)) { $command = new CommandBuilder('rm', '-rf'); $command->addArgumentSeparator()->addArgument($this->tempDir); $command->executeInteractive(); } }
/** * Create docker instance from git repository * * @param string $path Path * @param string $repo Repository */ protected function initCode($path, $repo) { $this->setTerminalTitle('Cloning code'); $path .= '/code'; $this->output->writeln('<comment>Initialize new code instance in "' . $path . '"</comment>'); if (is_dir($path)) { if (file_exists($path . '/.gitkeep')) { // Remove gitkeep PhpUtility::unlink($path . '/.gitkeep'); } // Remove code directory $command = new CommandBuilder('rmdir'); $command->addArgumentSeparator()->addArgument($path)->executeInteractive(); } $command = new CommandBuilder('git', 'clone --branch=master --recursive %s %s', array($repo, $path)); $command->executeInteractive(); }