aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
AgeCommit message (Collapse)Author
2016-07-30utils: provide a better location in 'odeprecated'Martin Afanasjew
Try to find a formula in the backtrace to make the warning message more helpful in identifying the culprit, as the formula is not always the immediate caller of a deprecated method. Provide some sane fallbacks if there's not formula in the call stack.
2016-07-29utils: add API removal messaging methods.Mike McQuaid
Add new `odeprecated` and `odisabled` methods to print API removal messages. Currently these are just used by things in `compat/`.
2016-07-09emoji: extract logic into generic OS classes. (#450)Mike McQuaid
2016-07-07Use GitRepositoryExtension for HOMEBREW_REPOSITORYMartin Afanasjew
2016-07-05gist-logs: truncate log files to be gist-friendly (#279)Andrew Janke
Truncates each log file to about 1 MB. This avoids upload and download errors with the gists, and respects GitHub's suggested size limits.
2016-07-04utils: output what files `edit` is opening. (#444)Mike McQuaid
Since we've moved all formulae to taps it's not necessarily obvious what the path for the files are otherwise.
2016-06-03Use `curl` for the GitHub API (#295)Mike McQuaid
* Move GitHub API module to utils/github.rb. * Move curl method to utils/curl.rb. * global: use long curl arguments and an array. This makes the code more self-documenting. * utils/curl: support reading curl's output. * utils/github: use curl instead of open-uri. It has far better proxy support. * pull: set Homebrew user agent. * gist-logs: remove trailing whitespace. * gist-logs: use first instead of [0]. Easier to read. * gist-logs: use curl-based GitHub.open method.
2016-05-28bottle/test-bot: deep merge bottle JSON hashes.Mike McQuaid
2016-05-26utils: avoid using 'gem' as an identifier (#278)Martin Afanasjew
Avoid breaking code highlighting of some editors (e.g. Sublime Text) when `gem` is used as an identifier. This messes up the highlighting below the first use and makes working with the file rather annoying.
2016-05-08Add support for testing generic OS.Mike McQuaid
If the environment variable HOMEBREW_TEST_GENERIC_OS is set ensure that neither Mac nor Linux-specific code is loaded. This allows easier testing of cross-platform code on OS X and will make it easier to port Homebrew to platforms other than OS X and Linux.
2016-05-03Tty: Avoid truncating if not sensibleScore_Under
This causes truncate to simply return the original string if the terminal is not very wide, or if the terminal is unsupported.
2016-05-02Update Homebrew/homebrew references in commentsMartin Afanasjew
Replace `homebrew` with `brew`, `homebrew-core`, or `legacy-homebrew` depending on context.
2016-04-21brew-audit: pull style checks in to main audit outputAndrew Janke
This collects all violations for each formula in a single place, instead of doing `brew style` outputs for all formulae first, and then the other audit checks. Closes #112. Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-18brew test, install, update-test: add --keep-tmp optionAndrew Janke
Also enables sandbox for --interactive and --debug use of install and test, using automatic retention. Closes #66. Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-07curl: fall back to /usr/bin/curl when HOMEBREW_CURL doesn't existXu Cheng
This can happen when `HOMEBREW_CURL` is set to brewed curl, but during `brew resinstall curl`, brewed curl's symlink is temporary unlinked. So let's fallback to /usr/bin/curl in this case.
2016-04-04utils: add analytics functions.Mike McQuaid
2016-04-04Make Homebrew user agent consistent, use a slash.Mike McQuaid
Generally it seems user agents are all `software/version` but ours is not. Also, set the user agent in a way that it's shared between Bash and Ruby code. Closes https://github.com/Homebrew/legacy-homebrew/pull/50480.
2016-04-04GitHub: fix issues/pr searchingXu Cheng
Closes #6.
2016-04-02--version/config: show core tap informationXu Cheng
2016-03-28utils, gist-logs: improve/fix credential handling.Mike McQuaid
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. Closes Homebrew/homebrew#50410. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-20Add advice about keychain credentialsTim D. Smith
Fixes Homebrew/homebrew#50050. Closes Homebrew/homebrew#50059.
2016-03-10utils: API Git credential tweaks.Mike McQuaid
- 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. Closes Homebrew/homebrew#49954. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-09utils: use string arg to IO.popen.Mike McQuaid
Closes Homebrew/homebrew#49882.
2016-03-08Set HOMEBREW_API_TOKEN from Git when available.Mike McQuaid
As requested in Homebrew/homebrew#46578. Falls back to existing functionality. Closes Homebrew/homebrew#46578. Closes Homebrew/homebrew#49846. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-01brew search: properly handle 503 errors.Felix Bünemann
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. Closes Homebrew/homebrew#48538. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-06utils: inject Ruby path when running GemsMartin Afanasjew
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`).
2016-01-04utils: extend brewed_curl recommended usage to 10.8Dominyk Tiller
Closes Homebrew/homebrew#47646. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2016-01-03utils: add which_allXu Cheng
Similar to which, except it returns all of paths where binary is found. i.e. it's equivalent to `which -a`.
2015-12-30utils: improve disk_usage_readableXu Cheng
* Avoid parallel assignment. * Avoid string manipulation.
2015-12-30utils: add readable disk space, numbers methods.Rakesh
2015-12-22Reimplement #pretty_durationSebastian Staudt
Also reuse this improved implementation in the GitHub rate limit errors. Closes Homebrew/homebrew#44721. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-12-14pretty_duration: fixed for int argumentsBaptiste Fontaine
Without this the returned string is not as accurate if the method is called with an int larger than 120. Closes Homebrew/homebrew#47002. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-12-07Use `(installed)` and emoji ticks consistently.Mike McQuaid
Across info, search and update. Closes Homebrew/homebrew#45131. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-11-20utils: native rewrite of install_gem_setup_path!Martin Afanasjew
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. Closes Homebrew/homebrew#46185. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-11-01download_strategy: silence curl on Travis CI.Mike McQuaid
Use one of the Travis CI default environment variables: http://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables Closes Homebrew/homebrew#44446. Closes https://github.com/travis-ci/travis-ci/issues/4936. Closes Homebrew/homebrew#45561. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-20underline url in Error messageXu Cheng
2015-10-20Provide better link when rate limit exceeded error is thrownPatrick Stadler
Closes Homebrew/homebrew#45134. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-18remove unnecessary require statementsXu Cheng
2015-10-16utils: improve highlighting in multi-column outputMartin Afanasjew
The yellow background made the text unreadable for light-on-dark color schemes. Fix by making the highlighted text just bold. Fixes Homebrew/homebrew#45028. Closes Homebrew/homebrew#45030. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-14utils: highlight items in column-wise outputMartin Afanasjew
Closes Homebrew/homebrew#44343. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-14utils: re-implement and improve column-wise outputMartin Afanasjew
2015-09-09Homebrew.git_*: check git availableXu Cheng
2015-09-09utils: add Homebrew.git_originXu Cheng
2015-09-08Improve description searching and add a cache.Dan Martinez
Closes Homebrew/homebrew#42281. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-09-08quiet_system: don't print cmd even when verbose modeXu Cheng
It's kinda annoying that quiet_system wasn't really quiet. This commit fixes that.
2015-09-02homebrew_version_string: check git availableXu Cheng
2015-09-02add git utilsXu Cheng
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.
2015-08-29More API documentation.Mike McQuaid
And remove the documented stuff from the `example-formula.rb`. Closes Homebrew/homebrew#43241. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-25include git sha1 in --version outputTim D. Smith
HOMEBREW_VERSION doesn't change very often; the repository state is more interesting. Closes Homebrew/homebrew#41886.
2015-08-16which: don't fail on malformed paths in PATHBaptiste Fontaine