89 Commits

Author SHA1 Message Date
Ian Gregory
a715dec49d Add --adopt switch
Allows `brew install` & co. to adopt existing cask artifacts that are
identical to those being installed.

Discussion: #14006
2022-10-21 23:28:51 -04:00
apainintheneck
c322f4fb90 cask/installer.rb: Stopped including Staged 2022-07-11 17:13:16 -07:00
apainintheneck
4dce389aa7 Remove download sha file from .metadata dir when uninstalling casks 2022-06-05 13:00:20 -07:00
apainintheneck
6f06236bca Fix :svn download errors with :latest casks 2022-06-01 09:04:54 -07:00
apainintheneck
b85f407e95 Only upgrade :latest casks when --greedy and the cask has been updated
A sha256 hash of the previous download is stored and compared with
new downloads before updating :latest casks. This prevents unnecessary
reinstalls when the cask hasn't been updated.

Move download path to cask from installer to prevent unnecessary
redownloads of casks.
2022-05-17 16:15:05 -07:00
apainintheneck
0dd3764041 Allow casks with outdated caskfiles to be reinstalled
The problem occurred when calling `brew reinstall` on a cask
with an out of date caskfile.

To solve the problem Cask::Installer#uninstall_existing_cask has been changed to
catch a possible CaskInvalidError when trying to load outdated
caskfiles using Cask::CaskLoader#load.
2022-05-02 23:39:18 -07:00
Issy Long
0b6b2f04da
cask/reinstall: Support --zap for entirely purging cask files
- The `brew uninstall` command has `--zap`, so let's make `brew
  reinstall` have parity here for a better user experience. (Requested
  in issue 12983.)
- It feels weird that to get my new reinstall test to pass I had to add
  `--zap` to `cask/cmd/install.rb`, not `cask/cmd/reinstall.rb` to get
  the tests to pass. But the `brew reinstall --cask caffeine --zap`
  command worked fine all the time. The CLI argument parser from the
  test run was complaining about not knowing what `zap` was. As a
  result, `--zap` now shows up as a switch in `brew install --help`
  which I'm not 100% convinced is the desired UX. But I've edited the
  description accordingly to specify that it will only work on
  `reinstall` operations (and `--zap` on `install` is a no-op).

```
issyl0 at pictor in /opt/homebrew on reinstall-cask-zap
❯ brew reinstall --cask caffeine --zap
==> Downloading https://github.com/IntelliScape/caffeine/releases/download/1.1.3/Caffeine.dmg
Already downloaded: /Users/issyl0/Library/Caches/Homebrew/downloads/3d6ccfdd3b8d0ab37d1c2468d6e69078c2d31d3b12bf51947c4db21e5f376af2--Caffeine.dmg
==> Implied `brew uninstall --cask caffeine`
==> Backing App 'Caffeine.app' up to '/opt/homebrew/Caskroom/caffeine/1.1.3/Caffeine.app'
==> Removing App '/Applications/Caffeine.app'
==> Dispatching zap stanza
==> Trashing files:
~/Library/Application Support/com.intelliscapesolutions.caffeine
~/Library/Preferences/com.intelliscapesolutions.caffeine.plist
~/Library/Caches/com.intelliscapesolutions.caffeine
~/Library/HTTPStoages/com.intelliscapesolutions.caffeine.binarycookies
==> Removing all staged versions of Cask 'caffeine'
==> Installing Cask caffeine
==> Moving App 'Caffeine.app' to '/Applications/Caffeine.app'
🍺  caffeine was successfully installed!
```
2022-04-09 16:37:23 +01:00
fn ⌃ ⌥
04710be2a8
install: fix --skip-cask-deps message 2021-09-27 18:25:39 -07:00
Mike McQuaid
1a904af264
Merge pull request #12018 from FnControlOption/upgrade-tsort
upgrade: use topological sort to upgrade formulae
2021-09-12 19:26:22 +01:00
hyuraku
e44ac800c2 repair cask install quiet mode 2021-09-10 23:12:52 +09:00
fn ⌃ ⌥
0c3e49092c upgrade: use topological sort to upgrade formulae 2021-09-09 13:41:50 -07:00
FnControlOption
eb16e10902 messages: record cask installations.
This is used to record installation times and also to determine
whether to display caveats.
2021-09-02 08:44:00 -07:00
Rylan Polster
ea2e40c69a
Add Cask::Cask#source to return cask's source code 2021-08-14 16:18:13 -04:00
Nanda H Krishna
2394a4c4fc
Rename metadata_master_container_path to metadata_main_container_path 2021-07-08 12:36:40 +05:30
Issy Long
155feba8e0
cask/installer: Add Cask caveats to the end-of-operation summary
- Both formulae and casks can have caveats, but only formulae caveats
  were shown at the end of a bulk install/upgrade/reinstall operation
  via `Homebrew.messages.record_caveats`. This fixes that to show Cask
  caveats too, for consistency (scrolling up all of the
  multi-formulae-and-casks output to see caveats is time-consuming and
  users might miss them).
- In doing this I had to change how `Messages#record_caveats` works
  since the cask name is just a string, not an object.
