diff --git a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/DeploymentMethod.java b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/DeploymentMethod.java index e7241be55..258bf84a4 100644 --- a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/DeploymentMethod.java +++ b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/DeploymentMethod.java @@ -24,4 +24,11 @@ interface DeploymentMethod { */ void finish(); + /** + * Should return a string that, given the input parameter, will be a unique (but human readable) + * identifier for that particular resource location. + * @return + */ + String getID(); + } diff --git a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/LocalDeploymentMethod.java b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/LocalDeploymentMethod.java index 70bce99f7..fcde4f3ed 100644 --- a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/LocalDeploymentMethod.java +++ b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/LocalDeploymentMethod.java @@ -51,4 +51,9 @@ public boolean deploy(InputStream data, String toLocation) { public void finish() { } + @Override + public String getID() { + return rootDirectory; + } + } diff --git a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/RemoteDeploymentMethod.java b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/RemoteDeploymentMethod.java index 83b92e1d6..1bdb2055e 100644 --- a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/RemoteDeploymentMethod.java +++ b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/RemoteDeploymentMethod.java @@ -26,4 +26,9 @@ public void finish() { SSHWrapper.closeSessions(); } + @Override + public String getID() { + return remote; + } + } diff --git a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/SiteDeploy.java b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/SiteDeploy.java index 8e8f9d91c..4281e4bdc 100644 --- a/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/SiteDeploy.java +++ b/src/main/java/com/laytonsmith/tools/docgen/sitedeploy/SiteDeploy.java @@ -19,6 +19,7 @@ import com.laytonsmith.core.MethodScriptFileLocations; import com.laytonsmith.core.Static; import com.laytonsmith.core.exceptions.CRE.CREThrowable; +import com.laytonsmith.core.exceptions.ConfigCompileException; import com.laytonsmith.core.functions.Function; import com.laytonsmith.persistence.DataSourceException; import com.laytonsmith.persistence.PersistenceNetwork; @@ -47,6 +48,7 @@ import java.util.Map; import java.util.Queue; import java.util.Set; +import java.util.TreeMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -613,9 +615,9 @@ public void run() { if (notificationAboutLocalCache) { hash = getLocalMD5(new ByteArrayInputStream(c)); try { - if (lc.containsKey(toLocation)) { + if (lc.containsKey(deploymentMethod.getID() + toLocation)) { if (useLocalCache) { - String cacheHash = lc.get(toLocation); + String cacheHash = lc.get(deploymentMethod.getID() + toLocation); if (cacheHash.equals(hash)) { skipUpload = true; } @@ -632,7 +634,7 @@ public void run() { } if (pn != null && notificationAboutLocalCache && hash != null) { try { - lc.put(toLocation, hash); + lc.put(deploymentMethod.getID() + toLocation, hash); pn.set(dm, new String[]{"site_deploy", "local_cache"}, JSONValue.toJSONString(lc)); } catch (DataSourceException | ReadOnlyException | IllegalArgumentException ex) { Logger.getLogger(SiteDeploy.class.getName()).log(Level.SEVERE, null, ex); @@ -888,40 +890,72 @@ private void deployLearningTrail() throws IOException { } private void deployAPI() { - Set> functionClasses = ClassDiscovery.getDefaultInstance().loadClassesWithAnnotationThatExtend(api.class, Function.class); - // A map of where it maps the enclosing class to the list of function rows, which contains a list of - // table cells. - Map, List>> data = new HashMap<>(); - for(Class functionClass : functionClasses) { - if(!data.containsKey(functionClass.getEnclosingClass())) { - data.put(functionClass.getEnclosingClass(), new ArrayList>()); - } - List> d = data.get(functionClass.getEnclosingClass()); - List c = new ArrayList<>(); - // function name, returns, arguments, throws, description, since, restricted - Function f; - try { - f = ReflectionUtils.instantiateUnsafe(functionClass); - } catch(ReflectionUtils.ReflectionException ex) { - throw new RuntimeException("While trying to construct " + functionClass + ", got the following", ex); - } - DocGen.DocInfo di = new DocGen.DocInfo(f.docs()); - c.add(f.getName()); - c.add(di.ret); - c.add(di.args); - List exc = new ArrayList<>(); - if(f.thrown() != null) { - for(Class e : f.thrown()) { - CREThrowable ct = ReflectionUtils.instantiateUnsafe(e); - exc.add("{{object|" + ct.getName() + "}}"); + generateQueue.submit(new Runnable() { + @Override + public void run() { + Set> functionClasses = ClassDiscovery.getDefaultInstance().loadClassesWithAnnotationThatExtend(api.class, Function.class); + // A map of where it maps the enclosing class to the list of function rows, which contains a list of + // table cells. + Map, List>> data = new TreeMap<>(); + for(Class functionClass : functionClasses) { + if(!data.containsKey(functionClass.getEnclosingClass())) { + data.put(functionClass.getEnclosingClass(), new ArrayList>()); + } + List> d = data.get(functionClass.getEnclosingClass()); + List c = new ArrayList<>(); + // function name, returns, arguments, throws, description, since, restricted + Function f; + try { + f = ReflectionUtils.instantiateUnsafe(functionClass); + } catch(ReflectionUtils.ReflectionException ex) { + throw new RuntimeException("While trying to construct " + functionClass + ", got the following", ex); + } + DocGen.DocInfo di = new DocGen.DocInfo(f.docs()); + c.add(f.getName()); + c.add(di.ret); + c.add(di.args); + List exc = new ArrayList<>(); + if(f.thrown() != null) { + for(Class e : f.thrown()) { + CREThrowable ct = ReflectionUtils.instantiateUnsafe(e); + exc.add("{{object|" + ct.getName() + "}}"); + } + } + c.add(StringUtils.Join(exc, "
")); + StringBuilder desc = new StringBuilder(); + desc.append(di.desc); + if(di.extendedDesc != null) { + desc.append(" [[functions/").append(f.getName()).append("|See more...]]"); + } + try { + if(f.examples() != null && f.examples().length > 0) { + desc.append("
([[functions/").append(f.getName()).append("#Examples|Examples...]]"); + } + } catch (ConfigCompileException ex) { + Logger.getLogger(SiteDeploy.class.getName()).log(Level.SEVERE, null, ex); + } + c.add(desc.toString()); + c.add(f.since().toString()); + c.add("" + (f.isRestricted() ? "Yes" : "No") + + ""); + d.add(c); + } + // data is now constructed. + StringBuilder b = new StringBuilder(); + for(Map.Entry, List>> e : data.entrySet()) { + Class clazz = e.getKey(); + b.append("== ").append(clazz.getSimpleName()).append(" ==\n"); + String docs = (String)ReflectionUtils.invokeMethod(clazz, null, "docs"); + b.append("

").append(docs).append("

"); } - } - c.add(StringUtils.Join(exc, "
")); - StringBuilder desc = new StringBuilder(); - c.add(desc.toString()); - d.add(c); - } + writePage("API", b.toString(), "API", + Arrays.asList(new String[]{"API", "functions"}), + "A list of all " + Implementation.GetServerType().getBranding() + " functions"); + currentGenerateTask.addAndGet(1); + } + }); + totalGenerateTasks.addAndGet(1); } private void deployEventAPI() { diff --git a/src/main/resources/docs/About b/src/main/resources/docs/About index e0aa3ad49..e3f85dd6d 100644 --- a/src/main/resources/docs/About +++ b/src/main/resources/docs/About @@ -16,7 +16,7 @@ For more information about how this site is generated, or information about the Portions of the site are copyright © 2016 - %%CURRENTYEAR%% by the %%branding%% Team, based on works contributed under the license of the MethodScript project. -This site may use cookies. See our privacy policy [[privacy_policy|here]]. +This site may use cookies. See our privacy policy [[privacy_policy.html|here]].
The site template is provided by TEMPLATED.
diff --git a/src/main/resources/docs/Help b/src/main/resources/docs/Help new file mode 100644 index 000000000..03a4bdc22 --- /dev/null +++ b/src/main/resources/docs/Help @@ -0,0 +1,7 @@ + + +Need more help? + +See the forums at the link above, or find us on IRC on esper.net #CommandHelper, or just use the widget below: + + diff --git a/src/main/resources/siteDeploy/frame.html b/src/main/resources/siteDeploy/frame.html index 9c0ea54ef..e780cae7b 100644 --- a/src/main/resources/siteDeploy/frame.html +++ b/src/main/resources/siteDeploy/frame.html @@ -66,6 +66,7 @@

%%branding%%

  • Home
  • Docs
  • Forums
  • +
  • Help