433 Commits

Author SHA1 Message Date
Mike McQuaid
99dda758c4 utils: only look for gems in GEM_HOME.
This avoids issues where a gem is installed but cannot be found.

Fixes #3355.
Fixes #3760.
2018-02-09 21:09:18 +00:00
Mike McQuaid
0a12328500 utils: no .metadata deprecations.
Otherwise running on old casks can produce deprecations.

Fixes #3738.
2018-02-05 09:14:54 +00:00
Mike McQuaid
4abae7f7e9 Always install Gems into bundler location. 2018-01-26 22:05:43 +00:00
Mike McQuaid
459b113e28 utils: reduce odeprecated warnings.
Fix the code so we don't actually output `odeprecated` warnings for
`HOMEBREW_CACHE`d or `.brew`d formulae.
2018-01-24 09:02:00 +00:00
Mike McQuaid
5e5989b704 utils: no deprecations for cached formulae.
`HOMEBREW_CACHE`d and `.brew`ed formulae cannot be updated so don't
complain about their deprecation.
2018-01-21 13:34:36 +00:00
Mike McQuaid
17c24d040b utils: tell developers to submit odeprecated PRs.
Rather than just telling them to submit an issue as it's likely that
as these folks will be able to submit a PR.
2018-01-17 10:50:48 +00:00
Dominyk Tiller
6fe261bc5c
utils: stop debug exploding when zsh is used 2017-12-24 20:59:34 +00:00
Shaun Jackman
ce85e3b3b5 Remove with_system_path
The method with_system_path is no longer needed,
since environment filtering uses a default PATH.
2017-12-12 09:27:06 -08:00
Shaun Jackman
a4033c7196 Do not specify absolute paths to utilities
Specifying an absolute path to utilities is no longer needed,
since environment filtering uses a default PATH.
2017-12-12 09:25:16 -08:00
Mike McQuaid
9ebf338804 diagnostic: fix paths usage.
- Don't allow taking an argument. This doesn't work and never has as it
  caches the result regardless of the argument.
- Don't rely on the PATH to check for external commands.
2017-11-17 17:41:58 +00:00
Mike McQuaid
b369593cbd utils: correctly handle empty user gem env. 2017-11-05 14:45:36 +00:00
Mike McQuaid
ca189437e4 Tweak use of with_env
- Use it in more places where it saves code
- Allow using symbolic keys for a cleaner interface
- Use `HOMEBREW_GEM_*` instead of `GEM_OLD_*`
2017-10-29 14:44:43 +00:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Markus Reiter
7cadff0a33 Use PATH where possible. 2017-09-29 22:18:24 +02:00
Dan Wendorf
acf1b278ae List cask full-names
`brew cask list` supports the `--full-name` flag which will include the tap
name for casks not part of the core caskroom/cask tap. For example, if
cask "foo-beta" is installed from the caskroom/versions cask, `brew cask
list --full-name` will report the name as "caskroom/versions/foo-beta".
2017-09-16 10:00:06 -07:00
Gautham Goli
d45ff9c0fd audit: Add a global flag to silent warning when auditing 2017-09-04 23:57:09 +05:30
Mike McQuaid
2d18ba586b Enable more deprecations.
It's been long enough that these have been commented out so let's
enable them globally.
2017-07-21 10:50:07 +01:00
Misty De Meo
610af15f0e
run_as_not_developer: use with_env helper 2017-07-15 17:40:35 -07:00
Misty De Meo
30adcab6cf
Add with_env helper to set temporary ENV vars 2017-07-15 17:39:55 -07:00
Markus Reiter
599a618273 Move require? to utils. 2017-06-14 12:51:36 +02:00
Mike McQuaid
ed9942fbd1 Merge pull request #2769 from MikeMcQuaid/rubocop-no-perl-backrefs
rubocop: don’t allow Perl regex backrefs.
2017-06-12 16:47:28 +01:00
Mike McQuaid
021cef4b2b Autocorrect Rubocop Style/SpecialGlobalVars. 2017-06-12 09:11:42 +01:00
Mike McQuaid
7a0aff1080 Autocorrect Rubocop Style/PerlBackrefs. 2017-06-10 20:23:20 +03:00
Mike McQuaid
486d3d84b1 edit: tweak default editors.
Add `atom` (not my editor of choice [TextMate for life!]) but widely
used enough to probably warrant it. Also, reorder based on my best
guestimates of current usage and cleanup the editor code while we're
here.
2017-06-07 16:07:53 +01:00
Markus Reiter
2d6ae61314 Re-revert "Fix operator spacing." 2017-06-02 19:22:05 +02:00
adrian
de78999def don't try to find the full path of the editor in 'brew edit'
fixes #2709
2017-06-01 17:45:07 -07:00
ilovezfs
197392b56d Revert "Fix operator spacing." 2017-06-01 04:06:40 -07:00
Markus Reiter
d34ba7395b Fix operator spacing. 2017-05-31 19:53:41 +02:00
Markus Reiter
f0dc1d96c5 Merge pull request #2537 from reitermarkus/pathname-to_str
Remove `to_s` from some `Pathname`s.
2017-05-18 09:39:07 +02:00
Mike McQuaid
8205e61e64 More environment filtering tweaks
- only document HOMEBREW_* variables in the manpage (although still
  read from all the original environment variables).
