Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
This commit is contained in:
parent
73e521ec59
commit
94416e82f0
@ -86,7 +86,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Remove the source as we don't need to move it to the target location
|
# Remove the source as we don't need to move it to the target location
|
||||||
source.rmtree
|
FileUtils.rm_r(source)
|
||||||
|
|
||||||
return post_move(command)
|
return post_move(command)
|
||||||
end
|
end
|
||||||
@ -112,14 +112,14 @@ module Cask
|
|||||||
sudo: true)
|
sudo: true)
|
||||||
end
|
end
|
||||||
Quarantine.copy_xattrs(source, target, command:)
|
Quarantine.copy_xattrs(source, target, command:)
|
||||||
source.rmtree
|
FileUtils.rm_r(source)
|
||||||
elsif target.dirname.writable?
|
elsif target.dirname.writable?
|
||||||
FileUtils.move(source, target)
|
FileUtils.move(source, target)
|
||||||
else
|
else
|
||||||
# default sudo user isn't necessarily able to write to Homebrew's locations
|
# default sudo user isn't necessarily able to write to Homebrew's locations
|
||||||
# e.g. with runas_default set in the sudoers (5) file.
|
# e.g. with runas_default set in the sudoers (5) file.
|
||||||
command.run!("/bin/cp", args: ["-pR", source, target], sudo: true)
|
command.run!("/bin/cp", args: ["-pR", source, target], sudo: true)
|
||||||
source.rmtree
|
FileUtils.rm_r(source)
|
||||||
end
|
end
|
||||||
|
|
||||||
post_move(command)
|
post_move(command)
|
||||||
|
@ -411,7 +411,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def discontinued?
|
def discontinued?
|
||||||
odeprecated "`discontinued?`", "`deprecated?` or `disabled?`"
|
odisabled "`discontinued?`", "`deprecated?` or `disabled?`"
|
||||||
@caveats&.discontinued? == true
|
@caveats&.discontinued? == true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
caveat :discontinued do
|
caveat :discontinued do
|
||||||
odeprecated "`caveats :discontinued`", "`deprecate!`"
|
odisabled "`caveats :discontinued`", "`deprecate!`"
|
||||||
@discontinued = true
|
@discontinued = true
|
||||||
<<~EOS
|
<<~EOS
|
||||||
#{@cask} has been officially discontinued upstream.
|
#{@cask} has been officially discontinued upstream.
|
||||||
|
@ -399,7 +399,7 @@ on_request: true)
|
|||||||
|
|
||||||
extension = @cask.loaded_from_api? ? "json" : "rb"
|
extension = @cask.loaded_from_api? ? "json" : "rb"
|
||||||
(metadata_subdir/"#{@cask.token}.#{extension}").write @cask.source
|
(metadata_subdir/"#{@cask.token}.#{extension}").write @cask.source
|
||||||
old_savedir&.rmtree
|
FileUtils.rm_r(old_savedir) if old_savedir
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_config_file
|
def save_config_file
|
||||||
@ -454,8 +454,8 @@ on_request: true)
|
|||||||
def restore_backup
|
def restore_backup
|
||||||
return if !backup_path.directory? || !backup_metadata_path.directory?
|
return if !backup_path.directory? || !backup_metadata_path.directory?
|
||||||
|
|
||||||
@cask.staged_path.rmtree if @cask.staged_path.exist?
|
FileUtils.rm_r(@cask.staged_path) if @cask.staged_path.exist?
|
||||||
@cask.metadata_versioned_path.rmtree if @cask.metadata_versioned_path.exist?
|
FileUtils.rm_r(@cask.metadata_versioned_path) if @cask.metadata_versioned_path.exist?
|
||||||
|
|
||||||
backup_path.rename @cask.staged_path
|
backup_path.rename @cask.staged_path
|
||||||
backup_metadata_path.rename @cask.metadata_versioned_path
|
backup_metadata_path.rename @cask.metadata_versioned_path
|
||||||
|
@ -47,7 +47,7 @@ module Cask
|
|||||||
gain_permissions(path, permission_flags, command) do |p|
|
gain_permissions(path, permission_flags, command) do |p|
|
||||||
if p.parent.writable?
|
if p.parent.writable?
|
||||||
if directory
|
if directory
|
||||||
p.rmtree
|
FileUtils.rm_r p
|
||||||
else
|
else
|
||||||
FileUtils.rm_f p
|
FileUtils.rm_f p
|
||||||
end
|
end
|
||||||
|
@ -372,7 +372,7 @@ module Homebrew
|
|||||||
logs_days = [days, CLEANUP_DEFAULT_DAYS].min
|
logs_days = [days, CLEANUP_DEFAULT_DAYS].min
|
||||||
|
|
||||||
HOMEBREW_LOGS.subdirs.each do |dir|
|
HOMEBREW_LOGS.subdirs.each do |dir|
|
||||||
cleanup_path(dir) { dir.rmtree } if self.class.prune?(dir, logs_days)
|
cleanup_path(dir) { FileUtils.rm_r(dir) } if self.class.prune?(dir, logs_days)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
portable_rubies_to_remove.each do |portable_ruby|
|
portable_rubies_to_remove.each do |portable_ruby|
|
||||||
cleanup_path(portable_ruby) { portable_ruby.rmtree }
|
cleanup_path(portable_ruby) { FileUtils.rm_r(portable_ruby) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -531,7 +531,7 @@ module Homebrew
|
|||||||
return unless bootsnap.directory?
|
return unless bootsnap.directory?
|
||||||
|
|
||||||
bootsnap.each_child do |subdir|
|
bootsnap.each_child do |subdir|
|
||||||
cleanup_path(subdir) { subdir.rmtree } if subdir.basename.to_s != Homebrew.bootsnap_key
|
cleanup_path(subdir) { FileUtils.rm_r(subdir) } if subdir.basename.to_s != Homebrew.bootsnap_key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -166,11 +166,11 @@ module Homebrew
|
|||||||
@command_name = T.let(T.must(cmd_location.label).chomp("_args").tr("_", "-"), String)
|
@command_name = T.let(T.must(cmd_location.label).chomp("_args").tr("_", "-"), String)
|
||||||
@is_dev_cmd = T.let(T.must(cmd_location.absolute_path).start_with?(Commands::HOMEBREW_DEV_CMD_PATH),
|
@is_dev_cmd = T.let(T.must(cmd_location.absolute_path).start_with?(Commands::HOMEBREW_DEV_CMD_PATH),
|
||||||
T::Boolean)
|
T::Boolean)
|
||||||
# odeprecated(
|
odeprecated(
|
||||||
# "`brew #{@command_name}'. This command needs to be refactored, as it is written in a style that",
|
"`brew #{@command_name}'. This command needs to be refactored, as it is written in a style that",
|
||||||
# "inheritance from `Homebrew::AbstractCommand' ( see https://docs.brew.sh/External-Commands )",
|
"inherits from `Homebrew::AbstractCommand' ( see https://docs.brew.sh/External-Commands )",
|
||||||
# disable_for_developers: false,
|
disable_for_developers: false,
|
||||||
# )
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@constraints = T.let([], T::Array[[String, String]])
|
@constraints = T.let([], T::Array[[String, String]])
|
||||||
|
@ -432,11 +432,11 @@ class Reporter
|
|||||||
@api_names_before_txt = api_names_before_txt
|
@api_names_before_txt = api_names_before_txt
|
||||||
@api_dir_prefix = api_dir_prefix
|
@api_dir_prefix = api_dir_prefix
|
||||||
else
|
else
|
||||||
initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{tap.repo_var_suffix}"
|
initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{tap.repository_var_suffix}"
|
||||||
@initial_revision = ENV[initial_revision_var].to_s
|
@initial_revision = ENV[initial_revision_var].to_s
|
||||||
raise ReporterRevisionUnsetError, initial_revision_var if @initial_revision.empty?
|
raise ReporterRevisionUnsetError, initial_revision_var if @initial_revision.empty?
|
||||||
|
|
||||||
current_revision_var = "HOMEBREW_UPDATE_AFTER#{tap.repo_var_suffix}"
|
current_revision_var = "HOMEBREW_UPDATE_AFTER#{tap.repository_var_suffix}"
|
||||||
@current_revision = ENV[current_revision_var].to_s
|
@current_revision = ENV[current_revision_var].to_s
|
||||||
raise ReporterRevisionUnsetError, current_revision_var if @current_revision.empty?
|
raise ReporterRevisionUnsetError, current_revision_var if @current_revision.empty?
|
||||||
end
|
end
|
||||||
|
@ -82,18 +82,18 @@ git_init_if_necessary() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
repo_var_suffix() {
|
repository_var_suffix() {
|
||||||
local repo_dir="${1}"
|
local repository_directory="${1}"
|
||||||
local repo_var_suffix
|
local repository_var_suffix
|
||||||
|
|
||||||
if [[ "${repo_dir}" == "${HOMEBREW_REPOSITORY}" ]]
|
if [[ "${repository_directory}" == "${HOMEBREW_REPOSITORY}" ]]
|
||||||
then
|
then
|
||||||
repo_var_suffix=""
|
repository_var_suffix=""
|
||||||
else
|
else
|
||||||
repo_var_suffix="${repo_dir#"${HOMEBREW_LIBRARY}/Taps"}"
|
repository_var_suffix="${repository_directory#"${HOMEBREW_LIBRARY}/Taps"}"
|
||||||
repo_var_suffix="$(echo -n "${repo_var_suffix}" | tr -C "A-Za-z0-9" "_" | tr "[:lower:]" "[:upper:]")"
|
repository_var_suffix="$(echo -n "${repository_var_suffix}" | tr -C "A-Za-z0-9" "_" | tr "[:lower:]" "[:upper:]")"
|
||||||
fi
|
fi
|
||||||
echo "${repo_var_suffix}"
|
echo "${repository_var_suffix}"
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream_branch() {
|
upstream_branch() {
|
||||||
@ -592,7 +592,7 @@ EOS
|
|||||||
echo "Checking if we need to fetch ${DIR}..."
|
echo "Checking if we need to fetch ${DIR}..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAP_VAR="$(repo_var_suffix "${DIR}")"
|
TAP_VAR="$(repository_var_suffix "${DIR}")"
|
||||||
UPSTREAM_BRANCH_DIR="$(upstream_branch)"
|
UPSTREAM_BRANCH_DIR="$(upstream_branch)"
|
||||||
declare UPSTREAM_BRANCH"${TAP_VAR}"="${UPSTREAM_BRANCH_DIR}"
|
declare UPSTREAM_BRANCH"${TAP_VAR}"="${UPSTREAM_BRANCH_DIR}"
|
||||||
declare PREFETCH_REVISION"${TAP_VAR}"="$(git rev-parse -q --verify refs/remotes/origin/"${UPSTREAM_BRANCH_DIR}")"
|
declare PREFETCH_REVISION"${TAP_VAR}"="$(git rev-parse -q --verify refs/remotes/origin/"${UPSTREAM_BRANCH_DIR}")"
|
||||||
@ -778,7 +778,7 @@ EOS
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAP_VAR="$(repo_var_suffix "${DIR}")"
|
TAP_VAR="$(repository_var_suffix "${DIR}")"
|
||||||
UPSTREAM_BRANCH_VAR="UPSTREAM_BRANCH${TAP_VAR}"
|
UPSTREAM_BRANCH_VAR="UPSTREAM_BRANCH${TAP_VAR}"
|
||||||
UPSTREAM_BRANCH="${!UPSTREAM_BRANCH_VAR}"
|
UPSTREAM_BRANCH="${!UPSTREAM_BRANCH_VAR}"
|
||||||
CURRENT_REVISION="$(read_current_revision)"
|
CURRENT_REVISION="$(read_current_revision)"
|
||||||
|
@ -61,10 +61,6 @@ module Homebrew
|
|||||||
"formula is outdated. Otherwise, the repository's HEAD will only be checked for " \
|
"formula is outdated. Otherwise, the repository's HEAD will only be checked for " \
|
||||||
"updates when a new stable or development version has been released.",
|
"updates when a new stable or development version has been released.",
|
||||||
}],
|
}],
|
||||||
[:switch, "--ignore-pinned", {
|
|
||||||
description: "Set a successful exit status even if pinned formulae are not upgraded.",
|
|
||||||
hidden: true,
|
|
||||||
}],
|
|
||||||
[:switch, "--keep-tmp", {
|
[:switch, "--keep-tmp", {
|
||||||
description: "Retain the temporary files created during installation.",
|
description: "Retain the temporary files created during installation.",
|
||||||
}],
|
}],
|
||||||
@ -124,9 +120,6 @@ module Homebrew
|
|||||||
|
|
||||||
sig { override.void }
|
sig { override.void }
|
||||||
def run
|
def run
|
||||||
# Disabled since this is now the default behavior.
|
|
||||||
odisabled "`brew upgrade --ignore-pinned`" if args.ignore_pinned?
|
|
||||||
|
|
||||||
formulae, casks = args.named.to_resolved_formulae_to_casks
|
formulae, casks = args.named.to_resolved_formulae_to_casks
|
||||||
# If one or more formulae are specified, but no casks were
|
# If one or more formulae are specified, but no casks were
|
||||||
# specified, we want to make note of that so we don't
|
# specified, we want to make note of that so we don't
|
||||||
|
@ -27,8 +27,6 @@ module Homebrew
|
|||||||
"to the cask file."
|
"to the cask file."
|
||||||
switch "--no-audit",
|
switch "--no-audit",
|
||||||
description: "Don't run `brew audit` before opening the PR."
|
description: "Don't run `brew audit` before opening the PR."
|
||||||
switch "--online",
|
|
||||||
hidden: true
|
|
||||||
switch "--no-style",
|
switch "--no-style",
|
||||||
description: "Don't run `brew style --fix` before opening the PR."
|
description: "Don't run `brew style --fix` before opening the PR."
|
||||||
switch "--no-browse",
|
switch "--no-browse",
|
||||||
@ -60,8 +58,6 @@ module Homebrew
|
|||||||
|
|
||||||
sig { override.void }
|
sig { override.void }
|
||||||
def run
|
def run
|
||||||
odisabled "brew bump-cask-pr --online" if args.online?
|
|
||||||
|
|
||||||
# This will be run by `brew audit` or `brew style` later so run it first to
|
# This will be run by `brew audit` or `brew style` later so run it first to
|
||||||
# not start spamming during normal output.
|
# not start spamming during normal output.
|
||||||
gem_groups = []
|
gem_groups = []
|
||||||
|
@ -507,10 +507,6 @@ module Homebrew
|
|||||||
return if tap.nil?
|
return if tap.nil?
|
||||||
|
|
||||||
throttled_rate = formula.livecheck.throttle
|
throttled_rate = formula.livecheck.throttle
|
||||||
throttled_rate ||= if (rate = tap.audit_exceptions.dig(:throttled_formulae, formula.name))
|
|
||||||
odisabled "throttled_formulae.json", "Livecheck#throttle"
|
|
||||||
rate
|
|
||||||
end
|
|
||||||
return if throttled_rate.blank?
|
return if throttled_rate.blank?
|
||||||
|
|
||||||
formula_suffix = Version.new(new_version).patch.to_i
|
formula_suffix = Version.new(new_version).patch.to_i
|
||||||
|
@ -41,7 +41,6 @@ module Homebrew
|
|||||||
Homebrew.setup_gem_environment!
|
Homebrew.setup_gem_environment!
|
||||||
|
|
||||||
if args.stackprof?
|
if args.stackprof?
|
||||||
# odeprecated. vernier is better in every way
|
|
||||||
with_env HOMEBREW_STACKPROF: "1" do
|
with_env HOMEBREW_STACKPROF: "1" do
|
||||||
system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named)
|
system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named)
|
||||||
end
|
end
|
||||||
|
@ -39,17 +39,17 @@ module Homebrew
|
|||||||
odie "Tap is already installed!" if tap.installed?
|
odie "Tap is already installed!" if tap.installed?
|
||||||
|
|
||||||
titleized_user = tap.user.dup
|
titleized_user = tap.user.dup
|
||||||
titleized_repo = tap.repo.dup
|
titleized_repository = tap.repository.dup
|
||||||
titleized_user[0] = titleized_user[0].upcase
|
titleized_user[0] = titleized_user[0].upcase
|
||||||
titleized_repo[0] = titleized_repo[0].upcase
|
titleized_repository[0] = titleized_repository[0].upcase
|
||||||
root_url = GitHubPackages.root_url(tap.user, "homebrew-#{tap.repo}") if args.github_packages?
|
root_url = GitHubPackages.root_url(tap.user, "homebrew-#{tap.repository}") if args.github_packages?
|
||||||
|
|
||||||
(tap.path/"Formula").mkpath
|
(tap.path/"Formula").mkpath
|
||||||
|
|
||||||
# FIXME: https://github.com/errata-ai/vale/issues/818
|
# FIXME: https://github.com/errata-ai/vale/issues/818
|
||||||
# <!-- vale off -->
|
# <!-- vale off -->
|
||||||
readme = <<~MARKDOWN
|
readme = <<~MARKDOWN
|
||||||
# #{titleized_user} #{titleized_repo}
|
# #{titleized_user} #{titleized_repository}
|
||||||
|
|
||||||
## How do I install these formulae?
|
## How do I install these formulae?
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_deprecated_official_taps
|
def check_deprecated_official_taps
|
||||||
tapped_deprecated_taps =
|
tapped_deprecated_taps =
|
||||||
Tap.select(&:official?).map(&:repo) & DEPRECATED_OFFICIAL_TAPS
|
Tap.select(&:official?).map(&:repository) & DEPRECATED_OFFICIAL_TAPS
|
||||||
return if tapped_deprecated_taps.empty?
|
return if tapped_deprecated_taps.empty?
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
|
@ -76,13 +76,6 @@ class AbstractDownloadStrategy
|
|||||||
@quiet = true
|
@quiet = true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Disable any output during downloading.
|
|
||||||
sig { void }
|
|
||||||
def shutup!
|
|
||||||
odisabled "`AbstractDownloadStrategy#shutup!`", "`AbstractDownloadStrategy#quiet!`"
|
|
||||||
quiet!
|
|
||||||
end
|
|
||||||
|
|
||||||
def quiet?
|
def quiet?
|
||||||
Context.current.quiet? || @quiet
|
Context.current.quiet? || @quiet
|
||||||
end
|
end
|
||||||
|
@ -218,12 +218,12 @@ end
|
|||||||
|
|
||||||
# Raised when a formula in a specific tap is unavailable.
|
# Raised when a formula in a specific tap is unavailable.
|
||||||
class TapFormulaUnavailableError < FormulaUnavailableError
|
class TapFormulaUnavailableError < FormulaUnavailableError
|
||||||
attr_reader :tap, :user, :repo
|
attr_reader :tap, :user, :repository
|
||||||
|
|
||||||
def initialize(tap, name)
|
def initialize(tap, name)
|
||||||
@tap = tap
|
@tap = tap
|
||||||
@user = tap.user
|
@user = tap.user
|
||||||
@repo = tap.repo
|
@repository = tap.repository
|
||||||
super "#{tap}/#{name}"
|
super "#{tap}/#{name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ module Kernel
|
|||||||
|
|
||||||
require "tap"
|
require "tap"
|
||||||
|
|
||||||
tap = Tap.fetch(match[:user], match[:repo])
|
tap = Tap.fetch(match[:user], match[:repository])
|
||||||
tap_message = +"\nPlease report this issue to the #{tap.full_name} tap"
|
tap_message = +"\nPlease report this issue to the #{tap.full_name} tap"
|
||||||
tap_message += " (not Homebrew/brew or Homebrew/homebrew-core)" unless tap.official?
|
tap_message += " (not Homebrew/brew or Homebrew/homebrew-core)" unless tap.official?
|
||||||
tap_message += ", or even better, submit a PR to fix it" if replacement
|
tap_message += ", or even better, submit a PR to fix it" if replacement
|
||||||
|
@ -509,7 +509,7 @@ class Pathname
|
|||||||
# create a RuboCop autocorrect instead soon.
|
# create a RuboCop autocorrect instead soon.
|
||||||
# This is why monkeypatching is non-ideal (but right solution to get
|
# This is why monkeypatching is non-ideal (but right solution to get
|
||||||
# Ruby 3.3 over the line).
|
# Ruby 3.3 over the line).
|
||||||
# odeprecated "rmtree", "FileUtils#rm_r"
|
odeprecated "rmtree", "FileUtils#rm_r"
|
||||||
FileUtils.rm_r(@path, noop:, verbose:, secure:)
|
FileUtils.rm_r(@path, noop:, verbose:, secure:)
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
@ -1234,7 +1234,7 @@ class Formula
|
|||||||
#
|
#
|
||||||
# @see https://www.unix.com/man-page/all/5/plist/ <code>plist(5)</code> man page
|
# @see https://www.unix.com/man-page/all/5/plist/ <code>plist(5)</code> man page
|
||||||
def plist
|
def plist
|
||||||
odeprecated "`Formula#plist`", "`Homebrew::Service`"
|
odisabled "`Formula#plist`", "`Homebrew::Service`"
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2777,12 +2777,12 @@ class Formula
|
|||||||
).returns(Pathname)
|
).returns(Pathname)
|
||||||
}
|
}
|
||||||
def fetch(verify_download_integrity: true, timeout: nil, quiet: false)
|
def fetch(verify_download_integrity: true, timeout: nil, quiet: false)
|
||||||
# odeprecated "Formula#fetch", "Resource#fetch on Formula#resource"
|
odeprecated "Formula#fetch", "Resource#fetch on Formula#resource"
|
||||||
active_spec.fetch(verify_download_integrity:, timeout:, quiet:)
|
active_spec.fetch(verify_download_integrity:, timeout:, quiet:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_download_integrity(filename)
|
def verify_download_integrity(filename)
|
||||||
# odeprecated "Formula#verify_download_integrity", "Resource#verify_download_integrity on Formula#resource"
|
odeprecated "Formula#verify_download_integrity", "Resource#verify_download_integrity on Formula#resource"
|
||||||
active_spec.verify_download_integrity(filename)
|
active_spec.verify_download_integrity(filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2887,8 +2887,8 @@ class Formula
|
|||||||
def inreplace(paths, before = nil, after = nil, old_audit_result = nil, audit_result: true, &block)
|
def inreplace(paths, before = nil, after = nil, old_audit_result = nil, audit_result: true, &block)
|
||||||
# NOTE: must check for `#nil?` and not `#blank?`, or else `old_audit_result = false` will not call `odeprecated`.
|
# NOTE: must check for `#nil?` and not `#blank?`, or else `old_audit_result = false` will not call `odeprecated`.
|
||||||
unless old_audit_result.nil?
|
unless old_audit_result.nil?
|
||||||
# odeprecated "inreplace(paths, before, after, #{old_audit_result})",
|
odeprecated "inreplace(paths, before, after, #{old_audit_result})",
|
||||||
# "inreplace(paths, before, after, audit_result: #{old_audit_result})"
|
"inreplace(paths, before, after, audit_result: #{old_audit_result})"
|
||||||
audit_result = old_audit_result
|
audit_result = old_audit_result
|
||||||
end
|
end
|
||||||
Utils::Inreplace.inreplace(paths, before, after, audit_result:, &block)
|
Utils::Inreplace.inreplace(paths, before, after, audit_result:, &block)
|
||||||
@ -3749,7 +3749,7 @@ class Formula
|
|||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
def go_resource(name, &block)
|
def go_resource(name, &block)
|
||||||
odeprecated "`Formula.go_resource`", "Go modules"
|
odisabled "`Formula.go_resource`", "Go modules"
|
||||||
specs.each { |spec| spec.go_resource(name, &block) }
|
specs.each { |spec| spec.go_resource(name, &block) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -948,7 +948,7 @@ module Homebrew
|
|||||||
problem <<~EOS
|
problem <<~EOS
|
||||||
#{formula.name} seems to be listed in tap_migrations.json!
|
#{formula.name} seems to be listed in tap_migrations.json!
|
||||||
Please remove #{formula.name} from present tap & tap_migrations.json
|
Please remove #{formula.name} from present tap & tap_migrations.json
|
||||||
before submitting it to Homebrew/homebrew-#{formula.tap.repo}.
|
before submitting it to Homebrew/homebrew-#{formula.tap.repository}.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ on_request: installed_on_request?, options:)
|
|||||||
# any exceptions must leave us with nothing installed
|
# any exceptions must leave us with nothing installed
|
||||||
ignore_interrupts do
|
ignore_interrupts do
|
||||||
begin
|
begin
|
||||||
formula.prefix.rmtree if formula.prefix.directory?
|
FileUtils.rm_r(formula.prefix) if formula.prefix.directory?
|
||||||
rescue Errno::EACCES, Errno::ENOTEMPTY
|
rescue Errno::EACCES, Errno::ENOTEMPTY
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
Could not remove #{formula.prefix.basename} keg! Do so manually:
|
Could not remove #{formula.prefix.basename} keg! Do so manually:
|
||||||
@ -825,7 +825,7 @@ on_request: installed_on_request?, options:)
|
|||||||
# dependency tree. In that case, don't generate an error, just move on.
|
# dependency tree. In that case, don't generate an error, just move on.
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
ignore_interrupts { tmp_keg.rmtree if tmp_keg&.directory? }
|
ignore_interrupts { FileUtils.rm_r(tmp_keg) if tmp_keg&.directory? }
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
@ -1020,7 +1020,7 @@ on_request: installed_on_request?, options:)
|
|||||||
ignore_interrupts do
|
ignore_interrupts do
|
||||||
# any exceptions must leave us with nothing installed
|
# any exceptions must leave us with nothing installed
|
||||||
formula.update_head_version
|
formula.update_head_version
|
||||||
formula.prefix.rmtree if formula.prefix.directory?
|
FileUtils.rm_r(formula.prefix) if formula.prefix.directory?
|
||||||
formula.rack.rmdir_if_possible
|
formula.rack.rmdir_if_possible
|
||||||
end
|
end
|
||||||
raise e
|
raise e
|
||||||
|
@ -19,8 +19,13 @@ class GitRepository
|
|||||||
def git_repository?
|
def git_repository?
|
||||||
pathname.join(".git").exist?
|
pathname.join(".git").exist?
|
||||||
end
|
end
|
||||||
# odeprecated: use git_repository? instead
|
|
||||||
alias git_repo? git_repository?
|
sig { returns(T::Boolean) }
|
||||||
|
def git_repo?
|
||||||
|
# delete this whole function when removing odisabled
|
||||||
|
odeprecated "GitRepository#git_repo?", "GitRepository#git_repository?"
|
||||||
|
git_repository?
|
||||||
|
end
|
||||||
|
|
||||||
# Gets the URL of the Git origin remote.
|
# Gets the URL of the Git origin remote.
|
||||||
sig { returns(T.nilable(String)) }
|
sig { returns(T.nilable(String)) }
|
||||||
@ -31,7 +36,7 @@ class GitRepository
|
|||||||
# Sets the URL of the Git origin remote.
|
# Sets the URL of the Git origin remote.
|
||||||
sig { params(origin: String).returns(T.nilable(T::Boolean)) }
|
sig { params(origin: String).returns(T.nilable(T::Boolean)) }
|
||||||
def origin_url=(origin)
|
def origin_url=(origin)
|
||||||
return if !git_repo? || !Utils::Git.available?
|
return if !git_repository? || !Utils::Git.available?
|
||||||
|
|
||||||
safe_system Utils::Git.git, "remote", "set-url", "origin", origin, chdir: pathname
|
safe_system Utils::Git.git, "remote", "set-url", "origin", origin, chdir: pathname
|
||||||
end
|
end
|
||||||
@ -115,7 +120,7 @@ class GitRepository
|
|||||||
|
|
||||||
sig { params(args: T.untyped, safe: T::Boolean, err: T.nilable(Symbol)).returns(T.nilable(String)) }
|
sig { params(args: T.untyped, safe: T::Boolean, err: T.nilable(Symbol)).returns(T.nilable(String)) }
|
||||||
def popen_git(*args, safe: false, err: nil)
|
def popen_git(*args, safe: false, err: nil)
|
||||||
unless git_repo?
|
unless git_repository?
|
||||||
return unless safe
|
return unless safe
|
||||||
|
|
||||||
raise "Not a Git repository: #{pathname}"
|
raise "Not a Git repository: #{pathname}"
|
||||||
|
@ -123,11 +123,11 @@ class GitHubPackages
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.image_version_rebuild(version_rebuild)
|
def self.image_version_rebuild(version_rebuild)
|
||||||
return version_rebuild if version_rebuild.match?(VALID_OCI_TAG_REGEX)
|
unless version_rebuild.match?(VALID_OCI_TAG_REGEX)
|
||||||
|
raise ArgumentError, "GitHub Packages versions must match #{VALID_OCI_TAG_REGEX.source}!"
|
||||||
|
end
|
||||||
|
|
||||||
odisabled "GitHub Packages versions that do not match #{VALID_OCI_TAG_REGEX.source}",
|
version_rebuild
|
||||||
"declaring a new `version` without these characters"
|
|
||||||
version_rebuild.gsub(INVALID_OCI_TAG_CHARS_REGEX, ".")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -268,7 +268,7 @@ class Keg
|
|||||||
LinkageCacheStore.new(path, db).delete!
|
LinkageCacheStore.new(path, db).delete!
|
||||||
end
|
end
|
||||||
|
|
||||||
path.rmtree
|
FileUtils.rm_r(path)
|
||||||
path.parent.rmdir_if_possible
|
path.parent.rmdir_if_possible
|
||||||
remove_opt_record if optlinked?
|
remove_opt_record if optlinked?
|
||||||
remove_linked_keg_record if linked?
|
remove_linked_keg_record if linked?
|
||||||
|
@ -14,7 +14,7 @@ module Language
|
|||||||
# e.g. `resource "github.com/foo/bar"`.
|
# e.g. `resource "github.com/foo/bar"`.
|
||||||
sig { params(resources: T::Array[Resource], target: T.any(String, Pathname)).void }
|
sig { params(resources: T::Array[Resource], target: T.any(String, Pathname)).void }
|
||||||
def self.stage_deps(resources, target)
|
def self.stage_deps(resources, target)
|
||||||
odeprecated "`Language::Go.stage_deps`", "Go modules"
|
odisabled "`Language::Go.stage_deps`", "Go modules"
|
||||||
if resources.empty?
|
if resources.empty?
|
||||||
if Homebrew::EnvConfig.developer?
|
if Homebrew::EnvConfig.developer?
|
||||||
odie "Tried to stage empty Language::Go resources array"
|
odie "Tried to stage empty Language::Go resources array"
|
||||||
|
@ -6,6 +6,13 @@ require "utils"
|
|||||||
module OS
|
module OS
|
||||||
# Helper module for querying system information on Linux.
|
# Helper module for querying system information on Linux.
|
||||||
module Linux
|
module Linux
|
||||||
|
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
|
# This check is the only acceptable or necessary one in this file.
|
||||||
|
# rubocop:disable Homebrew/MoveToExtendOS
|
||||||
|
raise "Loaded OS::Linux on macOS!" if OS.mac?
|
||||||
|
# rubocop:enable Homebrew/MoveToExtendOS
|
||||||
|
|
||||||
# Get the OS version.
|
# Get the OS version.
|
||||||
#
|
#
|
||||||
# @api internal
|
# @api internal
|
||||||
@ -50,71 +57,4 @@ module OS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Style/Documentation
|
|
||||||
module Mac
|
|
||||||
::MacOS = OS::Mac
|
|
||||||
|
|
||||||
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
|
||||||
|
|
||||||
def self.version
|
|
||||||
odisabled "`MacOS.version` on Linux"
|
|
||||||
MacOSVersion::NULL
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.full_version
|
|
||||||
odisabled "`MacOS.full_version` on Linux"
|
|
||||||
MacOSVersion::NULL
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.languages
|
|
||||||
odisabled "`MacOS.languages` on Linux"
|
|
||||||
@languages ||= Array(ENV["LANG"]&.slice(/[a-z]+/)).uniq
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.language
|
|
||||||
odisabled "`MacOS.language` on Linux"
|
|
||||||
languages.first
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.sdk_root_needed?
|
|
||||||
odisabled "`MacOS.sdk_root_needed?` on Linux"
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.sdk_path_if_needed(_version = nil)
|
|
||||||
odisabled "`MacOS.sdk_path_if_needed` on Linux"
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.sdk_path(_version = nil)
|
|
||||||
odisabled "`MacOS.sdk_path` on Linux"
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
module Xcode
|
|
||||||
def self.version
|
|
||||||
odisabled "`MacOS::Xcode.version` on Linux"
|
|
||||||
::Version::NULL
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.installed?
|
|
||||||
odisabled "`MacOS::Xcode.installed?` on Linux"
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module CLT
|
|
||||||
def self.version
|
|
||||||
odisabled "`MacOS::CLT.version` on Linux"
|
|
||||||
::Version::NULL
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.installed?
|
|
||||||
odisabled "`MacOS::CLT.installed?` on Linux"
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# rubocop:enable Style/Documentation
|
|
||||||
end
|
end
|
||||||
|
@ -7,16 +7,19 @@ require "os/mac/xcode"
|
|||||||
require "os/mac/sdk"
|
require "os/mac/sdk"
|
||||||
require "os/mac/keg"
|
require "os/mac/keg"
|
||||||
|
|
||||||
# TODO: remove this once the `MacOS` module is undefined on Linux
|
|
||||||
require "simulate_system"
|
|
||||||
|
|
||||||
module OS
|
module OS
|
||||||
# Helper module for querying system information on macOS.
|
# Helper module for querying system information on macOS.
|
||||||
module Mac
|
module Mac
|
||||||
::MacOS = OS::Mac
|
|
||||||
|
|
||||||
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
|
# This check is the only acceptable or necessary one in this file.
|
||||||
|
# rubocop:disable Homebrew/MoveToExtendOS
|
||||||
|
raise "Loaded OS::Mac on Linux!" if OS.linux?
|
||||||
|
# rubocop:enable Homebrew/MoveToExtendOS
|
||||||
|
|
||||||
|
# Provide MacOS alias for backwards compatibility and nicer APIs.
|
||||||
|
::MacOS = OS::Mac
|
||||||
|
|
||||||
VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze
|
VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze
|
||||||
private_constant :VERSION
|
private_constant :VERSION
|
||||||
|
|
||||||
@ -35,7 +38,6 @@ module OS
|
|||||||
# @api internal
|
# @api internal
|
||||||
sig { returns(MacOSVersion) }
|
sig { returns(MacOSVersion) }
|
||||||
def self.full_version
|
def self.full_version
|
||||||
odisabled "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
@full_version ||= if (fake_macos = ENV.fetch("HOMEBREW_FAKE_MACOS", nil)) # for Portable Ruby building
|
@full_version ||= if (fake_macos = ENV.fetch("HOMEBREW_FAKE_MACOS", nil)) # for Portable Ruby building
|
||||||
MacOSVersion.new(fake_macos)
|
MacOSVersion.new(fake_macos)
|
||||||
else
|
else
|
||||||
@ -68,7 +70,6 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.languages
|
def self.languages
|
||||||
odisabled "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
return @languages if @languages
|
return @languages if @languages
|
||||||
|
|
||||||
os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages")
|
os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages")
|
||||||
@ -82,7 +83,6 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.language
|
def self.language
|
||||||
odisabled "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
languages.first
|
languages.first
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -93,7 +93,6 @@ module OS
|
|||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def self.sdk_root_needed?
|
def self.sdk_root_needed?
|
||||||
odisabled "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
if MacOS::CLT.installed?
|
if MacOS::CLT.installed?
|
||||||
# If there's no CLT SDK, return false
|
# If there's no CLT SDK, return false
|
||||||
return false unless MacOS::CLT.provides_sdk?
|
return false unless MacOS::CLT.provides_sdk?
|
||||||
@ -142,13 +141,11 @@ module OS
|
|||||||
|
|
||||||
# Returns the path to an SDK or nil, following the rules set by {sdk}.
|
# Returns the path to an SDK or nil, following the rules set by {sdk}.
|
||||||
def self.sdk_path(version = nil)
|
def self.sdk_path(version = nil)
|
||||||
odisabled "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
s = sdk(version)
|
s = sdk(version)
|
||||||
s&.path
|
s&.path
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.sdk_path_if_needed(version = nil)
|
def self.sdk_path_if_needed(version = nil)
|
||||||
odisabled "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
# Prefer CLT SDK when both Xcode and the CLT are installed.
|
# Prefer CLT SDK when both Xcode and the CLT are installed.
|
||||||
# Expected results:
|
# Expected results:
|
||||||
# 1. On Xcode-only systems, return the Xcode SDK.
|
# 1. On Xcode-only systems, return the Xcode SDK.
|
||||||
|
@ -126,7 +126,6 @@ module OS
|
|||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def self.installed?
|
def self.installed?
|
||||||
odisabled "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
!prefix.nil?
|
!prefix.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -178,7 +177,6 @@ module OS
|
|||||||
# @api internal
|
# @api internal
|
||||||
sig { returns(::Version) }
|
sig { returns(::Version) }
|
||||||
def self.version
|
def self.version
|
||||||
odisabled "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
# may return a version string
|
# may return a version string
|
||||||
# that is guessed based on the compiler, so do not
|
# that is guessed based on the compiler, so do not
|
||||||
# use it in order to check if Xcode is installed.
|
# use it in order to check if Xcode is installed.
|
||||||
@ -278,7 +276,6 @@ module OS
|
|||||||
# Returns true even if outdated tools are installed.
|
# Returns true even if outdated tools are installed.
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def self.installed?
|
def self.installed?
|
||||||
odisabled "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
!version.null?
|
!version.null?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -423,7 +420,6 @@ module OS
|
|||||||
# @api internal
|
# @api internal
|
||||||
sig { returns(::Version) }
|
sig { returns(::Version) }
|
||||||
def self.version
|
def self.version
|
||||||
odisabled "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
|
||||||
if @version ||= detect_version
|
if @version ||= detect_version
|
||||||
::Version.new @version
|
::Version.new @version
|
||||||
else
|
else
|
||||||
|
@ -69,7 +69,7 @@ module Homebrew
|
|||||||
raise
|
raise
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
backup_path(keg).rmtree if backup_path(keg).exist?
|
FileUtils.rm_r(backup_path(keg)) if backup_path(keg).exist?
|
||||||
rescue Errno::EACCES, Errno::ENOTEMPTY
|
rescue Errno::EACCES, Errno::ENOTEMPTY
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
Could not remove #{backup_path(keg).parent.basename} backup keg! Do so manually:
|
Could not remove #{backup_path(keg).parent.basename} backup keg! Do so manually:
|
||||||
@ -96,7 +96,7 @@ module Homebrew
|
|||||||
|
|
||||||
return unless path.directory?
|
return unless path.directory?
|
||||||
|
|
||||||
Pathname.new(keg).rmtree if keg.exist?
|
FileUtils.rm_r(Pathname.new(keg)) if keg.exist?
|
||||||
|
|
||||||
path.rename keg
|
path.rename keg
|
||||||
keg.link(verbose:) if keg_was_linked
|
keg.link(verbose:) if keg_was_linked
|
||||||
|
@ -154,7 +154,7 @@ class SoftwareSpec
|
|||||||
end
|
end
|
||||||
|
|
||||||
def go_resource(name, &block)
|
def go_resource(name, &block)
|
||||||
odeprecated "`SoftwareSpec#go_resource`", "Go modules"
|
odisabled "`SoftwareSpec#go_resource`", "Go modules"
|
||||||
resource name, Resource::Go, &block
|
resource name, Resource::Go, &block
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,26 +49,26 @@ class Tap
|
|||||||
# Fetch a {Tap} by name.
|
# Fetch a {Tap} by name.
|
||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
sig { params(user: String, repo: String).returns(Tap) }
|
sig { params(user: String, repository: String).returns(Tap) }
|
||||||
def self.fetch(user, repo = T.unsafe(nil))
|
def self.fetch(user, repository = T.unsafe(nil))
|
||||||
user, repo = user.split("/", 2) if repo.nil?
|
user, repository = user.split("/", 2) if repository.nil?
|
||||||
|
|
||||||
if [user, repo].any? { |part| part.nil? || part.include?("/") }
|
if [user, repository].any? { |part| part.nil? || part.include?("/") }
|
||||||
raise InvalidNameError, "Invalid tap name: '#{[*user, *repo].join("/")}'"
|
raise InvalidNameError, "Invalid tap name: '#{[*user, *repository].join("/")}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
user = T.must(user)
|
user = T.must(user)
|
||||||
repo = T.must(repo)
|
repository = T.must(repository)
|
||||||
|
|
||||||
# We special case homebrew and linuxbrew so that users don't have to shift in a terminal.
|
# We special case homebrew and linuxbrew so that users don't have to shift in a terminal.
|
||||||
user = user.capitalize if ["homebrew", "linuxbrew"].include?(user)
|
user = user.capitalize if ["homebrew", "linuxbrew"].include?(user)
|
||||||
repo = repo.sub(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX, "")
|
repository = repository.sub(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX, "")
|
||||||
|
|
||||||
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
|
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repository)
|
||||||
return CoreCaskTap.instance if user == "Homebrew" && repo == "cask"
|
return CoreCaskTap.instance if user == "Homebrew" && repository == "cask"
|
||||||
|
|
||||||
cache_key = "#{user}/#{repo}".downcase
|
cache_key = "#{user}/#{repository}".downcase
|
||||||
cache.fetch(cache_key) { |key| cache[key] = new(user, repo) }
|
cache.fetch(cache_key) { |key| cache[key] = new(user, repository) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get a {Tap} from its path or a path inside of it.
|
# Get a {Tap} from its path or a path inside of it.
|
||||||
@ -79,9 +79,9 @@ class Tap
|
|||||||
|
|
||||||
return unless match
|
return unless match
|
||||||
return unless (user = match[:user])
|
return unless (user = match[:user])
|
||||||
return unless (repo = match[:repo])
|
return unless (repository = match[:repository])
|
||||||
|
|
||||||
fetch(user, repo)
|
fetch(user, repository)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(name: String).returns(T.nilable([Tap, String])) }
|
sig { params(name: String).returns(T.nilable([Tap, String])) }
|
||||||
@ -89,13 +89,13 @@ class Tap
|
|||||||
return unless (match = name.match(HOMEBREW_TAP_FORMULA_REGEX))
|
return unless (match = name.match(HOMEBREW_TAP_FORMULA_REGEX))
|
||||||
|
|
||||||
user = T.must(match[:user])
|
user = T.must(match[:user])
|
||||||
repo = T.must(match[:repo])
|
repository = T.must(match[:repository])
|
||||||
name = T.must(match[:name])
|
name = T.must(match[:name])
|
||||||
|
|
||||||
# Relative paths are not taps.
|
# Relative paths are not taps.
|
||||||
return if [user, repo].intersect?([".", ".."])
|
return if [user, repository].intersect?([".", ".."])
|
||||||
|
|
||||||
tap = fetch(user, repo)
|
tap = fetch(user, repository)
|
||||||
[tap, name.downcase]
|
[tap, name.downcase]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,13 +104,13 @@ class Tap
|
|||||||
return unless (match = token.match(HOMEBREW_TAP_CASK_REGEX))
|
return unless (match = token.match(HOMEBREW_TAP_CASK_REGEX))
|
||||||
|
|
||||||
user = T.must(match[:user])
|
user = T.must(match[:user])
|
||||||
repo = T.must(match[:repo])
|
repository = T.must(match[:repository])
|
||||||
token = T.must(match[:token])
|
token = T.must(match[:token])
|
||||||
|
|
||||||
# Relative paths are not taps.
|
# Relative paths are not taps.
|
||||||
return if [user, repo].intersect?([".", ".."])
|
return if [user, repository].intersect?([".", ".."])
|
||||||
|
|
||||||
tap = fetch(user, repo)
|
tap = fetch(user, repository)
|
||||||
[tap, token.downcase]
|
[tap, token.downcase]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -157,8 +157,14 @@ class Tap
|
|||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
attr_reader :repository
|
attr_reader :repository
|
||||||
# odeprecated: use repository instead.
|
|
||||||
alias repo repository
|
# @deprecated
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def repo
|
||||||
|
# delete this whole function when removing odisabled
|
||||||
|
odeprecated "Tap#repo", "Tap#repository"
|
||||||
|
repository
|
||||||
|
end
|
||||||
|
|
||||||
# The name of this {Tap}. It combines {#user} and {#repository} with a slash.
|
# The name of this {Tap}. It combines {#user} and {#repository} with a slash.
|
||||||
# {#name} is always in lowercase.
|
# {#name} is always in lowercase.
|
||||||
@ -267,12 +273,20 @@ class Tap
|
|||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
sig { returns(T.nilable(String)) }
|
sig { returns(T.nilable(String)) }
|
||||||
def remote_repo
|
def remote_repository
|
||||||
return unless (remote = self.remote)
|
return unless (remote = self.remote)
|
||||||
|
|
||||||
@remote_repo ||= remote.delete_prefix("https://github.com/")
|
@remote_repository ||= remote.delete_prefix("https://github.com/")
|
||||||
.delete_prefix("git@github.com:")
|
.delete_prefix("git@github.com:")
|
||||||
.delete_suffix(".git")
|
.delete_suffix(".git")
|
||||||
|
end
|
||||||
|
|
||||||
|
# @deprecated
|
||||||
|
sig { returns(T.nilable(String)) }
|
||||||
|
def remote_repo
|
||||||
|
# delete this whole function when removing odisabled
|
||||||
|
odeprecated "Tap#remote_repo", "Tap#remote_repository"
|
||||||
|
remote_repository
|
||||||
end
|
end
|
||||||
|
|
||||||
# The default remote path to this {Tap}.
|
# The default remote path to this {Tap}.
|
||||||
@ -288,8 +302,14 @@ class Tap
|
|||||||
.tr("^A-Za-z0-9", "_")
|
.tr("^A-Za-z0-9", "_")
|
||||||
.upcase
|
.upcase
|
||||||
end
|
end
|
||||||
# odeprecated: use repository_var_suffix instead.
|
|
||||||
alias repo_var_suffix repository_var_suffix
|
# @deprecated
|
||||||
|
sig { returns(String) }
|
||||||
|
def repo_var_suffix
|
||||||
|
# delete this whole function when removing odisabled
|
||||||
|
odeprecated "Tap#repo_var_suffix", "Tap#repository_var_suffix"
|
||||||
|
repository_var_suffix
|
||||||
|
end
|
||||||
|
|
||||||
# Check whether this {Tap} is a Git repository.
|
# Check whether this {Tap} is a Git repository.
|
||||||
#
|
#
|
||||||
@ -326,7 +346,7 @@ class Tap
|
|||||||
end
|
end
|
||||||
|
|
||||||
# The issues URL of this {Tap}.
|
# The issues URL of this {Tap}.
|
||||||
# e.g. `https://github.com/user/homebrew-repo/issues`
|
# e.g. `https://github.com/user/homebrew-repository/issues`
|
||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
sig { returns(T.nilable(String)) }
|
sig { returns(T.nilable(String)) }
|
||||||
@ -417,11 +437,11 @@ class Tap
|
|||||||
require "descriptions"
|
require "descriptions"
|
||||||
require "readall"
|
require "readall"
|
||||||
|
|
||||||
if official? && DEPRECATED_OFFICIAL_TAPS.include?(repo)
|
if official? && DEPRECATED_OFFICIAL_TAPS.include?(repository)
|
||||||
odie "#{name} was deprecated. This tap is now empty and all its contents were either deleted or migrated."
|
odie "#{name} was deprecated. This tap is now empty and all its contents were either deleted or migrated."
|
||||||
elsif user == "caskroom" || name == "phinze/cask"
|
elsif user == "caskroom" || name == "phinze/cask"
|
||||||
new_repo = (repo == "cask") ? "cask" : "cask-#{repo}"
|
new_repository = (repository == "cask") ? "cask" : "cask-#{repository}"
|
||||||
odie "#{name} was moved. Tap homebrew/#{new_repo} instead."
|
odie "#{name} was moved. Tap homebrew/#{new_repository} instead."
|
||||||
end
|
end
|
||||||
|
|
||||||
raise TapNoCustomRemoteError, name if custom_remote && clone_target.nil?
|
raise TapNoCustomRemoteError, name if custom_remote && clone_target.nil?
|
||||||
@ -618,7 +638,7 @@ class Tap
|
|||||||
require "utils/link"
|
require "utils/link"
|
||||||
Utils::Link.unlink_manpages(path)
|
Utils::Link.unlink_manpages(path)
|
||||||
Utils::Link.unlink_completions(path)
|
Utils::Link.unlink_completions(path)
|
||||||
path.rmtree
|
FileUtils.rm_r(path)
|
||||||
path.parent.rmdir_if_possible
|
path.parent.rmdir_if_possible
|
||||||
$stderr.puts "Untapped#{formatted_contents} (#{abv})."
|
$stderr.puts "Untapped#{formatted_contents} (#{abv})."
|
||||||
|
|
||||||
@ -866,7 +886,7 @@ class Tap
|
|||||||
hash = {
|
hash = {
|
||||||
"name" => name,
|
"name" => name,
|
||||||
"user" => user,
|
"user" => user,
|
||||||
"repo" => repo,
|
"repository" => repository,
|
||||||
"path" => path.to_s,
|
"path" => path.to_s,
|
||||||
"installed" => installed?,
|
"installed" => installed?,
|
||||||
"official" => official?,
|
"official" => official?,
|
||||||
@ -1059,7 +1079,7 @@ class Tap
|
|||||||
# An array of all installed {Tap} names.
|
# An array of all installed {Tap} names.
|
||||||
sig { returns(T::Array[String]) }
|
sig { returns(T::Array[String]) }
|
||||||
def self.names
|
def self.names
|
||||||
odeprecated "`#{self}.names`"
|
odisabled "`#{self}.names`"
|
||||||
|
|
||||||
map(&:name).sort
|
map(&:name).sort
|
||||||
end
|
end
|
||||||
@ -1165,7 +1185,7 @@ class AbstractCoreTap < Tap
|
|||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def self.ensure_installed!
|
def self.ensure_installed!
|
||||||
odeprecated "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`"
|
odisabled "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`"
|
||||||
|
|
||||||
instance.ensure_installed!
|
instance.ensure_installed!
|
||||||
end
|
end
|
||||||
@ -1234,7 +1254,7 @@ class CoreTap < AbstractCoreTap
|
|||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def linuxbrew_core?
|
def linuxbrew_core?
|
||||||
remote_repo.to_s.end_with?("/linuxbrew-core") || remote_repo == "Linuxbrew/homebrew-core"
|
remote_repository.to_s.end_with?("/linuxbrew-core") || remote_repository == "Linuxbrew/homebrew-core"
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(Pathname) }
|
sig { returns(Pathname) }
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
HOMEBREW_TAP_FORMULA_NAME_REGEX = T.let(/(?<name>[\w+\-.@]+)/, Regexp)
|
HOMEBREW_TAP_FORMULA_NAME_REGEX = T.let(/(?<name>[\w+\-.@]+)/, Regexp)
|
||||||
# Match taps' formulae, e.g. `someuser/sometap/someformula`.
|
# Match taps' formulae, e.g. `someuser/sometap/someformula`.
|
||||||
HOMEBREW_TAP_FORMULA_REGEX = T.let(
|
HOMEBREW_TAP_FORMULA_REGEX = T.let(
|
||||||
%r{\A(?<user>[^/]+)/(?<repo>[^/]+)/#{HOMEBREW_TAP_FORMULA_NAME_REGEX.source}\Z},
|
%r{\A(?<user>[^/]+)/(?<repository>[^/]+)/#{HOMEBREW_TAP_FORMULA_NAME_REGEX.source}\Z},
|
||||||
Regexp,
|
Regexp,
|
||||||
)
|
)
|
||||||
# Match default formula taps' formulae, e.g. `homebrew/core/someformula` or `someformula`.
|
# Match default formula taps' formulae, e.g. `homebrew/core/someformula` or `someformula`.
|
||||||
@ -18,7 +18,7 @@ HOMEBREW_DEFAULT_TAP_FORMULA_REGEX = T.let(
|
|||||||
HOMEBREW_TAP_CASK_TOKEN_REGEX = T.let(/(?<token>[\w+\-.@]+)/, Regexp)
|
HOMEBREW_TAP_CASK_TOKEN_REGEX = T.let(/(?<token>[\w+\-.@]+)/, Regexp)
|
||||||
# Match taps' casks, e.g. `someuser/sometap/somecask`.
|
# Match taps' casks, e.g. `someuser/sometap/somecask`.
|
||||||
HOMEBREW_TAP_CASK_REGEX = T.let(
|
HOMEBREW_TAP_CASK_REGEX = T.let(
|
||||||
%r{\A(?<user>[^/]+)/(?<repo>[^/]+)/#{HOMEBREW_TAP_CASK_TOKEN_REGEX.source}\Z},
|
%r{\A(?<user>[^/]+)/(?<repository>[^/]+)/#{HOMEBREW_TAP_CASK_TOKEN_REGEX.source}\Z},
|
||||||
Regexp,
|
Regexp,
|
||||||
)
|
)
|
||||||
# Match default cask taps' casks, e.g. `homebrew/cask/somecask` or `somecask`.
|
# Match default cask taps' casks, e.g. `homebrew/cask/somecask` or `somecask`.
|
||||||
@ -29,7 +29,7 @@ HOMEBREW_DEFAULT_TAP_CASK_REGEX = T.let(
|
|||||||
|
|
||||||
# Match taps' directory paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap`.
|
# Match taps' directory paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap`.
|
||||||
HOMEBREW_TAP_DIR_REGEX = T.let(
|
HOMEBREW_TAP_DIR_REGEX = T.let(
|
||||||
%r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/(?<user>[^/]+)/(?<repo>[^/]+)},
|
%r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/(?<user>[^/]+)/(?<repository>[^/]+)},
|
||||||
Regexp,
|
Regexp,
|
||||||
)
|
)
|
||||||
# Match taps' formula paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula`.
|
# Match taps' formula paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula`.
|
||||||
|
@ -239,7 +239,7 @@ RSpec.describe Cask::Artifact::App, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "gives a warning if the source doesn't exist" do
|
it "gives a warning if the source doesn't exist" do
|
||||||
source_path.rmtree
|
FileUtils.rm_r(source_path)
|
||||||
|
|
||||||
message = "It seems the App source '#{source_path}' is not there."
|
message = "It seems the App source '#{source_path}' is not there."
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ RSpec.describe Cask::Installer, :cask do
|
|||||||
described_class.new(cask).forbidden_tap_check
|
described_class.new(cask).forbidden_tap_check
|
||||||
end.to raise_error(Cask::CaskCannotBeInstalledError, /from the #{dep_tap} tap but/)
|
end.to raise_error(Cask::CaskCannotBeInstalledError, /from the #{dep_tap} tap but/)
|
||||||
ensure
|
ensure
|
||||||
dep_path.parent.parent.rmtree
|
FileUtils.rm_r(dep_path.parent.parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ RSpec.describe Cask::Uninstall, :cask do
|
|||||||
|
|
||||||
expect(cask).to be_installed
|
expect(cask).to be_installed
|
||||||
|
|
||||||
cask.config.appdir.join("MyFancyApp.app").rmtree
|
FileUtils.rm_r(cask.config.appdir.join("MyFancyApp.app"))
|
||||||
|
|
||||||
expect { described_class.uninstall_casks(cask) }
|
expect { described_class.uninstall_casks(cask) }
|
||||||
.to raise_error(Cask::CaskError, /uninstall script .* does not exist/)
|
.to raise_error(Cask::CaskError, /uninstall script .* does not exist/)
|
||||||
|
@ -11,7 +11,7 @@ RSpec.describe Homebrew::Cmd::Reinstall do
|
|||||||
install_test_formula "testball"
|
install_test_formula "testball"
|
||||||
foo_dir = HOMEBREW_CELLAR/"testball/0.1/bin"
|
foo_dir = HOMEBREW_CELLAR/"testball/0.1/bin"
|
||||||
expect(foo_dir).to exist
|
expect(foo_dir).to exist
|
||||||
foo_dir.rmtree
|
FileUtils.rm_r(foo_dir)
|
||||||
|
|
||||||
expect { brew "reinstall", "testball" }
|
expect { brew "reinstall", "testball" }
|
||||||
.to output(/Reinstalling testball/).to_stdout
|
.to output(/Reinstalling testball/).to_stdout
|
||||||
|
@ -15,8 +15,8 @@ RSpec.describe Homebrew::Cmd::UpdateReport do
|
|||||||
def initialize(tap)
|
def initialize(tap)
|
||||||
@tap = tap
|
@tap = tap
|
||||||
|
|
||||||
ENV["HOMEBREW_UPDATE_BEFORE#{tap.repo_var_suffix}"] = "12345678"
|
ENV["HOMEBREW_UPDATE_BEFORE#{tap.repository_var_suffix}"] = "12345678"
|
||||||
ENV["HOMEBREW_UPDATE_AFTER#{tap.repo_var_suffix}"] = "abcdef00"
|
ENV["HOMEBREW_UPDATE_AFTER#{tap.repository_var_suffix}"] = "abcdef00"
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@ -94,7 +94,7 @@ RSpec.describe Homebrew::Cmd::UpdateReport do
|
|||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
tap.path.parent.rmtree
|
FileUtils.rm_r(tap.path.parent)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "with restructured Tap" do
|
specify "with restructured Tap" do
|
||||||
|
@ -71,11 +71,11 @@ RSpec.describe Homebrew::Diagnostic::Checks do
|
|||||||
expect(checks.check_user_path_3)
|
expect(checks.check_user_path_3)
|
||||||
.to match("Homebrew's \"sbin\" was not found in your PATH")
|
.to match("Homebrew's \"sbin\" was not found in your PATH")
|
||||||
ensure
|
ensure
|
||||||
sbin.rmtree
|
FileUtils.rm_rf(sbin)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#check_for_symlinked_cellar" do
|
specify "#check_for_symlinked_cellar" do
|
||||||
HOMEBREW_CELLAR.rmtree
|
FileUtils.rm_r(HOMEBREW_CELLAR)
|
||||||
|
|
||||||
mktmpdir do |path|
|
mktmpdir do |path|
|
||||||
FileUtils.ln_s path, HOMEBREW_CELLAR
|
FileUtils.ln_s path, HOMEBREW_CELLAR
|
||||||
|
@ -46,7 +46,7 @@ RSpec.describe "Exception" do
|
|||||||
describe TapFormulaOrCaskUnavailableError do
|
describe TapFormulaOrCaskUnavailableError do
|
||||||
subject(:error) { described_class.new(tap, "foo") }
|
subject(:error) { described_class.new(tap, "foo") }
|
||||||
|
|
||||||
let(:tap) { instance_double(Tap, user: "u", repo: "r", to_s: "u/r", installed?: false) }
|
let(:tap) { instance_double(Tap, user: "u", repository: "r", to_s: "u/r", installed?: false) }
|
||||||
|
|
||||||
it(:to_s) { expect(error.to_s).to match(%r{Please tap it and then try again: brew tap u/r}) }
|
it(:to_s) { expect(error.to_s).to match(%r{Please tap it and then try again: brew tap u/r}) }
|
||||||
end
|
end
|
||||||
@ -88,7 +88,7 @@ RSpec.describe "Exception" do
|
|||||||
describe TapFormulaUnavailableError do
|
describe TapFormulaUnavailableError do
|
||||||
subject(:error) { described_class.new(tap, "foo") }
|
subject(:error) { described_class.new(tap, "foo") }
|
||||||
|
|
||||||
let(:tap) { instance_double(Tap, user: "u", repo: "r", to_s: "u/r", installed?: false) }
|
let(:tap) { instance_double(Tap, user: "u", repository: "r", to_s: "u/r", installed?: false) }
|
||||||
|
|
||||||
it(:to_s) { expect(error.to_s).to match(%r{Please tap it and then try again: brew tap u/r}) }
|
it(:to_s) { expect(error.to_s).to match(%r{Please tap it and then try again: brew tap u/r}) }
|
||||||
end
|
end
|
||||||
|
@ -39,7 +39,7 @@ RSpec.describe FormulaInstaller do
|
|||||||
keg.uninstall
|
keg.uninstall
|
||||||
formula.clear_cache
|
formula.clear_cache
|
||||||
# there will be log files when sandbox is enable.
|
# there will be log files when sandbox is enable.
|
||||||
formula.logs.rmtree if formula.logs.directory?
|
FileUtils.rm_r(formula.logs) if formula.logs.directory?
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(keg).not_to exist
|
expect(keg).not_to exist
|
||||||
@ -288,7 +288,7 @@ RSpec.describe FormulaInstaller do
|
|||||||
fi.forbidden_tap_check
|
fi.forbidden_tap_check
|
||||||
end.to raise_error(CannotInstallFormulaError, /has the tap #{f_tap}/)
|
end.to raise_error(CannotInstallFormulaError, /has the tap #{f_tap}/)
|
||||||
ensure
|
ensure
|
||||||
f_path.parent.parent.rmtree
|
FileUtils.rm_r(f_path.parent.parent)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises on not allowed third-party tap on formula" do
|
it "raises on not allowed third-party tap on formula" do
|
||||||
@ -311,7 +311,7 @@ RSpec.describe FormulaInstaller do
|
|||||||
fi.forbidden_tap_check
|
fi.forbidden_tap_check
|
||||||
end.to raise_error(CannotInstallFormulaError, /has the tap #{f_tap}/)
|
end.to raise_error(CannotInstallFormulaError, /has the tap #{f_tap}/)
|
||||||
ensure
|
ensure
|
||||||
f_path.parent.parent.parent.rmtree
|
FileUtils.rm_r(f_path.parent.parent.parent)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not raise on allowed tap on formula" do
|
it "does not raise on allowed tap on formula" do
|
||||||
@ -332,7 +332,7 @@ RSpec.describe FormulaInstaller do
|
|||||||
|
|
||||||
expect { fi.forbidden_tap_check }.not_to raise_error
|
expect { fi.forbidden_tap_check }.not_to raise_error
|
||||||
ensure
|
ensure
|
||||||
f_path.parent.parent.parent.rmtree
|
FileUtils.rm_r(f_path.parent.parent.parent)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises on forbidden tap on dependency" do
|
it "raises on forbidden tap on dependency" do
|
||||||
@ -366,7 +366,7 @@ RSpec.describe FormulaInstaller do
|
|||||||
fi.forbidden_tap_check
|
fi.forbidden_tap_check
|
||||||
end.to raise_error(CannotInstallFormulaError, /from the #{dep_tap} tap but/)
|
end.to raise_error(CannotInstallFormulaError, /from the #{dep_tap} tap but/)
|
||||||
ensure
|
ensure
|
||||||
dep_path.parent.parent.rmtree
|
FileUtils.rm_r(dep_path.parent.parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ RSpec.describe Formula do
|
|||||||
context "when in a Tap" do
|
context "when in a Tap" do
|
||||||
let(:tap) { Tap.fetch("foo", "bar") }
|
let(:tap) { Tap.fetch("foo", "bar") }
|
||||||
let(:path) { (tap.path/"Formula/#{name}.rb") }
|
let(:path) { (tap.path/"Formula/#{name}.rb") }
|
||||||
let(:full_name) { "#{tap.user}/#{tap.repo}/#{name}" }
|
let(:full_name) { "#{tap.user}/#{tap.repository}/#{name}" }
|
||||||
let(:full_alias_name) { "#{tap.user}/#{tap.repo}/#{alias_name}" }
|
let(:full_alias_name) { "#{tap.user}/#{tap.repository}/#{alias_name}" }
|
||||||
|
|
||||||
specify "formula instantiation" do
|
specify "formula instantiation" do
|
||||||
expect(f.name).to eq(name)
|
expect(f.name).to eq(name)
|
||||||
@ -228,7 +228,7 @@ RSpec.describe Formula do
|
|||||||
|
|
||||||
alias_name = "bar"
|
alias_name = "bar"
|
||||||
alias_path = tap.alias_dir/alias_name
|
alias_path = tap.alias_dir/alias_name
|
||||||
full_alias_name = "#{tap.user}/#{tap.repo}/#{alias_name}"
|
full_alias_name = "#{tap.user}/#{tap.repository}/#{alias_name}"
|
||||||
tap.alias_dir.mkpath
|
tap.alias_dir.mkpath
|
||||||
FileUtils.ln_sf f.path, alias_path
|
FileUtils.ln_sf f.path, alias_path
|
||||||
|
|
||||||
@ -1545,7 +1545,7 @@ RSpec.describe Formula do
|
|||||||
described_class.clear_cache
|
described_class.clear_cache
|
||||||
expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
|
expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
|
||||||
|
|
||||||
head_prefix_a.rmtree
|
FileUtils.rm_r(head_prefix_a)
|
||||||
described_class.clear_cache
|
described_class.clear_cache
|
||||||
expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
|
expect(f.outdated_kegs(fetch_head: true)).not_to be_empty
|
||||||
|
|
||||||
@ -1553,7 +1553,7 @@ RSpec.describe Formula do
|
|||||||
described_class.clear_cache
|
described_class.clear_cache
|
||||||
expect(f.outdated_kegs(fetch_head: true)).to be_empty
|
expect(f.outdated_kegs(fetch_head: true)).to be_empty
|
||||||
ensure
|
ensure
|
||||||
testball_repo.rmtree if testball_repo.exist?
|
FileUtils.rm_r(testball_repo) if testball_repo.exist?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1632,7 +1632,7 @@ RSpec.describe Formula do
|
|||||||
expect(f.outdated_kegs).not_to be_empty
|
expect(f.outdated_kegs).not_to be_empty
|
||||||
|
|
||||||
described_class.clear_cache
|
described_class.clear_cache
|
||||||
head_prefix.rmtree
|
FileUtils.rm_r(head_prefix)
|
||||||
|
|
||||||
setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 })
|
setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 })
|
||||||
expect(f.outdated_kegs).to be_empty
|
expect(f.outdated_kegs).to be_empty
|
||||||
|
@ -47,7 +47,7 @@ RSpec.describe Keg do
|
|||||||
expect(keg).to be_a_directory
|
expect(keg).to be_a_directory
|
||||||
expect(keg).not_to be_an_empty_installation
|
expect(keg).not_to be_an_empty_installation
|
||||||
|
|
||||||
(keg/"bin").rmtree
|
FileUtils.rm_r(keg/"bin")
|
||||||
expect(keg).to be_an_empty_installation
|
expect(keg).to be_an_empty_installation
|
||||||
|
|
||||||
(keg/"bin").mkpath
|
(keg/"bin").mkpath
|
||||||
|
@ -87,7 +87,7 @@ RSpec.describe Migrator do
|
|||||||
end
|
end
|
||||||
|
|
||||||
specify "#backup_oldname_cellar" do
|
specify "#backup_oldname_cellar" do
|
||||||
old_keg_record.parent.rmtree
|
FileUtils.rm_r(old_keg_record.parent)
|
||||||
(new_keg_record/"bin").mkpath
|
(new_keg_record/"bin").mkpath
|
||||||
|
|
||||||
migrator.backup_oldname_cellar
|
migrator.backup_oldname_cellar
|
||||||
|
@ -163,7 +163,7 @@ RSpec.describe Tap do
|
|||||||
|
|
||||||
specify "attributes" do
|
specify "attributes" do
|
||||||
expect(homebrew_foo_tap.user).to eq("Homebrew")
|
expect(homebrew_foo_tap.user).to eq("Homebrew")
|
||||||
expect(homebrew_foo_tap.repo).to eq("foo")
|
expect(homebrew_foo_tap.repository).to eq("foo")
|
||||||
expect(homebrew_foo_tap.name).to eq("homebrew/foo")
|
expect(homebrew_foo_tap.name).to eq("homebrew/foo")
|
||||||
expect(homebrew_foo_tap.path).to eq(path)
|
expect(homebrew_foo_tap.path).to eq(path)
|
||||||
expect(homebrew_foo_tap).to be_installed
|
expect(homebrew_foo_tap).to be_installed
|
||||||
@ -186,7 +186,7 @@ RSpec.describe Tap do
|
|||||||
(HOMEBREW_TAP_DIRECTORY/"someone/homebrew-no-git").mkpath
|
(HOMEBREW_TAP_DIRECTORY/"someone/homebrew-no-git").mkpath
|
||||||
expect(described_class.fetch("someone", "no-git").issues_url).to be_nil
|
expect(described_class.fetch("someone", "no-git").issues_url).to be_nil
|
||||||
ensure
|
ensure
|
||||||
path.parent.rmtree
|
FileUtils.rm_rf(path.parent)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "files" do
|
specify "files" do
|
||||||
@ -238,7 +238,7 @@ RSpec.describe Tap do
|
|||||||
it "returns the remote https repository" do
|
it "returns the remote https repository" do
|
||||||
setup_git_repo
|
setup_git_repo
|
||||||
|
|
||||||
expect(homebrew_foo_tap.remote_repo).to eq("Homebrew/homebrew-foo")
|
expect(homebrew_foo_tap.remote_repository).to eq("Homebrew/homebrew-foo")
|
||||||
|
|
||||||
services_tap = described_class.fetch("Homebrew", "services")
|
services_tap = described_class.fetch("Homebrew", "services")
|
||||||
services_tap.path.mkpath
|
services_tap.path.mkpath
|
||||||
@ -246,13 +246,13 @@ RSpec.describe Tap do
|
|||||||
system "git", "init"
|
system "git", "init"
|
||||||
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-bar"
|
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-bar"
|
||||||
end
|
end
|
||||||
expect(services_tap.remote_repo).to eq("Homebrew/homebrew-bar")
|
expect(services_tap.remote_repository).to eq("Homebrew/homebrew-bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the remote ssh repository" do
|
it "returns the remote ssh repository" do
|
||||||
setup_git_repo
|
setup_git_repo
|
||||||
|
|
||||||
expect(homebrew_foo_tap.remote_repo).to eq("Homebrew/homebrew-foo")
|
expect(homebrew_foo_tap.remote_repository).to eq("Homebrew/homebrew-foo")
|
||||||
|
|
||||||
services_tap = described_class.fetch("Homebrew", "services")
|
services_tap = described_class.fetch("Homebrew", "services")
|
||||||
services_tap.path.mkpath
|
services_tap.path.mkpath
|
||||||
@ -260,17 +260,17 @@ RSpec.describe Tap do
|
|||||||
system "git", "init"
|
system "git", "init"
|
||||||
system "git", "remote", "add", "origin", "git@github.com:Homebrew/homebrew-bar"
|
system "git", "remote", "add", "origin", "git@github.com:Homebrew/homebrew-bar"
|
||||||
end
|
end
|
||||||
expect(services_tap.remote_repo).to eq("Homebrew/homebrew-bar")
|
expect(services_tap.remote_repository).to eq("Homebrew/homebrew-bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns nil if the Tap is not a Git repository" do
|
it "returns nil if the Tap is not a Git repository" do
|
||||||
expect(homebrew_foo_tap.remote_repo).to be_nil
|
expect(homebrew_foo_tap.remote_repository).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns nil if Git is not available" do
|
it "returns nil if Git is not available" do
|
||||||
setup_git_repo
|
setup_git_repo
|
||||||
allow(Utils::Git).to receive(:available?).and_return(false)
|
allow(Utils::Git).to receive(:available?).and_return(false)
|
||||||
expect(homebrew_foo_tap.remote_repo).to be_nil
|
expect(homebrew_foo_tap.remote_repository).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -412,8 +412,8 @@ RSpec.describe Tap do
|
|||||||
expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").not_to exist
|
expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").not_to exist
|
||||||
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").not_to exist
|
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").not_to exist
|
||||||
ensure
|
ensure
|
||||||
(HOMEBREW_PREFIX/"etc").rmtree if (HOMEBREW_PREFIX/"etc").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"etc") if (HOMEBREW_PREFIX/"etc").exist?
|
||||||
(HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"share") if (HOMEBREW_PREFIX/"share").exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#link_completions_and_manpages when completions are enabled for non-official tap" do
|
specify "#link_completions_and_manpages when completions are enabled for non-official tap" do
|
||||||
@ -433,8 +433,8 @@ RSpec.describe Tap do
|
|||||||
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file
|
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file
|
||||||
tap.uninstall
|
tap.uninstall
|
||||||
ensure
|
ensure
|
||||||
(HOMEBREW_PREFIX/"etc").rmtree if (HOMEBREW_PREFIX/"etc").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"etc") if (HOMEBREW_PREFIX/"etc").exist?
|
||||||
(HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"share") if (HOMEBREW_PREFIX/"share").exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#link_completions_and_manpages when completions are disabled for non-official tap" do
|
specify "#link_completions_and_manpages when completions are disabled for non-official tap" do
|
||||||
@ -451,8 +451,8 @@ RSpec.describe Tap do
|
|||||||
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").not_to be_a_file
|
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").not_to be_a_file
|
||||||
tap.uninstall
|
tap.uninstall
|
||||||
ensure
|
ensure
|
||||||
(HOMEBREW_PREFIX/"etc").rmtree if (HOMEBREW_PREFIX/"etc").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"etc") if (HOMEBREW_PREFIX/"etc").exist?
|
||||||
(HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"share") if (HOMEBREW_PREFIX/"share").exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#link_completions_and_manpages when completions are enabled for official tap" do
|
specify "#link_completions_and_manpages when completions are enabled for official tap" do
|
||||||
@ -472,8 +472,8 @@ RSpec.describe Tap do
|
|||||||
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file
|
expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file
|
||||||
tap.uninstall
|
tap.uninstall
|
||||||
ensure
|
ensure
|
||||||
(HOMEBREW_PREFIX/"etc").rmtree if (HOMEBREW_PREFIX/"etc").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"etc") if (HOMEBREW_PREFIX/"etc").exist?
|
||||||
(HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
|
FileUtils.rm_r(HOMEBREW_PREFIX/"share") if (HOMEBREW_PREFIX/"share").exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#config" do
|
specify "#config" do
|
||||||
@ -736,7 +736,7 @@ RSpec.describe Tap do
|
|||||||
|
|
||||||
specify "attributes" do
|
specify "attributes" do
|
||||||
expect(core_tap.user).to eq("Homebrew")
|
expect(core_tap.user).to eq("Homebrew")
|
||||||
expect(core_tap.repo).to eq("core")
|
expect(core_tap.repository).to eq("core")
|
||||||
expect(core_tap.name).to eq("homebrew/core")
|
expect(core_tap.name).to eq("homebrew/core")
|
||||||
expect(core_tap.command_files).to eq([])
|
expect(core_tap.command_files).to eq([])
|
||||||
expect(core_tap).to be_installed
|
expect(core_tap).to be_installed
|
||||||
@ -790,14 +790,16 @@ RSpec.describe Tap do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#repo_var_suffix" do
|
describe "#repository_var_suffix" do
|
||||||
it "converts the repo directory to an environment variable suffix" do
|
it "converts the repo directory to an environment variable suffix" do
|
||||||
expect(CoreTap.instance.repo_var_suffix).to eq "_HOMEBREW_HOMEBREW_CORE"
|
expect(CoreTap.instance.repository_var_suffix).to eq "_HOMEBREW_HOMEBREW_CORE"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "converts non-alphanumeric characters to underscores" do
|
it "converts non-alphanumeric characters to underscores" do
|
||||||
expect(described_class.fetch("my", "tap-with-dashes").repo_var_suffix).to eq "_MY_HOMEBREW_TAP_WITH_DASHES"
|
expect(described_class.fetch("my",
|
||||||
expect(described_class.fetch("my", "tap-with-@-symbol").repo_var_suffix).to eq "_MY_HOMEBREW_TAP_WITH___SYMBOL"
|
"tap-with-dashes").repository_var_suffix).to eq "_MY_HOMEBREW_TAP_WITH_DASHES"
|
||||||
|
expect(described_class.fetch("my",
|
||||||
|
"tap-with-@-symbol").repository_var_suffix).to eq "_MY_HOMEBREW_TAP_WITH___SYMBOL"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ module UnpackStrategy
|
|||||||
super
|
super
|
||||||
|
|
||||||
# The export command doesn't work on checkouts (see https://bugs.launchpad.net/bzr/+bug/897511).
|
# The export command doesn't work on checkouts (see https://bugs.launchpad.net/bzr/+bug/897511).
|
||||||
(unpack_dir/".bzr").rmtree
|
FileUtils.rm_r(unpack_dir/".bzr")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -68,7 +68,7 @@ module Utils
|
|||||||
|
|
||||||
yield s
|
yield s
|
||||||
else
|
else
|
||||||
s.gsub!(T.must(before), T.must(after), audit_result)
|
s.gsub!(T.must(before), T.must(after), audit_result:)
|
||||||
end
|
end
|
||||||
|
|
||||||
errors[path] = s.errors unless s.errors.empty?
|
errors[path] = s.errors unless s.errors.empty?
|
||||||
|
@ -39,8 +39,8 @@ class StringInreplaceExtension
|
|||||||
def gsub!(before, after, old_audit_result = nil, audit_result: true)
|
def gsub!(before, after, old_audit_result = nil, audit_result: true)
|
||||||
# NOTE: must check for `#nil?` and not `#blank?`, or else `old_audit_result = false` will not call `odeprecated`.
|
# NOTE: must check for `#nil?` and not `#blank?`, or else `old_audit_result = false` will not call `odeprecated`.
|
||||||
unless old_audit_result.nil?
|
unless old_audit_result.nil?
|
||||||
# odeprecated "gsub!(before, after, #{old_audit_result})",
|
odeprecated "gsub!(before, after, #{old_audit_result})",
|
||||||
# "gsub!(before, after, audit_result: #{old_audit_result})"
|
"gsub!(before, after, audit_result: #{old_audit_result})"
|
||||||
audit_result = old_audit_result
|
audit_result = old_audit_result
|
||||||
end
|
end
|
||||||
before = before.to_s if before.is_a?(Pathname)
|
before = before.to_s if before.is_a?(Pathname)
|
||||||
@ -55,7 +55,9 @@ class StringInreplaceExtension
|
|||||||
# @api public
|
# @api public
|
||||||
sig { params(flag: String, new_value: T.any(String, Pathname)).void }
|
sig { params(flag: String, new_value: T.any(String, Pathname)).void }
|
||||||
def change_make_var!(flag, new_value)
|
def change_make_var!(flag, new_value)
|
||||||
return if gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=[ \t]*((?:.*\\\n)*.*)$/, "#{flag}=#{new_value}", false)
|
return if gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=[ \t]*((?:.*\\\n)*.*)$/,
|
||||||
|
"#{flag}=#{new_value}",
|
||||||
|
audit_result: false)
|
||||||
|
|
||||||
errors << "expected to change #{flag.inspect} to #{new_value.inspect}"
|
errors << "expected to change #{flag.inspect} to #{new_value.inspect}"
|
||||||
end
|
end
|
||||||
@ -67,9 +69,11 @@ class StringInreplaceExtension
|
|||||||
def remove_make_var!(flags)
|
def remove_make_var!(flags)
|
||||||
Array(flags).each do |flag|
|
Array(flags).each do |flag|
|
||||||
# Also remove trailing \n, if present.
|
# Also remove trailing \n, if present.
|
||||||
unless gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=(?:.*\\\n)*.*$\n?/, "", false)
|
next if gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=(?:.*\\\n)*.*$\n?/,
|
||||||
errors << "expected to remove #{flag.inspect}"
|
"",
|
||||||
end
|
audit_result: false)
|
||||||
|
|
||||||
|
errors << "expected to remove #{flag.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user