From 1943132cf664775e242cd962cefd41601d6ff81c Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Wed, 8 Mar 2023 09:16:53 -0800 Subject: [PATCH] Move i18n out of global --- Library/Homebrew/Gemfile | 1 + Library/Homebrew/Gemfile.lock | 1 + Library/Homebrew/cmd/deps.rb | 1 - Library/Homebrew/cmd/link.rb | 1 - Library/Homebrew/cmd/unlink.rb | 1 - Library/Homebrew/cmd/uses.rb | 1 + Library/Homebrew/dev-cmd/generate-man-completions.rb | 1 - Library/Homebrew/global.rb | 8 +------- Library/Homebrew/keg.rb | 1 - Library/Homebrew/manpages.rb | 1 + Library/Homebrew/system_command.rb | 1 - 11 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 1a5f5d8383..35bae40352 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -41,6 +41,7 @@ end gem "activesupport" gem "addressable" gem "concurrent-ruby" +gem "i18n" gem "mechanize" gem "patchelf" gem "plist" diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index b588a1cd64..ead2916c52 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -231,6 +231,7 @@ DEPENDENCIES byebug concurrent-ruby did_you_mean + i18n json_schemer mechanize minitest diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 16f39a3c1b..444da12f15 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -2,7 +2,6 @@ # frozen_string_literal: true require "formula" -require "ostruct" require "cli/parser" require "cask/caskroom" require "dependencies_helpers" diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index d52f4c5f3a..9bacec52f3 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -1,7 +1,6 @@ # typed: true # frozen_string_literal: true -require "ostruct" require "caveats" require "cli/parser" require "unlink" diff --git a/Library/Homebrew/cmd/unlink.rb b/Library/Homebrew/cmd/unlink.rb index 605adfbf22..5034b6a2a7 100644 --- a/Library/Homebrew/cmd/unlink.rb +++ b/Library/Homebrew/cmd/unlink.rb @@ -1,7 +1,6 @@ # typed: true # frozen_string_literal: true -require "ostruct" require "cli/parser" require "unlink" diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index a4620bc159..9b77b71723 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -9,6 +9,7 @@ require "formula" require "cli/parser" require "cask/caskroom" require "dependencies_helpers" +require "ostruct" module Homebrew extend T::Sig diff --git a/Library/Homebrew/dev-cmd/generate-man-completions.rb b/Library/Homebrew/dev-cmd/generate-man-completions.rb index 1732a7a445..8c48755473 100644 --- a/Library/Homebrew/dev-cmd/generate-man-completions.rb +++ b/Library/Homebrew/dev-cmd/generate-man-completions.rb @@ -2,7 +2,6 @@ # frozen_string_literal: true require "formula" -require "ostruct" require "completions" require "manpages" diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index d1e6a96da4..1f87b4c3a9 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -7,8 +7,8 @@ require "English" require "fileutils" require "json" require "json/add/exception" -require "ostruct" require "forwardable" +require "set" # Only require "core_ext" here to ensure we're only requiring the minimum of # what we need. @@ -16,7 +16,6 @@ require "active_support/core_ext/object/blank" require "active_support/core_ext/string/filters" require "active_support/core_ext/object/try" require "active_support/core_ext/array/access" -require "i18n" require "active_support/core_ext/hash/except" require "active_support/core_ext/kernel/reporting" require "active_support/core_ext/hash/keys" @@ -26,9 +25,6 @@ require "active_support/core_ext/enumerable" require "active_support/core_ext/string/exclude" require "active_support/core_ext/string/indent" -I18n.backend.available_locales # Initialize locales so they can be overwritten. -I18n.backend.store_translations :en, support: { array: { last_word_connector: " and " } } - HOMEBREW_API_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_API_DEFAULT_DOMAIN").freeze HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_BOTTLE_DEFAULT_DOMAIN").freeze HOMEBREW_BREW_DEFAULT_GIT_REMOTE = ENV.fetch("HOMEBREW_BREW_DEFAULT_GIT_REMOTE").freeze @@ -148,8 +144,6 @@ rescue nil end.compact.freeze -require "set" - require "system_command" require "exceptions" require "utils" diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index cb19e3af11..f878f60f83 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -4,7 +4,6 @@ require "keg_relocate" require "language/python" require "lock_file" -require "ostruct" require "extend/cachable" # Installation prefix of a formula. diff --git a/Library/Homebrew/manpages.rb b/Library/Homebrew/manpages.rb index c08c000ee4..9603adea02 100644 --- a/Library/Homebrew/manpages.rb +++ b/Library/Homebrew/manpages.rb @@ -3,6 +3,7 @@ require "cli/parser" require "erb" +require "i18n" SOURCE_PATH = (HOMEBREW_LIBRARY_PATH/"manpages").freeze TARGET_MAN_PATH = (HOMEBREW_REPOSITORY/"manpages").freeze diff --git a/Library/Homebrew/system_command.rb b/Library/Homebrew/system_command.rb index 3ddd2a039b..e069a4e27f 100644 --- a/Library/Homebrew/system_command.rb +++ b/Library/Homebrew/system_command.rb @@ -2,7 +2,6 @@ # frozen_string_literal: true require "open3" -require "ostruct" require "plist" require "shellwords"