Skip to content

Commit

Permalink
Merge pull request #235 from gsmet/cleanup
Browse files Browse the repository at this point in the history
Various cleanups
  • Loading branch information
gsmet authored Dec 10, 2021
2 parents 149f0e8 + 7fcee3a commit 38af2c1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 67 deletions.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/create-github-app.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \

[TIP]
====
Maven 3.6.2+ is required for this to work.
Maven 3.8.1+ is required for this to work.
====

Once the project is created, go to the `my-github-app` directory.
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/includes/attributes.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:quarkus-version: 2.5.1.Final
:quarkus-version: 2.5.2.Final
:quarkus-github-app-version: 1.4.1

:github-api-javadoc-root-url: https://github-api.kohsuke.org/apidocs/org/kohsuke/github
Expand Down
57 changes: 0 additions & 57 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@

<artifactId>quarkus-github-app-docs</artifactId>
<name>Quarkus - GitHub App - Documentation</name>

<properties>
<asciidoctorj.version>2.5.2</asciidoctorj.version>
<asciidoctor-maven-plugin.version>2.2.1</asciidoctor-maven-plugin.version>
<yaml-properties-maven-plugin.version>1.1.3</yaml-properties-maven-plugin.version>
</properties>

<dependencies>
<!-- Make sure the doc is built after the other artifacts -->
Expand All @@ -31,7 +25,6 @@
<plugin>
<groupId>it.ozimov</groupId>
<artifactId>yaml-properties-maven-plugin</artifactId>
<version>${yaml-properties-maven-plugin.version}</version>
<executions>
<execution>
<phase>initialize</phase>
Expand Down Expand Up @@ -92,56 +85,6 @@
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor-maven-plugin.version}</version>
<configuration>
<skip>${skipDocs}</skip>
<enableVerbose>true</enableVerbose>
<logHandler>
<failIf>
<severity>WARN</severity>
</failIf>
</logHandler>
<sourceDirectory>${project.basedir}/modules/ROOT/pages/</sourceDirectory>
<preserveDirectories>true</preserveDirectories>
<attributes>
<icons>font</icons>
<!-- Antora images path -->
<imagesdir>./_images/</imagesdir>
<sectanchors>true</sectanchors>
<!-- set the idprefix to blank -->
<idprefix />
<idseparator>-</idseparator>
<docinfo1>true</docinfo1>
<!-- avoid content security policy violations -->
<skip-front-matter>true</skip-front-matter>
</attributes>
</configuration>
<executions>
<execution>
<id>output-html</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<skip>${skipDocs}</skip>
<backend>html5</backend>
<attributes>
<source-highlighter>coderay</source-highlighter>
<!-- avoid content security policy violations -->
<linkcss>true</linkcss>
<copycss>true</copycss>
</attributes>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>${asciidoctorj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.kohsuke.github.GHAppInstallationToken;
import org.kohsuke.github.GitHub;
import org.kohsuke.github.GitHubBuilder;
import org.kohsuke.github.extras.okhttp3.OkHttpConnector;

import com.github.benmanes.caffeine.cache.CacheLoader;
import com.github.benmanes.caffeine.cache.Caffeine;
Expand All @@ -35,15 +34,12 @@ public class GitHubService {

private final JwtTokenCreator jwtTokenCreator;

private final OkHttpConnector okhttpConnector;

private final LoadingCache<Long, CachedInstallationToken> installationTokenCache;

@Inject
public GitHubService(GitHubAppRuntimeConfig gitHubAppRuntimeConfig, JwtTokenCreator jwtTokenCreator, OkHttpClient client) {
this.gitHubAppRuntimeConfig = gitHubAppRuntimeConfig;
this.jwtTokenCreator = jwtTokenCreator;
this.okhttpConnector = new OkHttpConnector(client);
this.installationTokenCache = Caffeine.newBuilder()
.maximumSize(50)
.expireAfter(new Expiry<Long, CachedInstallationToken>() {
Expand Down Expand Up @@ -120,7 +116,7 @@ public DynamicGraphQLClient getInstallationGraphQLClient(Long installationId) {
private GitHub createInstallationClient(Long installationId) throws IOException {
CachedInstallationToken installationToken = installationTokenCache.get(installationId);

final GitHubBuilder gitHubBuilder = new GitHubBuilder().withConnector(okhttpConnector)
final GitHubBuilder gitHubBuilder = new GitHubBuilder()
.withAppInstallationToken(installationToken.getToken())
.withEndpoint(gitHubAppRuntimeConfig.instanceEndpoint);

Expand Down Expand Up @@ -183,7 +179,7 @@ private GitHub createApplicationGitHub() {
}

try {
final GitHubBuilder gitHubBuilder = new GitHubBuilder().withConnector(okhttpConnector)
final GitHubBuilder gitHubBuilder = new GitHubBuilder()
.withJwtToken(jwtToken)
.withEndpoint(gitHubAppRuntimeConfig.instanceEndpoint);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public void handle(RoutingContext event) {
.setWebRoot(replayUiFinalDestination)
.setDefaultContentEncoding("UTF-8");

if (event.normalisedPath().length() == replayUiPath.length()) {
if (event.normalizedPath().length() == replayUiPath.length()) {
event.response().setStatusCode(302);
event.response().headers().set(HttpHeaders.LOCATION, replayUiPath + "/");
event.response().end();
return;
} else if (event.normalisedPath().length() == replayUiPath.length() + 1) {
} else if (event.normalizedPath().length() == replayUiPath.length() + 1) {
event.reroute(replayUiPath + "/index.html");
return;
}
Expand Down

0 comments on commit 38af2c1

Please sign in to comment.