1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Tidy up the Robo file further

This commit is contained in:
J. King 2021-05-21 06:43:17 -04:00
parent 38cb1059b2
commit d031d931a5

View file

@ -163,10 +163,11 @@ class RoboFile extends \Robo\Tasks {
// create a temporary directory // create a temporary directory
$dir = $t->tmpDir().\DIRECTORY_SEPARATOR; $dir = $t->tmpDir().\DIRECTORY_SEPARATOR;
// create a Git worktree for the selected commit in the temp location // create a Git worktree for the selected commit in the temp location
$result = $this->taskExec("git worktree add ".escapeshellarg($dir)." ".escapeshellarg($commit))->run(); $result = $this->taskExec("git worktree add ".escapeshellarg($dir)." ".escapeshellarg($commit))->dir(BASE)->run();
if ($result->getExitCode() > 0) { if ($result->getExitCode() > 0) {
return $result; return $result;
} }
try {
// get useable version strings from Git // get useable version strings from Git
$version = trim(`git -C "$dir" describe --tags`); $version = trim(`git -C "$dir" describe --tags`);
$archVersion = preg_replace('/^([^-]+)-(\d+)-(\w+)$/', "$1.r$2.$3", $version); $archVersion = preg_replace('/^([^-]+)-(\d+)-(\w+)$/', "$1.r$2.$3", $version);
@ -220,9 +221,11 @@ class RoboFile extends \Robo\Tasks {
$t->addTask($this->taskPack($tarball)->addDir("arsse", $dir)); $t->addTask($this->taskPack($tarball)->addDir("arsse", $dir));
// execute the collection // execute the collection
$result = $t->run(); $result = $t->run();
} finally {
// remove the Git worktree // remove the Git worktree
$this->taskFilesystemStack()->remove($dir)->run(); $this->taskFilesystemStack()->remove($dir)->run();
$this->taskExec("git worktree prune")->run(); $this->taskExec("git worktree prune")->dir(BASE)->run();
}
return $result; return $result;
} }