Group release methods together & improve their order

[MAILPOET-1977]
This commit is contained in:
Jan Jakeš
2019-04-19 13:42:44 +02:00
committed by M. Shull
parent 34e4203b9f
commit 720d9a4808

View File

@ -513,19 +513,6 @@ class RoboFile extends \Robo\Tasks {
->run(); ->run();
} }
function releaseChangelogWrite($opts = ['version-name' => null]) {
$this->say("Updating changelog");
$outputs = $this->getChangelogController()->update($opts['version-name']);
$this->say("Changelog \n{$outputs[0]} \n{$outputs[1]}\n\n");
$this->say("IMPORTANT NOTES \n" . ($outputs[2] ?: 'none'));
}
function releaseChangelogGet($opts = ['version-name' => null]) {
$outputs = $this->getChangelogController()->get($opts['version-name']);
$this->say("Changelog \n{$outputs[0]} \n{$outputs[1]}\n");
$this->say("IMPORTANT NOTES \n" . ($outputs[2] ?: 'none'));
}
public function testAcceptanceGroupTests() { public function testAcceptanceGroupTests() {
return $this->taskSplitTestFilesByGroups(4) return $this->taskSplitTestFilesByGroups(4)
->projectRoot('.') ->projectRoot('.')
@ -534,23 +521,16 @@ class RoboFile extends \Robo\Tasks {
->run(); ->run();
} }
public function releaseVersionWrite($version) { public function prepareRelease($version = null) {
$version = trim($version); $version = $this->releaseVersionAssign($version, ['return' => true]);
$this->validateVersion($version);
$this->taskReplaceInFile(__DIR__ . '/readme.txt') return $this->collectionBuilder()
->regex('/Stable tag:\s*\d+\.\d+\.\d+/i') ->addCode(function () use ($version) {
->to('Stable tag: ' . $version) return $this->releaseVersionWrite($version);
->run(); })
->addCode(function () use ($version) {
$this->taskReplaceInFile(__DIR__ . '/mailpoet.php') return $this->releaseChangelogWrite(['version-name' => $version]);
->regex('/Version:\s*\d+\.\d+\.\d+/i') })
->to('Version: ' . $version)
->run();
$this->taskReplaceInFile(__DIR__ . '/mailpoet.php')
->regex("/['\"]version['\"]\s*=>\s*['\"]\d+\.\d+\.\d+['\"],/i")
->to(sprintf("'version' => '%s',", $version))
->run(); ->run();
} }
@ -578,17 +558,37 @@ class RoboFile extends \Robo\Tasks {
} }
} }
public function prepareRelease($version = null) { public function releaseVersionWrite($version) {
$version = $this->releaseVersionAssign($version, ['return' => true]); $version = trim($version);
$this->validateVersion($version);
return $this->collectionBuilder() $this->taskReplaceInFile(__DIR__ . '/readme.txt')
->addCode(function () use ($version) { ->regex('/Stable tag:\s*\d+\.\d+\.\d+/i')
return $this->releaseVersionWrite($version); ->to('Stable tag: ' . $version)
})
->addCode(function () use ($version) {
return $this->releaseChangelogWrite(['version-name' => $version]);
})
->run(); ->run();
$this->taskReplaceInFile(__DIR__ . '/mailpoet.php')
->regex('/Version:\s*\d+\.\d+\.\d+/i')
->to('Version: ' . $version)
->run();
$this->taskReplaceInFile(__DIR__ . '/mailpoet.php')
->regex("/['\"]version['\"]\s*=>\s*['\"]\d+\.\d+\.\d+['\"],/i")
->to(sprintf("'version' => '%s',", $version))
->run();
}
function releaseChangelogGet($opts = ['version-name' => null]) {
$outputs = $this->getChangelogController()->get($opts['version-name']);
$this->say("Changelog \n{$outputs[0]} \n{$outputs[1]}\n");
$this->say("IMPORTANT NOTES \n" . ($outputs[2] ?: 'none'));
}
function releaseChangelogWrite($opts = ['version-name' => null]) {
$this->say("Updating changelog");
$outputs = $this->getChangelogController()->update($opts['version-name']);
$this->say("Changelog \n{$outputs[0]} \n{$outputs[1]}\n\n");
$this->say("IMPORTANT NOTES \n" . ($outputs[2] ?: 'none'));
} }
public function releaseDownloadZip() { public function releaseDownloadZip() {
@ -610,6 +610,13 @@ class RoboFile extends \Robo\Tasks {
$github_controller->publishRelease($version['name'], $changelog[1], $path); $github_controller->publishRelease($version['name'], $changelog[1], $path);
} }
public function releasePublishJira($version = null) {
$version = $this->releaseVersionGetNext($version);
$jira_controller = $this->createJiraController();
$jira_version = $jira_controller->releaseVersion($version);
$this->say("JIRA version '$jira_version[name]' was released.");
}
public function releasePublishSlack($version = null) { public function releasePublishSlack($version = null) {
$jira_controller = $this->createJiraController(); $jira_controller = $this->createJiraController();
$version = $jira_controller->getVersion($version); $version = $jira_controller->getVersion($version);
@ -622,13 +629,6 @@ class RoboFile extends \Robo\Tasks {
$slack_notifier->notify($version['name'], $changelog[1], $version['id']); $slack_notifier->notify($version['name'], $changelog[1], $version['id']);
} }
public function releasePublishJira($version = null) {
$version = $this->releaseVersionGetNext($version);
$jira_controller = $this->createJiraController();
$jira_version = $jira_controller->releaseVersion($version);
$this->say("JIRA version '$jira_version[name]' was released.");
}
protected function rsearch($folder, $extensions = array()) { protected function rsearch($folder, $extensions = array()) {
$dir = new RecursiveDirectoryIterator($folder); $dir = new RecursiveDirectoryIterator($folder);
$iterator = new RecursiveIteratorIterator($dir); $iterator = new RecursiveIteratorIterator($dir);