Reorder global.

This commit is contained in:
Markus Reiter 2020-11-29 21:23:44 +01:00
parent 2ad7f5317c
commit 7348185347
5 changed files with 32 additions and 23 deletions

View File

@ -1,7 +1,6 @@
# typed: true # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "cli/named_args"
require "ostruct" require "ostruct"
module Homebrew module Homebrew
@ -16,6 +15,8 @@ module Homebrew
sig { void } sig { void }
def initialize def initialize
require "cli/named_args"
super() super()
@processed_options = [] @processed_options = []

View File

@ -9,6 +9,11 @@ require "ostruct"
require "pp" require "pp"
require "forwardable" require "forwardable"
require "rbconfig"
RUBY_PATH = Pathname.new(RbConfig.ruby).freeze
RUBY_BIN = RUBY_PATH.dirname.freeze
require_relative "load_path" require_relative "load_path"
require "rubygems" require "rubygems"
@ -41,26 +46,11 @@ HOMEBREW_DEFAULT_CACHE = ENV["HOMEBREW_DEFAULT_CACHE"]
HOMEBREW_DEFAULT_LOGS = ENV["HOMEBREW_DEFAULT_LOGS"] HOMEBREW_DEFAULT_LOGS = ENV["HOMEBREW_DEFAULT_LOGS"]
HOMEBREW_DEFAULT_TEMP = ENV["HOMEBREW_DEFAULT_TEMP"] HOMEBREW_DEFAULT_TEMP = ENV["HOMEBREW_DEFAULT_TEMP"]
HOMEBREW_REQUIRED_RUBY_VERSION = ENV["HOMEBREW_REQUIRED_RUBY_VERSION"] HOMEBREW_REQUIRED_RUBY_VERSION = ENV["HOMEBREW_REQUIRED_RUBY_VERSION"]
require "env_config"
require "config"
require "os"
require "context"
require "extend/pathname"
require "extend/predicable"
require "extend/module"
require "cli/args"
require "messages"
HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"] HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"]
HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"] HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"]
HOMEBREW_WWW = "https://brew.sh" HOMEBREW_WWW = "https://brew.sh"
require "rbconfig"
RUBY_PATH = Pathname.new(RbConfig.ruby).freeze
RUBY_BIN = RUBY_PATH.dirname.freeze
HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"] HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"]
HOMEBREW_USER_AGENT_RUBY = HOMEBREW_USER_AGENT_RUBY =
"#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
@ -72,8 +62,18 @@ HOMEBREW_DEFAULT_PREFIX = "/usr/local"
HOMEBREW_MACOS_ARM_DEFAULT_PREFIX = "/opt/homebrew" HOMEBREW_MACOS_ARM_DEFAULT_PREFIX = "/opt/homebrew"
HOMEBREW_LINUX_DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew" HOMEBREW_LINUX_DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew"
HOMEBREW_PULL_API_REGEX =
%r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze
HOMEBREW_PULL_OR_COMMIT_URL_REGEX =
%r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze
HOMEBREW_RELEASES_URL_REGEX =
%r{https://github\.com/([\w-]+)/([\w-]+)?/releases/download/(.+)}.freeze
require "fileutils" require "fileutils"
require "os"
require "os/global" require "os/global"
require "messages"
module Homebrew module Homebrew
extend FileUtils extend FileUtils
@ -111,12 +111,14 @@ module Homebrew
end end
end end
HOMEBREW_PULL_API_REGEX = require "env_config"
%r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = require "config"
%r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze require "context"
HOMEBREW_RELEASES_URL_REGEX = require "extend/pathname"
%r{https://github\.com/([\w-]+)/([\w-]+)?/releases/download/(.+)}.freeze require "extend/predicable"
require "extend/module"
require "cli/args"
require "PATH" require "PATH"

View File

@ -1,6 +1,8 @@
# typed: false # typed: false
# frozen_string_literal: true # frozen_string_literal: true
require "env_config"
# Enables experimental `patchelf.rb` write support. # Enables experimental `patchelf.rb` write support.
HOMEBREW_PATCHELF_RB_WRITE = ( HOMEBREW_PATCHELF_RB_WRITE = (
ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank? && ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank? &&
@ -9,7 +11,7 @@ HOMEBREW_PATCHELF_RB_WRITE = (
).freeze ).freeze
module Homebrew module Homebrew
DEFAULT_PREFIX ||= if Homebrew::EnvConfig.force_homebrew_on_linux? DEFAULT_PREFIX ||= if EnvConfig.force_homebrew_on_linux?
HOMEBREW_DEFAULT_PREFIX HOMEBREW_DEFAULT_PREFIX
else else
HOMEBREW_LINUX_DEFAULT_PREFIX HOMEBREW_LINUX_DEFAULT_PREFIX

View File

@ -1,6 +1,8 @@
# typed: true # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "config"
# Match taps' formulae, e.g. `someuser/sometap/someformula` # Match taps' formulae, e.g. `someuser/sometap/someformula`
HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}.freeze HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}.freeze
# Match taps' casks, e.g. `someuser/sometap/somecask` # Match taps' casks, e.g. `someuser/sometap/somecask`

View File

@ -1,6 +1,8 @@
# typed: true # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "env_config"
# Various helper functions for interacting with TTYs. # Various helper functions for interacting with TTYs.
# #
# @api private # @api private