Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/rudikershaw/git-build-hook

A maven plugin for managing client side (local) git configuration for those working on your project. Including but not limited to setting git config, installing hooks, validating the local repository.
https://github.com/rudikershaw/git-build-hook

build client-git-hooks client-side-git-hooks enforce-conventions enforcer git git-hook git-hooks hooks installer linting local-git-hooks maven maven-plugin project-management

Last synced: 3 months ago
JSON representation

A maven plugin for managing client side (local) git configuration for those working on your project. Including but not limited to setting git config, installing hooks, validating the local repository.

Lists

README

        

The Git Build Hook Maven Plugin Logo

[![MIT Licence][licence-image]][licence-url]
[![Build Status][travis-image]][travis-url]
[![Maven Central][maven-central-image]][maven-central-url]

# Git Build Hook Maven Plugin

A Maven plugin used to add configuration, install git hooks, and initialize the local project's git repository. It is common for a team or project to need to manage client side git configuration. For example, you may need to install pre-commit hooks for all your developers, or insist on a particular `core.autoclrf` policy. This plugin allows you to setup configuration for every developer working on the project the first time they run your build.

## Key Features

* Set arbitrary project specific git configuration.
* Install client side (local) git hooks for the project.
* Fail the build if your project is not being managed by Git.
* Use with Maven archetypes to initialise Git repository with the first build.

## Basic Usage

A common use-case might be to install local git hooks by setting the `core.hooksPath` configuration. Put all your Git hooks in a directory in your project, then configure your `pom.xml` to include the following plugin declaration, goal, and configuration.

```$xml



com.rudikershaw.gitbuildhook
git-build-hook-maven-plugin
3.4.1



hooks-directory/

true






configure





```

When you run your project build the plugin will configure git to run hooks out of the directory specified. This will effectively set up the hooks in that directory for everyone working on your project. If you would prefer to install individual git hooks into the default hooks directory, then you can use the `install` goal with configuration for each hook you wish to install like so;

```$xml
...



file_path/to/your/hook.sh
class_path/package/hook.sh




my.company
company-git-hooks
[1.2.3,)


...


install

...
```

With both of the above goals, the build will fail if the project is not managed by Git. If you would prefer the plugin to, instead of failing, initialize a new Git repository at the root of the project you can do the following;

```$xml
...


initialize
configure

...
```

### Wait, but why?

Many web-based hosting services for version control using Git, do not allow server side hooks. Server side hooks are extremely useful for enforcing certain styles of commit message, restricting the kind and types of actions that can be performed against certain branches, providing useful feedback or advice during certain actions in Git, and much more. This kind of quick feedback is advantageous when managing any large group of developers.

If you cannot perform these kind of actions server side, what else can be done? Well, the hooks can be installed on the developers local machines. But it can be difficult to organise groups of people to install these hooks and even more difficult to get updates out to everyone.

If only there was some way that the hooks could be managed in your project repository and installed automatically during your build. Well, that is what this plugin is for.

[licence-image]: http://img.shields.io/npm/l/gulp-rtlcss.svg?style=flat
[licence-url]: https://tldrlegal.com/license/mit-license
[travis-image]: https://app.travis-ci.com/rudikershaw/git-build-hook.svg?branch=develop
[travis-url]: https://app.travis-ci.com/rudikershaw/git-build-hook?branch=develop
[maven-central-image]: https://maven-badges.herokuapp.com/maven-central/com.rudikershaw.gitbuildhook/git-build-hook-maven-plugin/badge.svg
[maven-central-url]: https://maven-badges.herokuapp.com/maven-central/com.rudikershaw.gitbuildhook/git-build-hook-maven-plugin