Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a podcasts page to the website #259

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Podcasts have yet to be integrated into the site.
This step is not needed at the moment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the script expects this extra value, we need to keep it here to avoid the workflow to break. The new webpage is already created by the script, but I commented the link to it in the menu so you can first validate the new page before making it public.


- name: Generate site
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ output/

# VS Code project files
.vscode/
/out/
2 changes: 1 addition & 1 deletion CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions podcasts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ podcasts:
logo: img/logos/airhacks.png
language: EN
hosts:
- name: Adam Bien
- Adam Bien
FDelporte marked this conversation as resolved.
Show resolved Hide resolved
- title: Stackd
url: https://stackdpodcast.com
logo: img/logos/stackd.png
language: EN
social:
twitter: https://twitter.com/stackdpodcast
hosts:
- name: Kito Mann
- name: Josh Juneau
- name: Daniel Hinojosa
- name: Ian Hlavats
- Kito Mann
- Josh Juneau
- Daniel Hinojosa
- Ian Hlavats
- title: Foojay Podcast
url: https://foojay.io/today/category/podcast/
logo: img/logos/foojay_podcast.png
Expand All @@ -34,34 +34,34 @@ podcasts:
linkedin: https://www.linkedin.com/company/foojayio/
mastodon: https://foojay.social/@foojay
hosts:
- name: Frank Delporte
- Frank Delporte
- title: JavaFX In Action
url: https://webtechie.be/tags/jfx-in-action/
logo: img/logos/jfx-in-action.png
language: EN
social:
mastodon: https://foojay.social/@frankdelporte
hosts:
- name: Frank Delporte
- Frank Delporte
- title: Happy Path Programming
url: https://happypathprogramming.com/
logo: img/logos/hpp.jpg
language: EN
social:
twitter: https://twitter.com/happypathprog
hosts:
- name: Bruce Eckel
- name: James Ward
- Bruce Eckel
- James Ward
- title: Les Cast Codeurs Podcast
url: https://lescastcodeurs.com/
logo: img/logos/lescastcodeurs.png
language: FR
social:
twitter: https://twitter.com/lescastcodeurs
hosts:
- name: Antonio Goncalves
- name: Arnaud Héritier
- name: Emmanuel Bernard
- name: Guillaume Laforge
- name: Katia Aresti
- Antonio Goncalves
- Arnaud Héritier
- Emmanuel Bernard
- Guillaume Laforge
- Katia Aresti

10 changes: 10 additions & 0 deletions resources/podcasts.adoc.tpl
Original file line number Diff line number Diff line change
@@ -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
90 changes: 79 additions & 11 deletions resources/site.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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()
Expand Down Expand Up @@ -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")));
Expand All @@ -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 {
Expand Down Expand Up @@ -331,4 +351,52 @@ String getMastodonAccount() {
return "@" + n + "@" + s;
}
}

static class Podcasts {
public List<Podcast> podcasts = new ArrayList<>();
}

static class Podcast {
public String title;
public String url;
public String language;
public String logo;
public Social social;
public List<String> 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("|")
.append(String.join(", " , hosts));
} else {
b.append("|\n");
}

if (social != null) {
b.append(social.formatted());
} else {
b.append("|\n");
}

return b.append("\n\n")
.toString();
}
}
}
1 change: 1 addition & 0 deletions site/templates/menu.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<li><a href="<#if (content.rootpath)??>${content.rootpath}<#else></#if>index.html">Home</a></li>
<li><a href="<#if (content.rootpath)??>${content.rootpath}<#else></#if>bylaws.html">Bylaws</a></li>
<li><a href="<#if (content.rootpath)??>${content.rootpath}<#else></#if>members.html">Members</a></li>
<li><a href="<#if (content.rootpath)??>${content.rootpath}<#else></#if>podcasts.html">Podcasts</a></li>
<li><a href="<#if (content.rootpath)??>${content.rootpath}<#else></#if>stats.html">Stats</a></li>
<li><a href="<#if (content.rootpath)??>${content.rootpath}<#else></#if>about.html">About</a></li>
</ul>
Expand Down