331 Commits

Author SHA1 Message Date
Mike McQuaid
a5ec0aa259 emoji: extract logic into generic OS classes. (#450) 2016-07-09 13:51:43 +01:00
Martin Afanasjew
77dd9d56ff Use GitRepositoryExtension for HOMEBREW_REPOSITORY 2016-07-07 01:46:58 +02:00
Andrew Janke
f518f57bd8 gist-logs: truncate log files to be gist-friendly (#279)
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-05 08:45:17 -04:00
Mike McQuaid
883b201c09 utils: output what files edit is opening. (#444)
Since we've moved all formulae to taps it's not necessarily obvious
what the path for the files are otherwise.
2016-07-04 16:09:24 +01:00
Mike McQuaid
8e0e1642ad Use curl for the GitHub API (#295)
* 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-06-03 13:05:18 +01:00
Mike McQuaid
7829af7508 bottle/test-bot: deep merge bottle JSON hashes. 2016-05-28 20:11:07 +01:00
Martin Afanasjew
e517e2e41d utils: avoid using 'gem' as an identifier (#278)
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-26 16:27:53 +02:00
Mike McQuaid
ddb576b582 Add support for testing generic OS.
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-08 16:51:22 +01:00
Score_Under
b5007c48e0 Tty: Avoid truncating if not sensible
This causes truncate to simply return the original string if the
terminal is not very wide, or if the terminal is unsupported.
2016-05-03 15:56:47 +01:00
Martin Afanasjew
8600b9edf1 Update Homebrew/homebrew references in comments
Replace `homebrew` with `brew`, `homebrew-core`, or `legacy-homebrew`
depending on context.
2016-05-02 21:19:09 +02:00
Andrew Janke
a3b70d38a7 brew-audit: pull style checks in to main audit output
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-21 14:45:33 -04:00
Andrew Janke
acc9a7ca85 brew test, install, update-test: add --keep-tmp option
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-18 12:23:08 -04:00
Xu Cheng
d5085edce0 curl: fall back to /usr/bin/curl when HOMEBREW_CURL doesn't exist
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-07 14:57:37 +08:00
Mike McQuaid
1238c65ba1 utils: add analytics functions. 2016-04-04 12:27:47 +01:00
Mike McQuaid
77611bafb1 Make Homebrew user agent consistent, use a slash.
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-04 12:18:21 +01:00
Xu Cheng
bc19a47eb9 GitHub: fix issues/pr searching
Closes #6.
2016-04-04 02:00:21 +08:00
Xu Cheng
2bb30fc5f0 --version/config: show core tap information 2016-04-02 21:51:36 +08:00
Mike McQuaid
6135da800e utils, gist-logs: improve/fix credential handling.
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-28 18:22:47 +08:00
Tim D. Smith
8aaa95ee99 Add advice about keychain credentials
Fixes Homebrew/homebrew#50050. Closes Homebrew/homebrew#50059.
2016-03-20 14:55:58 +08:00
Mike McQuaid
c8debd8fa4 utils: API Git credential tweaks.
- 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-10 18:45:43 +08:00
Mike McQuaid
ec2a3f979e utils: use string arg to IO.popen.
Closes Homebrew/homebrew#49882.
2016-03-09 16:00:22 +08:00
Mike McQuaid
041c8502c5 Set HOMEBREW_API_TOKEN from Git when available.
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-03-08 20:52:11 +08:00
Felix Bünemann
f32c2a9974 brew search: properly handle 503 errors.
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-02-01 18:37:36 +00:00
Martin Afanasjew
8dc1e05ff8 utils: inject Ruby path when running Gems
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-06 06:21:42 +01:00
Dominyk Tiller
e7738d067f utils: extend brewed_curl recommended usage to 10.8
Closes Homebrew/homebrew#47646.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2016-01-04 03:10:10 +00:00
Xu Cheng
66c0b06d72 utils: add which_all
Similar to which, except it returns all of paths where binary is found.
i.e. it's equivalent to `which -a`.
2016-01-03 21:00:11 +08:00
Xu Cheng
d043b9d40f utils: improve disk_usage_readable
* Avoid parallel assignment.
* Avoid string manipulation.
2015-12-30 16:56:05 +08:00
Rakesh
a96a9004f4 utils: add readable disk space, numbers methods. 2015-12-30 08:10:36 +00:00
Sebastian Staudt
f0a370ea12 Reimplement #pretty_duration
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-22 12:46:03 +01:00
Baptiste Fontaine
f1ac9b5776 pretty_duration: fixed for int arguments
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-14 16:34:12 +01:00
Mike McQuaid
bf2315b1f4 Use (installed) and emoji ticks consistently.
Across info, search and update.

Closes Homebrew/homebrew#45131.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-07 14:56:30 +00:00
Martin Afanasjew
fde1614670 utils: native rewrite of install_gem_setup_path!
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-20 14:00:45 +00:00
Mike McQuaid
68896d14aa download_strategy: silence curl on Travis CI.
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-11-01 00:18:51 -07:00
Xu Cheng
8207c48a23 underline url in Error message 2015-10-20 19:03:24 +08:00
Patrick Stadler
3dda14f5bd Provide better link when rate limit exceeded error is thrown
Closes Homebrew/homebrew#45134.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-20 08:38:53 +01:00
Xu Cheng
06806f860d remove unnecessary require statements 2015-10-18 22:57:42 +08:00
Martin Afanasjew
4ac345ca61 utils: improve highlighting in multi-column output
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-16 16:08:43 +01:00
Martin Afanasjew
4cf703d5d8 utils: highlight items in column-wise output
Closes Homebrew/homebrew#44343.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-10-14 15:07:57 +01:00
Martin Afanasjew
c3e7a64648 utils: re-implement and improve column-wise output 2015-10-14 15:07:57 +01:00
Xu Cheng
31ddce85e7 Homebrew.git_*: check git available 2015-09-09 12:19:17 +08:00
Xu Cheng
1b531492ca utils: add Homebrew.git_origin 2015-09-09 12:19:16 +08:00
Dan Martinez
8374374168 Improve description searching and add a cache.
Closes Homebrew/homebrew#42281.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-09-08 15:23:37 +01:00
Xu Cheng
e3299bb7a3 quiet_system: don't print cmd even when verbose mode
It's kinda annoying that quiet_system wasn't really quiet. This commit
fixes that.
2015-09-08 17:36:28 +08:00
Xu Cheng
8d5c445daa homebrew_version_string: check git available 2015-09-02 15:24:52 +08:00
Xu Cheng
71f794260b add git utils
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-09-02 15:24:52 +08:00
Mike McQuaid
2c959a7d58 More API documentation.
And remove the documented stuff from the `example-formula.rb`.

Closes Homebrew/homebrew#43241.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-29 15:43:16 +01:00
Tim D. Smith
143709e679 include git sha1 in --version output
HOMEBREW_VERSION doesn't change very often; the repository state is more
interesting.

Closes Homebrew/homebrew#41886.
2015-08-25 00:13:53 -07:00
Baptiste Fontaine
c631fc3013 which: don't fail on malformed paths in PATH 2015-08-16 17:03:05 +02:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
70025458f3 interactive_shell: create .zshrc when necessary
Closes Homebrew/homebrew#42190.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-29 16:23:10 +08:00