asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
285 stars 120 forks source link

Download PDF themes from own repository #733

Open upeuker opened 1 month ago

upeuker commented 1 month ago

I know the feature to load a pdf theme from a Gitlab or a GitHub repository.

For my use case it would be helpful to get the theme from another repository in other words my own local instance of a gitlab repository or some other git repository.

Is this possible and what did I overlooked if yes. Or would that be a common useful feature for users with grouped projects and many documents, which must be created with a consistent styling.

Thx, Uwe

ysb33r commented 1 month ago

The Git(Hub|Lab) implementation relies on the ZIP download feature that both providers have to offer.

As long as any other service offers that, then it won't be too hard to implement.

For a local-hosted Gitlab, try to set baseUri eg.

pdfThemes {
  gitlab('foo') {
    baseUri = 'https://gitlab.self.hosted.example'.toURI()
  }
}
upeuker commented 1 month ago

Thanks for the fast response.

Redefining the gitlab-URI works basically. The remaining problem: Running the Gradle build via Gitlab-CI works, because the theme and the project instance is the same. The local build or a build from Jenkins (for example) didn't work because the credentials from the local environment or the Jenkins session are not provided to the asciidoctor task (I think).

Is there a simple solution in the configuration or should I ask my gitlab administrator for open access without necessary credentials?

Many thanks Uwe

ysb33r commented 1 month ago

It is not ideal but you can set it in the URI for now i.e.

pdfThemes {
  gitlab('foo') {
    baseUri = "https://${System.getenv('YOUR_USER'):${System.getenv('YOUR_TOKEN')}@gitlab.self.hosted.example".toURI()
  }
}
upeuker commented 1 month ago

Thx. I'm going to try it.