Skip to content

Commit 41ab24f

Browse files
Mark Turner2danez
Mark Turner2
authored andcommitted
Fixed update version problem that updated all props ending in "version"
Conflicts: src/main/groovy/net/researchgate/release/PluginHelper.groovy
1 parent 1f74579 commit 41ab24f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/groovy/net/researchgate/release/PluginHelper.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class PluginHelper {
8787
try {
8888
// we use replace here as other ant tasks escape and modify the whole file
8989
project.ant.replaceregexp(file: file, byline: true) {
90-
regexp(pattern: "$key(\\s*)=(\\s*).+")
91-
substitution(expression: "$key\\1=\\2$version")
90+
regexp(pattern: "^(\\s*)$key(\\s*)=(\\s*).+")
91+
substitution(expression: "\\1$key\\2=\\3$version")
9292
}
9393
} catch (BuildException be) {
9494
throw new GradleException('Unable to write version property.', be)

src/test/groovy/net/researchgate/release/PluginHelperVersionPropertyFileTests.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public class PluginHelperVersionPropertyFileTests extends Specification {
118118
props.withWriter {
119119
it << "version=${project.version}\n"
120120
it << "something=http://www.gradle.org/test\n"
121+
it << " another.prop.version = 1.1\n"
121122
}
122123
project.createScmAdapter.execute()
123124
when:
@@ -128,5 +129,6 @@ public class PluginHelperVersionPropertyFileTests extends Specification {
128129
noExceptionThrown()
129130
lines[0] == 'version=3.1'
130131
lines[1] == 'something=http://www.gradle.org/test'
132+
lines[2] == ' another.prop.version = 1.1'
131133
}
132134
}

0 commit comments

Comments
 (0)