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

build(deps-dev): bump json from 2.7.6 to 2.8.1 in /Library/Homebrew #18725

Merged
merged 6 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GEM
bindata (~> 2)
erubi (1.13.0)
hana (1.3.7)
json (2.7.6)
json (2.8.1)
json_schemer (2.3.0)
bigdecimal
hana (~> 1.3)
Expand Down
14 changes: 6 additions & 8 deletions Library/Homebrew/cmd/outdated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ def run
end

json = {
"formulae" => json_info(formulae),
"casks" => json_info(casks),
formulae: json_info(formulae),
casks: json_info(casks),
}
puts JSON.pretty_generate(json)
# json v2.8.1 is inconsistent it how it renders empty arrays,
# so we use `[]` for consistency:
puts JSON.pretty_generate(json).gsub(/\[\n\n\s*\]/, "[]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a bug that should be reported upstream?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on it. It's actually a bug that's been around a while, you can even see it in our fixtures:


There's also an SO question around the issue: https://stackoverflow.com/questions/58361230/avoiding-extra-lines-in-ruby-json-pretty-generate

The unusual thing (to me) is seeing different output on substantially similar inupts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't repro on my mac, so I've given up filing an issue. (It seems limited to the "generic" os in testing, in case you want to chase it down.)


outdated = formulae + casks

else
outdated = if args.formula?
outdated_formulae
Expand Down Expand Up @@ -170,10 +171,7 @@ def json_version(version)
"v1" => :v1,
"v2" => :v2,
}

raise UsageError, "invalid JSON version: #{version}" unless version_hash.include?(version)

version_hash[version]
version_hash.fetch(version) { raise UsageError, "invalid JSON version: #{version}" }
end

sig { returns(T::Array[Formula]) }
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/test/support/fixtures/cask/everything.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"token": "everything",
"full_token": "everything",
"old_tokens": [

],
"old_tokens": [],
"tap": "homebrew/cask",
"name": [
"Everything"
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/vendor/bundle/bundler/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def self.extension_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/elftools-1.3.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/erubi-1.13.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/hana-1.3.7/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/json-2.7.6")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json-2.7.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/json-2.8.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json-2.8.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/regexp_parser-2.9.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simpleidn-0.2.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.3.0/lib")
Expand Down
Loading