91 Commits
Author SHA1 Message Date
Mike McQuaid 94148c3bc8 Fix handling unreadable casks
When casks are unreadable (e.g. have invalid syntax, the cask file
cannot be found) then it's not been possible to uninstall them, list
them or perform any operation which iterates through all casks.

Handle these various cases by falling back to creating a `Cask::Cask`
object using just the name/token and latest installed version on disk.

This provides enough functionality to be able to verbosely list these
casks, not error on listing and, most importantly, uninstall/reinstall
them.

Fixes https://github.com/Homebrew/homebrew-cask/issues/62223
2022-05-16 17:27:13 -04:00
Mike McQuaid 38e1b3d64b Deprecations, disables, deletions for 3.4.0 2022-02-22 14:28:32 +00:00
fn ⌃ ⌥ 9b611be759 Print given argument instead of rename if matching keg not found 2021-11-24 11:39:52 -08:00
EricFromCanada 6e0e96eb1d list: raise NoSuchKegError if formula exists but isn't installed 2021-11-11 17:40:32 -05:00
Rylan Polster 0b8032d421 Document HOMEBREW_INSTALL_FROM_API 2021-10-22 12:37:57 -04:00
Nathan WoythalerandMike McQuaid 0b8605bcbe Add --print-path flag to brew edit
Add a `--print-path` flag to `brew edit`, in order to print the source `.rb`
file of both casks and formulae. In order to prevent faulty reporting, `brew
formula $SOME_CASK` will now error out if a cask matches, but a formula does
not.
2021-10-20 09:04:59 +01:00
Mike McQuaid f65d525693 Deprecations/disables for 3.3.0/4.0.0.
Deprecate, disable and remove code for Homebrew 3.3.0 or 4.0.0
(whichever the next release ends up being).
2021-10-19 16:36:42 +01:00
hyuraku 2347bfdb92 use default_kegs 2021-09-09 22:16:45 +09:00
Rylan Polster 5d536d66fc Rename HOMEBREW_JSON_CORE to HOMEBREW_INSTALL_FROM_API 2021-08-27 00:24:15 -04:00
Rylan Polster 99635bf3ae Remove need for homebrew/cask to be tapped 2021-08-14 16:17:26 -04:00
92717b6f6f Update Library/Homebrew/cli/named_args.rb
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2021-08-12 09:16:23 -04:00
Connor Mann a566c53db8 Add resolve_latest_keg revision secondary sort 2021-08-11 20:07:28 -04:00
Rylan PolsterandGitHub 90bbe8bb03 Merge pull request #11831 from Rylan12/api-cleanup
Refactor API methods
2021-08-09 12:32:55 -04:00
Connor Mann 363bcbd72a Sort head kegs by tab modification time 2021-08-06 21:27:21 -04:00
Rylan Polster 737dd1654b Refactor API methods 2021-08-06 04:31:27 -04:00
Connor Mann 3dde12c634 Handle only HEAD kegs in to_latest_kegs 2021-08-04 18:51:39 -04:00
Rylan Polster 1e34b69cd4 Prioritize installing from JSON if env var is set 2021-07-12 03:23:42 -04:00
Rylan Polster e316c4f013 Rename Utils::BottleAPI to BottleAPI 2021-07-05 11:45:15 -04:00
Rylan Polster 36dd69dd60 Rename download_bottles to fetch_bottles 2021-07-05 10:55:34 -04:00
Rylan Polster 22f986b89a Install formulae from JSON files 2021-07-04 12:38:59 -04:00
Mike McQuaid 30a65342e8 Deprecate, disable, delete code for Homebrew 3.2.0
Do the usual deprecation, disable, delete dance for Homebrew 3.2.0.
2021-06-17 11:34:32 +01:00
Connor Mann 0a1614286d Fix style 2021-05-24 08:44:36 -04:00
73ef297dd5 Update Library/Homebrew/cli/named_args.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-05-21 11:55:30 -04:00
3b0243900f Update Library/Homebrew/cli/named_args.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-05-21 11:55:11 -04:00
Connor Mann 6f005caf07 Rename memoized variable 2021-05-20 15:10:20 -04:00
Connor Mann fa9a525d32 Add to_latest_kegs 2021-05-20 12:58:23 -04:00
b1ce7ef647 Update Library/Homebrew/cli/named_args.rb
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2021-05-20 11:30:22 -04:00
Connor Mann 26a3218fb0 Deprecate method: :keg 2021-05-20 09:53:31 -04:00
Connor Mann 49aa057188 Rename resolve_keg to resolve_default_keg 2021-05-19 10:29:40 -04:00
Connor Mann 137914d50c Rename method :keg to :default_kegs 2021-05-19 10:07:03 -04:00
Connor Mann fe9a9bb24c Rename to_keg to to_default_kegs 2021-05-19 09:34:18 -04:00
Connor Mann 15dcc6f496 Add to_kegs 2021-05-18 10:07:35 -04:00
Connor Mann d46881c5e2 Rename to_kegs to to_keg 2021-05-18 09:52:19 -04:00
Bo Anderson 2f041abf2b dev-cmd/bottle: don't take uniq of arguments 2021-04-08 22:07:47 +01:00
Markus Reiter c5d4716e2e Ignore FormulaOrCaskUnavailableError. 2021-03-25 19:34:34 +01:00
Markus Reiter 507db5256f Revert "Merge pull request #10934 from dawidd6/revert-uninstall"
This reverts commit 5b1ad84184, reversing
changes made to e1385b0754.
2021-03-25 19:11:52 +01:00
Dawid Dziurla 8fa557ea02 Revert "Fix uninstall --force for casks."
This reverts commit 45066f9144.
2021-03-25 18:46:50 +01:00
Markus Reiter 45066f9144 Fix uninstall --force for casks. 2021-03-24 13:32:58 +01:00
Bo Anderson 8e98ce69f3 Stricter handling of CLI args 2021-03-18 16:41:57 +00:00
nandahkrishna 585ec90878 cask_loader: do not auto-tap in FromTapLoader 2021-03-11 21:09:42 +05:30
hyuraku efd4138c8e cli/named_args: refactor if statements 2021-03-01 09:10:26 +09:00
Seeker 1ce8bd00fb named_args: print error if formula and cask found but one is unreadable 2021-01-28 15:21:23 -08:00
Seeker 89930157b5 named_args: raise rescued error if both formula/cask are unreadable 2021-01-28 15:21:23 -08:00
Seeker 7863879145 named_args: raise error if formula/cask is found but unreadable 2021-01-25 11:49:27 -08:00
Rylan Polster 64816651d0 Only tap homebrew/cask on CaskUnavailableError in brew install 2021-01-20 12:22:31 -05:00
Seeker fbafaff4fe rubocop: require braces for Sorbet sig 2021-01-18 16:52:45 -08:00
Rylan Polster da811373d3 Add named_args DSL for commands 2021-01-13 17:09:42 -05:00
hyuraku 0a97cd18a5 set default args 2020-12-17 21:14:18 +09:00
Markus Reiter 1c2a31e224 Allow passing individual casks to bump-unversioned-casks for debugging. 2020-12-08 01:03:39 +01:00
Bryce Glover c237223e15 [Library/Homebrew/cli/named_args.rb] to_formulae_to_casks(): Reassociate its
`rescue` block with the right enclosing scope.

     PR #9398 accidentally removed some semantically significant indentation in
this function, thus inadvertently kicking the `rescue` block inside out to func-
tion scope, when it moved its code further up in the file.  This may well not
confuse a Ruby interpreter, but it could trip human readers up.  Compensate and
correct the overlooked offending oversight and potential refactoring mistake by
restoring only that indentation, leaving the function in its new location.

Refs #9398.
2020-12-05 16:34:55 -05:00