Skip to content

Commit

Permalink
Add base64 and csv gems to Gemfile
Browse files Browse the repository at this point in the history
These will be needed with Ruby 3.4 and base64 is blocking #16893.

Relatedly:
- don't use `HOMEBREW_BOOTSNAP` by default in all CI jobs. We can add it
  back one-by-one where necessary but as-is it's breaking too much with
  `base64`
- ensure that `csv` gem is not committed and optionally installed on
  demand by `brew contributions --csv`
- no longer hide warnings about base64/csv requires
  • Loading branch information
MikeMcQuaid committed May 21, 2024
1 parent 323d0ca commit c1b8d63
Show file tree
Hide file tree
Showing 10 changed files with 403 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_ENV_HINTS: 1
HOMEBREW_BOOTSNAP: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1

concurrency:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
**/vendor/bundle/ruby/*/gems/coderay-*/
**/vendor/bundle/ruby/*/gems/colorize-*/
**/vendor/bundle/ruby/*/gems/commander-*/
**/vendor/bundle/ruby/*/gems/csv-*/
**/vendor/bundle/ruby/*/gems/diff-lcs-*/
**/vendor/bundle/ruby/*/gems/docile-*/
**/vendor/bundle/ruby/*/gems/ecma-re-validator-*/
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ end
group :ast, optional: true do
gem "rubocop-ast", require: false
end
group :contributions, optional: true do
gem "csv", require: false
end
group :bootsnap, optional: true do
gem "bootsnap", require: false
end
Expand Down Expand Up @@ -78,6 +81,7 @@ end

# vendored gems (no group)
gem "addressable"
gem "base64"
gem "patchelf"
gem "plist"
gem "ruby-macho"
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ GEM
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.2.0)
bindata (2.5.0)
bootsnap (1.18.3)
msgpack (~> 1.2)
coderay (1.1.3)
commander (4.6.0)
highline (~> 2.0.0)
csv (3.3.0)
diff-lcs (1.5.1)
docile (1.4.0)
elftools (1.3.1)
Expand Down Expand Up @@ -169,7 +171,9 @@ PLATFORMS

DEPENDENCIES
addressable
base64
bootsnap
csv
json_schemer
kramdown
method_source
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
require "api/cask"
require "api/formula"
require "warnings"
Warnings.ignore :default_gems do
require "base64" # TODO: Add this to the Gemfile or remove it before moving to Ruby 3.4.
end
require "base64"
require "extend/cachable"

module Homebrew
Expand Down
7 changes: 4 additions & 3 deletions Library/Homebrew/dev-cmd/contributions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

require "abstract_command"
require "warnings"
Warnings.ignore :default_gems do
require "csv"
end

module Homebrew
module DevCmd
Expand Down Expand Up @@ -47,6 +44,8 @@ class Contributions < AbstractCommand

sig { override.void }
def run
Homebrew.install_bundler_gems!(groups: ["contributions"]) if args.csv?

results = {}
grand_totals = {}

Expand Down Expand Up @@ -118,6 +117,8 @@ def time_period(from:, to:)

sig { params(totals: Hash).returns(String) }
def generate_csv(totals)
require "csv"

Check warning on line 120 in Library/Homebrew/dev-cmd/contributions.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/contributions.rb#L120

Added line #L120 was not covered by tests

CSV.generate do |csv|
csv << %w[user repo author committer coauthorship review total]

Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/vendor/bundle/bundler/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def self.extension_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.5/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ast-2.4.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/base64-0.2.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.5.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/msgpack-1.7.2")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/msgpack-1.7.2/lib")
Expand All @@ -45,6 +46,7 @@ def self.extension_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/coderay-1.1.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/highline-2.0.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/commander-4.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/csv-3.3.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/diff-lcs-1.5.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/docile-1.4.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/elftools-1.3.1/lib")
Expand Down Expand Up @@ -119,4 +121,6 @@ def self.extension_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.36/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.8.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.14.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/vernier-1.0.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/vernier-1.0.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib")
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Loading

0 comments on commit c1b8d63

Please sign in to comment.