KengoTODA / ghooks.gradle

Simple git hooks

Home Page:https://plugins.gradle.org/plugin/com.gtramontina.ghooks.gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


ghooks
SIMPLE GIT HOOKS

Travis (.org) Maven metadata URL GitHub Commitizen Friendly semantic-release

What

Share and version-control all your git hooks. This plugin is a Gradle version of ghooks for Node.js.

Installing

Add the following entry to your build.gradle on the plugins section.

plugins {
    id "com.gtramontina.ghooks.gradle" version "1.1.0"
}

build.gradle

Next, create a .githooks/ directory on the root of your git project. This is where you'll keep your git hooks:

mkdir .githooks/

You may now execute any gradle command. The plugin will ensure it has everything it needs in order to get your git hooks working.

With additions to your build file, you can even use this plugin if your hooks are in a dependency and shared amongst multiple projects:

task addHooksFromJar {
    def hookDir = new File(projectDir, ".githooks")

    if(!hookDir.exists()) {
        hookDir.mkdir()
    }

    configurations.compile.each { jar ->
        if (jar.name.contains("hooks")) {
            copy {
                from(zipTree(jar))
                into(hookDir)
            }
        }
    }
}

installGitHooks.dependsOn("addHooksFromJar")

Contributing

Contributions of any kind are very welcome! 🙏

References

About

Simple git hooks

https://plugins.gradle.org/plugin/com.gtramontina.ghooks.gradle

License:MIT License


Languages

Language:Kotlin 97.9%Language:Shell 2.1%