2021-06-09 12:11:51 +01:00
Mike McQuaid
2ce6cd5e81
brew style --fix 2021-05-18 11:58:44 +01:00
Mike McQuaid
d73351251c
Deprecate, disable, delete code for next major/minor version.
Do the usual dance for bumping our major/minor version.
2021-04-09 09:30:36 +01:00
Markus Reiter
24c9b599a6
Revert "Revert "Merge pull request #10864 from reitermarkus/command-timeout""
This reverts commit 57b2660cae8cf43efd2b88d84a7174706328c001.
2021-04-03 20:10:32 +02:00
Rylan Polster
57b2660cae
Revert "Merge pull request #10864 from reitermarkus/command-timeout"
This reverts commit d55bdd3ddbe7ff2b1f106a41bd994dc117ca5142, reversing
changes made to 3c3bf1c74d1d7ef1d2c792719574623b6c3c4d25.
2021-03-24 01:22:18 -04:00
Markus Reiter
712a95fdd0 Allow specifying timeouts for commands and downloads. 2021-03-16 18:15:21 +01:00
Seeker
880a82d21a
uninstall: delete references to unused --binaries flag 2021-02-22 19:48:43 -08:00
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +05:30
EricFromCanada
6fc116318e fixes for grammar and wording 2021-01-26 16:19:47 -05:00
EricFromCanada
2ed324ebc0 use backticks around suggested input, flags, and binaries 2021-01-26 16:19:47 -05:00
EricFromCanada
a427de5bee capitalization fixes
"curl" is the binary, while "cURL" is the umbrella project.
2021-01-26 15:36:44 -05:00
EricFromCanada
c0a753edd3 pluralize "artifacts" 2021-01-26 15:36:43 -05:00
Seeker
b9854bd4cf rubocops: add unless_multiple_conditions 2021-01-08 10:33:54 -08:00
Cheng XU
72a346e6c8
cask/installer: do not install tap during conflict checking
If the tap of the conflicted cask is not installed, we should just skip it.
This matches the behavior of formula installation.

Without this, running `brew install dropbox` would result to install
the `homebrew/cask-versions` tap.

Fixes #9125.
2020-12-22 15:32:11 -08:00
Markus Reiter
82c1e6fb0e Fix basename for extracting cask downloads. 2020-12-21 15:43:25 +01:00
Markus Reiter
b57a448f2a Add bump-unversioned-casks command. 2020-12-07 23:03:47 +01:00
Markus Reiter
3c2ec1c60f Deprecate remaining cask commands. 2020-11-21 19:56:12 +01:00
Markus Reiter
bf486c5397
Merge pull request #9212 from reitermarkus/brew-cask-fetch
Support casks in `brew fetch`.
2020-11-20 09:32:13 +01:00
Markus Reiter
c54a9937e7 Remove cask-specific checksum errors. 2020-11-19 19:46:59 +01:00
Markus Reiter
7a83f34dd1 Support casks in brew fetch. 2020-11-19 19:46:59 +01:00
Markus Reiter
7c5d8a5288 Refactor FormulaInstaller. 2020-11-18 09:30:11 +01:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
5f005f67cf Refactor global Cask::Config. 2020-10-01 00:57:10 +02:00
Mike McQuaid
3923d331de
Fix brew style 2020-09-15 13:39:06 +01:00
Mike McQuaid
3b114736ce
Merge pull request #8572 from Akylzhan/patch-1
Update cask/installer.rb: check deps before download
2020-09-02 14:22:05 +01:00
Akylzhan Sauranbay
3fdab5a24d Update cask/installer.rb: check dependencies before download 2020-09-02 18:14:24 +06:00
Seeker
98248a44a4 cask/installer: fix reference to opt_linked/optlinked 2020-09-01 14:14:41 -07:00
Mike McQuaid
8b97c27c21 brew style manual fixes 2020-09-01 14:26:45 +01:00
Markus Reiter
5f152f5dc3 Document Installer. 2020-08-26 03:13:59 +02:00
Markus Reiter
e9d8f09da1 Pass debug?, quiet? and verbose? to FormulaInstaller. 2020-08-06 16:12:52 +02:00
Seeker
b4f25b5911 cask/installer: don't call installed? if Formula 2020-07-12 17:14:10 -07:00
Mike McQuaid
11cf77be17
formula_installer: prelude before fetch.
This ensures that dependencies are verified and tapped before they are
fetched. `FormulaInstaller#lock` has been moved into
`FormulaInstaller#install` to avoid locking until necessary.

While we're here, don't compute dependencies before fetching if we're
not going to use them.
2020-05-23 13:40:13 +01:00
Mike McQuaid
08a9f0e1c0
Use FormulaInstaller#fetch before #prelude. 2020-05-11 09:38:26 +01:00
Michelle Nguyen
2264c08cee
Fetch formula resources before unlinking during upgrade.
Fixes #6374.
2020-05-11 09:37:56 +01:00