Created
July 21, 2016 20:53
-
-
Save kohsuke/04d1a1bf40ec79ccea23fbdca7d133b5 to your computer and use it in GitHub Desktop.
javadocReverseIndex.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
/* | |
Generate index from short/full class name to the javadoc page, in the form of .htaccess. | |
This serves http://hudson-ci.org/javadoc/byShortName/ | |
Push it as scp .htaccess hudson-ci.org:~/www/jenkins-ci.org/javadoc/byShortName | |
*/ | |
index = new TreeMap(); | |
base = new File("./target/site/apidocs"); | |
base.eachFileRecurse { File f -> | |
if(f.path.contains("-")) return; // non class files produced by javadoc | |
if(!f.path.endsWith(".html")) return; // directories and others | |
tail = f.path.substring(base.path.length()+1); | |
shortClassName = f.name.substring(0,f.name.length()-5); // cut off ".html" | |
fullClassName = tail.substring(0,tail.length()-5).replace('/','.'); | |
index[shortClassName] = tail; | |
index[fullClassName] = tail; | |
} | |
index.each { k,v -> | |
println "Redirect 302 /byShortName/${k} http://javadoc.jenkins-ci.org/?${v}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment