openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1837992 - in /openwebbeans/meecrowave/trunk: ./ meecrowave-doc/ meecrowave-doc/src/main/java/org/apache/meecrowave/doc/ meecrowave-doc/src/main/java/org/apache/meecrowave/doc/generator/ meecrowave-doc/src/main/jbake/content/
Date Tue, 14 Aug 2018 08:01:09 GMT
Author: rmannibucau
Date: Tue Aug 14 08:01:09 2018
New Revision: 1837992

URL: http://svn.apache.org/viewvc?rev=1837992&view=rev
Log:
enhancing out site generation to be one maven command

Modified:
    openwebbeans/meecrowave/trunk/.gitignore
    openwebbeans/meecrowave/trunk/meecrowave-doc/pom.xml
    openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/JBake.java
    openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/generator/Downloads.java
    openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc

Modified: openwebbeans/meecrowave/trunk/.gitignore
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/.gitignore?rev=1837992&r1=1837991&r2=1837992&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/.gitignore (original)
+++ openwebbeans/meecrowave/trunk/.gitignore Tue Aug 14 08:01:09 2018
@@ -7,3 +7,4 @@ target
 *.iml
 *.log
 *~
+.site-content
\ No newline at end of file

Modified: openwebbeans/meecrowave/trunk/meecrowave-doc/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-doc/pom.xml?rev=1837992&r1=1837991&r2=1837992&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-doc/pom.xml (original)
+++ openwebbeans/meecrowave/trunk/meecrowave-doc/pom.xml Tue Aug 14 08:01:09 2018
@@ -27,11 +27,16 @@
 
   <artifactId>meecrowave-doc</artifactId>
   <name>Meecrowave :: Doc</name>
-  <description>A module building the static website in ${project.build.directory}/${project.build.finalName}</description>
+  <description>
+    A module building the static website in ${project.build.directory}/${project.build.finalName}
+    To build use that command:
+    $ mvn clean compile scm-publish:publish-scm [-Djbake.updatedownloads=true]
+  </description>
 
   <properties>
     <jbake.http>false</jbake.http>
     <jbake.pdf>true</jbake.pdf>
+    <jbake.updatedownloads>false</jbake.updatedownloads> <!-- grabs too much
things on the net to be true by default -->
     <meecrowave.build.name>${project.groupId}.documentation</meecrowave.build.name>
   </properties>
 
@@ -151,9 +156,30 @@
             <argument>${project.build.directory}/${project.build.finalName}</argument>
             <argument>${jbake.http}</argument>
             <argument>${jbake.pdf}</argument>
+            <argument>${jbake.updatedownloads}</argument>
           </arguments>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-scm-publish-plugin</artifactId>
+        <version>1.0-beta-2</version>
+        <configuration>
+          <content>${project.build.directory}/${project.build.finalName}</content>
+          <pubScmUrl>scm:svn:https://svn.apache.org/repos/infra/websites/production/openwebbeans/content/meecrowave</pubScmUrl>
+          <tryUpdate>true</tryUpdate>
+          <checkoutDirectory>${project.parent.basedir}/.site-content</checkoutDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <id>scm-publish</id>
+            <phase>site-deploy</phase>
+            <goals>
+              <goal>publish-scm</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 

Modified: openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/JBake.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/JBake.java?rev=1837992&r1=1837991&r2=1837992&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/JBake.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/JBake.java
Tue Aug 14 08:01:09 2018
@@ -18,21 +18,17 @@
  */
 package org.apache.meecrowave.doc;
 
-import com.orientechnologies.orient.core.Orient;
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.MapConfiguration;
-import org.apache.meecrowave.Meecrowave;
-import org.apache.meecrowave.doc.generator.ArquillianConfiguration;
-import org.apache.meecrowave.doc.generator.CliConfiguration;
-import org.apache.meecrowave.doc.generator.Configuration;
-import org.apache.meecrowave.doc.generator.LetsEncryptConfiguration;
-import org.apache.meecrowave.doc.generator.MavenConfiguration;
-import org.apache.meecrowave.doc.generator.OAuth2Configuration;
-import org.jbake.app.ConfigUtil;
-import org.jbake.app.Oven;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
 
+import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
+import java.io.PrintStream;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.ClosedWatchServiceException;
 import java.nio.file.Path;
 import java.nio.file.WatchEvent;
@@ -46,9 +42,20 @@ import java.util.concurrent.atomic.Atomi
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Stream;
 
