Added a new configuration variable, PHPCI_BUILD_ROOT_DI.

This variable allows to change where the build happens.
It defaults to PHPCI_DIR.'PHPCI/build/'.

Moved build path calculate and build removal into the Build class.

Also remove the build directory when deleting the build.

Close #834
This commit is contained in:
Adirelle 2015-02-27 10:51:18 +01:00 committed by Tobias van Beek
commit ccdc73326d
5 changed files with 37 additions and 26 deletions

View file

@ -217,4 +217,28 @@ class Build extends BuildBase
{
return array($builder, $file, $line, $message);
}
/**
* Return the path to run this build into.
*
* @return string
*/
public function getBuildPath()
{
return PHPCI_BUILD_ROOT_DIR . $this->getId();
}
/**
* Removes the build directory.
*/
public function removeBuildDirectory()
{
$buildPath = $this->getBuildPath();
if (!is_dir($buildPath)) {
return;
}
exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $buildPath));
}
}