- resort manpage environment variables in alphabetical order
- check the original path for trailing slashes
2017-05-13 11:42:01 +01:00
Markus Reiter
5828eefd01 Remove to_s from some Pathnames. 2017-05-08 13:37:28 +02:00
Mike McQuaid
57db2e539e Revert "Merge pull request #2597 from MikeMcQuaid/vendor-gems"
This reverts commit 3e4547f52e7ebec633f8bfefc8a396d944edf908, reversing
changes made to 6edf9382bcc1240ad6f97c8b752cfe56cef9965d.
2017-05-07 17:28:39 +01:00
Mike McQuaid
e1bbab6ca6 Revert "Merge pull request #2603 from MikeMcQuaid/tweak-gem-vendoring"
This reverts commit 2372872974d1049c2beafe7dedb7f8f882502058, reversing
changes made to 3e4547f52e7ebec633f8bfefc8a396d944edf908.
2017-05-07 17:28:37 +01:00
Mike McQuaid
33f83be10e Tweak Gem vendoring.
If people have `HOMEBREW_RUBY_PATH` set then things explode in a rather
confusing fashion. Instead, run `bundle` for them with the arguments
that they'd want.

Also, move `macho` requires into the module itself; it's a pain having
to do everything for Bundler before requiring `pathname` which is a core
Ruby class.
2017-05-07 15:33:54 +01:00
Mike McQuaid
ee253e465b Vendor all Homebrew's gems.
Homebrew's actually ended up using a fair few gems. While we want to
avoid Bundler at runtime (and this PR still does that, in fact uses
Bundler even less at runtime than it did before) writing our own version
to use at build-time seems redundant.
2017-05-07 13:52:57 +01:00
Markus Reiter
24b190cc14 Remove existing from PATH when adding Gem.bindir. 2017-05-03 10:18:07 +02:00
Mike McQuaid
5b19563937 utils: create GEM_HOME when installing Gems.
It may not exist before Gem installation which means that the resulting
installed gem will not be found in the PATH.
2017-05-03 08:26:30 +01:00
Markus Reiter
4d5d6a65e3 Rename PATH#validate to PATH#existing. 2017-04-30 21:11:28 +02:00
Markus Reiter
22f624b373 Make PATH enumerable. 2017-04-30 21:11:28 +02:00
Markus Reiter
f8ad9d7efd Use PATH where possible. 2017-04-30 21:11:27 +02:00
Markus Reiter
314483f75c Remove Array#to_path_s. 2017-04-30 21:11:27 +02:00
Markus Reiter
e221d0481a Use to_path_s in install_gem_setup_path!. 2017-04-30 21:11:27 +02:00
Mike McQuaid
6b0afa3e9c Remove puts_hash, require pp
I wasn’t aware this existed when I created puts_hash so: may as well
remove it.
2017-04-24 11:45:32 +01:00
Mike McQuaid
3e40059f8d utils: make which_editor handle editor args.
Handle cases like e.g. `EDITOR="subl -w"`.
2017-04-24 08:49:11 +01:00
Mike McQuaid
d5155256ce Fix audit version_scheme and revision checks.
Another attempt at fixing `brew audit` issues around detecting
`revision` and `version_scheme` changes correctly. First done in #1754
and #2086 (reverted in #2099 and #2100).

To ease future debugging a `ph` helper has been added to print a hash
and a series of RSpec tests to verify that the `revision`,
`version_scheme` and `version` formula version audits behave as
expected.

Fixes #1731.
2017-04-23 18:56:22 +01:00
Mike McQuaid
11acadaa50 Merge pull request #2524 from MikeMcQuaid/more-env-filtering-fixes
Hide sensitive tokens from install/test/post.
2017-04-23 09:45:47 +01:00
Mike McQuaid
688034d22a utils: fix which_editor.
Handle when there's no editor variable specified or it's specified but
empty.
2017-04-22 17:29:59 +01:00
Mike McQuaid
d02b4f321d Hide sensitive tokens from install/test/post.
Hide these tokens to avoid malicious subprocesses e.g. sending them
over the network. Also, support using these tokens with environment
filtering and clear `HOMEBREW_PATH` from subprocesses to stop them
sniffing it. Finally, use `HOMEBREW_PATH` to detect Homebrew’s user’s
PATH for e.g. `brew doctor` etc.
2017-04-22 16:31:19 +01:00
Mike McQuaid
69c7a20896 Fix brew edit with environment filtering.
For many people `brew edit` makes use of the `EDITOR` variable to pick a
sensible editor. With environment filtering enabled unless this editor
is found in the default system PATH it'll fall back to e.g. `vim`.

Instead, ensure that we export the original, pre-filtering `PATH` as
`HOMEBREW_PATH` and use that internally to locate the editor. In future
this same approach will likely be used for requirements to be able to
find tools, too, and for other variables which we want to expose to
Homebrew itself but not other build tools.

Note that `HOMEBREW_PATH` is the same as `PATH` when build filtering
hasn't been enabled.
2017-04-21 18:26:12 +01:00