Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap to --json=v2 #821

Merged
merged 1 commit into from Nov 26, 2020
Merged

Swap to --json=v2 #821

merged 1 commit into from Nov 26, 2020

Conversation

jacobbednarz
Copy link
Member

Homebrew/brew@311c106 introduced a deprecation for using JSON output
with the v1 format so it's time to bump up to v2.

Looking over the occurrences and their usage, we should be 👌

$ rg -F "json=v1"
lib/bundle/locker.rb
90:        name_bottles = JSON.parse(`brew info --json=v1 --installed --quiet`)

lib/bundle/cask_dumper.rb
29:      cask_info_response = `brew info --cask #{cask_list.join(" ")} --json=v1`

spec/bundle/locker_spec.rb
73:        allow(locker).to receive(:`).with("brew info --json=v1 --installed --quiet").and_return <<~EOS

spec/bundle/cask_dumper_spec.rb
60:          .with("brew info --cask foo --json=v1")
73:          .with("brew info --cask foo --json=v1")
86:          .with("brew info --cask foo bar --json=v1")

@carlocab
Copy link
Member

Doesn't work yet:

❯ gh pr checkout 821
Switched to a new branch 'move-to-v2-json'
❯ brew bundle cleanup
Error: no implicit conversion of String into Integer
Please report this bug:
  https://github.com/Homebrew/homebrew-bundle/issues
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/lib/bundle/cask_dumper.rb:33:in `dig'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/lib/bundle/cask_dumper.rb:33:in `block in formula_dependencies'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/lib/bundle/cask_dumper.rb:32:in `each'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/lib/bundle/cask_dumper.rb:32:in `flat_map'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/lib/bundle/cask_dumper.rb:32:in `formula_dependencies'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/lib/bundle/commands/cleanup.rb:71:in `formulae_to_uninstall'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/lib/bundle/commands/cleanup.rb:22:in `run'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle/cmd/bundle.rb:119:in `bundle'
/usr/local/Homebrew/Library/Homebrew/brew.rb:119:in `<main>'

lib/bundle/cask_dumper.rb Outdated Show resolved Hide resolved
@rlbaker
Copy link

rlbaker commented Nov 26, 2020

This resolves the issue for me @jacobbednarz, thank you looking into this. Let me know if there's anything else I can provide on my end.

@jacobbednarz
Copy link
Member Author

jacobbednarz commented Nov 26, 2020

Awesome! I'll sort out the tests.

@jacobbednarz jacobbednarz removed the request for review from MikeMcQuaid November 26, 2020 01:53
Homebrew/brew@311c106 introduced a deprecation for using JSON output
with the v1 format so it's time to bump up to v2.

Looking over the occurrences and their usage, we should be 👌

```
$ rg -F "json=v1"
lib/bundle/locker.rb
90:        name_bottles = JSON.parse(`brew info --json=v1 --installed --quiet`)

lib/bundle/cask_dumper.rb
29:      cask_info_response = `brew info --cask #{cask_list.join(" ")} --json=v1`

spec/bundle/locker_spec.rb
73:        allow(locker).to receive(:`).with("brew info --json=v1 --installed --quiet").and_return <<~EOS

spec/bundle/cask_dumper_spec.rb
60:          .with("brew info --cask foo --json=v1")
73:          .with("brew info --cask foo --json=v1")
86:          .with("brew info --cask foo bar --json=v1")
```
@jacobbednarz jacobbednarz merged commit b0aed0a into master Nov 26, 2020
@jacobbednarz jacobbednarz deleted the move-to-v2-json branch November 26, 2020 02:00
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants