57 Commits

Author SHA1 Message Date
Dan Wendorf
151c2861ac Custom commands can show help
We attempted to find the help message for commands before loading custom
commands in the path.
2017-11-18 17:04:54 -08:00
Mike McQuaid
7a68b4a3f9 Refactor command handling code
Don’t rely on having external commands always present in the PATH in
order to find them. Instead, provide an accessory method to Tap so
they can be added and used when needed.

While we’re here, do some general refactoring and cleanup of the
command code in these places.
2017-11-05 15:37:57 +00:00
Mike McQuaid
29f81812cc brew.rb: cleanup PATH setup.
Avoid adding all the tap commands to the PATH when not necessary.
2017-11-03 14:50:17 +00:00
Markus Reiter
632fdca2d4 Merge pull request #3306 from amyspark/hacktoberfest-quash-cask-help
Fixes querying Cask commands' help
2017-10-24 20:54:24 +02:00
L. E. Segovia
09e26b1152 brew style fixes 2017-10-24 10:17:11 -03:00
L. E. Segovia
2bfc7904fb Simplify cask help check 2017-10-24 08:04:49 -03:00
L. E. Segovia
75de4db003 Let Cask handle the -h flag 2017-10-20 16:51:26 -03:00
L. E. Segovia
16faf6fca9 Shorten HOMEBREW_HELP set/unset 2017-10-18 08:47:52 -03:00
L. E. Segovia
098305e679 Correct setting and deleting HOMEBREW_HELP
(and also delete the extra help_flag case, it's no longer needed)
2017-10-18 08:37:24 -03:00
L. E. Segovia
fd2b0d21c4 Only unset HOMEBREW_HELP before issuing the tap 2017-10-18 08:30:26 -03:00
Ash Furrow
11572c749b
Specifies which errant version of Ruby is used in raise. 2017-10-17 17:24:04 -04:00
L. E. Segovia
0998e16e81 Fix mistaken &
I meant to verify that both a cmd and a help flag were received from the
shell
2017-10-12 11:20:04 -03:00
L. E. Segovia
d1262868a9 Fixes help querying
- If a non-existent command with a flag is queried to Cask, the latter
is printed instead of the command
 - If the help from a not-yet-tapped cask's command is queried, it
prints brew tap's help infinitely

Fixes caskroom/homebrew-cask#28977
2017-10-12 00:11:11 -03:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Mike McQuaid
bcca2a7c6b brew: handle Ruby 2.3 more gracefully.
- `brew.rb` needed updated to fail unless on Ruby 2.3
- `brew update` should unset `HOMEBREW_RUBY_PATH` to ensure that this
  doesn't "stick" on a Ruby 2.0 version after a portable Ruby has been
  installed.
2017-09-29 19:53:50 +01:00
Mike McQuaid
cf5fdeef1d Rubocop: manual rule fixes. 2017-09-24 21:23:59 +01:00
Mike McQuaid
cb3a47d9e2 Fix brew tests on High Sierra.
The `brew test` tests were failing as they were unable to include
`test/unit/assertions`. This is because it's a gem and we were setting
the `GEM_HOME` so system gems were being ignored.

While I was there and examining the `$LOAD_PATH`: reduce the number of
things we add there by using `Bundler.with_clean_env` and only adding
`HOMEBREW_LIBRARY_PATH` in the `$LOAD_PATH` if it isn't already there
(which it always is [and has to be] for integration tests).

This also seems to have the side effect of speeding up integration
tests from 1m26s to 1m8s on my machine.
2017-07-07 15:20:19 +01:00
Markus Reiter
599a618273 Move require? to utils. 2017-06-14 12:51:36 +02:00
Mike McQuaid
021cef4b2b Autocorrect Rubocop Style/SpecialGlobalVars. 2017-06-12 09:11:42 +01:00
Mike McQuaid
0e2b043c12 Merge pull request #2752 from MikeMcQuaid/remove-unused-analytics
analytics: remove unused analytics.
2017-06-09 08:59:40 +03:00
Mike McQuaid
10549d13f4 brew: no issue report prompt unless autoupdating.
Otherwise: you may be on an old enough version that we don't care.
2017-06-07 16:37:39 +01:00
Mike McQuaid
5367f1b408 analytics: remove unused analytics.
We didn't end up using the `screenview` and `exception` analytics as
much as expected so let's remove them and focus on stuff that's
formula-specific.
2017-06-07 16:34:54 +01:00
Mike McQuaid
ff51f6ea42 Merge pull request #2719 from MikeMcQuaid/external-command-homebrew-path
brew.rb: use HOMEBREW_PATH for external commands.
2017-06-03 10:00:07 +01:00
Mike McQuaid
12e0a5ee7d brew.rb: use HOMEBREW_PATH for external commands.
They shouldn’t need to handle our environment filtering on the PATH as
we’re essentially breaking an API for them otherwise.
2017-06-02 18:44:39 +01:00
Markus Reiter
2d6ae61314 Re-revert "Fix operator spacing." 2017-06-02 19:22:05 +02:00
Mike McQuaid
7a38bab333 Fixup all RuboCop warnings. 2017-05-29 18:43:18 +01:00
Esther W
6325fb88c5 Make behavior clearer by returning false 2017-05-18 15:43:54 -07:00
Esther W
4da2f24b0e Remove to_s method 2017-05-18 13:41:36 -07: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
6b5171de30 Remove unused e from rescue Interrupt. 2017-05-05 20:50:11 +02:00
Markus Reiter
f8ad9d7efd Use PATH where possible. 2017-04-30 21:11:27 +02:00
Mike McQuaid
45a7730f61 Fix and remove various TODOs.
Fix those that can be done so without tearing Homebrew to pieces and
remove the comments for those that can never be done.
2017-04-23 15:10:18 +01:00
Markus Reiter
3e7f94d5b5 Move cask to cmd/. 2017-03-06 11:41:29 +01:00
Mike McQuaid
598c5e36f9 Tell people to report URL/tap deprecations to the tap.
Rather than Homebrew/brew or Homebrew/homebrew-core.
2016-12-10 13:04:14 +00:00
Mike McQuaid
007002ad6f brew.rb: don't exit when failing to set devcmdrun.
It's not necessary to make this a hard failure so don't (and this makes
it more consistent with `brew.sh`).

Fixes #1462.
2016-11-09 12:44:13 +00:00
Markus Reiter
23dec587fd Make core_tap_version_string reusable. 2016-10-04 14:45:11 +02:00
Mike McQuaid
881fdcd25e Merge pull request #1190 from vladshablinsky/no-autoupdate-on-help
brew.sh: don't autoupdate if --help passed
2016-10-03 18:38:46 +01:00
Mike McQuaid
f90f52d902 Merge pull request #1205 from MikeMcQuaid/help-external-commands
help: support `#:` help in external commands.
2016-10-02 08:59:32 +01:00
Uladzislau Shablinski
d92a1ad584 brew.rb: update help parsing 2016-10-01 22:09:11 +03:00
Markus Reiter
75e8b59aad Add Formatter module. 2016-10-01 20:00:49 +02:00
Markus Reiter
6d8ee395fa Refactor Tty. 2016-10-01 20:00:49 +02:00
Mike McQuaid
a4ebda3fc4 help: support #: help in external commands.
Fixes https://github.com/Homebrew/homebrew-test-bot/issues/3
2016-10-01 18:25:16 +01:00
Markus Reiter
a5b11a6a5c Fix Style/GuardClause. 2016-09-23 15:30:07 +02:00
Mike McQuaid
f0e9292acd Use git describe to get the HOMEBREW_VERSION.
For tagged commits produces the output:
- `1.0.1`

For untagged commits with a dirty tree produces the output:
- `1.0.1-19-g23efbc5-dirty`

Performance:
```
git describe --tags --dirty 2> /dev/null
0.07s user 0.01s system 96% cpu 0.086 total
```

This means we can tag any commit without needing to manually remember
to bump the revision every time.
2016-09-22 08:56:40 +01:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
8f1ae3b28b Move LinkedKegs migration.
Move the `LinkedKegs` migration into `utils.rb` so it can also be called
from `brew.rb` on startup.
2016-09-17 15:00:46 +01:00