You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2018/12/09 17:35:23 UTC

[1/4] tomee-site-generator git commit: Renaming and comments for Sources class Needs to be a little clearer

Repository: tomee-site-generator
Updated Branches:
  refs/heads/master e1f56acdd -> a96d23581


Renaming and comments for Sources class
Needs to be a little clearer


Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/bb31cae2
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/bb31cae2
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/bb31cae2

Branch: refs/heads/master
Commit: bb31cae2b6babd9b21dcbf6ad82011d218a168b4
Parents: e1f56ac
Author: David Blevins <da...@gmail.com>
Authored: Sun Dec 9 08:47:20 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sun Dec 9 08:47:20 2018 -0800

----------------------------------------------------------------------
 .../java/org/apache/tomee/website/Docs.java     |  2 +-
 .../org/apache/tomee/website/Examples2.java     |  2 +-
 .../java/org/apache/tomee/website/JBake.java    |  5 +-
 .../java/org/apache/tomee/website/Sources.java  | 60 +++++++++++++++++---
 .../org/apache/tomee/website/VersionIndex.java  |  4 +-
 .../org/apache/tomee/website/VersionsIndex.java |  8 +--
 6 files changed, 62 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/bb31cae2/src/main/java/org/apache/tomee/website/Docs.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Docs.java b/src/main/java/org/apache/tomee/website/Docs.java
