Giter Club home page Giter Club logo

elixir_git_hooks's Introduction

Coverage Status Hex version Hex Docs Build Status Inline docs

GitHooks

Installs git hooks that will run in your Elixir project.

Any git hook type is supported, check here the hooks list.

Table of Contents

Installation

Add to dependencies:

def deps do
  [{:git_hooks, "~> 0.3.0", only: :dev, runtime: false}]
end

Then install and compile the dependencies:

mix deps.get && mix deps.compile

Backup current hooks

This project will backup automatically your the hook files that are going to be overwrite.

The backup files will have the file extension .pre_git_hooks_backup.

Automatic installation

This library will install automatically the configured git hooks in your config.exs file.

Manual installation

You can manually install the configured git hooks at any time by running:

mix git_hooks.install

Configuration

One or more git hooks can be configured, those hooks will be the ones installed in your git project.

Currently there are supported two configuration options:

  • tasks: A list of the commands that will be executed when running a git hook
  • verbose: If true, the output of the mix tasks will be visible. This can be configured globally or per git hook.
config :git_hooks,
  verbose: true,
  hooks: [
    pre_commit: [
      tasks: [
        "mix format"
      ]
    ],
    pre_push: [
      verbose: false,
      tasks: [
        "mix dialyzer",
        "mix test",
        "echo 'success!'"
      ]
    ]
  ]

Removing a hook

When a git hook configuration is removed, the installed hook will automatically delete it.

Any backup done at the moment will still be kept.

Execution

Automatic execution

The configured mix tasks will run automatically for each git hook.

Manual execution

You can also run manually any configured git hook as well.

The following example will run the pre_commit configuration:

mix git_hooks.run pre_commit

It is also possible to run all the configured hooks:

mix git_hooks.run all

elixir_git_hooks's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar laibulle avatar qgadrian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.