Update image_optim dependency 0.12.0 -> 0.13.0

Changes:

  https://github.com/toy/image_optim/compare/70ec2ed18aebc1cc07038e0b0c7494f2b23e4fec...8fe5473e2a5aa23db9121dd19b3a464c8323a443

Change-Id: Ifc992739207715ed4ca136bf2097551f0bc83b6b
Reviewed-on: http://gerrit.causes.com/36959
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Relax image_optim dependency

Make it depend on the last minor version, rather than revision.

Change-Id: Ief6540676eb1aad58ff45d6c2354f68bb8f9e88e
Reviewed-on: http://gerrit.causes.com/37008
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Ignore more Rubocop checks

Change-Id: Ib8bab84d87eebfd35c98cdb66f18fde4a6765312
Reviewed-on: http://gerrit.causes.com/37009
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Isolate external messages to HookContext in runner

We were referencing `@context` repeatedly in order to send it the
`hook_type_name` and `hook_script_name` messages. Isolate these to
helper methods to emphasize the dependency.

Change-Id: If984ee29f7a14ec78ebc32386dda972126806d8d
Reviewed-on: http://gerrit.causes.com/37379
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Extract helper methods from run_hook

The `run_hook` method had a number of things going on that made it a bit
complex to work with. Extract chunks of logic into separate helpers to
make it a bit more manageable.

Change-Id: I2b4bf3fe7f3439470f5b0b0d2eee0ea906157c40
Reviewed-on: http://gerrit.causes.com/37380
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Extract HookLoader responsibility from HookRunner

The `HookRunner` class was taking on too much responsibility by
attempting to handling loading, running, and printing the result of
hooks.

One clear opportunity was to extract the loading of hooks into separate
loader classes (one for built-in hooks and another for plugins).

This also sets us up to allow each of these classes to perform
additional checks down the road (like warning the user if the plugin has
changed).

Change-Id: I911c1c61bc4c77bcbca84e8748db9a53812477cb
Reviewed-on: http://gerrit.causes.com/37381
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Move hook loaders into own directory

We may want to support other types of hook loaders in the future, so
emphasize that this feature is extendible by keeping all loaders in
their own directory hierarchy.

Change-Id: Iab581a6af28e74793490614340f96165376270ce
Reviewed-on: http://gerrit.causes.com/37382
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Check plugin signatures before hook run

Change-Id: Iecd680b89d474db34e7d2e309977f49c382ef917
Reviewed-on: http://gerrit.causes.com/37383
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Add UserInput class

This will make managing fetching input from the user easier both in
terms of implementation and testing.

Change-Id: I5b043156bd5d0a8c33667929d91c9f5aeaf1a602
Reviewed-on: http://gerrit.causes.com/37384
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Extract hook signature logic into HookSigner

The `PluginHookLoader` was getting complicated since it combined
signature calculation with hook loading.

Extract the signature calculation and verification into a separate
helper class.

Change-Id: I7632eecb6a454846126bac146fd94c578b57e7c9
Reviewed-on: http://gerrit.causes.com/37385
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Use \ for line concatenation in overcommit-hook

Appease the Rubocop gods.

Change-Id: Iaefe596d0d352ba90de574b31e46bec0c59719c2
Reviewed-on: http://gerrit.causes.com/37386
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Exclude hooks from FileName Rubocop check

This naming convention doesn't apply for scripts.

Change-Id: I56c08d22f5242165a7b097ce048a025c560851f4
Reviewed-on: http://gerrit.causes.com/37387
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Update changelog

Include updates about new signature verification and auto-updating
master hook.

Change-Id: I3ee4d8000fec63ddbddd335c954134c714fbb91c
Reviewed-on: http://gerrit.causes.com/37389
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Fix line continuation Rubocop warnings

Change-Id: I9a926856b8d4a0ce6015e393eb14c0792adaceae
Reviewed-on: http://gerrit.causes.com/37390
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Fix exists? Rubocop deprecation warnings

Change-Id: I1b45c3274b8bd5dd64ff171ef02e999263a83737
Reviewed-on: http://gerrit.causes.com/37391
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Nest class methods under class << self

Change-Id: I2b255b449378b0b4af9b0576add1840f478a4e6a
Reviewed-on: http://gerrit.causes.com/37392
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Fix unnecessary private modifier Rubocop warnings

Change-Id: Iea718e3a9e3f79966204ebeaf9e8349930dfe1f1
Reviewed-on: http://gerrit.causes.com/37393
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Fix array element indentation in spec

Change-Id: I1fa1332fa682e0ce0521ffdf10cfbe03bf53dbb8
Reviewed-on: http://gerrit.causes.com/37394
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Reword disabling signature section of README

Make it clear that this shouldn't be necessary, even for proprietary
repos.

Change-Id: Ica4bb5d8d38e17d2047a4cc384e6afbef45b4dcb
Reviewed-on: http://gerrit.causes.com/37396
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Update overcommit-hook before hook run if changed

Previously, if upgrading Overcommit would result in the master hook
being changed, the user would have to manually run `overcommit
--install` in order to update the hooks.

Make this a little bit easier by automatically updating the master hook
if it has changed.

One trick to get this to work is that if the hook is changed and we
update it, we need to `exec` in order to replace the current process
with a new one executing the new master hook, otherwise the old file
will still be run.

Change-Id: I6746e6f25cf624c0da9d91153ba1f91b9a9b8e75
Reviewed-on: http://gerrit.causes.com/37388
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>