Introduces symlinks for current documentation
fixes gh-172
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.release.cloud.docs;
|
||||
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.cloud.release.internal.git.ProjectGitHandler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -25,8 +26,9 @@ class SpringCloudDocsConfiguration {
|
||||
|
||||
@Bean
|
||||
SpringCloudCustomProjectDocumentationUpdater springCloudCustomProjectDocumentationUpdater(
|
||||
ProjectGitHandler handler) {
|
||||
return new SpringCloudCustomProjectDocumentationUpdater(handler);
|
||||
ProjectGitHandler handler, ReleaserProperties releaserProperties) {
|
||||
return new SpringCloudCustomProjectDocumentationUpdater(handler,
|
||||
releaserProperties);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,49 +16,23 @@
|
||||
|
||||
package org.springframework.cloud.release.cloud.docs;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.cloud.release.internal.docs.CustomProjectDocumentationUpdater;
|
||||
import org.springframework.cloud.release.internal.git.ProjectGitHandler;
|
||||
|
||||
public class SpringCloudDocsAccessor {
|
||||
|
||||
public static CustomProjectDocumentationUpdater updater(ProjectGitHandler handler) {
|
||||
return new SpringCloudCustomProjectDocumentationUpdater(handler);
|
||||
public static CustomProjectDocumentationUpdater updater(ProjectGitHandler handler,
|
||||
ReleaserProperties releaserProperties) {
|
||||
return new SpringCloudCustomProjectDocumentationUpdater(handler,
|
||||
releaserProperties);
|
||||
}
|
||||
|
||||
public static CustomProjectDocumentationUpdater testUpdater(ProjectGitHandler handler,
|
||||
String version) {
|
||||
return new TestCustomProjectDocumentationUpdater(handler, version);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TestCustomProjectDocumentationUpdater
|
||||
extends SpringCloudCustomProjectDocumentationUpdater {
|
||||
|
||||
private final String version;
|
||||
|
||||
TestCustomProjectDocumentationUpdater(ProjectGitHandler gitHandler, String version) {
|
||||
super(gitHandler);
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
String readIndexHtmlContents(File indexHtml) {
|
||||
return response();
|
||||
}
|
||||
|
||||
private String response() {
|
||||
return "<!DOCTYPE HTML>\n" + "\n" + "<meta charset=\"UTF-8\">\n"
|
||||
+ "<meta http-equiv=\"refresh\" content=\"1; url=https://cloud.spring.io/spring-cloud-static/"
|
||||
+ this.version + "/\">\n" + "\n" + "<script>\n"
|
||||
+ " window.location.href = \"https://cloud.spring.io/spring-cloud-static/"
|
||||
+ this.version + "/\"\n" + "</script>\n" + "\n"
|
||||
+ "<title>Page Redirection</title>\n" + "\n"
|
||||
+ "<!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->\n"
|
||||
+ "If you are not redirected automatically, follow the <a href='https://cloud.spring.io/spring-cloud-static/"
|
||||
+ this.version + "/'>link to latest release</a>\n";
|
||||
ReleaserProperties releaserProperties = new ReleaserProperties();
|
||||
return new SpringCloudCustomProjectDocumentationUpdater(handler,
|
||||
releaserProperties);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -242,8 +242,13 @@ public class AcceptanceTests {
|
||||
"2.1.2.BUILD-SNAPSHOT");
|
||||
then(this.gitHandler.issueCreatedInSpringGuides).isTrue();
|
||||
then(this.gitHandler.issueCreatedInStartSpringIo).isTrue();
|
||||
then(text(new File(this.documentationFolder, "current/index.html")))
|
||||
.doesNotContain("Angel.SR3").contains("Greenwich.SR2");
|
||||
then(Files.readSymbolicLink(
|
||||
new File(this.documentationFolder, "spring-cloud-consul/current")
|
||||
.toPath())
|
||||
.toString()).endsWith("5.3.5.RELEASE");
|
||||
then(Files
|
||||
.readSymbolicLink(new File(this.documentationFolder, "current").toPath())
|
||||
.toString()).endsWith("Xitmars.SR4");
|
||||
thenRunUpdatedTestsWereCalled();
|
||||
}
|
||||
|
||||
@@ -515,8 +520,12 @@ public class AcceptanceTests {
|
||||
"2.1.6.BUILD-SNAPSHOT");
|
||||
then(this.gitHandler.issueCreatedInSpringGuides).isTrue();
|
||||
then(this.gitHandler.issueCreatedInStartSpringIo).isTrue();
|
||||
then(text(new File(this.documentationFolder, "current/index.html")))
|
||||
.doesNotContain("Angel.SR3").contains("Greenwich.SR2");
|
||||
then(Files.readSymbolicLink(
|
||||
new File(this.documentationFolder, "spring-cloud-build/current").toPath())
|
||||
.toString()).endsWith("5.3.11.RELEASE");
|
||||
then(Files
|
||||
.readSymbolicLink(new File(this.documentationFolder, "current").toPath())
|
||||
.toString()).endsWith("Xitmars.SR4");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user