Remove --force attribute from release command

[MAILPOET-1879]
This commit is contained in:
Pavel Dohnal
2019-04-04 14:34:22 +02:00
committed by M. Shull
parent 1a4102ecff
commit c6b5b4b4de

View File

@@ -424,7 +424,7 @@ class RoboFile extends \Robo\Tasks {
->run(); ->run();
} }
function svnPublish($opts = ['force' => false]) { function svnPublish() {
$this->loadEnv(); $this->loadEnv();
$svn_dir = ".mp_svn"; $svn_dir = ".mp_svn";
@@ -508,44 +508,32 @@ class RoboFile extends \Robo\Tasks {
$result = $collection->run(); $result = $collection->run();
if ($result->wasSuccessful()) { if ($result->wasSuccessful()) {
// Run or suggest release command depending on a flag
$repo_url = "https://plugins.svn.wordpress.org/$plugin_dist_name"; $repo_url = "https://plugins.svn.wordpress.org/$plugin_dist_name";
$release_cmd = "svn ci -m \"Release $plugin_version\""; $release_cmd = "svn ci -m \"Release $plugin_version\"";
$tag_cmd = "svn copy $repo_url/trunk $repo_url/tags/$plugin_version -m \"Tag $plugin_version\""; $tag_cmd = "svn copy $repo_url/trunk $repo_url/tags/$plugin_version -m \"Tag $plugin_version\"";
if (!empty($opts['force'])) { $svn_login = getenv('WP_SVN_USERNAME');
$svn_login = getenv('WP_SVN_USERNAME'); $svn_password = getenv('WP_SVN_PASSWORD');
$svn_password = getenv('WP_SVN_PASSWORD'); if ($svn_login && $svn_password) {
if ($svn_login && $svn_password) { $release_cmd .= " --username $svn_login --password $svn_password";
$release_cmd .= " --username $svn_login --password $svn_password";
} else {
$release_cmd .= ' --force-interactive';
}
$result = $this->taskExecStack()
->stopOnFail()
->dir($svn_dir)
->exec($release_cmd)
->exec($tag_cmd)
->run();
} else { } else {
$this->yell( $release_cmd .= ' --force-interactive';
"Go to '$svn_dir' and run '$release_cmd' to publish the release"
);
$this->yell(
"Run '$tag_cmd' to tag the release"
);
} }
$result = $this->taskExecStack()
->stopOnFail()
->dir($svn_dir)
->exec($release_cmd)
->exec($tag_cmd)
->run();
} }
return $result; return $result;
} }
public function publish($opts = ['force' => false]) { public function publish() {
return $this->collectionBuilder() return $this->collectionBuilder()
->addCode(array($this, 'pushpot')) ->addCode(array($this, 'pushpot'))
->addCode(array($this, 'svnCheckout')) ->addCode(array($this, 'svnCheckout'))
->addCode(function () use ($opts) { ->addCode(array($this, 'svnPublish'))
return $this->svnPublish($opts);
})
->run(); ->run();
} }