diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 362689d7..a3127d2f 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -31,7 +31,7 @@ jobs: - name: Parse data run: | cd resources - ./jbang site.java ../java-champions.yml ../site/content/ + ./jbang site.java ../java-champions.yml ../podcasts.yml ../site/content/ - name: Generate site run: | diff --git a/.gitignore b/.gitignore index 2452027f..f6d7c0ea 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ output/ # VS Code project files .vscode/ +/out/ diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 0f17903d..0b59bacf 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -14,7 +14,7 @@ You may install of these prerequisites with link:https://sdkman.io[Sdkman]. 1. `git clone https://github.com/aalmiray/java-champions.git` 2. `cd java-champions/resources` -3. `jbang site.java ../java-champions.yml ../site/content/` +3. `jbang site.java ../java-champions.yml ../podcasts.yml ../site/content/` 4. `cd ../site` 5. `jbake -b` 6. `jbake -s` diff --git a/README.adoc b/README.adoc index de38a795..67a19181 100644 --- a/README.adoc +++ b/README.adoc @@ -2,6 +2,8 @@ image:site/assets/img/duke_champion.png[align="center"] +The data collected in this repository is used to update link:javachampions.org[javachampions.org]. + == What is a Java Champion? One of the best descriptions was given in the 2009 JavaOne diff --git a/java-champions.yml b/java-champions.yml index a8b826b8..ede03b49 100644 --- a/java-champions.yml +++ b/java-champions.yml @@ -773,7 +773,7 @@ members: social: twitter: https://twitter.com/FrankDelporte mastodon: https://foojay.social/@frankdelporte - bluesky: https://bsky.app/profile/frankdelporte.bsky.social + bluesky: https://bsky.app/profile/frankdelporte.be youtube: https://www.youtube.com/@FrankDelporte linkedin: https://www.linkedin.com/in/frankdelporte/ github: https://github.com/FDelporte diff --git a/resources/podcasts.adoc.tpl b/resources/podcasts.adoc.tpl new file mode 100644 index 00000000..f2cc7b57 --- /dev/null +++ b/resources/podcasts.adoc.tpl @@ -0,0 +1,10 @@ += Podcasts +Frank Delporte +:jbake-type: page +:jbake-status: published +:linkattrs: + +[cols="^,^,<2,<2,<2,<2"] +[subs="attributes"] +|=== +| | |Title |Language |Host(s) |Social diff --git a/resources/site.java b/resources/site.java index 4e332b37..eccf6415 100644 --- a/resources/site.java +++ b/resources/site.java @@ -49,23 +49,25 @@ public class site { ); public static void main(String... args) throws Exception { - if (null == args || args.length != 2) { - System.out.println("❌ Usage: java site.java [YAML] [DIRECTORY]"); + if (null == args || args.length != 3) { + System.out.println("❌ Usage: java site.java [YAML members] [YAML podcasts] [DIRECTORY]"); System.exit(1); } - var file = Path.of(args[0]); - var directory = Path.of(args[1]); + var fileMembers = Path.of(args[0]); + var filePodcasts = Path.of(args[1]); + var directory = Path.of(args[2]); var mapper = YAMLMapper.builder().build(); var members = new Members(); + var podcasts = new Podcasts(); - // parse input data - try (InputStream in = Files.newInputStream(file)) { + // parse members input data + try (InputStream in = Files.newInputStream(fileMembers)) { members = mapper.readValue(in, Members.class); } catch (IOException e) { e.printStackTrace(); - System.out.printf("❌ Unexpected error reading %s%n", file); + System.out.printf("❌ Unexpected error reading %s%n", fileMembers); System.exit(1); } @@ -75,8 +77,8 @@ public static void main(String... args) throws Exception { membersDoc.append(member.formatted()); } - var output = directory.resolve("members.adoc"); - Files.write(output, membersDoc.toString().getBytes()); + var outputMembers = directory.resolve("members.adoc"); + Files.write(outputMembers, membersDoc.toString().getBytes()); // generate stats.adoc var countries = members.members.stream() @@ -111,8 +113,8 @@ public static void main(String... args) throws Exception { .replace("@COUNTRIES_HEIGHT@", String.valueOf(countries.size() * 30)) .replace("@YEARS@", yearsSb.toString()) .replace("@YEARS_HEIGHT@", String.valueOf(years.size() * 30)); - output = directory.resolve("stats.adoc"); - Files.write(output, statsDoc.getBytes()); + var outputStats = directory.resolve("stats.adoc"); + Files.write(outputStats, statsDoc.getBytes()); // generate fediverse CSV file var mastodonCsv = new PrintWriter(Files.newOutputStream(directory.resolve("resources").resolve("mastodon.csv"))); @@ -123,6 +125,24 @@ public static void main(String... args) throws Exception { .forEach(mastodonCsv::println); mastodonCsv.flush(); mastodonCsv.close(); + + // parse podcasts input data + try (InputStream in = Files.newInputStream(filePodcasts)) { + podcasts = mapper.readValue(in, Podcasts.class); + } catch (IOException e) { + e.printStackTrace(); + System.out.printf("❌ Unexpected error reading %s%n", filePodcasts); + System.exit(1); + } + + // generate podcasts.adoc + var podcastsDoc = new StringBuilder(Files.readString(Path.of("podcasts.adoc.tpl"))); + for (Podcast podcast : podcasts.podcasts) { + podcastsDoc.append(podcast.formatted()); + } + + var outputPodcasts = directory.resolve("podcasts.adoc"); + Files.write(outputPodcasts, podcastsDoc.toString().getBytes()); } static class Members { @@ -331,4 +351,65 @@ String getMastodonAccount() { return "@" + n + "@" + s; } } + + static class Podcasts { + public List podcasts = new ArrayList<>(); + } + + static class Host { + public String name; + + String formatted() { + var b = new StringBuilder() + .append(name); + + return b.append("\n") + .toString(); + } + } + + static class Podcast { + public String title; + public String url; + public String language; + public String logo; + public Social social; + public List hosts = new ArrayList<>(); + + String formatted() { + var b = new StringBuilder("|{counter:idx}\n") + .append("|image:") + .append(logo) + .append("[]"); + + b.append("|") + .append("link:") + .append(url) + .append("[") + .append(title) + .append("]") + .append("\n"); + + b.append("|") + .append(language) + .append("\n"); + + if (hosts != null && !hosts.isEmpty()) { + b.append("a|"); + hosts.forEach(h -> b.append("* ").append(h.formatted()).append("\n")); + b.append("\n"); + } else { + b.append("|\n"); + } + + if (social != null) { + b.append(social.formatted()); + } else { + b.append("|\n"); + } + + return b.append("\n\n") + .toString(); + } + } } diff --git a/site/templates/menu.ftl b/site/templates/menu.ftl index 1aed5fcc..415c7097 100644 --- a/site/templates/menu.ftl +++ b/site/templates/menu.ftl @@ -15,6 +15,7 @@
  • Home
  • Bylaws
  • Members
  • +
  • Stats
  • About