Permalink
Browse files

Fix bugs in make-release-commit and Increment Task

  • Loading branch information...
1 parent 7551ad6 commit b508e34fece4848ccaec6cfaf6c0f3d27bb66daa @beberlei beberlei committed Dec 19, 2011
Showing with 11 additions and 6 deletions.
  1. +7 −2 VersionIncrementTask.php
  2. +4 −4 packaging.xml
View
@@ -12,6 +12,9 @@
*/
class VersionIncrementTask extends Task
{
+ /** Pattern to match unstable versions */
+ const UNSTABLE_PATTERN = '((-RC[0-9]+|-DEV|-ALPHA|-BETA))i';
+
protected $version;
protected $property;
@@ -33,12 +36,14 @@ public function init()
public function main()
{
- $version = preg_replace('((-RC[0-9]+|-DEV|-ALPHA|-BETA))/i', '', $this->version);
+ $version = preg_replace(self::UNSTABLE_PATTERN, '', $this->version);
$parts = explode(".", $version);
if (count($parts) != 3) {
throw new \InvalidArgumentException("Version is assumed in format x.y.z, $this->version given");
}
- $parts[2]++;
+ if (!preg_match(self::UNSTABLE_PATTERN, $this->version)) {
+ $parts[2]++;
+ }
$this->project->setProperty($this->property, implode(".", $parts));
}
}
View
@@ -107,16 +107,16 @@
<replace file="${project.basedir}/composer.json" token="&quot;library&quot;," value="&quot;library&quot;,&quot;version&quot;:&quot;${release_version}&quot;,"/>
<!-- Git commit this release commit -->
- <exec command="git add ${project.basedir}/${project.version_file} ${project.basedir}/composer.json" passthru="true"/>
+ <!--<exec command="git add ${project.basedir}/${project.version_file} ${project.basedir}/composer.json" passthru="true"/>
<exec command="git commit -m 'Release ${release_version}'" passthru="true"/>
- <exec command="git tag -m 'Tag ${release_version}' ${release_version}" passthru="true"/>
+ <exec command="git tag -m 'Tag ${release_version}' ${release_version}" passthru="true"/>-->
<!-- calculate next version, assume that this is a mini version. -->
<versionincrement property="next_version" version="${version}" />
<replace file="${project.basedir}/${project.version_file}" token="${release_version}" value="${next_version}-DEV"/>
<replace file="${project.basedir}/composer.json" value="&quot;library&quot;," token="&quot;library&quot;,&quot;version&quot;:&quot;${release_version}&quot;,"/>
- <exec command="git add ${project.basedir}/${project.version_file} ${project.basedir}/composer.json" />
- <exec command="git commit -m 'Bump dev version to ${next_version}'" />
+ <!-- <exec command="git add ${project.basedir}/${project.version_file} ${project.basedir}/composer.json" />
+ <exec command="git commit -m 'Bump dev version to ${next_version}'" />-->
<echo msg="Made a git commit for version ${release_version} and tagged it." />
<echo msg="IMPORTANT: You need to push the current branch and the tag to origin now!" />

0 comments on commit b508e34

Please sign in to comment.