-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
349 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
%gh-pages.site.url=https://pages.quarkiverse.io/ | ||
%gh-pages.quarkus.http.root-path=/quarkus-roq/ | ||
quarkus.web-bundler.dependencies.auto-import=all | ||
quarkus.log.category."io.quarkiverse.roq.frontmatter.deployment.scan".level=DEBUG | ||
quarkus.log.category."io.quarkiverse.roq.frontmatter.deployment.scan".level=DEBUG | ||
quarkus.default-locale=en |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkiverse.roq</groupId> | ||
<artifactId>quarkus-roq-plugin-serie-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-roq-plugin-serie-deployment</artifactId> | ||
<name>Quarkus Roq - Plugin - Serie - Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkiverse.roq</groupId> | ||
<artifactId>quarkus-roq-frontmatter-deployment</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.roq</groupId> | ||
<artifactId>quarkus-roq-plugin-serie</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-internal</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${assertj.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
73 changes: 73 additions & 0 deletions
73
...ent/src/main/java/io/quarkiverse/roq/plugin/serie/deployment/RoqPluginSerieProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package io.quarkiverse.roq.plugin.serie.deployment; | ||
|
||
import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Collectors; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
import io.quarkiverse.roq.frontmatter.deployment.RoqFrontMatterOutputBuildItem; | ||
import io.quarkiverse.roq.frontmatter.deployment.scan.RoqFrontMatterRawTemplateBuildItem; | ||
import io.quarkiverse.roq.plugin.series.runtime.SerieMessage; | ||
import io.quarkiverse.roq.plugin.series.runtime.Series; | ||
import io.quarkiverse.roq.plugin.series.runtime.SeriesRecorder; | ||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.arc.deployment.SyntheticBeanBuildItem; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.Record; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
|
||
public class RoqPluginSerieProcessor { | ||
|
||
private static final String FEATURE = "roq-plugin-series"; | ||
|
||
@BuildStep | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(FEATURE); | ||
} | ||
|
||
@BuildStep | ||
void registerAdditionalBeans(RoqFrontMatterOutputBuildItem roqOutput, | ||
BuildProducer<AdditionalBeanBuildItem> additionalBeans) { | ||
if (roqOutput == null) { | ||
return; | ||
} | ||
additionalBeans.produce(AdditionalBeanBuildItem.builder() | ||
.addBeanClasses( | ||
SerieMessage.class) | ||
.setUnremovable().build()); | ||
} | ||
|
||
@BuildStep | ||
@Record(value = STATIC_INIT) | ||
void generateSeries( | ||
SeriesRecorder recorder, | ||
BuildProducer<SyntheticBeanBuildItem> beansProducer, | ||
List<RoqFrontMatterRawTemplateBuildItem> templates) { | ||
Map<String, List<String>> serieTemplates = templates.stream() | ||
.filter(Predicate.not(RoqFrontMatterRawTemplateBuildItem::isLayout)) | ||
.filter(item -> item.data().containsKey("serie")) | ||
.collect(Collectors.toMap( | ||
item -> item.data().getString("serie"), | ||
item -> new ArrayList<>(List.of(item.data().getString("title"))), | ||
(a, b) -> { | ||
a.addAll(b); | ||
return a; | ||
})); | ||
if (serieTemplates.isEmpty()) { | ||
return; | ||
} | ||
beansProducer.produce(SyntheticBeanBuildItem.configure(Series.class) | ||
.named("series") | ||
.scope(Singleton.class) | ||
.unremovable() | ||
.runtimeValue(recorder.generateSeries(serieTemplates)) | ||
.done()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkiverse.roq</groupId> | ||
<artifactId>quarkus-roq-plugin-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>quarkus-roq-plugin-serie-parent</artifactId> | ||
<packaging>pom</packaging> | ||
<name>Quarkus Roq - Plugin - Serie</name> | ||
|
||
<properties> | ||
<quarkus-barcode.version>0.0.3</quarkus-barcode.version> | ||
</properties> | ||
<modules> | ||
<module>deployment</module> | ||
<module>runtime</module> | ||
</modules> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkiverse.roq</groupId> | ||
<artifactId>quarkus-roq-plugin-serie-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-roq-plugin-serie</artifactId> | ||
<name>Quarkus Roq - Plugin - Serie - Runtime</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkiverse.roq</groupId> | ||
<artifactId>quarkus-roq-frontmatter</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-maven-plugin</artifactId> | ||
<version>${quarkus.version}</version> | ||
<executions> | ||
<execution> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>extension-descriptor</goal> | ||
</goals> | ||
<configuration> | ||
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
17 changes: 17 additions & 0 deletions
17
...in/serie/runtime/src/main/java/io/quarkiverse/roq/plugin/series/runtime/SerieMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.quarkiverse.roq.plugin.series.runtime; | ||
|
||
import io.quarkus.qute.i18n.Message; | ||
import io.quarkus.qute.i18n.MessageBundle; | ||
|
||
@MessageBundle(value = "serie", defaultKey = Message.UNDERSCORED_ELEMENT_NAME) | ||
public interface SerieMessage { | ||
|
||
@Message | ||
String header(String serieName); | ||
|
||
@Message | ||
String navigate_to(); | ||
|
||
@Message | ||
String select_post(); | ||
} |
24 changes: 24 additions & 0 deletions
24
plugin/serie/runtime/src/main/java/io/quarkiverse/roq/plugin/series/runtime/Series.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.quarkiverse.roq.plugin.series.runtime; | ||
|
||
import java.util.List; | ||
|
||
import io.quarkiverse.roq.data.runtime.annotations.DataMapping; | ||
import io.quarkiverse.roq.frontmatter.runtime.RoqTemplateExtension; | ||
|
||
@DataMapping("series") | ||
public record Series(List<Serie> series) { | ||
public record Serie(String title, List<Entry> entries) { | ||
public record Entry(String title) { | ||
public String link() { | ||
return "/posts/%s".formatted(RoqTemplateExtension.slugify(title)); | ||
} | ||
} | ||
} | ||
|
||
public Serie findSerie(String title) { | ||
return series.stream() | ||
.filter(serie -> serie.title().equals(title)) | ||
.findFirst() | ||
.orElse(null); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../serie/runtime/src/main/java/io/quarkiverse/roq/plugin/series/runtime/SeriesRecorder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.quarkiverse.roq.plugin.series.runtime; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import io.quarkus.runtime.RuntimeValue; | ||
import io.quarkus.runtime.annotations.Recorder; | ||
|
||
@Recorder | ||
public class SeriesRecorder { | ||
public RuntimeValue<Series> generateSeries(Map<String, List<String>> serieTemplates) { | ||
return new RuntimeValue<>( | ||
new Series(serieTemplates.entrySet().stream() | ||
.map(entry -> new Series.Serie(entry.getKey(), | ||
entry.getValue().stream().map(Series.Serie.Entry::new).toList())) | ||
.toList())); | ||
} | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
plugin/serie/runtime/src/main/resources/messages/serie_en.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
header=This post is part of the posts serie : {serieName} | ||
navigate_to=Navigate to | ||
select_post=Select a post |
Oops, something went wrong.