Skip to content

Commit f1adadc

Browse files
committed
Add ability to use gitFlowConfig and commitMessages properties from the command line - closes #284
1 parent 72da507 commit f1adadc

File tree

14 files changed

+208
-27
lines changed

14 files changed

+208
-27
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.amashchenko.maven.plugin</groupId>
4+
<artifactId>gitflow-maven-test</artifactId>
5+
<packaging>pom</packaging>
6+
<version>0.0.3-test-SNAPSHOT</version>
7+
</project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build.log
2+
expected-pom.xml
3+
invoker.properties
4+
init.bsh
5+
verify.bsh

src/it/feature-start-3-it/init.bsh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
try {
2+
new File(basedir, "gitignorefile").renameTo(new File(basedir, ".gitignore"));
3+
4+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " init");
5+
p.waitFor();
6+
7+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.email 'a@a.aa'");
8+
p.waitFor();
9+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.name 'a'");
10+
p.waitFor();
11+
12+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add .");
13+
p.waitFor();
14+
15+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m init");
16+
p.waitFor();
17+
18+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout -b develop");
19+
p.waitFor();
20+
21+
} catch (Exception e) {
22+
e.printStackTrace();
23+
return false;
24+
}
25+
return true;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:feature-start -B -DfeatureName=test -DgitFlowConfig.featureBranchPrefix=improve/
2+
3+
invoker.description=Non-interactive feature-start setting gitFlowConfig from the command line.

src/it/feature-start-3-it/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.amashchenko.maven.plugin</groupId>
4+
<artifactId>gitflow-maven-test</artifactId>
5+
<packaging>pom</packaging>
6+
<version>0.0.3-SNAPSHOT</version>
7+
</project>

src/it/feature-start-3-it/verify.bsh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import org.codehaus.plexus.util.FileUtils;
2+
3+
try {
4+
File gitRef = new File(basedir, ".git/refs/heads/improve/test");
5+
if (!gitRef.exists()) {
6+
System.out.println("feature-start .git/refs/heads/improve/test doesn't exist");
7+
return false;
8+
}
9+
10+
File file = new File(basedir, "pom.xml");
11+
File expectedFile = new File(basedir, "expected-pom.xml");
12+
13+
String actual = FileUtils.fileRead(file, "UTF-8");
14+
String expected = FileUtils.fileRead(expectedFile, "UTF-8");
15+
16+
actual = actual.replaceAll("\\r?\\n", "");
17+
expected = expected.replaceAll("\\r?\\n", "");
18+
19+
if (!expected.equals(actual)) {
20+
System.out.println("feature-start expected: " + expected + " actual was:" + actual);
21+
return false;
22+
}
23+
} catch (Exception e) {
24+
e.printStackTrace();
25+
return false;
26+
}
27+
return true;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.amashchenko.maven.plugin</groupId>
4+
<artifactId>gitflow-maven-test</artifactId>
5+
<packaging>pom</packaging>
6+
<version>0.0.3-test-SNAPSHOT</version>
7+
<build>
8+
<plugins>
9+
<plugin>
10+
<groupId>com.amashchenko.maven.plugin</groupId>
11+
<artifactId>gitflow-maven-plugin</artifactId>
12+
<configuration>
13+
<gitFlowConfig>
14+
<featureBranchPrefix>improve/</featureBranchPrefix>
15+
</gitFlowConfig>
16+
</configuration>
17+
</plugin>
18+
</plugins>
19+
</build>
20+
</project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build.log
2+
expected-pom.xml
3+
invoker.properties
4+
init.bsh
5+
verify.bsh

src/it/feature-start-4-it/init.bsh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
try {
2+
new File(basedir, "gitignorefile").renameTo(new File(basedir, ".gitignore"));
3+
4+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " init");
5+
p.waitFor();
6+
7+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.email 'a@a.aa'");
8+
p.waitFor();
9+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.name 'a'");
10+
p.waitFor();
11+
12+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add .");
13+
p.waitFor();
14+
15+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m init");
16+
p.waitFor();
17+
18+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout -b develop");
19+
p.waitFor();
20+
21+
} catch (Exception e) {
22+
e.printStackTrace();
23+
return false;
24+
}
25+
return true;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:feature-start -B -DfeatureName=test -DgitFlowConfig.featureBranchPrefix=featprefix/
2+
3+
invoker.description=Non-interactive feature-start setting gitFlowConfig from the command line using pom with configuration. Pom configuration must be used.

0 commit comments

Comments
 (0)