Skip to content

Breaks if grunt isn't setup on every branch #21

@CamdenSegal

Description

@CamdenSegal

I've setup a pre-commit hook using grunt-githooks on a branch of my repository. If I switch to a branch that is not configured with a gruntfile it blocks me from committing with the error "Fatal error: Unable to find Gruntfile."

It seems like it could be a good practice change the hook script from binding into specific grunt tasks to instead:

  • First checking for the existence of the Gruntfile
    • If no Gruntfile exists exit the hook without blocking.
  • Then checking the Gruntfile to see if githooks is configured
    • If githooks is not configured in the gruntfile then exit the hook without blocking.
  • Then checking and running the tasks assigned to the current hook in the Gruntfile.

This will allow for changing the tasks to be run per hook by just modifying the gruntfile, and also allow for different tasks, or no tasks, to be run on different branches.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions