1132 Commits

Author SHA1 Message Date
Mike McQuaid
e8a29a2d72
Merge pull request #7440 from FTLam11/FTLam11-#7432-add-json-option-to-brew-cask-outdated
Add JSON support for brew cask outdated, fixes #7432
2020-04-29 11:40:22 +01:00
Frank Lam
682914bf40
Improve readability of guard clause
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
2020-04-29 18:16:39 +08:00
Frank Lam
9a605a1dd6
Refactor Cask#outdated_info 2020-04-28 12:21:51 +08:00
Claudia
b8aa808b9d
Make sure DEFAULT_DIRS values are Pathnames
This commit fixes the PR #7417 bug.

The call to `canonicalize` needs to wrap `DEFAULT_DIRS`, not the
other way around. This was mixed up in PR #7417 due to an oversight.
2020-04-27 15:25:28 +02:00
Claudia
dd3267ece0
Add test for JSON-based cask config loader
Previously, the JSON-based cask config loader was untested.
This commit changes the interface to accept a string, making the loader
easier to test. The commit also adds a test.
2020-04-27 14:54:56 +02:00
Frank Lam
dabbfe3e3e
Fix linter offenses 2020-04-26 21:31:21 +08:00
Frank Lam
f2fa2c5d30
Add JSON support to brew cask outdated
* brew outdated already has JSON support, now users and tools can get
similar results with brew cask outdated --json
2020-04-26 21:13:19 +08:00
Frank Lam
65ff9155f8
Add Cask#outdated_info to format output 2020-04-26 21:07:42 +08:00
Claudia
d026cb91e7
Fix cask loading after adding an artifact type
This commit fixes an issue where we added a new global artifact
and then updated a cask to make use of that new artifact.
This caused a number of `brew cask` commands to fail for users
who had the cask installed before the artifact was added.

When loading the definition of an installed cask, we configure it
using a snapshot from install time, e. g. `/usr/local/Caskroom/markdownmdimporter/.metadata/config.json`.

The snapshot looks like this:

```
{
  "default": {
    "appdir": "/Applications",
    "prefpanedir": "/Users/claudia/Library/PreferencePanes",
    "qlplugindir": "/Users/claudia/Library/QuickLook",
    "dictionarydir": "/Users/claudia/Library/Dictionaries",
    "fontdir": "/Users/claudia/Library/Fonts",
    "colorpickerdir": "/Users/claudia/Library/ColorPickers",
    "servicedir": "/Users/claudia/Library/Services",
    "input_methoddir": "/Users/claudia/Library/Input Methods",
    "internet_plugindir": "/Users/claudia/Library/Internet Plug-Ins",
    "audio_unit_plugindir": "/Users/claudia/Library/Audio/Plug-Ins/Components",
    "vst_plugindir": "/Users/claudia/Library/Audio/Plug-Ins/VST",
    "vst3_plugindir": "/Users/claudia/Library/Audio/Plug-Ins/VST3",
    "screen_saverdir": "/Users/claudia/Library/Screen Savers"
  },
  "env": {},
  "explicit": {}
}
```

Note that there is no `mdimporterdir` because the cask was installed
before the artifact was added.

The root cause is that the cask loading code still expects the snapshot
to contain directory configuration for all artifact types.
Since the snapshot never learned about the new artifact type, cask
loading would fail.

The fix applied in this commit is to fall back to the global default
whenever the `default` directory map of a configuration snapshot is
incomplete.

