Fix WatchmanFileScanner for Ruby < 1.9.2 compatibility

`File.realpath` appeared in 1.9.2 (I believe), so swap it out for
Pathname instead, which should work everywhere.

Note that the call as it existed was not optimal anyway, as the call to
`File.expand_path` was redundant.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Talk to Watchman using its binary protocol

A couple of people have reported problems building and using Command-T
as a result of issues with the JSON library, which we started requiring
in commit d24139eb779. For example, see:

  https://github.com/wincent/Command-T/issues/68

This commit removes that dependency, replacing it with an implementation
of the Watchman binary protocol. As a bonus (and in fact, this was my
initial motivation for starting to look at this, before I'd heard of
JSON-related problems), this reduces the cost of communicating with
Watchman by about half:

                          user     system      total        real
    watchman JSON     1.310000   0.250000   1.620000 (  5.784897)
    watchman binary   0.620000   0.220000   0.890000 (  3.839422)

Those are the timings produced by running the script in
bin/benchmarks/watchman.rb in a Watchman-monitored directory containing
well over 300k files. The speed-up is due to the fact that the binary
protocol format is much more compact, resulting in less data being
transmitted over the socket, and also because parsing JSON is typically
pretty slow.

The protocol adapter added here has been written in a relatively
straightforward way, without any hoop-jumping in the name of
optimization. It would likely be possible to make it go even faster with
some corner-cutting, but I don't really see the need for that at this
point.

I don't really test on Windows any more, so I've tried to make this safe
on Windows by adding some checks for header files which I don't expect
to be available there. On such a platform, compilation should still
succeed, but the compiled code just has some stub modules in it which
raise exceptions. Watchman doesn't work on Windows anyway, so Windows
uses shouldn't really notice any difference.

This is the first cut; I expect to do some more clean-up in follow-up
commits.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Reorganize benchmark files

Give "benchmark.rb" a more descriptive name, and move it down into the
"benchmarks" subdirectory.

Updated some relative paths.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Silence a compiler warning

The compiler doesn't know that `rb_raise` longjmps us out of the
function, so make it feel better by pretending that we'll return a VALUE
no matter what.

Fixes the Clang warning:

  watchman.c:470:1: warning: control may reach end of non-void function [-Wreturn-type]

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Fix compilation errors on 1.8

1.8 has an st.h header which defines ST_CONTINUE (et al), which is
apparently not included by default.

1.9 has a ruby/st.h header, included by default, and also a st.h header
for backwards compatibility. The latter works but issues a warning to
the console.

Let's check for the presence of the headers and use the appropriate one.
Note that ruby/st.h has the standard include guards in place, so we need
not worry about inadvertently including things twice.

Reported here:

  https://github.com/wincent/Command-T/issues/67#issuecomment-38815959

Leads to:

  watchman.c:188:12: error: use of undeclared identifier 'ST_CONTINUE'

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Update specs for Ruby 1.8 compatibility

The implementation does work under 1.8, but the specs needed some
convincing of that fact.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Doc updates

- added a FAQ section
- fixed a typo
- turned a "see" reference into a navigable link
- improved trouble-shooting documentation
- augmented and polished TIPS section
- started prepping for 1.8 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Drop c99 mode to enable compilation on mingw

This avoids the 'unknown type name off_t' error that will otherwise
occur:

  http://sourceforge.net/p/mingw/bugs/2046/

Originally submitted at:

  https://github.com/wincent/Command-T/pull/63

Minor tweaks applied:

- squashed two commits into one
- reordered some lines to keep comments close to the lines they actually
  apply to
- de-c99-ize additional sites missed by original commit (eg. watchman.c
  file)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Add Roland Puntaier to AUTHORS section of docs

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Merge branch 'rpuntaie/master' into next

* branch 'rpuntaie/master':
  Add Roland Puntaier to AUTHORS section of docs
  Drop c99 mode to enable compilation on mingw

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Update docs for 1.8 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>