index c03fb6d..63fd515 100644
--- a/src/main/java/org/apache/tomee/website/Docs.java
+++ b/src/main/java/org/apache/tomee/website/Docs.java
@@ -37,7 +37,7 @@ public class Docs {
 
     public void prepare(final Source source) {
         final File srcDocs = new File(source.getDir(), "docs");
-        final File destDocs = sources.getDestinationFor(source, "docs");
+        final File destDocs = sources.getJbakeContentDestFor(source, "docs");
 
         if (!srcDocs.exists()) return;
 

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/bb31cae2/src/main/java/org/apache/tomee/website/Examples2.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Examples2.java b/src/main/java/org/apache/tomee/website/Examples2.java
index ad0c1aa..8cae7e7 100644
--- a/src/main/java/org/apache/tomee/website/Examples2.java
+++ b/src/main/java/org/apache/tomee/website/Examples2.java
@@ -34,7 +34,7 @@ public class Examples2 {
 
     public void prepare(final Source source) {
         final File srcDir = new File(source.getDir(), "examples");
-        final File destDir = sources.getDestinationFor(source, "examples");
+        final File destDir = sources.getJbakeContentDestFor(source, "examples");
 
         // If we don't have examples in this codebase, skip
         if (!srcDir.exists()) return;

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/bb31cae2/src/main/java/org/apache/tomee/website/JBake.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/JBake.java b/src/main/java/org/apache/tomee/website/JBake.java
index e397968..7105a9d 100755
--- a/src/main/java/org/apache/tomee/website/JBake.java
+++ b/src/main/java/org/apache/tomee/website/JBake.java
@@ -42,6 +42,7 @@ public class JBake {
                 new File("target/jbake"),
                 new File("repos"),
                 new File("src/main/jbake"),
+                destination,
                 new Source("https://git-wip-us.apache.org/repos/asf/tomee.git", "master", "tomee-8.0", true),
                 new Source("https://git-wip-us.apache.org/repos/asf/tomee.git", "tomee-7.1.0", "tomee-7.1"),
                 new Source("https://git-wip-us.apache.org/repos/asf/tomee.git", "tomee-7.0.5", "tomee-7.0"),
@@ -56,8 +57,8 @@ public class JBake {
             try {
                 orient.startup();
 
-                final Oven oven = new Oven(sources.getDestination(), destination, new CompositeConfiguration() {{
-                    addConfiguration(ConfigUtil.load(sources.getDestination()));
+                final Oven oven = new Oven(sources.getJbake(), destination, new CompositeConfiguration() {{
+                    addConfiguration(ConfigUtil.load(sources.getJbake()));
                 }}, true);
                 oven.setupPaths();
 

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/bb31cae2/src/main/java/org/apache/tomee/website/Sources.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Sources.java b/src/main/java/org/apache/tomee/website/Sources.java
index 3af5ca4..86d0265 100644
--- a/src/main/java/org/apache/tomee/website/Sources.java
+++ b/src/main/java/org/apache/tomee/website/Sources.java
@@ -38,17 +38,47 @@ import java.util.List;
  */
 public class Sources {
 
-    private final File destination;
+    /**
+     * The directory where all final html files are placed
+     * after generation.
+     */
+    private final File generated;
+
+
+    /**
+     * The directory where all JBake input is aggregated
+     * to create one big source tree prior to generation.
+     */
+    private final File jbake;
+
+    /**
+     * The directory where we are keeping a cache of git
+     * clones of the repos and branches that contribute
+     * to the content of the site.
+     */
     private final File repos;
+
+    /**
+     * The directory where we are keeping a cache of git
+     * clones of the repos and branches that contribute
+     * to the content of the site.
+     */
     private final File mainSource;
+
+
+    /**
+     * The definition of each repo/branch that contributes
+     * to the content of the site.
+     */
     private final List<Source> sources = new ArrayList<>();
 
-    public Sources(final File destination, final File repos, final File mainSource, final Source... sources) {
-        this.destination = destination;
+    public Sources(final File jbake, final File repos, final File mainSource, final File generated, final Source... sources) {
+        this.generated = generated;
+        this.jbake = jbake;
         this.repos = repos;
         this.mainSource = mainSource;
 
-        destination.mkdirs();
+        jbake.mkdirs();
         repos.mkdirs();
 
         Collections.addAll(this.sources, sources);
@@ -60,8 +90,20 @@ public class Sources {
         }
     }
 
-    public File getDestination() {
-        return destination;
+    public File getGenerated() {
+        return generated;
+    }
+
+    public File getRepos() {
+        return repos;
+    }
+
+    public File getMainSource() {
+        return mainSource;
+    }
+
+    public File getJbake() {
+        return jbake;
     }
 
     public List<Source> getSources() {
@@ -78,7 +120,7 @@ public class Sources {
         final VersionIndex versionIndex = new VersionIndex(this);
 
         try {
-            IO.copyDirectory(mainSource, destination);
+            IO.copyDirectory(mainSource, jbake);
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
@@ -95,8 +137,8 @@ public class Sources {
         VersionsIndex.prepare(this);
     }
 
-    public File getDestinationFor(final Source source, final String... parts) {
-        final File content = new File(destination, "content");
+    public File getJbakeContentDestFor(final Source source, final String... parts) {
+        final File content = new File(jbake, "content");
         File dir = new File(content, source.getName());
 
         for (final String part : parts) {

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/bb31cae2/src/main/java/org/apache/tomee/website/VersionIndex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/VersionIndex.java b/src/main/java/org/apache/tomee/website/VersionIndex.java
index 462b1d0..a2d0116 100644
--- a/src/main/java/org/apache/tomee/website/VersionIndex.java
+++ b/src/main/java/org/apache/tomee/website/VersionIndex.java
@@ -30,8 +30,8 @@ public class VersionIndex {
     }
 
     public void prepare(final Source source) {
-        final File docs = sources.getDestinationFor(source, "docs");
-        final File examples = sources.getDestinationFor(source, "examples");
+        final File docs = sources.getJbakeContentDestFor(source, "docs");
+        final File examples = sources.getJbakeContentDestFor(source, "examples");
 
         try {
             final StringBuilder index = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/bb31cae2/src/main/java/org/apache/tomee/website/VersionsIndex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/VersionsIndex.java b/src/main/java/org/apache/tomee/website/VersionsIndex.java
index 8d73ccc..eaf3b0a 100644
--- a/src/main/java/org/apache/tomee/website/VersionsIndex.java
+++ b/src/main/java/org/apache/tomee/website/VersionsIndex.java
@@ -47,8 +47,8 @@ public class VersionsIndex {
 
                 index.append("*\n\n");
 
-                final File docs = sources.getDestinationFor(source, "docs");
-                final File examples = sources.getDestinationFor(source, "examples");
+                final File docs = sources.getJbakeContentDestFor(source, "docs");
+                final File examples = sources.getJbakeContentDestFor(source, "examples");
 
                 if (docs.exists() && docs.listFiles().length > 0) {
                     index.append(" - link:").append(source.getName()).append("/docs[Documentation]\n");
@@ -59,8 +59,8 @@ public class VersionsIndex {
                 index.append("\n\n");
             }
 
-            IO.copy(IO.read(index.toString()), new File(sources.getDestination(), "content/documentation.adoc"));
-            IO.copy(IO.read(index.toString()), new File(sources.getDestination(), "content/docs.adoc"));
+            IO.copy(IO.read(index.toString()), new File(sources.getJbake(), "content/documentation.adoc"));
+            IO.copy(IO.read(index.toString()), new File(sources.getJbake(), "content/docs.adoc"));
 
         } catch (IOException e) {
             throw new RuntimeException(e);


[4/4] tomee-site-generator git commit: Empty stub of Javadoc generator TOMEE-2342 Publish Javadocs

Posted by db...@apache.org.
Empty stub of Javadoc generator
TOMEE-2342 Publish Javadocs


Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/a96d2358
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/a96d2358
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/a96d2358

Branch: refs/heads/master
Commit: a96d23581868abff30270115b113df7292872e8b
Parents: 1dade49
Author: David Blevins <da...@gmail.com>
Authored: Sun Dec 9 09:35:14 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sun Dec 9 09:35:14 2018 -0800

----------------------------------------------------------------------
 .../java/org/apache/tomee/website/Javadocs.java | 68 ++++++++++++++++++++
 .../java/org/apache/tomee/website/Sources.java  |  2 +
 2 files changed, 70 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/a96d2358/src/main/java/org/apache/tomee/website/Javadocs.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Javadocs.java b/src/main/java/org/apache/tomee/website/Javadocs.java
new file mode 100644
index 0000000..6320c42
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/Javadocs.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomee.website;
+
+/**
+ * For each git repo (source) it will collects the `src/main/java` contents
+ * into one large source tree and use the Javadoc proccessor directly in code
+ * to (with Asciidoclet configured) to generate a single javadoc for that repo.
+ *
+ * The examples/ directory for each repo will be filtered out and not included
+ * in the final aggregated javadoc.
+ */
+public class Javadocs {
+
+    private final Sources sources;
+
+    public Javadocs(final Sources sources) {
+        this.sources = sources;
+    }
+
+    /**
+     * Method is called for each git repo configured
+     * as a codebase that contributes to the documentation
+     *
+     * This is currently active branches of TomEE, but will
+     * be other sources in the future such as Sheldon
+     * and Chatterbox
+     *
+     * This method recurssively walks the already cloned
+     * git repo (the Source) and collects all `src/main/java`
+     * directories.
+     *
+     * All the files in these directories are aggregated into
+     * one single director at `target/<source.name>-java`.
+     * For example `target/tomee-8.0-java`
+     *
+     * We then run the javadoc processor on `target/<source.name>-java`
+     * and ensure all generated javadoc is placed at:
+     *
+     *  - `<sources.generated>/<source.name>/javadoc/`
+     *
+     * For example if the Source instance represents TomEE 8.0
+     * and the Sources.getGenerated() returns `target/site-1.0-SNAPSHOT`
+     * we would generate all the javadoc into this location:
+     *
+     *  - `target/site-1.0-SNAPSHOT/tomee-8.0/javadoc`
+     *
+     * @param source
+     */
+    public void prepare(final Source source) {
+
+        // do the magic
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/a96d2358/src/main/java/org/apache/tomee/website/Sources.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Sources.java b/src/main/java/org/apache/tomee/website/Sources.java
index cc254ba..0b481bd 100644
--- a/src/main/java/org/apache/tomee/website/Sources.java
+++ b/src/main/java/org/apache/tomee/website/Sources.java
@@ -116,6 +116,7 @@ public class Sources {
      */
     public void prepare() {
         final Docs docs = new Docs(this);
+        final Javadocs javadocs = new Javadocs(this);
         final Examples examples = new Examples(this);
         final VersionIndex versionIndex = new VersionIndex(this);
 
@@ -129,6 +130,7 @@ public class Sources {
                 .peek(source -> source.setDir(new File(repos, source.getName())))
                 .peek(Repos::download)
                 .peek(docs::prepare)
+                .peek(javadocs::prepare)
                 .peek(examples::prepare)
                 .peek(versionIndex::prepare)
                 .forEach(Sources::done);


[3/4] tomee-site-generator git commit: Rename Examples2 to Examples

Posted by db...@apache.org.
Rename Examples2 to Examples


Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/1dade492
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/1dade492
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/1dade492

Branch: refs/heads/master
Commit: 1dade49263b7868398405774612dcca81cc92e9f
Parents: d54197d
Author: David Blevins <da...@gmail.com>
Authored: Sun Dec 9 09:12:29 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sun Dec 9 09:12:29 2018 -0800

----------------------------------------------------------------------
 .../java/org/apache/tomee/website/Examples.java | 81 ++++++++++++++++++++
 .../org/apache/tomee/website/Examples2.java     | 81 --------------------
 .../java/org/apache/tomee/website/Sources.java  |  2 +-
 3 files changed, 82 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/1dade492/src/main/java/org/apache/tomee/website/Examples.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Examples.java b/src/main/java/org/apache/tomee/website/Examples.java
new file mode 100644
index 0000000..316d75b
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/Examples.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomee.website;
+
+import org.apache.openejb.loader.IO;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class Examples {
+
+    private final Sources sources;
+
+    public Examples(final Sources sources) {
+        this.sources = sources;
+    }
+
+    public void prepare(final Source source) {
+        final File srcDir = new File(source.getDir(), "examples");
+        final File destDir = sources.getJbakeContentDestFor(source, "examples");
+
+        // If we don't have examples in this codebase, skip
+        if (!srcDir.exists()) return;
+
+        final List<Example> examples = Stream.of(srcDir.listFiles())
+                .filter(File::isDirectory)
+                .filter(this::hasReadme)
+                .map(this::getReadme)
+                .map(Example::from)
+                .peek(example -> example.updateDestination(destDir))
+                .peek(this::copyToDest)
+                .peek(JbakeHeaders::addJbakeHeader)
+                .peek(FixMarkdown::process)
+                .collect(Collectors.toList());
+
+
+        GroupedIndex.process(destDir, "examplesindex");
+//        https://javaee.github.io/javaee-spec/javadocs/javax/servlet/http/HttpServletMapping.html
+    }
+
+    /**
+     * Copy all the readme.mdtext to examples/foo-bar.mdtext
+     */
+    private void copyToDest(final Example example) {
+        try {
+            IO.copy(example.getSrcReadme(), example.getDestReadme());
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+    private boolean hasReadme(final File dir) {
+        return getReadme(dir) != null;
+    }
+
+    private File getReadme(final File dir) {
+        for (final File file : dir.listFiles()) {
+            if (file.getName().startsWith("README.")) return file;
+        }
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/1dade492/src/main/java/org/apache/tomee/website/Examples2.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Examples2.java b/src/main/java/org/apache/tomee/website/Examples2.java
deleted file mode 100644
index 8cae7e7..0000000
--- a/src/main/java/org/apache/tomee/website/Examples2.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.tomee.website;
-
-import org.apache.openejb.loader.IO;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-public class Examples2 {
-
-    private final Sources sources;
-
-    public Examples2(final Sources sources) {
-        this.sources = sources;
-    }
-
-    public void prepare(final Source source) {
-        final File srcDir = new File(source.getDir(), "examples");
-        final File destDir = sources.getJbakeContentDestFor(source, "examples");
-
-        // If we don't have examples in this codebase, skip
-        if (!srcDir.exists()) return;
-
-        final List<Example> examples = Stream.of(srcDir.listFiles())
-                .filter(File::isDirectory)
-                .filter(this::hasReadme)
-                .map(this::getReadme)
-                .map(Example::from)
-                .peek(example -> example.updateDestination(destDir))
-                .peek(this::copyToDest)
-                .peek(JbakeHeaders::addJbakeHeader)
-                .peek(FixMarkdown::process)
-                .collect(Collectors.toList());
-
-
-        GroupedIndex.process(destDir, "examplesindex");
-//        https://javaee.github.io/javaee-spec/javadocs/javax/servlet/http/HttpServletMapping.html
-    }
-
-    /**
-     * Copy all the readme.mdtext to examples/foo-bar.mdtext
-     */
-    private void copyToDest(final Example example) {
-        try {
-            IO.copy(example.getSrcReadme(), example.getDestReadme());
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-
-    private boolean hasReadme(final File dir) {
-        return getReadme(dir) != null;
-    }
-
-    private File getReadme(final File dir) {
-        for (final File file : dir.listFiles()) {
-            if (file.getName().startsWith("README.")) return file;
-        }
-
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/1dade492/src/main/java/org/apache/tomee/website/Sources.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Sources.java b/src/main/java/org/apache/tomee/website/Sources.java
index 86d0265..cc254ba 100644
--- a/src/main/java/org/apache/tomee/website/Sources.java
+++ b/src/main/java/org/apache/tomee/website/Sources.java
@@ -116,7 +116,7 @@ public class Sources {
      */
     public void prepare() {
         final Docs docs = new Docs(this);
-        final Examples2 examples = new Examples2(this);
+        final Examples examples = new Examples(this);
         final VersionIndex versionIndex = new VersionIndex(this);
 
         try {


[2/4] tomee-site-generator git commit: Prune old examples code

Posted by db...@apache.org.
Prune old examples code


Project: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/commit/d54197d4
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/d54197d4
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/d54197d4

Branch: refs/heads/master
Commit: d54197d47d07757af3dc91a4c3dc8dd5a7be20c4
Parents: bb31cae
Author: David Blevins <da...@gmail.com>
Authored: Sun Dec 9 09:09:15 2018 -0800
Committer: David Blevins <da...@gmail.com>
Committed: Sun Dec 9 09:09:15 2018 -0800

----------------------------------------------------------------------
 .../java/org/apache/tomee/website/Examples.java | 319 -------------------
 .../java/org/apache/tomee/website/JBake.java    |   2 -
 src/main/jbake/jbake.properties                 |   1 -
 src/main/jbake/templates/examples.gsp           | 202 ------------
 4 files changed, 524 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/d54197d4/src/main/java/org/apache/tomee/website/Examples.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Examples.java b/src/main/java/org/apache/tomee/website/Examples.java
deleted file mode 100755
index efab3d5..0000000
--- a/src/main/java/org/apache/tomee/website/Examples.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package org.apache.tomee.website;
-
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.apache.johnzon.jaxrs.JohnzonProvider;
-import org.apache.johnzon.mapper.JohnzonProperty;
-import org.apache.johnzon.mapper.MapperBuilder;
-
-import javax.ws.rs.ForbiddenException;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.GenericType;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.nio.charset.StandardCharsets;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Stream;
-
-import static java.util.Arrays.asList;
-import static java.util.Optional.ofNullable;
-import static java.util.stream.Collectors.toList;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
-import static lombok.AccessLevel.PRIVATE;
-import static org.apache.commons.codec.binary.Base64.decodeBase64;
-
-@NoArgsConstructor(access = PRIVATE)
-public class Examples {
-    private static final String DEFAULT_README = "No README.md yet, be the first to contribute one!";
-
-    // don't load it for each page, would be pretty inefficient
-    private static final Map<String, Collection<Example>> CACHE = new TreeMap<>();
-    private static final String CACHE_FILE = "examples.cache";
-    private static final Collection<String> EXCLUDED_KEYWORDS = new HashSet<>(asList(
-            "with", "jvm", "preview", "demo", "to", "a", "access", "and", "app", "application", "auto", "basic", "bean", "by", "change", "complete",
-            "composer", "custom", "declared", "example", "handling", "in", "by", "change", "simple", "interface"));
-
-    public static void populateTree() {
-        final String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
-        load();
-        CACHE.forEach((tag, examples) -> examples.forEach(e -> {
-            try (final Writer w = new FileWriter("src/main/jbake/content/examples/" + e.getName() + ".adoc")) {
-                w.write("= " + findTitle(e.getName(), e.getReadme()) + "\n" +
-                        ":jbake-date: " + date + "\n" +
-                        ":jbake-type: page\n" +
-                        ":jbake-tomeepdf:\n" +
-                        ":jbake-status: published\n\n" +
-                        "Example " + e.getName() + " can be browsed at " + e.getUrl() + "\n\n" +
-                        mdToAdoc(e.getReadme()));
-            } catch (final IOException ioe) {
-                throw new IllegalStateException(ioe);
-            }
-        }));
-    }
-
-    public static ExampleWrapper loadAll() {
-        load();
-        return new ExampleWrapper(CACHE, CACHE.values().stream().mapToInt(Collection::size).sum());
-    }
-
-    public static void load() {
-        if (!CACHE.isEmpty()) {
-            return;
-        }
-
-        final File cache = new File(CACHE_FILE);
-        if (cache.isFile()) {
-            System.out.println("Reading examples from cache, delete " + CACHE_FILE + " if you want to reload them");
-            try (final InputStream is = new FileInputStream(cache)) {
-                final ExampleWrapper wrapper = new MapperBuilder().build().readObject(is, ExampleWrapper.class);
-                CACHE.putAll(wrapper.getAll());
-            } catch (IOException e) {
-                throw new IllegalArgumentException(e);
-            }
-            return;
-        }
-
-        final Client client = ClientBuilder.newClient().register(new JohnzonProvider<>());
-        try {
-            final WebTarget github = client.target("https://api.github.com");
-            final Invocation.Builder request = github.path("repos/apache/tomee/contents/examples").request(APPLICATION_JSON_TYPE);
-            final String auth = System.getProperty("github.auth");
-            if (auth != null) {
-                request.header("Authorization", auth);
-            }
-            request
-                    .get(new GenericType<Collection<GithubContentItem>>() {
-                    }).stream().filter(i -> "dir".equals(i.getType()))
-                    .parallel()
-                    .sorted((i1, i2) -> i1.getName().compareTo(i2.getName()))
-                    .map(i -> new Example(i.getName(), i.getHtmlUrl(), loadReadme(auth, github, i)))
-                    .forEach(example -> {
-                        final Collection<String> split = Stream.of(example.getName()
-                                .replace("application-composer", "applicationcomposer")
-                                .replace("configproperty", "config")
-                                .replace("descriptors", "descriptor")
-                                .replace("ejbs", "ejb")
-                                .replace("env-entry", "enventry")
-                                .replace("events", "event")
-                                .replace("interceptors", "interceptor")
-                                .split("-"))
-                                .filter(s -> !EXCLUDED_KEYWORDS.contains(s))
-                                .filter(s -> {
-                                    try {
-                                        Integer.parseInt(s);
-                                        return false;
-                                    } catch (final NumberFormatException nfe) {
-                                        return true;
-                                    }
-                                })
-                                .collect(toList());
-                        if (split.isEmpty()) {
-                            CACHE.computeIfAbsent("Unclassified", k -> new ArrayList<>()).add(example);
-                        } else {
-                            for (final String keyword : split) {
-                                CACHE.computeIfAbsent(keyword, k -> new ArrayList<>()).add(example);
-                            }
-                        }
-                    });
-
-            // debug stats
-            final int totalExamples = CACHE.size();
-            final long exampleMissingReadme = CACHE.values().stream().flatMap(Collection::stream).filter(e -> DEFAULT_README.equals(e.getReadme())).count();
-            System.out.println(exampleMissingReadme + "/" + totalExamples + " miss a README.md");
-            CACHE.values().stream().flatMap(Collection::stream).filter(e -> DEFAULT_README.equals(e.getReadme())).forEach(e -> System.out.println("  - " + e.getName()));
-
-            try (final OutputStream os = new FileOutputStream(CACHE_FILE)) {
-                new MapperBuilder().setPretty(true).build().writeObject(loadAll(), os);
-            } catch (final IOException e) {
-                throw new IllegalArgumentException(e);
-            }
-        } finally {
-            client.close();
-        }
-    }
-
-    private static String loadReadme(final String auth, final WebTarget github, final GithubContentItem i) {
-        try {
-            final Invocation.Builder request = github.path("repos/apache/tomee/contents/examples/{name}/README.md")
-                    .resolveTemplate("name", i.getName()).request(APPLICATION_JSON_TYPE);
-            if (auth != null) {
-                request.header("Authorization", auth);
-            }
-            return ofNullable(request
-                    .get(GithubContentItem.class)
-                    .getContent())
-                    .map(c -> new String(decodeBase64(c), StandardCharsets.UTF_8))
-                    .orElse(DEFAULT_README);
-        } catch (final NotFoundException wae) {
-            System.err.println(wae.getMessage() + " for the README.md of " + i.getName());
-            return DEFAULT_README;
-        } catch (final ForbiddenException wae) {
-            System.err.println("Can't retrieve examples, set -Dgithub.auth=.... to get a higher rate limit");
-            return DEFAULT_README;
-        }
-    }
-
-    private static String findTitle(final String name, final String readme) {
-        try (final BufferedReader reader = new BufferedReader(new StringReader(readme))) {
-            String line;
-            while ((line = reader.readLine()) != null) {
-                if (line.startsWith("Title: ")) {
-                    return line.substring("Title: ".length());
-                }
-            }
-        } catch (final IOException e) {
-            throw new IllegalStateException(e);
-        }
-        return name;
-    }
-
-    // quick cleanup of markdown syntax to adoc one used there
-    private static String mdToAdoc(final String s) {
-        final Pattern link = Pattern.compile("(.*)\\[([^\\]]*)\\]\\(([^\\)]*)\\)(.*)");
-
-        try (final StringWriter writer = new StringWriter();
-             final BufferedReader reader = new BufferedReader(new StringReader(s))) {
-            String line;
-            while ((line = reader.readLine()) != null) {
-                if (line.startsWith("Title: ")) {
-                    continue;
-                }
-                if (line.startsWith("#")) {
-                    for (int i = 0; i < line.length(); i++) {
-                        if (line.charAt(i) == '#') {
-                            writer.append('=');
-                        } else {
-                            writer.append(" ").append(line.substring(i));
-                            break;
-                        }
-                    }
-                } else if (line.startsWith("    package") || line.startsWith("    import") || line.startsWith("    public ") || line.startsWith("    @")) { // java code
-                    writer.append("\n[source,java]\n----\n");
-                    writer.append(line.replaceFirst("    ", "")).append('\n');
-                    while ((line = reader.readLine()) != null) {
-                        writer.append(line.replaceFirst("    ", "")).append('\n');
-                        if ("    }".equals(line)) {
-                            writer.append("----\n");
-                            break;
-                        }
-                    }
-                } else if (line.startsWith("    <")) { // xml code
-                    writer.append("\n[source,xml]\n----\n");
-                    if (line.startsWith("    <?")) { // prolog
-                        writer.append(line.replaceFirst("    ", "")).append('\n');
-                        line = reader.readLine();
-                    }
-                    while (line != null && line.trim().isEmpty()) {
-                        line = reader.readLine();
-                    }
-                    if (line.trim().startsWith("<!--")) {
-                        if (line.contains("-->")) {
-                            writer.append(line.replaceFirst("    ", "")).append('\n');
-                        } else {
-                            do {
-                                writer.append(line.replaceFirst("    ", "")).append('\n');
-                            } while ((line = reader.readLine()) != null && !line.trim().equals("-->"));
-                            writer.append(line.replaceFirst("    ", "")).append('\n');
-                        }
-                        line = reader.readLine();
-                        while (line != null && line.trim().isEmpty()) {
-                            line = reader.readLine();
-                        }
-                    }
-
-                    if (line.trim().endsWith("/>")) {
-                        writer.append(line.replaceFirst("    ", "")).append('\n');
-                        writer.append("----\n");
-                    } else {
-                        final int space = line.indexOf(' ', 5);
-                        final String end = "</" + line.substring(5, space < 0 ? line.indexOf('>') : space) + ">";
-                        writer.append(line.replaceFirst("    ", "")).append('\n');
-                        while ((line = reader.readLine()) != null) {
-                            writer.append(line.replaceFirst("    ", "")).append('\n');
-                            if (end.equals(line.trim())) {
-                                writer.append("----\n");
-                                break;
-                            }
-                        }
-                    }
-                } else if (line.startsWith("    -------------------------------------------------------")) { // run output
-                    writer.append("\n[source]\n----\n");
-                    writer.append(line.replaceFirst("    ", "")).append('\n');
-                    while ((line = reader.readLine()) != null) {
-                        writer.append(line.replaceFirst("    ", "")).append('\n');
-                        if (line.startsWith("    Tests run:") && !line.contains("Time elapsed:")) {
-                            writer.append("----\n");
-                            break;
-                        }
-                    }
-                } else if (line.startsWith(">")) {
-                    writer.append("\nNOTE: ").append(line.substring(1)).append("\n");
-                } else {
-                    final Matcher matcher = link.matcher(line);
-                    if (matcher.matches()) {
-                        String l = matcher.group(3);
-                        if (l.startsWith("../") && l.endsWith("README.html")) { // hack for old relative links
-                            l = l.substring("../".length(), l.length() - "/README.html".length()) + ".html";
-                        }
-                        writer.append(matcher.group(1)).append("link:").append(l).append('[').append(matcher.group(2)).append(']').append(matcher.group(4));
-                    } else {
-                        writer.append(line);
-                    }
-                }
-                writer.append('\n');
-            }
-            return writer.toString();
-        } catch (final IOException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    public static void main(final String[] args) {
-        populateTree();
-    }
-
-    @Data
-    public static class ExampleWrapper {
-        private final Map<String, Collection<Example>> all;
-        private final int total;
-    }
-
-    @Data
-    public static class Example {
-        private final String name;
-        private final String url;
-        private final String readme;
-    }
-
-    @Data
-    public static class GithubContentItem {
-        private String name;
-        private String path;
-        private String type;
-        private String content;
-
-        @JohnzonProperty("html_url")
-        private String htmlUrl;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/d54197d4/src/main/java/org/apache/tomee/website/JBake.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/JBake.java b/src/main/java/org/apache/tomee/website/JBake.java
index 7105a9d..147fe8d 100755
--- a/src/main/java/org/apache/tomee/website/JBake.java
+++ b/src/main/java/org/apache/tomee/website/JBake.java
@@ -33,10 +33,8 @@ public class JBake {
         System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "64"); // try to have parallelStream better than default
 
         final File source = args == null || args.length < 1 ? new File("src/main/jbake") : new File(args[0]);
-        final File pdfSource = new File(source, "content");
         final File destination = args == null || args.length < 2 ? new File("target/site-tmp") : new File(args[1]);
         final boolean startHttp = args == null || args.length < 2 || Boolean.parseBoolean(args[2]); // by default we dev
-        final boolean skipPdf = args == null || args.length < 3 || Boolean.parseBoolean(args[3]); // by default...too slow sorry
 
         final Sources sources = new Sources(
                 new File("target/jbake"),

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/d54197d4/src/main/jbake/jbake.properties
----------------------------------------------------------------------
diff --git a/src/main/jbake/jbake.properties b/src/main/jbake/jbake.properties
index 4e56dfa..739db5a 100755
--- a/src/main/jbake/jbake.properties
+++ b/src/main/jbake/jbake.properties
@@ -12,7 +12,6 @@ template.docsindex.file = docs-index.gsp
 template.examplesindex.file = examples-index.gsp
 template.post.file = post.gsp
 template.contributors.file = contributors.gsp
-template.examples.file = examples.gsp
 template.blog.file = blog.gsp
 # template.archive.file = archive.gsp
 # template.tag.file = tags.gsp

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/d54197d4/src/main/jbake/templates/examples.gsp
----------------------------------------------------------------------
diff --git a/src/main/jbake/templates/examples.gsp b/src/main/jbake/templates/examples.gsp
deleted file mode 100755
index b68f547..0000000
--- a/src/main/jbake/templates/examples.gsp
+++ /dev/null
@@ -1,202 +0,0 @@
-<%include "header.gsp"%>
-<%include "menu.gsp"%>
-
-<div id="main-block" class="container main-block">
-<div class="row title">
-  <div class='page-header'>
-    <% if (content.containsKey('tomeepdf')) { %>
-    <div class='btn-toolbar pull-right'>
-      <div class='btn-group'>
-        <a class="btn" href="<%if (content.rootpath) {%>${content.rootpath}<% } else { %><% }%>${content.uri.replace('html', 'pdf')}">
-          <i class="fa fa-file-pdf-o"></i> Download as PDF
-        </a>
-      </div>
-    </div>
-    <% } %>
-    <h2>${content.title}</h2>
-  </div>
-</div>
-<div class="row">
-  <div class="col-md-12">
-    <input id="example-search" placeholder="Search an example and click on it to browse it..." class="typeahead"/>
-  </div>
-  <div class="vspace">&nbsp;</div>
-  <div class="col-md-12 examples text-center">
-    <%
-    def all = org.apache.tomee.website.Examples.loadAll()
-    def keys = []
-    keys.addAll(all.all.keySet())
-
-    [keys.subList(0, (int) keys.size() / 2), keys.subList((int) keys.size() / 2, keys.size())].each { list ->
-      keys.subList(0, (int) keys.size() / 2).each { tag ->
-      examples = all.all[tag]
-    %>
-    <div class="col-sm-6">
-      <h3>${tag}</h3>
-      <ul class="list-unstyled">
-        <% examples.each {example -> %>
-        <li><a href="${example.name}.html">${example.name}</a></li>
-        <% } %>
-      </ul>
-    </div>
-    <% }} %>
-  </div>
-</div>
-</div>
-
-<style>
-.typeahead {
-    padding-left: 43px;
-    padding-right: 43px;
-    border-radius: 23px;
-    border:1px #ccc solid;
-    height: 46px;
-    width: 100%;
-    outline: none;
-}
-.typeahead:focus {
-    border-color: #66afe9;
-    outline: 0;
-    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
-}
-
-
-/* typeahead styling*/
-.tt-menu hr {
-    margin-bottom: 5px;
-    margin-top: 5px;
-}
-.tt-menu h3 {
-    margin-bottom: 2px;
-    margin-top: 2px;
-    padding-bottom: 2px;
-    padding-top: 2px;
-    font-size: 18px;
-    font-weight: bolder;
-}
-.tt-menu h2 {
-    font-weight: bold;
-}
-span.twitter-typeahead .tt-menu,
-span.twitter-typeahead .tt-dropdown-menu {
-  z-index: 1000;
-  display: none;
-  width: 100%;
-  min-width: 160px;
-  padding: 5px 0;
-  margin: 2px 0 0;
-  list-style: none;
-  text-align: left;
-  background-color: #ffffff;
-  border: 1px solid #cccccc;
-  border: 1px solid rgba(0, 0, 0, 0.15);
-  border-radius: 4px;
-  -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
-  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
-  background-clip: padding-box;
-}
-span.twitter-typeahead h3 {
-  padding-left: 15px;
-  clear: both;
-}
-span.twitter-typeahead .tt-suggestion {
-  display: block;
-  padding: 3px 15px;
-  clear: both;
-  font-weight: normal;
-  line-height: 1.42857143;
-  color: #333333;
-}
-span.twitter-typeahead .tt-suggestion.tt-cursor,
-span.twitter-typeahead .tt-suggestion:hover,
-span.twitter-typeahead .tt-suggestion:focus {
-  color: #ffffff;
-  text-decoration: none;
-  outline: 0;
-  background-color: #337ab7;
-}
-.input-group.input-group-lg span.twitter-typeahead .form-control {
-  height: 46px;
-  padding: 10px 16px;
-  line-height: 1.3333333;
-  border-radius: 6px;
-}
-.input-group.input-group-sm span.twitter-typeahead .form-control {
-  height: 30px;
-  padding: 5px 10px;
-  line-height: 1.5;
-  border-radius: 3px;
-}
-span.twitter-typeahead {
-  width: 100%;
-}
-.input-group span.twitter-typeahead {
-  display: block !important;
-  height: 34px;
-}
-.input-group span.twitter-typeahead .tt-menu,
-.input-group span.twitter-typeahead .tt-dropdown-menu {
-  top: 32px !important;
-}
-.input-group span.twitter-typeahead:not(:first-child):not(:last-child) .form-control {
-  border-radius: 0;
-}
-.input-group span.twitter-typeahead:first-child .form-control {
-  border-top-left-radius: 4px;
-  border-bottom-left-radius: 4px;
-  border-top-right-radius: 0;
-  border-bottom-right-radius: 0;
-}
-.input-group span.twitter-typeahead:last-child .form-control {
-  border-top-left-radius: 0;
-  border-bottom-left-radius: 0;
-  border-top-right-radius: 4px;
-  border-bottom-right-radius: 4px;
-}
-.input-group.input-group-sm span.twitter-typeahead {
-  height: 30px;
-}
-.input-group.input-group-sm span.twitter-typeahead .tt-menu,
-.input-group.input-group-sm span.twitter-typeahead .tt-dropdown-menu {
-  top: 30px !important;
-}
-.input-group.input-group-lg span.twitter-typeahead {
-  height: 46px;
-}
-.input-group.input-group-lg span.twitter-typeahead .tt-menu,
-.input-group.input-group-lg span.twitter-typeahead .tt-dropdown-menu {
-  top: 46px !important;
-}
-</style>
-<script src="<%if (content.rootpath) {%>${content.rootpath}<% } else { %><% }%>js/jquery-1.11.1.min.js"></script>
-<script src="<%if (content.rootpath) {%>${content.rootpath}<% } else { %><% }%>js/typeahead.bundle.min.js"></script>
-<script>
-(function () {
-  var names = [];
-  document.querySelectorAll('.examples li > a').forEach(function (s) {
-    names.push(s.innerHTML);
-  });
-  var engine = new Bloodhound({
-    datumTokenizer: Bloodhound.tokenizers.nonword,
-    queryTokenizer: Bloodhound.tokenizers.nonword,
-    local: names
-  });
-  var input = jQuery('#example-search');
-  input.typeahead({ minLength: 1, highlight: true }, {
-    name: 'Examples',
-    source: engine,
-    templates: {
-      suggestion: function (item) {
-        return '<a href="' + item + '.html">' + item + '</a>';
-      }
-    }
-  });
-  input.bind('typeahead:select', function (evt, item) {
-    jQuery('li > a[href="' + item + '.html"]').click();
-  });
-})();
-
-</script>
-
-<%include "footer.gsp"%>
-