Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 3.29 KB

README.md

File metadata and controls

64 lines (46 loc) · 3.29 KB


ghooks
SIMPLE GIT HOOKS

GitHub Workflow Status 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 "2.0.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