Propagate "days" param through to Ajax requests

We DRY up some of the controller actions here by handling "days" in a
before filter.

It's pretty clear that as the number of routing helpers grows, we'll
want to split them out into a separate file, but leaving them where they
are for now.

Note that it's necessary to use `::URI` here to get at the top-level
constant, and not `URI`, which in Sinatra context refers to an instance
of URI::Parse.

Change-Id: I5626e4793a73bdd9e8417b60a1944f78a51aa6d9
Reviewed-on: https://gerrit.causes.com/26047
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Add a sticky footer and show a random quip in it

As an "easter egg", put a random quip in the footer, drawn from a
collection of programming quotes and aphorisms found pulled from a
handful of Google search results.

The footer is "sticky" in the sense that it stays at the bottom of the
viewport, even if the HTML content itself is short. Note that it is not
a fixed position element; it will move down if the content is long. The
method employed here is the one recommended in the Twitter bootstrap
samples:

  http://twitter.github.io/bootstrap/examples/sticky-footer.html

On small screens, the text ellipsizes, but we show the full quote via a
title attribute.

Change-Id: I71b5a05d02c349c214ac23fa9ec378dfd365b66d
Reviewed-on: https://gerrit.causes.com/26048
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Delegate some CommitSet methods to underlying `@commits`

In many was a CommitSet is a thin wrapper around the underlying
Enumerable; rather than using hand-coded wrapper methods, let's just
forward them directly. If the number of methods to delegate grows much
larger we can look at actually turning CommitSet itself into a true
Enumerable.

Change-Id: Icd9fc8fdf36f192171f66a67514f3fed3622aadc
Reviewed-on: https://gerrit.causes.com/26049
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Update sample config template with references to -c/--config switches

Change-Id: Ia04bb3f3c2103639bec0c971ff50f418e79215a1
Reviewed-on: https://gerrit.causes.com/26050
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Optionally show organization name in page titles

Change-Id: Ib9887bf1c99d34bfadb84e9b45aa1c7e62b07e20
Reviewed-on: https://gerrit.causes.com/26051
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Add pairing chart

This commit adds a pairing chart at /pairs, and also on the main
dashboard. The `?days=N` query string parameter is respected, if
present.

Included are tool-tips for headers and count cells, and background
coloring showing relative "hotness" of table cells (as measured by
commits).

Change-Id: I6955090c05b0c82c54ff871a6fc302d29493d781
Reviewed-on: https://gerrit.causes.com/26052
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Highlight active page in global nav

Change-Id: I79c674610937279442920c6e8c694a991dd4608b
Reviewed-on: https://gerrit.causes.com/26053
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Add headings to dashboard page

Change-Id: I082742a7262672bd36ff8652dbd790eac769d7f5
Reviewed-on: https://gerrit.causes.com/26054
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Add thead element to pairing matrix

This gives us some slightly nicer styling, courtesy of Bootstrap.

Change-Id: Ic6bfe5d34aff624c990b11c39cbc2d7dba4d2a85
Reviewed-on: https://gerrit.causes.com/26055
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Add RepoSet class and use it in Gatherer class

I am about to add some functionality that needs to iterate over the
repos on disk. As this is exactly what the Gatherer class is already
doing, extract that functionality out into a new class called RepoSet,
whose sole responsibility is to provide an abstraction around a set of
repos on disk.

Change-Id: Ib6fd17cd2ec48cb657e8da6486d2323eb215e524
Reviewed-on: https://gerrit.causes.com/26056
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Add `git` subcommand, with `git gc` subcommand

We now have a `twigg git gc` sub-subcommand that we can use to run `git
gc` on all the repos in batch mode.

This required me to make the `RepoSet#repos` method public, which I had
initially marked as private.

The command implementation inherits from GitHost in order to leverage
its functionality, which is a bit of a smell because there is little
that is "host-like" about this command (as a stretch argument, you could
allege that your local filesystem is the "host").

For now, this works and is DRY, but I'd like to clean it up conceptually
in a future commit.

Change-Id: I874d274767b7a7ae86644003b6e5b2fe948cfa80
Reviewed-on: https://gerrit.causes.com/26057
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Make text more readable on dark backgrounds on /pairs

Once the background crosses a threshold of 0.4 opacity, switch to
off-white text (from black) for better readability. We only do this on
the "solo" cells (the ones with blue backgrounds) because the green
cells are easy to read at any opacity.

The color used, #f8f8ff, is known as "ghost white":

  http://en.wikipedia.org/wiki/Shades_of_white

Change-Id: I3582a956b4bd4ea488c2ff33f5515d638baa73ff
Reviewed-on: https://gerrit.causes.com/26058
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Fix bug in pairing matrix max calculations

We were grabbing the max count of the outer loop, but not the nested
inner loop. This returned the right result only some of the time.

Evidently the code could be DRYed up a little, as the two max
calculations are substantially similar. I'll see if I can come up with
something that is not too clever; for now we'' stick with the
dumb-but-readable option.

Change-Id: I305cca9fe8f8169f1b20623e8037e6ff0897843e
Reviewed-on: https://gerrit.causes.com/26059
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Add commit listing to author detail page

Seems to be a pretty natural thing to want to see.

Change-Id: Ie6c64609b2c43c9564775b97c769fb196123876d
Reviewed-on: https://gerrit.causes.com/26060
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
DRY up commit details modal by using partial

I extracted this in the previous commit for use by the author detail
page; now we can DRY up the commit row partial.

Change-Id: I38b9296114934c1981f4bd7fc55b594564c5a1cc
Reviewed-on: https://gerrit.causes.com/26061
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Use path helpers instead of hard-coded strings in a couple of places

Change-Id: Iff8d9d50bc90ea18158c685618a46e6f74cb773d
Reviewed-on: https://gerrit.causes.com/26062
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Show team commits on team detail page

Change-Id: I63b320ece007e01394002f0fef5c4a9fcc845a2f
Reviewed-on: https://gerrit.causes.com/26063
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Make /authors/:slug more similar to /teams/:slug

For consistency and potential future DRY-ing. In the future we could
make these methods even more similar and have them rely on some common
underlying functionality.

Change-Id: I182f708730fdb8188a70c57d5744207e3c132f4a
Reviewed-on: https://gerrit.causes.com/26064
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Get /teams/:slug to parity with /authors/:slug

Here we break the bulk of the /authors/:slug page out into a partial
which can be reused directly by the /teams/:slug page. This means that
the teams detail page now has commit summary, nvd3 visualization, and
commit listing.

This is all possible because it rests on the shared underlying
abstraction provided by the CommitSet class.

In order to facilitate this, moved the d3/nvd3 JS up into the layout.

Change-Id: I199052a967258f1807661fe634d81310eda5fd2a
Reviewed-on: https://gerrit.causes.com/26065
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Remove Shotgun in favor of Sinatra::Reloader

I found Shotgun to be mostly unsatisfactory for development. I am not
sure whether it is a problem with the gem itself, or I was expecting too
much of it in the context of Twigg, where the source code is distributed
across multiple directories, but it failed to reload the code for most
changes (view changes worked, although I think they would have worked
anyway, but almost nothing else did, requiring a manual restart).

Rip it out in favor of Sinatra::Reloader, which comes with
sinatra-contrib, which we already depend on. As a bonus, this reduces
our dependency footprint, in addition to allowing us to configure things
so that our source code always gets reloaded, irrespective of which
directory it happens to have come from.

Change-Id: Ibe3120b303c82726410aec5e512870c53c7ce9d1
Reviewed-on: https://gerrit.causes.com/26066
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>