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/11/30 22:26:46 UTC

[02/34] tomee-site-generator git commit: Pull examples and docs from active branches

Pull examples and docs from active branches


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/3c8d3037
Tree: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/tree/3c8d3037
Diff: http://git-wip-us.apache.org/repos/asf/tomee-site-generator/diff/3c8d3037

Branch: refs/heads/master
Commit: 3c8d3037d12581fa02383ee2552146332871d385
Parents: 88e7874
Author: dblevins <da...@gmail.com>
Authored: Sun Nov 25 20:35:16 2018 -0800
Committer: dblevins <da...@gmail.com>
Committed: Sun Nov 25 20:35:16 2018 -0800

----------------------------------------------------------------------
 .../java/org/apache/tomee/website/Docs.java     |  44 +++++
 .../java/org/apache/tomee/website/Example.java  |  75 ++++++++
 .../org/apache/tomee/website/Examples2.java     | 192 +++++++++++++++++++
 .../java/org/apache/tomee/website/JBake.java    |  16 +-
 .../java/org/apache/tomee/website/Repos.java    |  97 ++++++++++
 .../java/org/apache/tomee/website/Source.java   |  75 ++++++++
 .../java/org/apache/tomee/website/Sources.java  | 158 +++------------
 7 files changed, 526 insertions(+), 131 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/3c8d3037/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
