Revamp khan-dotfiles to do a full install.

There's now an OS-specific setup step -- mac-setup.sh,
linux-setup.sh -- and a non-OS setup step, setup.sh.

Lots of stuff that used to be in mac-install has moved to the common
setup.sh, and I added everything I could from the forge page:
   https://sites.google.com/a/khanacademy.org/forge/for-khan-employees/-new-employees-onboard-doc/developer-setup

I also did the best I could to make setup.sh and linux-setup.sh
idempotent: you can safely run them multiple times.  I'm not sure
about mac-setup.sh yet; I'll need to test it on a mac.

I separated out the 'big 3' dotfiles -- .bashrc, .gitconfig, .hgrc --
into two parts, one owned by this repo (which we symlink to), and one
that is local.  I can do this because each of these files supports an
'include' functionality.  By default, we put local stuff such as your
email address in the 'local' version of .gitconfig/etc.

Test plan:
Ran
   sh -x ./setup.sh /tmp/setup
and saw it ran successfully.  Ran it again and saw it was basically a
noop.  Examined /tmp/setup/.bashrc and other dotfiles, and they looked
reasonable to me.

Also ran
   sh -x ./linux-setup.sh
and saw it ran successfully.  Ran it again and saw it was basically a
noop.

I haven't tested mac-setup.sh but will once I get this repo onto a
mac.

I also haven't tried actually *using* the .bashrc/etc that are
installed.  Will also do this on the mac machine, which is 'clean'
right now and thus a good test case.
Get rid of symlink.sh, which is no longer needed.

Test plan:
None
Get the mac setup to not re-install AppEngineLauncher.

Also add set -e since installing should be a conservative activity.

Test plan:
Will test on a mac after this is committed.
Ignore some errors that brew doctor makes, that we don't care about.

Test plan:
Will test on the mac.
Fix up the brew doctor command.

Test plan:
Will test on the mac.
Don't re-install nginx if it's already installed.

I think this gives us full idempotency!

Test plan:
Will test on the mac
Actually, brew returns 0 even if it's already installed.  We must use grep.

Test plan:
Will test on mac
'push simple' was actually added in 1.7.12, so check for that instead.

I think most modern macs come with git 1.7.12, so this is an important
change.

Test plan:
Ran setup.sh and it didn't die in check_dependencies

Also will test on mac
Revamp khan-dotfiles to do a full install.

Summary:
There's now an OS-specific setup step -- mac-setup.sh,
linux-setup.sh -- and a non-OS setup step, setup.sh.

Lots of stuff that used to be in mac-install has moved to the common
setup.sh, and I added everything I could from the forge page:
   https://sites.google.com/a/khanacademy.org/forge/for-khan-employees/-new-employees-onboard-doc/developer-setup

I also did the best I could to make setup.sh and linux-setup.sh
idempotent: you can safely run them multiple times.  I'm not sure
about mac-setup.sh yet; I'll need to test it on a mac.

I separated out the 'big 3' dotfiles -- .bashrc, .gitconfig, .hgrc --
into two parts, one owned by this repo (which we symlink to), and one
that is local.  I can do this because each of these files supports an
'include' functionality.  By default, we put local stuff such as your
email address in the 'local' version of .gitconfig/etc.

Get rid of symlink.sh, which is no longer needed.

Get the mac setup to not re-install AppEngineLauncher.

Also add set -e since installing should be a conservative activity.

Ignore some errors that brew doctor makes, that we don't care about.

Fix up the brew doctor command.

Don't re-install nginx if it's already installed.

I think this gives us full idempotency!

Actually, brew returns 0 even if it's already installed.  We must use grep.

'push simple' was actually added in 1.7.12, so check for that instead.

I think most modern macs come with git 1.7.12, so this is an important
change.

Test Plan:
Ran
   sh -x ./setup.sh /tmp/setup
and saw it ran successfully.  Ran it again and saw it was basically a
noop.  Examined /tmp/setup/.bashrc and other dotfiles, and they looked
reasonable to me.

Also ran
   sh -x ./linux-setup.sh
and saw it ran successfully.  Ran it again and saw it was basically a
noop.

I haven't tested mac-setup.sh but will once I get this repo onto a
mac.

I also haven't tried actually *using* the .bashrc/etc that are
installed.  Will also do this on the mac machine, which is 'clean'
right now and thus a good test case.

None

Will test on a mac after this is committed.

Will test on the mac.

Will test on the mac.

Will test on the mac

Will test on mac

Ran setup.sh and it didn't die in check_dependencies

Also will test on mac

Reviewers: alpert, benkomalo

Differential Revision: http://phabricator.khanacademy.org/D2202
Oops, forgot to remove [ui] now that it's moved to local .gitconfig.

Test plan:
Fingers crossed
Add a commit template to match what hgeditor.sh does for mercurial.

This isn't as good, because it doesn't auto-detect merges, but I think
merges have their own default template in git anyway so maybe it *is*
as good after all.

I'm also not sure how it interacts with git --amend, but since this is
a standard git feature I'm sure it interacts fine.  I'll find out
after I commit this...

I also made the linux setup not repeat some ntp work unnecessarily.

Test Plan:
Modified by .gitconfig by hand and ran ./setup.sh to populate
.git_template/commit_template, and am using the result to create this
commit message.
Cleanups based on chris's review: be better checking for brew and appengine.

Test plan:
Will test on mac
Sundry cleanups based on an audit of the code.

1) 'git co' should be the new one for kiln-land that Alpert provided,
not just an alias for 'git checkout'

2) I left out 'default = simple' somehow!

3) Add 'hg findreviewers' in the default .hgrc.

4) Provide status updates in setup.sh

5) Don't print as many scary messages when things are going properly,
in setup.sh.  (Normally this is when we're running the script a second
time and some tool is noisily telling us the thing is already
installed.)

Test Plan:
Ran
   make
twice on my system, and am using the result to do this commit.
Merge branch 'install' of github.com:Khan/khan-dotfiles into install

Conflicts:
	setup.sh
Duno why this was a $$ -- it should just be a $.  Oops!

Test plan:
Fingers crossed.
The default gem on OS X doesn't support --conservative, so do it manually.

Test plan:
Fingers crossed
Don't try to use 'echo -e', it's annoyingly non-portable.

Test plan:
Added
   add_warning 'test'; add_warning 'test2'
to this script and ran make, and saw the output was
   -- WARNINGS:

   WARNING: test
   WARNING: test2
Use `which python2.7` rather than assuming it's in /usr/bin.

Also, print warning messages as we go along, not just at the end.

Test plan:
Fingers crossed
Comment out 'brew doctor' -- Chris couldn't get it to pass.

If you do things that are perfectly legit, but brew doesn't like --
such as installing stuff to /usr/local not using brew -- then brew
doctor complains.  Who needs doctors like this?

Test plan:
None
Do the clone-vs-update thing differently so it emits more text on errors.

Test plan:
Ran make successfully.