Add Gemfile.lock/bundler checking

This commit adds a little helper script post-checkout to determine if
the Gemfile dependencies are still valid post-checkout. If they
aren't, the script will give a little warning. This should hopefully
remove a little bit of friction and annoyance when updating the
repository.

Change-Id: I6ebe97a926d170914604594637985cec7eb2a519
Reviewed-on: https://gerrit.causes.com/29509
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Greg Hurrell <greg@causes.com>
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
Add --no-ext-diff option to git diff

When a developer has explicitly set an external diff program to use with
`git`, the `extract_modified_lines` method would hang.

Add the `--no-ext-diff` flag to force git to use the built-in diff
program.

Change-Id: Icd9c4d7af7e0ac3292173468dc80bc5abfaef0d2
Reviewed-on: https://gerrit.causes.com/29550
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Greg Hurrell <greg@causes.com>
Expose StagedFile#original_path

Some hooks need to operate on the staged file's original path, so we
need to make this property available for reading.

Change-Id: I93316b27331c8121a1468730462da4a380c37974
Reviewed-on: https://gerrit.causes.com/29833
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Update changelog and readme

A couple of commits were recently added without their respective
changelog entries. Likewise, a haml_style pre-commit plugin was added
but the list in the readme was not updated. This commit addresses both
of these issues.

Change-Id: I30cfa2d31aa85593aaae7fd77bdf46da9491d025
Reviewed-on: https://gerrit.causes.com/29834
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Add Gemfile.lock

This ensures that the dependencies don't change across installations of
the repo. Specifically, we hope that this will make sure that Travis CI
builds against the same dependencies that we are using locally.

Change-Id: I92b4a57ac09b2f14b29ace86d3c409754c933a23
Reviewed-on: https://gerrit.causes.com/29836
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Cut 0.3.0

Change-Id: I1ea696df079279e57aa1c34155ae7a50a686f177
Reviewed-on: https://gerrit.causes.com/29835
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Tell Travis CI to execute rspec with bundle

After adding the Gemfile.lock, Travis CI failed when trying to execute
rspec:

  $ bundle install --deployment
  ...
  $ rspec
  /home/travis/build.sh: line 169: rspec: command not found

We believe that executing rspec in the context of the bundle will
resolve this.

Change-Id: Ie96202470068c610833436e2588d5c94d92b3e54
Reviewed-on: https://gerrit.causes.com/29841
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Add git author environment variables to .travis.yml

Our specs execute git commands. When run in Travis CI, we were seeing
error messages like:

  *** Please tell me who you are.
  Run
    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"
  to set your account's default identity.
  Omit --global to set the identity only in this repository.
  fatal: empty ident name (for
    <travis@testing-worker-linux-3-2-14691-linux-14-12347578.c45665.blueboxgrid.com>)
    not allowed

Setting the author name as an environment variable should resolve this
minor annoyance.

Change-Id: Iee2ed9308c69df868054156a05820de049afe1b9
Reviewed-on: https://gerrit.causes.com/29842
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Use per-file .rubocop.yml for staged files

Rubocop supports using a separate configuration file on a per-directory
basis. For each file, it first checks the directory that file is in,
then recursively scans upwards until it finds a `.rubocop.yml` file; if
it finds none it checks the user's home directory.

Overcommit wasn't running Rubocop with the appropriate configuration if
a user had a directory-specific configuration.

The solution was to extract all relevant Rubocop configurations for all
files, and to run each group of files against that particular
configuration (this is better than naïvely running each file separately
with its own config, which could take a long time with many files).

Change-Id: I0b11748eb3f346dca4aff3351dd5d73fa72be50f
Reviewed-on: https://gerrit.causes.com/30059
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Beautify CHANGELOG

Add some headings to the version numbers in the CHANGELOG to make it
more readable.

Change-Id: I86f2784b7ff3e386c2466fe8c3aa3aae78a8d036
Reviewed-on: https://gerrit.causes.com/30171
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Use Pathname.ascend in rubocop_yml_for

Using `Pathname.ascend` is a little more conventional. Also updated the
changelog to mention the fix in 2119b447.

Change-Id: I7a8f8bdd61f64bda3056dda72102b47da7fc2146
Reviewed-on: https://gerrit.causes.com/30172
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Tested-by: Shane da Silva <shane@causes.com>
Remove Gemfile.lock from repo

Gems aren't supposed to include a `Gemfile.lock` since the Gemspec
should explicitly list all dependencies.

Change-Id: I9f1f90179994337a5283cfa27d7e3ace4f0851e2
Reviewed-on: https://gerrit.causes.com/30173
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Cut version 0.3.1

Change-Id: I9bb09e03c688945994bcef923d55e3e53dc74663
Reviewed-on: https://gerrit.causes.com/30174
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Use enum_for with ascend in rubocop_yml_for

It turns out that even though `Pathname#ascend` wasn't written to return
an enumerator when no block was given, you can use a handy-dandy helper
called `enum_for` to wrap the call in an enumerator.

This allows the method to be drastically simplified to use `map` and
`find`.

Change-Id: Idda85f38ffd0e683334a20cdd114c5d4234d8d66
Reviewed-on: https://gerrit.causes.com/30175
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Lann Martin <lann@causes.com>
Reviewed-by: Greg Hurrell <greg@causes.com>
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
Fix rubocop.yml not found in working directory

The switch to using `Pathname#ascend` in e06c0326 broke finding a
`.rubocop.yml` file in the current working directory, since the path
passed to `ascend` would usually be relative (i.e. have no leading `/`),
and so we would not generate a final path of just searching for
`.rubocop.yml`.

Change-Id: I7e66727d077093e3f7c77a03348f488d7e334371
Reviewed-on: https://gerrit.causes.com/30476
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Cut version 0.3.2

Change-Id: I7523574e8effe6ec64493bc4e8390d7d94c22ac7
Reviewed-on: https://gerrit.causes.com/30478
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Fix RubyStyle specs to be 1.8.7-compliant

This was missed in 2fdedf1.

Change-Id: I3093327cb2003f44e697a6f5e52acb45f9b767c1
Reviewed-on: https://gerrit.causes.com/30479
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Add image optimization pre-commit plugin

Change-Id: I0817b9ff0b392d6e30b4c268d1a7a71e836123b8
Reviewed-on: https://gerrit.causes.com/30488
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Make image optimization check compatible with 1.8.7

Change-Id: I2d48b1934546838f723e1f60d690273c5cd5b232
Reviewed-on: https://gerrit.causes.com/30489
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Require image_optim only during ImageOptimization#run_check

Change-Id: If508f37c272b9b8f8dd34def31bc7007d0ab6a93
Reviewed-on: https://gerrit.causes.com/30490
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>