mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Tidy up the Robo file further
This commit is contained in:
parent
38cb1059b2
commit
d031d931a5
1 changed files with 60 additions and 57 deletions
117
RoboFile.php
117
RoboFile.php
|
@ -163,66 +163,69 @@ 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;
|
||||||
}
|
}
|
||||||
// get useable version strings from Git
|
try {
|
||||||
$version = trim(`git -C "$dir" describe --tags`);
|
// get useable version strings from Git
|
||||||
$archVersion = preg_replace('/^([^-]+)-(\d+)-(\w+)$/', "$1.r$2.$3", $version);
|
$version = trim(`git -C "$dir" describe --tags`);
|
||||||
// name the generic release tarball
|
$archVersion = preg_replace('/^([^-]+)-(\d+)-(\w+)$/', "$1.r$2.$3", $version);
|
||||||
$tarball = "arsse-$version.tar.gz";
|
// name the generic release tarball
|
||||||
// generate the Debian changelog; this also validates our original changelog
|
$tarball = "arsse-$version.tar.gz";
|
||||||
$debianChangelog = $this->changelogDebian($this->changelogParse(file_get_contents($dir."CHANGELOG"), $version), $version);
|
// generate the Debian changelog; this also validates our original changelog
|
||||||
// save commit description to VERSION file for use by packaging
|
$debianChangelog = $this->changelogDebian($this->changelogParse(file_get_contents($dir."CHANGELOG"), $version), $version);
|
||||||
$t->addTask($this->taskWriteToFile($dir."VERSION")->text($version));
|
// save commit description to VERSION file for use by packaging
|
||||||
// save the Debian changelog
|
$t->addTask($this->taskWriteToFile($dir."VERSION")->text($version));
|
||||||
$t->addTask($this->taskWriteToFile($dir."dist/debian/changelog")->text($debianChangelog));
|
// save the Debian changelog
|
||||||
// patch the Arch PKGBUILD file with the correct version string
|
$t->addTask($this->taskWriteToFile($dir."dist/debian/changelog")->text($debianChangelog));
|
||||||
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^pkgver=.*$/m')->to("pkgver=$archVersion"));
|
// patch the Arch PKGBUILD file with the correct version string
|
||||||
// patch the Arch PKGBUILD file with the correct source file
|
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^pkgver=.*$/m')->to("pkgver=$archVersion"));
|
||||||
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^source=\("arsse-[^"]+"\)$/m')->to('source=("'.basename($tarball).'")'));
|
// patch the Arch PKGBUILD file with the correct source file
|
||||||
// perform Composer installation in the temp location with dev dependencies
|
$t->addTask($this->taskReplaceInFile($dir."dist/arch/PKGBUILD")->regex('/^source=\("arsse-[^"]+"\)$/m')->to('source=("'.basename($tarball).'")'));
|
||||||
$t->addTask($this->taskComposerInstall()->arg("-q")->dir($dir));
|
// perform Composer installation in the temp location with dev dependencies
|
||||||
// generate the manual
|
$t->addTask($this->taskComposerInstall()->arg("-q")->dir($dir));
|
||||||
$t->addCode(function() {
|
// generate the manual
|
||||||
return $this->manual(["-q"]);
|
$t->addCode(function() {
|
||||||
});
|
return $this->manual(["-q"]);
|
||||||
// perform Composer installation in the temp location for final output
|
});
|
||||||
$t->addTask($this->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts")->arg("-q"));
|
// perform Composer installation in the temp location for final output
|
||||||
// delete unwanted files
|
$t->addTask($this->taskComposerInstall()->dir($dir)->noDev()->optimizeAutoloader()->arg("--no-scripts")->arg("-q"));
|
||||||
$t->addTask($this->taskFilesystemStack()->remove([
|
// delete unwanted files
|
||||||
$dir.".git",
|
$t->addTask($this->taskFilesystemStack()->remove([
|
||||||
$dir.".gitignore",
|
$dir.".git",
|
||||||
$dir.".gitattributes",
|
$dir.".gitignore",
|
||||||
$dir."composer.json",
|
$dir.".gitattributes",
|
||||||
$dir."composer.lock",
|
$dir."composer.json",
|
||||||
$dir.".php_cs.dist",
|
$dir."composer.lock",
|
||||||
$dir."phpdoc.dist.xml",
|
$dir.".php_cs.dist",
|
||||||
$dir."build.xml",
|
$dir."phpdoc.dist.xml",
|
||||||
$dir."RoboFile.php",
|
$dir."build.xml",
|
||||||
$dir."CONTRIBUTING.md",
|
$dir."RoboFile.php",
|
||||||
$dir."docs",
|
$dir."CONTRIBUTING.md",
|
||||||
$dir."tests",
|
$dir."docs",
|
||||||
$dir."vendor-bin",
|
$dir."tests",
|
||||||
$dir."vendor/bin",
|
$dir."vendor-bin",
|
||||||
$dir."robo",
|
$dir."vendor/bin",
|
||||||
$dir."robo.bat",
|
$dir."robo",
|
||||||
$dir."package.json",
|
$dir."robo.bat",
|
||||||
$dir."yarn.lock",
|
$dir."package.json",
|
||||||
$dir."postcss.config.js",
|
$dir."yarn.lock",
|
||||||
]));
|
$dir."postcss.config.js",
|
||||||
// generate a sample configuration file
|
]));
|
||||||
$t->addTask($this->taskExec(escapeshellarg(\PHP_BINARY)." arsse.php conf save-defaults config.defaults.php")->dir($dir));
|
// generate a sample configuration file
|
||||||
// remove any existing archive
|
$t->addTask($this->taskExec(escapeshellarg(\PHP_BINARY)." arsse.php conf save-defaults config.defaults.php")->dir($dir));
|
||||||
$t->addTask($this->taskFilesystemStack()->remove($tarball));
|
// remove any existing archive
|
||||||
// package it all up
|
$t->addTask($this->taskFilesystemStack()->remove($tarball));
|
||||||
$t->addTask($this->taskPack($tarball)->addDir("arsse", $dir));
|
// package it all up
|
||||||
// execute the collection
|
$t->addTask($this->taskPack($tarball)->addDir("arsse", $dir));
|
||||||
$result = $t->run();
|
// execute the collection
|
||||||
// remove the Git worktree
|
$result = $t->run();
|
||||||
$this->taskFilesystemStack()->remove($dir)->run();
|
} finally {
|
||||||
$this->taskExec("git worktree prune")->run();
|
// remove the Git worktree
|
||||||
|
$this->taskFilesystemStack()->remove($dir)->run();
|
||||||
|
$this->taskExec("git worktree prune")->dir(BASE)->run();
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue