/** * Clean the output build directory. * * @param string $outputDir */ protected function runCleanTask($outputDir) { $cleanTime = $this->runTimedTask(function () use($outputDir) { $this->builder->clean($outputDir); }); $this->output->writeln("<comment>Cleaned <path>{$outputDir}</path> in <time>{$cleanTime}ms</time></comment>", OutputInterface::VERBOSITY_VERBOSE); }
/** * Prepare the build directory as a git repository. * * Maybe there's already a git repo in the build folder, but is it pointing to * the correct origin and is it on the correct branch? Instead of checking for * things that might be wrong, we'll just start from scratch. * * @returns GitWorkingCopy * @throws RuntimeException */ protected function prepareRepository() { $config = $this->container['config']; $this->builder->clean($config['build.directory']); // clear out everything, including .git metadata $workingCopy = $this->git->workingCopy($config['build.directory']); $this->doGitInit($workingCopy, $config['deploy.git.url'], $config['deploy.git.branch']); // start again at last commit $this->builder->clean($config['build.directory'], true); // clear the old content but keep .git folder return $workingCopy; }