Gradle Replace In Place (GRIP): a gradle plugin to update your documentation or any file with a simple gradle task

Overview

GRIP (Gradle Replace In-Place)

A gradle tool to update some values in your (documentation) files by running a task.

(inspired by Knit)

Directives

Insert a gradle properties: GRADLE_PROPERTIES

<!--$ GRADLE_PROPERTIES version --><!-- END $-->

Take 1 parameter that must be the name of the gradle properties on your project.

Insert a system environment variable: SYSTEM_ENV

<!--$ SYSTEM_ENV LOGNAME --><!-- END $-->

Take 1 parameter that must be the name of one of the environment variable on the computer running grip.

Insert a local file

<!--$ INSERT src/commonMain/kotlin/com/glureau/grip/sample/doc.md --><!-- END $-->

Take 1 parameter that uses the gradle file pattern.

For example, the previous INSERT could be extended to:

<!--$ INSERT src/**/sample/*.md --><!-- END $-->

Insert a date/time: DATETIME

<!--$ DATETIME yyyy.MM.dd G 'at' HH:mm:ss z --><!-- END $-->

Take 1 parameter that represents the formatting of the current time (Calendar.getInstance()).

Setup

plugins {
    id("com.glureau.grip") version "0.4.0"
}

Then you can add additional configuration, with:

grip {
    // When replaceInPlace is false, the files are processed and the resulting file is stored in build/grip, see [Advanced](#Advanced)
    replaceInPlace = false

    // Choose the files that grip should process
    files = fileTree(project.projectDir) {
        // By default, we pick only markdowns, but there is really no limitation on type file.
        include("**/**.md")
        // Avoid re-loading the generated files
        exclude("**/grip/**")
    }
}

To update the files: $ ./gradlew grip

File types support

Currently the replacement token is made for Markdown and tools like mkdocs or dokka as it's considering a web comment format.

If you want to use the same plugin on other type of files, please open an issue with your needs!

Advanced

With GRIP you can replace in place but you can also generates files in the build/grip directory. (Only one mode available at a time.)

This allow to not modify your repository while using the new file copy. Also the produced file doesn't contain the original directives.

Execution order

Files retrieved by the grip.files extension are sorted so that the longer path are parsed first. For example src/com/glureau/grip/README.md (4 parent levels) is parsed before src/README.md (only 1 parent). This combined with replaceInPlace = false allow a multiple passes approach.

Let's say you want to have a global documentation that contains multiple parts, each part in a different module. And that those parts can also be splitted in more fine-grained documentation, with also directives in it:

  • moduleA/doc.md // General documentation about module B
  • moduleB/doc.md // General documentation about module B
  • moduleB/featureX/doc.md // Documentation about feature X inside the module B
  • moduleB/featureY/doc.md // Documentation about feature Y inside the module B
  • doc.md // Global documentation In moduleB/doc.md you can decide to load the documentation from every features of the module B. And from doc.md you can decide to load documentation from module A and from module B. In this approach, the produced file for doc.md will contain the content of all other markdowns.

Once this setup is in place, ./gradlew grip will generate a file in build/grip/doc.md (among other files) that you can directly use to publish somewhere else.

You might also like...
A Gradle plugin to report the number of method references in your APK on every build.
A Gradle plugin to report the number of method references in your APK on every build.

Dexcount Gradle Plugin A Gradle plugin to report the number of method references in your APK, AAR, or java module. This helps you keep tabs on the gro

 Gradle plugin which downloads and manages your Android SDK.
Gradle plugin which downloads and manages your Android SDK.

DEPRECATED This plugin is deprecated and is no longer being developed. Tools and dependencies are automatically downloaded using version 2.2.0 of the

Add a different ribbon to each of your Android app variants using this gradle plugin. Of course, configure it as you will

Easylauncher gradle plugin for Android Modify the launcher icon of each of your app-variants using simple gradle rules. Add ribbons of any color, over

Gradle plugin which validates the licenses of your dependency graph match what you expect

Licensee 📜 👀 A Gradle plugin which validates the licenses of your dependency graph match what you expect, or it fails your build! Jump to: Introduct

Gradle plugin which helps you analyze the size of your Android apps.
Gradle plugin which helps you analyze the size of your Android apps.

Ruler Ruler is a Gradle plugin which helps you analyze the size of your Android apps. Motivation App size is an important metric which directly correl

A powerful Gradle Plugin to help you demonstrate your android app
A powerful Gradle Plugin to help you demonstrate your android app

English | 简体中文 sample-gradle-plugin 🚀 A powerful Gradle Plugin to help you demonstrate your android app. We often write demo applications that contai

Helper to upload Gradle Android Artifacts, Gradle Java Artifacts and Gradle Kotlin Artifacts to Maven repositories (JCenter, Maven Central, Corporate staging/snapshot servers and local Maven repositories).

GradleMavenPush Helper to upload Gradle Android Artifacts, Gradle Java Artifacts and Gradle Kotlin Artifacts to Maven repositories (JCenter, Maven Cen

eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.
eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.

eventbus-intellij-plugin Plugin to navigate between events posted by EventBus. Post to onEvent and onEvent to Post Install There are two ways. Prefere

IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea

IntelliJ Idea Astor Plugin IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea. It communicates with a local/remote program

Releases(0.3.0)
Owner
Grégory Lureau
Grégory Lureau
Dokka plugin to render Mermaid graphics, from your code comments to your Dokka documentation.

Dokka plugin to render Mermaid graphics, from your code comments to your Dokka documentation.

Grégory Lureau 24 Jan 7, 2023
plugin to use to replace text in android studio

replace-text-plugin Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get known with the template documentation. Verify the p

null 1 Nov 29, 2022
A gradle plugin to optimize built jars through individual file optimizations and increased compression

Machete Machete is a gradle plugin that attempts to optimize the size of output JARs through both individual file optimizations and overall compressio

Silver 9 Nov 2, 2022
gradle-android-scala-plugin adds scala language support to official gradle android plugin

gradle-android-scala-plugin gradle-android-scala-plugin adds scala language support to official gradle android plugin. See also sample projects at htt

saturday06 345 Dec 10, 2022
Ownership-gradle-plugin - Gradle code ownership verification plugin

Gradle code ownership verification plugin A gradle plugin that will verify owner

null 4 Dec 15, 2022
A Gradle plugin for providing your secrets to your Android project.

Secrets Gradle Plugin for Android A Gradle plugin for providing your secrets securely to your Android project. This Gradle plugin reads secrets from a

Google 560 Jan 8, 2023
A small plugin which loads an additional properties file for secret values.

Gradle Secrets Plugin A small plugin which loads an additional properties file for secret values. Why Using this plugin, you can have an additional fi

null 7 Dec 25, 2022
A Intellij platform plugin to view truetype font file(.ttf) that includes icon glyphs usually

Icon Font Viewer 一个用于查看.ttf字体文件的Intellij平台(支持IDEA/Android Studio等)的插件,通常用于展示icon

null 7 Oct 22, 2022
K6-intellij-plugin - IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your IntelliJ IDE

IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your Intel

Mikhail Bolotov 8 Jan 2, 2023
GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.

Gradle Play Publisher Gradle Play Publisher is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and

null 3.9k Dec 30, 2022