19
19
*/
20
20
package io .wcm .devops .maven .nodejsproxy .resource ;
21
21
22
- import io .wcm .devops .maven .nodejsproxy .MavenProxyConfiguration ;
23
-
24
22
import org .apache .commons .lang3 .StringUtils ;
25
23
24
+ import io .wcm .devops .maven .nodejsproxy .MavenProxyConfiguration ;
25
+
26
26
/**
27
27
* Builds HTML index page
28
28
*/
29
29
public final class IndexPageBuilder {
30
30
31
31
private static final String [] EXAMPLE_URLS = new String [] {
32
- "${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0.pom" ,
33
- "${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-windows-x86.exe" ,
34
- "${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-windows-x64.exe" ,
35
- "${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-linux-x86.tar.gz" ,
36
- "${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-linux-x64.tar.gz" ,
37
- "${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-darwin-x86.tar.gz" ,
38
- "${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-darwin-x64.tar.gz" ,
39
- "${groupIdPath}/${npmArtifactId}/1.4.9/${npmArtifactId}-1.4.9.pom" ,
40
- "${groupIdPath}/${npmArtifactId}/1.4.9/${npmArtifactId}-1.4.9.tgz"
32
+ "${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}.pom" ,
33
+ "${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-windows-x86.exe" ,
34
+ "${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-windows-x64.exe" ,
35
+ "${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-linux-x86.tar.gz" ,
36
+ "${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-linux-x64.tar.gz" ,
37
+ "${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-darwin-x64.tar.gz" ,
38
+ "${groupIdPath}/${npmArtifactId}/${npmSampleVersion}/${npmArtifactId}-${npmSampleVersion}.pom" ,
39
+ "${groupIdPath}/${npmArtifactId}/${npmSampleVersion}/${npmArtifactId}-${npmSampleVersion}.tgz"
41
40
};
42
41
43
42
private IndexPageBuilder () {
@@ -54,22 +53,27 @@ public static String build(MavenProxyConfiguration config) {
54
53
url = StringUtils .replace (url , "${groupIdPath}" , StringUtils .replace (config .getGroupId (), "." , "/" ));
55
54
url = StringUtils .replace (url , "${nodeJsArtifactId}" , config .getNodeJsArtifactId ());
56
55
url = StringUtils .replace (url , "${npmArtifactId}" , config .getNpmArtifactId ());
56
+ url = StringUtils .replace (url , "${nodeJsSampleVersion}" , config .getNodeJsSampleVersion ());
57
+ url = StringUtils .replace (url , "${npmSampleVersion}" , config .getNpmSampleVersion ());
57
58
exampleUrlsMarkup .append ("<li><a href=\" " ).append (url ).append ("\" >" ).append (url ).append ("</a></li>" );
58
59
59
60
}
60
61
61
62
String serviceVersion = IndexPageBuilder .class .getPackage ().getImplementationVersion ();
62
63
63
- return "<html>"
64
- + "<head><title>Maven NodeJS Proxy</title></head>"
64
+ return "<!DOCTYPE html>\n <html>"
65
+ + "<head>"
66
+ + "<title>Maven NodeJS Proxy</title>"
67
+ + "<style>body { font-family: sans-serif; }</style>"
68
+ + "</head>"
65
69
+ "<body>"
66
70
+ "<h1>Maven NodeJS Proxy</h1>"
67
71
+ "<p>This is a Maven Artifact Proxy for NodeJS binaries located at: "
68
72
+ "<a href=\" " + config .getNodeJsBinariesRootUrl () + "\" >" + config .getNodeJsBinariesRootUrl () + "</a></p>"
69
73
+ "<p>Every call to this repository is routed directly to this URL.</p>"
70
74
+ "<p><strong>Please never use this Maven repository directly in your maven builds, but only via an Repository Manager "
71
75
+ "which caches the resolved artifacts.</strong></p>"
72
- + "<p>If you want to setup your own proxy get the source code:"
76
+ + "<p>If you want to setup your own proxy get the source code: "
73
77
+ "<a href=\" https://github.com/wcm-io-devops/maven-nodejs-proxy\" >https://github.com/wcm-io-devops/maven-nodejs-proxy</a></p>"
74
78
+ "<hr/>"
75
79
+ "<p>Examples:</p>"
0 commit comments