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 2021/05/22 04:08:22 UTC
[tomee-site-generator] 03/08: Code to get all TomEE repositories
This is an automated email from the ASF dual-hosted git repository.
dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-site-generator.git
commit 87b1d3e925ba209f49c8aae7269572682515f4b4
Author: David Blevins <da...@gmail.com>
AuthorDate: Fri May 21 18:38:33 2021 -0700
Code to get all TomEE repositories
---
.../apache/tomee/website/contributors/Main.java | 74 ++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/src/main/java/org/apache/tomee/website/contributors/Main.java b/src/main/java/org/apache/tomee/website/contributors/Main.java
new file mode 100644
index 0000000..1b89fa8
--- /dev/null
+++ b/src/main/java/org/apache/tomee/website/contributors/Main.java
@@ -0,0 +1,74 @@
+/*
+ * 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.contributors;
+
+import lombok.Builder;
+import lombok.Data;
+import org.apache.johnzon.jaxrs.JohnzonProvider;
+import org.apache.openejb.loader.IO;
+import org.tomitribe.swizzle.stream.StreamBuilder;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class Main {
+ private final Client client = ClientBuilder.newClient().register(new JohnzonProvider<>());
+
+ public static void main(String[] args) throws IOException {
+ new Main().main();
+ }
+
+ private void main() throws IOException {
+
+
+ // Get Apache list of committers and PMC members
+ // Get list of TomEE repos in the Apache org
+ // Get Github contributors for each tomee repo
+ // Override some specific images
+ // Sort by commits
+
+ final List<URI> hrefs = getRepositoryURIs();
+
+ }
+
+ /**
+ * List all the repositories for Apache TomEE
+ */
+ private List<URI> getRepositoryURIs() throws IOException {
+ final WebTarget github = client.target("https://github.com");
+ final String content = github.path("/apache").queryParam("q", "tomee").request().get(String.class);
+ final List<String> links = new ArrayList<String>();
+ StreamBuilder.create(IO.read(content))
+ .watch("href=\"/apache/tomee", "\"", links::add)
+ .run();
+
+ return links.stream()
+ .filter(s -> !s.contains("/"))
+ .filter(s -> !s.equals("-site-pub"))
+ .distinct()
+ .map(s -> "https://github.com/apache/tomee" + s)
+ .map(URI::create)
+ .collect(Collectors.toList());
+ }
+
+}