The API used (`Net::HTTP::Post`) does not handle basic authentication
credentials in the same way as `open` so fix both cases so they work.
Also, do some general usability tweaks to point out to people what could
be wrong with their tokens or credentials to help them debug.
ClosesHomebrew/homebrew#50410.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
- Use empty array when `git credential-osxkeychain` lookup fails to
cache and avoid rerunning it when there's no valid results.
- Redirect `stderr` to avoid printing errors when there's a failure
or no `git credential-osxkeychain` installed.
ClosesHomebrew/homebrew#49954.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This avoids crashing with an unknown key error, if the GitHub api
response does not contain the ratelimit headers, e.g. when GitHub is
down. It also tries to display the JSON error message in addition to
the HTTP status.
ClosesHomebrew/homebrew#48538.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Particularly the `bundler` Gem requires the right Ruby binary to be in
the PATH to work correctly if the Ruby binary used to run Homebrew is
overridden via `HOMEBREW_RUBY_PATH` and thus intentionally not prefixed
to the PATH (as that would affect formulae with a Ruby dependency).
The workaround here is to prefix this path only when a Gem is activated
via `Homebrew.install_gem_setup_path!` (currently used in `brew man`,
`brew style`, and `brew tests`).
Also reuse this improved implementation in the GitHub rate limit errors.
ClosesHomebrew/homebrew#44721.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Without this the returned string is not as accurate if the method is
called with an int larger than 120.
ClosesHomebrew/homebrew#47002.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Setting the environment variable `HOMEBREW_RUBY_PATH` allows one to run
Homebrew with a non-standard Ruby, even one that is not in `PATH`. This
creates the problem that the `gem` in `PATH` might not be the right one
to call, possibly leading to confusing results as the wrong RubyGems
installation is queried/manipulated.
ClosesHomebrew/homebrew#46185.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
The yellow background made the text unreadable for light-on-dark color
schemes. Fix by making the highlighted text just bold.
FixesHomebrew/homebrew#45028.
ClosesHomebrew/homebrew#45030.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Two methods:
* `Utils.git_available?` checks whether git is installed.
* `Utils.ensure_git_installed!` installs git for users who don't install
Xcode or CLT.
A simple change that allows for easy copy/pasting. Right now if you were to double click on the text it will also inadvertently copy the trailing period. This change will alleviate the unnecessary gymnastics of not capturing the trailing period.
/most_pedantic_pull_request_ever
ClosesHomebrew/homebrew#41257.
Signed-off-by: Xu Cheng <xucheng@me.com>
The link for the page that allows creation of API tokens has changed
from /settings/applications to /settings/tokens. Also the wording
on that page calls them "personal access tokens", so update
Homebrew to be consistent with that.
ClosesHomebrew/homebrew#39378.
Signed-off-by: Tim D. Smith <git@tim-smith.us>