Repository: tomee-site-generator Updated Branches: refs/heads/master 27d6e3ab5 -> 95dc035ff
Make adds recursive 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/95dc035f Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/95dc035f Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/95dc035f Branch: refs/heads/master Commit: 95dc035ffcacff70b66d1c1195248c9883383f71 Parents: 27d6e3a Author: dblevins <[email protected]> Authored: Sat Dec 1 17:08:05 2018 -0800 Committer: dblevins <[email protected]> Committed: Sat Dec 1 17:08:05 2018 -0800 ---------------------------------------------------------------------- .../java/org/apache/tomee/website/SvnPub.java | 85 +++++++++++--------- src/main/jbake/assets/css/cardio.css | 6 +- 2 files changed, 48 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/95dc035f/src/main/java/org/apache/tomee/website/SvnPub.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/tomee/website/SvnPub.java b/src/main/java/org/apache/tomee/website/SvnPub.java index 78c3d10..cdd8c6b 100644 --- a/src/main/java/org/apache/tomee/website/SvnPub.java +++ b/src/main/java/org/apache/tomee/website/SvnPub.java @@ -17,6 +17,7 @@ package org.apache.tomee.website; import org.apache.commons.io.FileUtils; +import org.apache.xml.security.exceptions.Base64DecodingException; import org.tmatesoft.svn.core.SVNCommitInfo; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; @@ -37,21 +38,19 @@ import org.tmatesoft.svn.core.wc2.SvnTarget; import java.io.File; import java.io.IOException; import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; import java.util.Date; -import java.util.stream.Stream; +import java.util.HashMap; +import java.util.Map; import static java.util.Arrays.asList; import static java.util.Optional.ofNullable; -import static java.util.stream.Collectors.toList; public class SvnPub { private SvnPub() { // no-op } - public static void main(final String[] args) throws SVNException, IOException { + public static void main(final String[] args) throws SVNException, IOException, Base64DecodingException { SVNJNAUtil.setJNAEnabled(false); // svnkit and java 8 == easy sigsev on ubuntu (fixed when upgrading svnkit version) final String username = System.getProperty("site.username", System.getenv("USER")); @@ -93,52 +92,58 @@ public class SvnPub { } FileUtils.copyDirectory(site[0], copy); - final Collection<File> added = new ArrayList<>(); - final Collection<File> updated = new ArrayList<>(); - client.getStatusClient().doStatus(copy, SVNRevision.HEAD, SVNDepth.INFINITY, false, false, false, false, new ISVNStatusHandler() { - @Override - public void handleStatus(final SVNStatus status) throws SVNException { - final SVNStatusType contentsStatus = status.getContentsStatus(); - if (contentsStatus == SVNStatusType.STATUS_UNVERSIONED) { - added.add(status.getFile()); - } else if (contentsStatus == SVNStatusType.STATUS_MODIFIED || contentsStatus == SVNStatusType.STATUS_REPLACED) { - updated.add(status.getFile()); - } // else we don't care - } - }, null); - - final Collection<File> copies = Stream.concat(added.stream(), updated.stream()).collect(toList()); - // remove the .pdf without their .html, likely means there is no real update - added.removeIf(f -> f.getName().endsWith(".pdf") && !copies.contains(new File(f.getParentFile(), f.getName().replace(".pdf", ".html")))); - updated.removeIf(f -> f.getName().endsWith(".pdf") && !copies.contains(new File(f.getParentFile(), f.getName().replace(".pdf", ".html")))); - - if (updated.size() + added.size() == 0) { + final Path sitePath = copy.getAbsoluteFile().toPath(); + + final Map<String, File> changed = new HashMap<>(); + int previous = 0; + + do { + previous = changed.size(); + + client.getStatusClient().doStatus(copy, SVNRevision.HEAD, SVNDepth.INFINITY, false, false, false, false, new ISVNStatusHandler() { + @Override + public void handleStatus(final SVNStatus status) throws SVNException { + final SVNStatusType contentsStatus = status.getContentsStatus(); + final File file = status.getFile(); + + final String path = sitePath.relativize(file.getAbsoluteFile().toPath()).toString(); + + if (contentsStatus == SVNStatusType.STATUS_UNVERSIONED || contentsStatus == SVNStatusType.STATUS_NONE) { + + changed.put(path, file); + client.getWCClient().doAdd(file, false, false, false, SVNDepth.INFINITY, false, false, true); + System.out.println("A " + path); + + } else if (contentsStatus == SVNStatusType.STATUS_MODIFIED || contentsStatus == SVNStatusType.STATUS_REPLACED) { + + if (changed.put(path, file) == null) { + System.out.println("M " + path); + } + + } // else we don't care + } + }, null); + + } while (changed.size() != previous); + + if (changed.size() == 0) { System.out.println("Nothing to commit!"); return; } - added.forEach(f -> { - try { - client.getWCClient().doAdd(f, false, false, false, SVNDepth.INFINITY, false, false, true); - } catch (final SVNException e) { - throw new IllegalStateException(e); - } - }); - - final Path sitePath = copy.getAbsoluteFile().toPath(); - added.forEach(f -> System.out.println("A " + sitePath.relativize(f.getAbsoluteFile().toPath()))); - updated.forEach(f -> System.out.println("M " + sitePath.relativize(f.getAbsoluteFile().toPath()))); - // now update it remotely, note: we could use the status output to do it more efficiently final String message = ofNullable(args == null || args.length < 2 ? System.getProperty("site.message") : args[1]) .filter(m -> !"notset".equalsIgnoreCase(m)) .orElseGet(() -> "Maven update of the website on the " + new Date() + " from " + username); - final SVNCommitInfo commitInfo = client.getCommitClient().doCommit( - Stream.concat(added.stream(), updated.stream()).toArray(File[]::new), false, message, - null, null, false, false, SVNDepth.IMMEDIATES); + + final File[] commit = changed.values().stream().toArray(File[]::new); + + final SVNCommitInfo commitInfo = client.getCommitClient().doCommit(commit, false, message, null, null, false, false, SVNDepth.IMMEDIATES); + if (commitInfo.getErrorMessage() != null) { throw new IllegalStateException(commitInfo.getErrorMessage().toString()); } + System.out.println(commitInfo.toString()); // do we want to POST https://cms.apache.org/tomee/publish?diff=1 \ http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/95dc035f/src/main/jbake/assets/css/cardio.css ---------------------------------------------------------------------- diff --git a/src/main/jbake/assets/css/cardio.css b/src/main/jbake/assets/css/cardio.css index 617bd32..4225162 100755 --- a/src/main/jbake/assets/css/cardio.css +++ b/src/main/jbake/assets/css/cardio.css @@ -130,9 +130,9 @@ body { line-height: 1.5; -webkit-font-smoothing: antialiased; } -h1, .h1, h2, .h2, h3, .h3, h4, .h4, { - margin-top: 30px; - margin-bottom: 10px; +h1, .h1, h2, .h2, h3, .h3, h4, .h4 { + margin-top: 20px; + margin-bottom: 20px; } h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 300;