new file mode 100644
index 0000000..500cf3a
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/Docs.java
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+public class Docs {
+
+    private final Sources sources;
+
+    public Docs(final Sources sources) {
+        this.sources = sources;
+    }
+
+    public void prepare(final Source source) {
+        final File srcDocs = new File(source.getDir(), "docs");
+        final File destDocs = sources.getDestinationFor(source, "docs");
+
+        if (!srcDocs.exists()) return;
+
+        try {
+            IO.copyDirectory(srcDocs, destDocs);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/3c8d3037/src/main/java/org/apache/tomee/website/Example.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Example.java b/src/main/java/org/apache/tomee/website/Example.java
new file mode 100644
index 0000000..152729b
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/Example.java
@@ -0,0 +1,75 @@
+/*
+ * 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 java.io.File;
+
+public class Example {
+    private final File srcReadme;
+    private File destReadme;
+    private final String name;
+    private final String ext;
+    private final String href;
+    private final String category;
+
+    public Example(final File srcReadme, final String name, final String ext, final String href, final String category) {
+        this.srcReadme = srcReadme;
+        this.name = name;
+        this.ext = ext;
+        this.href = href;
+        this.category = category;
+    }
+
+    public void updateDestination(final File examplesDir) {
+        this.setDestReadme(new File(examplesDir, this.getName() + "." + this.getExt()));
+    }
+
+    public File getDestReadme() {
+        return destReadme;
+    }
+
+    public void setDestReadme(final File destReadme) {
+        this.destReadme = destReadme;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getHref() {
+        return href;
+    }
+
+    public File getSrcReadme() {
+        return srcReadme;
+    }
+
+    public String getExt() {
+        return ext;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public static Example from(final File readme) {
+        final String ext = readme.getName().replaceFirst("[^.]+\\.", "");
+        final String exampleName = readme.getParentFile().getName();
+
+        return new Example(readme, exampleName, ext, exampleName + ".html", "Example");
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/3c8d3037/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
new file mode 100644
index 0000000..1891877
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/Examples2.java
@@ -0,0 +1,192 @@
+/*
+ * 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 org.apache.openejb.util.Join;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+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.getDestinationFor(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(this::addJbakeHeader)
+                .collect(Collectors.toList());
+
+
+        // Add any missing JBake headers
+
+
+        // Create an index.adoc file
+        final StringBuilder index = new StringBuilder();
+        for (final Example example : examples) {
+            index.append(" - ")
+                    .append(example.getHref())
+                    .append("[")
+                    .append(example.getName())
+                    .append("]")
+                    .append(File.separator)
+            ;
+        }
+
+        try {
+            IO.copy(IO.read(index.toString()), new File(destDir, "index.adoc"));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+//        https://javaee.github.io/javaee-spec/javadocs/javax/servlet/http/HttpServletMapping.html
+    }
+
+    private void addJbakeHeader(final Example example) {
+
+        if (example.getExt().startsWith("md")) {
+
+            addMarkdownHeader(example);
+
+        } else if (example.getExt().startsWith("a")) {
+
+            addAsciidocHeader(example);
+        }
+    }
+
+    private void addAsciidocHeader(final Example example) {
+        try {
+            String content = IO.slurp(example.getDestReadme());
+            if (content.contains(":jbake-type:")) return;
+
+            String header = "" +
+                    ":jbake-type: page\n" +
+                    ":jbake-status: published\n";
+
+            // The legacy Apache CMS setup for TomEE allowed a very similar header
+            // called "Title: " to specify the title in the created html page.
+            // If found, we convert it to the JBake version
+            // TODO all docs should be updated and this code removed
+            if (content.startsWith("Title:") || content.startsWith("title:")) {
+                final List<String> lines = new ArrayList<>();
+                Collections.addAll(lines, content.split("\n"));
+
+                // remove the legacy title syntax
+                final String titleLine = lines.remove(0);
+
+                // update the header
+                header += ":jbake-title:" + titleLine.substring("title:".length()).trim() + "\n";
+
+                // update the content
+                content = Join.join("\n", lines);
+            }
+
+
+            // Prepend the JBake header for Asciidoc
+            content = header + content;
+
+            // Update the destination readme file
+            IO.copy(IO.read(content), example.getDestReadme());
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void addMarkdownHeader(final Example example) {
+        try {
+            final File readme = example.getDestReadme();
+            String content = IO.slurp(readme);
+
+            if (content.contains("~~~~~~")) return;
+
+
+            String header = "" +
+                    "type=page\n" +
+                    "status=published\n";
+
+            // The legacy Apache CMS setup for TomEE allowed a very similar header
+            // called "Title: " to specify the title in the created html page.
+            // If found, we convert it to the JBake version
+            // TODO all docs should be updated and this code removed
+            if (content.startsWith("Title:") || content.startsWith("title:")) {
+                final List<String> lines = new ArrayList<>();
+                Collections.addAll(lines, content.split("\n"));
+
+                // remove the legacy title syntax
+                final String titleLine = lines.remove(0);
+
+                // update the header
+                header += "title=" + titleLine.substring("title:".length()).trim() + "\n";
+
+                // update the content
+                content = Join.join("\n", lines);
+            }
+
+            // Prepend the JBake header for Markdown
+            content = header + "~~~~~~\n" + content;
+
+            // Update the destination readme file
+            IO.copy(IO.read(content), example.getDestReadme());
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 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/3c8d3037/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 0f667c3..e2e2ea9 100755
--- a/src/main/java/org/apache/tomee/website/JBake.java
+++ b/src/main/java/org/apache/tomee/website/JBake.java
@@ -38,14 +38,26 @@ public class JBake {
         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"),
+                new File("repos"),
+                new File("src/main/jbake"),
+                new Source("https://git-wip-us.apache.org/repos/asf/tomee.git", "master", "master"),
+                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"),
+                new Source("https://git-wip-us.apache.org/repos/asf/tomee.git", "tomee-8.0.0-M1", "tomee-8.0", true)
+        );
+
+        sources.prepare();
+
         final Runnable build = () -> {
             System.out.println("Building TomEE website in " + destination);
             final Orient orient = Orient.instance();
             try {
                 orient.startup();
 
-                final Oven oven = new Oven(source, destination, new CompositeConfiguration() {{
-                    addConfiguration(ConfigUtil.load(source));
+                final Oven oven = new Oven(sources.getDestination(), destination, new CompositeConfiguration() {{
+                    addConfiguration(ConfigUtil.load(sources.getDestination()));
                 }}, true);
                 oven.setupPaths();
 

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/3c8d3037/src/main/java/org/apache/tomee/website/Repos.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Repos.java b/src/main/java/org/apache/tomee/website/Repos.java
new file mode 100644
index 0000000..6ee4713
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/Repos.java
@@ -0,0 +1,97 @@
+/*
+ * 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.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.PullResult;
+import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.api.errors.RefNotAdvertisedException;
+import org.eclipse.jgit.internal.storage.file.FileRepository;
+
+import java.io.File;
+import java.io.IOException;
+
+public class Repos {
+
+    public static void download(final Source source) {
+        if (source.getDir().exists()) {
+
+            try {
+                pull(source);
+            } catch (Exception e) {
+                System.out.println("Pull Failed. " + source);
+                e.printStackTrace();
+            }
+
+        } else {
+
+            try {
+                clone(source);
+            } catch (Exception e) {
+                System.out.println("Clone Failed. " + source);
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private static void clone(final Source source) throws Exception {
+        System.out.println("  > git clone " + source.getScmUrl());
+
+        jgit("clone", source.getScmUrl(), "-b", source.getBranch(), source.getDir().getAbsolutePath());
+    }
+
+    private static void pull(final Source source) throws IOException, GitAPIException {
+        System.out.println("  > git pull");
+
+        final Git git = new Git(new FileRepository(source.getDir().getAbsolutePath() + "/.git"));
+
+        try {
+            final PullResult call = git.pull()
+                    .setRemote("origin")
+                    .setRemoteBranchName(source.getBranch())
+                    .call();
+
+            if (call.getMergeResult() != null) {
+                System.out.println(call.getMergeResult().getMergeStatus());
+            }
+
+            if (!call.isSuccessful()) {
+                System.out.println("Pull Failed.  Will Remove and clone.");
+                // delete
+                deleteDirectory(source.getDir());
+                // and try again
+                download(source);
+            }
+        } catch (RefNotAdvertisedException ignore) {
+            // we are on a tag
+        }
+    }
+
+    public static void jgit(final String... args) throws Exception {
+        org.eclipse.jgit.pgm.Main.main(args);
+    }
+
+    private static boolean deleteDirectory(File dir) {
+        File[] allContents = dir.listFiles();
+        if (allContents != null) {
+            for (File file : allContents) {
+                deleteDirectory(file);
+            }
+        }
+        return dir.delete();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/3c8d3037/src/main/java/org/apache/tomee/website/Source.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tomee/website/Source.java b/src/main/java/org/apache/tomee/website/Source.java
new file mode 100644
index 0000000..af0afd6
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/Source.java
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+public class Source {
+    private final String name;
+    private final String scmUrl;
+    private final String branch;
+    private final boolean latest;
+    private File dir;
+
+    public Source(final String scmUrl, final String branch, final String name) {
+        this(scmUrl, branch, name, false);
+    }
+
+    public Source(final String scmUrl, final String branch, final String name, final boolean latest) {
+        this.scmUrl = scmUrl;
+        this.branch = branch;
+        this.name = name;
+        this.latest = latest;
+    }
+
+    public boolean isLatest() {
+        return latest;
+    }
+
+    public String getScmUrl() {
+        return scmUrl;
+    }
+
+    public String getBranch() {
+        return branch;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public File getDir() {
+        return dir;
+    }
+
+    public void setDir(final File dir) {
+        this.dir = dir;
+    }
+
+    @Override
+    public String toString() {
+        return "Source{" +
+                "name='" + name + '\'' +
+                ", scmUrl='" + scmUrl + '\'' +
+                ", branch='" + branch + '\'' +
+                '}';
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee-site-generator/blob/3c8d3037/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 5b64990..c08783e 100644
--- a/src/main/java/org/apache/tomee/website/Sources.java
+++ b/src/main/java/org/apache/tomee/website/Sources.java
@@ -17,11 +17,6 @@
 package org.apache.tomee.website;
 
 import org.apache.openejb.loader.IO;
-import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.PullResult;
-import org.eclipse.jgit.api.errors.GitAPIException;
-import org.eclipse.jgit.api.errors.RefNotAdvertisedException;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
 
 import java.io.File;
 import java.io.IOException;
@@ -38,7 +33,7 @@ import java.util.List;
  * for new content.
  *
  * The prepare step will copy relevant asciidoc and markdown sources into the
- * target/jbake/<name> directory.
+ * target/jbake/content/<name> directory.
  *
  */
 public class Sources {
@@ -59,10 +54,23 @@ public class Sources {
         Collections.addAll(this.sources, sources);
     }
 
+    public File getDestination() {
+        return destination;
+    }
+
+    /**
+     * This is the heart of the code to merge several documentation
+     * sources into one tree.
+     */
     public void prepare() {
+        final Docs docs = new Docs(this);
+        final Examples2 examples = new Examples2(this);
+
         sources.stream()
                 .peek(source -> source.setDir(new File(repos, source.getName())))
-                .peek(Sources::download)
+                .peek(Repos::download)
+                .peek(docs::prepare)
+                .peek(examples::prepare)
                 .forEach(Sources::done);
         ;
 
@@ -73,6 +81,20 @@ public class Sources {
         }
     }
 
+    public File getDestinationFor(final Source source, final String... parts) {
+        final File content = new File(destination, "content");
+        File dir = new File(content, source.getName());
+
+        for (final String part : parts) {
+            dir = new File(dir, part);
+        }
+
+        if (!dir.exists()) {
+            if (!dir.mkdirs()) throw new RuntimeException("Could not make directory: " + dir.getAbsolutePath());
+        }
+        return dir;
+    }
+
     private static void done(final Source source) {
         System.out.println("Done " + source);
     }
@@ -87,126 +109,4 @@ public class Sources {
 
         sources.prepare();
     }
-
-    private static void download(final Source source) {
-        if (source.getDir().exists()) {
-
-            try {
-                pull(source);
-            } catch (Exception e) {
-                System.out.println("Pull Failed. " + source);
-                e.printStackTrace();
-            }
-
-        } else {
-
-            try {
-                clone(source);
-            } catch (Exception e) {
-                System.out.println("Clone Failed. " + source);
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private static void clone(final Source source) throws Exception {
-        System.out.println("  > git clone " + source.getScmUrl());
-
-        jgit("clone", source.getScmUrl(), "-b", source.getBranch(), source.getDir().getAbsolutePath());
-    }
-
-    private static void pull(final Source source) throws IOException, GitAPIException {
-        System.out.println("  > git pull");
-
-        final Git git = new Git(new FileRepository(source.getDir().getAbsolutePath() + "/.git"));
-
-        try {
-            final PullResult call = git.pull()
-                    .setRemote("origin")
-                    .setRemoteBranchName(source.getBranch())
-                    .call();
-
-            if (call.getMergeResult() != null) {
-                System.out.println(call.getMergeResult().getMergeStatus());
-            }
-
-            if (!call.isSuccessful()) {
-                System.out.println("Pull Failed.  Will Remove and clone.");
-                // delete
-                deleteDirectory(source.getDir());
-                // and try again
-                download(source);
-            }
-        } catch (RefNotAdvertisedException ignore) {
-            // we are on a tag
-        }
-    }
-
-    public static void jgit(final String... args) throws Exception {
-        org.eclipse.jgit.pgm.Main.main(args);
-    }
-
-
-    public static class Source {
-        private final String name;
-        private final String scmUrl;
-        private final String branch;
-        private final boolean latest;
-        private File dir;
-
-        public Source(final String scmUrl, final String branch, final String name) {
-            this(scmUrl, branch, name, false);
-        }
-
-        public Source(final String scmUrl, final String branch, final String name, final boolean latest) {
-            this.scmUrl = scmUrl;
-            this.branch = branch;
-            this.name = name;
-            this.latest = latest;
-        }
-
-        public boolean isLatest() {
-            return latest;
-        }
-
-        public String getScmUrl() {
-            return scmUrl;
-        }
-
-        public String getBranch() {
-            return branch;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public File getDir() {
-            return dir;
-        }
-
-        public void setDir(final File dir) {
-            this.dir = dir;
-        }
-
-        @Override
-        public String toString() {
-            return "Source{" +
-                    "name='" + name + '\'' +
-                    ", scmUrl='" + scmUrl + '\'' +
-                    ", branch='" + branch + '\'' +
-                    '}';
-        }
-    }
-
-    private static boolean deleteDirectory(File dir) {
-        File[] allContents = dir.listFiles();
-        if (allContents != null) {
-            for (File file : allContents) {
-                deleteDirectory(file);
-            }
-        }
-        return dir.delete();
-    }
-
 }