<commit_before># RubyGitHooks

RubyGitHooks sets up a reasonable development environment for git hooks.

Git, by default, gives you information that doesn't instantly map to
what you want.  A pre-receive hook, for instance, doesn't just give
you the content that's being received.  You have to extract the
content by running git commands.  If you want to write a pre-receive
hook that can also be used pre-commit, you have to do a fair bit of
wrapping.

RubyGitHooks does that extracting and wrapping for your convenience.

## Installation

To use with a single Ruby installation:

    gem install ruby_git_hooks

Remember that ruby_git_hooks is invoked by Git -- it won't normally
run with Bundler.  Not only do you not need to add it to your Gemfile,
it probably won't help.  So make sure ruby_git_hooks is installed for
every Ruby you use day-to-day from the command line.

## Usage

## Writing Hook Scripts

Your new hook script should have a Ruby shebang line (see below).  You
can use the included hooks or define your own.

The hook should be copied or symlinked to the appropriate location, of
the form ".git/hooks/hook-name".

Here's an example: a pre-receive hook that uses the shebang line to
require ruby_git_hooks/case_clash, then runs it.

~~~
#!/usr/bin/env ruby
# Put this file in .git/hooks/pre-receive and make it executable!
require "ruby_git_hooks/case_clash"

RubyGitHooks.run CaseClashHook.new
~~~

### Multiple Git Hooks, One RubyGitHook<commit_msg>Adding directions on setting up pivotal token<commit_after># RubyGitHooks

RubyGitHooks sets up a reasonable development environment for git hooks.

Git, by default, gives you information that doesn't instantly map to
what you want.  A pre-receive hook, for instance, doesn't just give
you the content that's being received.  You have to extract the
content by running git commands.  If you want to write a pre-receive
hook that can also be used pre-commit, you have to do a fair bit of
wrapping.

RubyGitHooks does that extracting and wrapping for your convenience.

## Installation

To use with a single Ruby installation:

    gem install ruby_git_hooks

Remember that ruby_git_hooks is invoked by Git -- it won't normally
run with Bundler.  Not only do you not need to add it to your Gemfile,
it probably won't help.  So make sure ruby_git_hooks is installed for
every Ruby you use day-to-day from the command line.

## Usage

Setup the Pivotal API token with git:

    git config pivotal.token {your-pivotal-tracker-token}

Verify that config parameter is correct:

    git config --get pivotal.token

## Writing Hook Scripts

Your new hook script should have a Ruby shebang line (see below).  You
can use the included hooks or define your own.

The hook should be copied or symlinked to the appropriate location, of
the form ".git/hooks/hook-name".

Here's an example: a pre-receive hook that uses the shebang line to
require ruby_git_hooks/case_clash, then runs it.

~~~
#!/usr/bin/env ruby
# Put this file in .git/hooks/pre-receive and make it executable!
require "ruby_git_hooks/case_clash"

RubyGitHooks.run CaseClashHook.new
~~~

### Multiple Git Hooks, One RubyGitHook
{'fraction_non_alphanumeric': 0.05552030456852792, 'fraction_numerical': 0.0, 'mean_word_length': 4.126829268292683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3238872', 'n_tokens_mistral': 963, 'n_tokens_neox': 898, 'n_words': 458}