Moved OS-specific logic to functions:
- `find_ruby`: returns (via echo) Ruby that can be used
- `usable_ruby`: checks whether Ruby satisfies Homebrew
Pre-create OS-specific error messages:
- `upgrade_fail`: message that is printed when Homebrew fails to upgrade
vendor Ruby
- `install_fail`: message that is printed when Homebrew fails to install
vendor Ruby
Unconditionally set `TERMINFO_DIRS` when installing/upgrading vendor Ruby
**but** export it on Linux only.
Motivation: move OS-specific logic to functions so that it's easier to
understand the main steps.