Set THOR_DEBUG flag

Enable debug flag so errors from Thor are getting raised. This enables
us to rescue them, inform the user and exit with a failing exit code.
Rescue thor errors

Since debug flag is set thor raises errors. Rescue the error and print
the message to the ui. Then exit with a failing exit code.
When a command is unknown exit with 15

Treat unknown command the same as invalid option.
Exit code 15 is used when an option is invalid. Tread unk
Merge pull request #2478 from pjvds/fail_for_unknown_commands

Fix succeeding error code on Thor failures

Commits were cherry-picked into a new branch and then merged into 1-3-stable,
because the original source branch was out of date.

Fixes #2478
Merge branch '1-3-stable'

Conflicts:
	Rakefile
	spec/bundler/gem_helper_spec.rb
Display the Gem::SystemExitException if there is a rubygems
configuration problem
clean up gem error printing
Correct Thor error name
Revert "refresh so that `bundle exec bundle -v` works again"

This reverts commit 7b748268997d7522c1b3507b52ce61e7716b2e42, and thus
fixes #2454.

The refresh doesn't seem to be necessary... though the original commit
was a bit vague on exactly what it was setting out to fix.
Run gem installation in parallel
Add "--jobs, -j" option
Prohibit Dir.pwd while another thread is doing Dir.chdir
Improve messages for multi-threaded installation
Don't start additional thread if jobs == 1
Remove unnecessary chdir to improve concurrency
Fix to use SharedHelpers.pwd
Run installation in multiple processes unless host_os is Windows
Move constants to use it from SharedHelpers
Report exception to parent process
Fix to report post_install messages