-import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
-import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
-import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
+import org.apache.commons.configuration.CompositeConfiguration;
+import org.apache.commons.configuration.MapConfiguration;
+import org.apache.meecrowave.Meecrowave;
+import org.apache.meecrowave.doc.generator.ArquillianConfiguration;
+import org.apache.meecrowave.doc.generator.CliConfiguration;
+import org.apache.meecrowave.doc.generator.Configuration;
+import org.apache.meecrowave.doc.generator.Downloads;
+import org.apache.meecrowave.doc.generator.LetsEncryptConfiguration;
+import org.apache.meecrowave.doc.generator.MavenConfiguration;
+import org.apache.meecrowave.doc.generator.OAuth2Configuration;
+import org.jbake.app.ConfigUtil;
+import org.jbake.app.Oven;
+
+import com.orientechnologies.orient.core.Orient;
 
 public class JBake {
     private JBake() {
@@ -64,6 +71,7 @@ public class JBake {
         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 boolean updateDownloads = args != null && args.length > 4 &&
Boolean.parseBoolean(args[4]); // grabs central
 
         // generation of dynamic content
         new Configuration().run();
@@ -73,6 +81,31 @@ public class JBake {
         new OAuth2Configuration().run();
         new LetsEncryptConfiguration().run();
 
+        if (updateDownloads) {
+            final ByteArrayOutputStream tableContent = new ByteArrayOutputStream();
+            try (final PrintStream stream = new PrintStream(tableContent)) {
+                Downloads.doMain(stream);
+            }
+            try (final Writer writer = new FileWriter(new File(source, "content/download.adoc")))
{
+                writer.write("= Downloads\n"
+                        + ":jbake-generated: true\n"
+                        + ":jbake-date: 2017-07-24\n"
+                        + ":jbake-type: page\n"
+                        + ":jbake-status: published\n"
+                        + ":jbake-meecrowavepdf:\n"
+                        + ":jbake-meecrowavecolor: body-blue\n"
+                        + ":icons: font\n"
+                        + "\n"
+                        + "License under Apache License v2 (ALv2).\n"
+                        + "\n"
+                        + "[.table.table-bordered,options=\"header\"]\n"
+                        + "|===\n"
+                        + "|Name|Version|Date|Size|Type|Links\n");
+                writer.write(new String(tableContent.toByteArray(), StandardCharsets.UTF_8));
+                writer.write("\n|===\n");
+            }
+        }
+
         final Runnable build = () -> {
             System.out.println("Building Meecrowave website in " + destination);
             final Orient orient = Orient.instance();

Modified: openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/generator/Downloads.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/generator/Downloads.java?rev=1837992&r1=1837991&r2=1837992&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/generator/Downloads.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/java/org/apache/meecrowave/doc/generator/Downloads.java
Tue Aug 14 08:01:09 2018
@@ -27,6 +27,7 @@ import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PrintStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.time.LocalDateTime;
@@ -64,6 +65,10 @@ public class Downloads {
     }
 
     public static void main(final String[] args) {
+        doMain(System.out);
+    }
+
+    public static void doMain(final PrintStream stream) {
         System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "32");
         Stream.of(
                 Stream.of("org/apache/meecrowave/meecrowave")
@@ -73,12 +78,12 @@ public class Downloads {
                 versionStream("meecrowave-core")
                         .map(v -> v.classifiers("", "runner"))
                         .map(v -> v.extensions("jar")))
-                .flatMap(s -> s)
-                .flatMap(Downloads::toDownloadable)
-                .parallel()
-                .map(Downloads::fillDownloadable)
-                .filter(Objects::nonNull)
-                .sorted((o1, o2) -> {
+              .flatMap(s -> s)
+              .flatMap(Downloads::toDownloadable)
+              .parallel()
+              .map(Downloads::fillDownloadable)
+              .filter(Objects::nonNull)
+              .sorted((o1, o2) -> {
                     final int versionComp = o2.version.compareTo(o1.version);
                     if (versionComp != 0) {
                         if (o2.version.startsWith(o1.version) && o2.version.contains("-M"))
{ // milestone
@@ -104,9 +109,9 @@ public class Downloads {
 
                     return o1.url.compareTo(o2.url);
                 })
-                .collect(toList())
-                .forEach(d ->
-                        System.out.println("" +
+              .collect(toList())
+              .forEach(d ->
+                        stream.println("" +
                                 "|" + d.name + (d.classifier.isEmpty() ? "" : (" " + d.classifier)).replace("source-release",
"Source Release") +
                                 "|" + d.version +
                                 "|" + d.date +

Modified: openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc?rev=1837992&r1=1837991&r2=1837992&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc (original)
+++ openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc Tue
Aug 14 08:01:09 2018
@@ -1,4 +1,5 @@
 = Downloads
+:jbake-generated: true
 :jbake-date: 2017-07-24
 :jbake-type: page
 :jbake-status: published



Mime
View raw message