See also:
- https://github.com/Homebrew/brew/pull/7286#issuecomment-613376568
- https://discourse.brew.sh/t/cask-definition-is-invalid-invalid-mdimporter-stanza-key-not-found-mdimporterdir
2020-04-21 18:29:14 +02:00
Markus Reiter
30c313b7b9 Refactor cask command parsing logic. 2020-04-11 01:29:44 +02:00
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Dario Vladovic
3a21ca8956
Implement mdimporter cask stanza 2020-04-06 15:24:14 +02:00
Vítor Galvão
9c342b5dca cask-caveats-kext: retry installation if it fails 2020-03-23 16:13:50 +00:00
Mike McQuaid
1e265247ca
rubocop: apply autofixes. 2020-03-13 21:16:18 +00:00
Mike McQuaid
c48352aa6c
cask/cmd/list: fix ambiguous params. 2020-03-13 21:16:18 +00:00
Markus Reiter
19db7bb14b Ensure formula dependencies for casks are linked. 2020-02-21 17:36:55 +01:00
Mike McQuaid
dfa22680df
Autofix rubocop checks. 2020-02-19 11:24:12 +00:00
Daniel Bayley
f3a0fcfb6d Make rmdir: recursive 2020-02-11 07:56:15 +00:00
Vítor Galvão
497a160cda cask version MAJOR_MINOR_PATCH_REGEX: allow any word character instead of only digits 2019-12-07 14:04:55 +00:00
Mike McQuaid
ef34fbc634
cask/cmd/style: don't hide warnings.
These sometimes display useful RuboCop deprecations.
2019-12-01 14:19:26 +00:00
Markus Reiter
e3e514144c Show appcast contents if it doesn't contain the version. 2019-11-23 17:25:10 +01:00
Markus Reiter
fbf4b0432d Rescue more errors during cask upgrade. 2019-11-22 02:50:44 +01:00
Mike McQuaid
5f07a1e9bf
cask_loader: fix URI detection.
Fixes #6678
2019-11-14 07:39:07 -08:00
Mike McQuaid
6670ae6202
global: require rubygems for activesupport. 2019-11-06 10:36:40 +00:00
Markus Reiter
46c9dc3807 Add /Library/Java subdirectories to SYSTEM_DIRS. 2019-11-03 19:26:35 +01:00
Markus Reiter
0b9a870e1c Ensure @downloaded_path is not nil. 2019-11-02 02:52:33 +01:00
Markus Reiter
add8885dd8 Add helper method for cask installer to get dependencies. 2019-11-01 20:28:36 +01:00
Markus Reiter
78725740e2 Refactor cask dependency resolution. 2019-10-31 20:20:55 +01:00
Markus Reiter
df3bbd0299 Reduce need for interpolating appdir in casks. 2019-10-24 17:07:30 +02:00
Markus Reiter
54ab3dd7c4 Install pkg before app. 2019-10-24 15:04:01 +02:00
Markus Reiter
e6cfb4a3c2
Merge pull request #6629 from timsly/manpage-artifact
Add Manpage artifact
2019-10-24 13:48:52 +02:00
Tim Masliuchenko
6d1fafae13 Final tweaks 2019-10-24 09:43:59 +03:00
Tim Masliuchenko
87f29857f0 Pass section to the constructor 2019-10-23 18:34:16 +03:00
Tim Masliuchenko
22d821323c Feedbacks 2019-10-23 16:28:00 +03:00
Markus Reiter
1ea1f31d0b
Merge pull request #6634 from reitermarkus/trash
Fix `trash.swift` without arguments.
2019-10-23 12:08:09 +02:00
Markus Reiter
04493e2dde Fix trash.swift without arguments. 2019-10-23 06:59:39 +02:00
L. E. Segovia
a02ef65f68
cask: fix xattr error detection
Fixes Homebrew/homebrew-cask#71209
2019-10-23 01:49:09 +00:00
Tim Masliuchenko
3ef5e06943 Add Manpage artifact 2019-10-22 15:21:49 +03:00
Markus Reiter
7a5e4d1269 Remove User::automation_access?. 2019-10-22 07:38:35 +02:00
Markus Reiter
16b3cb0d71 Skip quarantining symlinks. 2019-10-15 18:32:37 +02:00
Markus Reiter
d24f3c3b99
Merge pull request #6605 from reitermarkus/missing-command-method
Fix missing `command` method.
2019-10-15 18:05:22 +02:00
Markus Reiter
40a0b8b10a Fix missing command method. 2019-10-15 17:39:15 +02:00
L. E. Segovia
ed7327296a
Cask: only quarantine working symlinks
Fixes Homebrew/homebrew-cask#70796
2019-10-14 15:38:41 +00:00
Issy Long
1f6168fe8a
Change regexp.match?(string) to string.match?(regexp) everywhere
- Only try to call `.match?` on strings that aren't nil.
2019-10-13 23:22:51 +01:00
Issy Long
341ea60807
Auto-fix Style/RedundantBegin offenses
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
  Layout/InconsistentIndentation once the auto-fixer had got rid of the
  "redundant begin"s.
2019-10-13 16:04:27 +01:00
Issy Long
b78028b9c2
Auto-fix Performance/RegexpMatch offenses 2019-10-13 16:04:26 +01:00
ytqh
24ef7fa5c8 remove xattr unsupported option in macOS 10.15 2019-10-11 21:18:53 +08:00
Mike McQuaid
9e56a8625d
Merge pull request #6531 from jpninanjohn/master
Show correct message when invalid arguments are passed to brew
2019-10-11 09:30:12 +01:00
Markus Reiter
77412ad14e
Merge pull request #6514 from amyspark/workaround-trash
Cask: refuse to trash root-owned files
2019-10-09 14:01:24 +02:00
Markus Reiter
b6b9cd248c Refactor brew cask style. 2019-10-04 23:43:48 +02:00