Skip to content

The Unified and Autonomous Development Platform

Update doclink to use new wiki space naming convention

robin shinee6485558fde1
diff --git a/server.core/src/main/java/com/gitplex/server/core/GitPlex.java b/server.core/src/main/java/com/gitplex/server/core/GitPlex.java
index 532b115a2e..ec005607ba 100644
--- a/server.core/src/main/java/com/gitplex/server/core/GitPlex.java
+++ b/server.core/src/main/java/com/gitplex/server/core/GitPlex.java
@@ -6,6 +6,8 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.annotation.Nullable;
import javax.inject.Inject;
@@ -35,6 +37,8 @@ public class GitPlex extends AbstractPlugin implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(GitPlex.class);
+ private static final Pattern DOCLINK_PATTERN = Pattern.compile("\\d+\\.\\d+");
+
private final ConfigManager configManager;
private final DataManager dataManager;
@@ -155,7 +159,12 @@ public class GitPlex extends AbstractPlugin implements Serializable {
}
public String getDocLink() {
- return "http://wiki.pmease.com//display/gp" + StringUtils.substringBefore(AppLoader.getProduct().getVersion(), ".");
+ String productVersion = AppLoader.getProduct().getVersion();
+ Matcher matcher = DOCLINK_PATTERN.matcher(productVersion);
+ if (!matcher.find())
+ throw new RuntimeException("Unexpected product version format: " + productVersion);
+ String wikiSpace = "GP" + matcher.group().replace(".", "");
+ return "http://wiki.pmease.com//display/" + wikiSpace;
}
}
diff --git a/server.product/pom.xml b/server.product/pom.xml
index 4fd714b456..998cbcc4df 100644
--- a/server.product/pom.xml
+++ b/server.product/pom.xml
@@ -31,8 +31,9 @@
</goals>
<configuration>
<source>
- project.properties["lowerCaseProductName"] = project.name.toLowerCase()
- project.properties["docLink"] = "http://wiki.pmease.com/display/gp" + project.version.substring(0, project.version.indexOf('.'))
+ project.properties["lowerCaseProductName"] = project.name.toLowerCase()
+ def wikiSpace = "GP" + project.version.find(/\d+\.\d+/).replace('.', '')
+ project.properties["docLink"] = "http://wiki.pmease.com/display/" + wikiSpace
</source>
</configuration>
</execution>
diff --git a/server.product/src/test/java/com/gitplex/server/product/Test.java b/server.product/src/test/java/com/gitplex/server/product/Test.java
index e8b9ebf116..0443be550c 100644
--- a/server.product/src/test/java/com/gitplex/server/product/Test.java
+++ b/server.product/src/test/java/com/gitplex/server/product/Test.java
@@ -1,11 +1,16 @@
package com.gitplex.server.product;
import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class Test {
@org.junit.Test
public void test() throws IOException {
+ Matcher matcher = Pattern.compile("\\d+\\.\\d+").matcher("1.0-EAP");
+ matcher.find();
+ System.out.println(matcher.group());
}
}
\ No newline at end of file