Compare commits
No commits in common. "eda9e78529af3c96e40baaee98a3d7a556f9b707" and "1019f9ef216b47a5b53afe86cb4e0a9c7cb3e5e3" have entirely different histories.
eda9e78529
...
1019f9ef21
2
.github/workflows/actionlint.yml
vendored
2
.github/workflows/actionlint.yml
vendored
@ -93,7 +93,7 @@ jobs:
|
|||||||
path: results.sarif
|
path: results.sarif
|
||||||
|
|
||||||
- name: Upload SARIF file
|
- name: Upload SARIF file
|
||||||
uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
|
uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
category: zizmor
|
category: zizmor
|
||||||
|
|||||||
4
.github/workflows/codeql-analysis.yml
vendored
4
.github/workflows/codeql-analysis.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
|
uses: github/codeql-action/init@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
|
||||||
with:
|
with:
|
||||||
languages: ruby
|
languages: ruby
|
||||||
config: |
|
config: |
|
||||||
@ -35,4 +35,4 @@ jobs:
|
|||||||
- Library/Homebrew/vendor
|
- Library/Homebrew/vendor
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
|
uses: github/codeql-action/analyze@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
|
||||||
|
|||||||
@ -57,7 +57,7 @@ GEM
|
|||||||
redcarpet (3.6.1)
|
redcarpet (3.6.1)
|
||||||
regexp_parser (2.11.2)
|
regexp_parser (2.11.2)
|
||||||
require-hooks (0.2.2)
|
require-hooks (0.2.2)
|
||||||
rexml (3.4.4)
|
rexml (3.4.2)
|
||||||
rspec (3.13.1)
|
rspec (3.13.1)
|
||||||
rspec-core (~> 3.13.0)
|
rspec-core (~> 3.13.0)
|
||||||
rspec-expectations (~> 3.13.0)
|
rspec-expectations (~> 3.13.0)
|
||||||
@ -96,10 +96,10 @@ GEM
|
|||||||
rubocop-md (2.0.2)
|
rubocop-md (2.0.2)
|
||||||
lint_roller (~> 1.1)
|
lint_roller (~> 1.1)
|
||||||
rubocop (>= 1.72.1)
|
rubocop (>= 1.72.1)
|
||||||
rubocop-performance (1.26.0)
|
rubocop-performance (1.25.0)
|
||||||
lint_roller (~> 1.1)
|
lint_roller (~> 1.1)
|
||||||
rubocop (>= 1.75.0, < 2.0)
|
rubocop (>= 1.75.0, < 2.0)
|
||||||
rubocop-ast (>= 1.44.0, < 2.0)
|
rubocop-ast (>= 1.38.0, < 2.0)
|
||||||
rubocop-rspec (3.7.0)
|
rubocop-rspec (3.7.0)
|
||||||
lint_roller (~> 1.1)
|
lint_roller (~> 1.1)
|
||||||
rubocop (~> 1.72, >= 1.72.1)
|
rubocop (~> 1.72, >= 1.72.1)
|
||||||
@ -124,15 +124,15 @@ GEM
|
|||||||
simplecov-html (0.13.2)
|
simplecov-html (0.13.2)
|
||||||
simplecov_json_formatter (0.1.4)
|
simplecov_json_formatter (0.1.4)
|
||||||
simpleidn (0.2.3)
|
simpleidn (0.2.3)
|
||||||
sorbet (0.6.12521)
|
sorbet (0.6.12479)
|
||||||
sorbet-static (= 0.6.12521)
|
sorbet-static (= 0.6.12479)
|
||||||
sorbet-runtime (0.6.12521)
|
sorbet-runtime (0.6.12479)
|
||||||
sorbet-static (0.6.12521-aarch64-linux)
|
sorbet-static (0.6.12479-aarch64-linux)
|
||||||
sorbet-static (0.6.12521-universal-darwin)
|
sorbet-static (0.6.12479-universal-darwin)
|
||||||
sorbet-static (0.6.12521-x86_64-linux)
|
sorbet-static (0.6.12479-x86_64-linux)
|
||||||
sorbet-static-and-runtime (0.6.12521)
|
sorbet-static-and-runtime (0.6.12479)
|
||||||
sorbet (= 0.6.12521)
|
sorbet (= 0.6.12479)
|
||||||
sorbet-runtime (= 0.6.12521)
|
sorbet-runtime (= 0.6.12479)
|
||||||
spoom (1.7.6)
|
spoom (1.7.6)
|
||||||
erubi (>= 1.10.0)
|
erubi (>= 1.10.0)
|
||||||
prism (>= 0.28.0)
|
prism (>= 0.28.0)
|
||||||
@ -154,9 +154,9 @@ GEM
|
|||||||
thor (>= 1.2.0)
|
thor (>= 1.2.0)
|
||||||
yard-sorbet
|
yard-sorbet
|
||||||
thor (1.4.0)
|
thor (1.4.0)
|
||||||
unicode-display_width (3.2.0)
|
unicode-display_width (3.1.5)
|
||||||
unicode-emoji (~> 4.1)
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||||
unicode-emoji (4.1.0)
|
unicode-emoji (4.0.4)
|
||||||
vernier (1.8.0)
|
vernier (1.8.0)
|
||||||
warning (1.5.0)
|
warning (1.5.0)
|
||||||
yard (0.9.37)
|
yard (0.9.37)
|
||||||
|
|||||||
@ -79,9 +79,8 @@ module Cask
|
|||||||
# Try to make the asset searchable under the target name. Spotlight
|
# Try to make the asset searchable under the target name. Spotlight
|
||||||
# respects this attribute for many filetypes, but ignores it for App
|
# respects this attribute for many filetypes, but ignores it for App
|
||||||
# bundles. Alfred 2.2 respects it even for App bundles.
|
# bundles. Alfred 2.2 respects it even for App bundles.
|
||||||
sig { params(file: Pathname, altname: Pathname, command: T.class_of(SystemCommand)).returns(T.nilable(SystemCommand::Result)) }
|
def add_altname_metadata(file, altname, command: nil)
|
||||||
def add_altname_metadata(file, altname, command:)
|
return if altname.to_s.casecmp(file.basename.to_s).zero?
|
||||||
return if altname.to_s.casecmp(file.basename.to_s)&.zero?
|
|
||||||
|
|
||||||
odebug "Adding #{ALT_NAME_ATTRIBUTE} metadata"
|
odebug "Adding #{ALT_NAME_ATTRIBUTE} metadata"
|
||||||
altnames = command.run("/usr/bin/xattr",
|
altnames = command.run("/usr/bin/xattr",
|
||||||
@ -109,5 +108,3 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require "extend/os/cask/artifact/relocated"
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ require "cask/cask"
|
|||||||
require "uri"
|
require "uri"
|
||||||
require "utils/curl"
|
require "utils/curl"
|
||||||
require "utils/output"
|
require "utils/output"
|
||||||
require "utils/path"
|
|
||||||
require "extend/hash/keys"
|
require "extend/hash/keys"
|
||||||
require "api"
|
require "api"
|
||||||
|
|
||||||
@ -113,7 +112,9 @@ module Cask
|
|||||||
|
|
||||||
return unless path.expand_path.exist?
|
return unless path.expand_path.exist?
|
||||||
return if invalid_path?(path)
|
return if invalid_path?(path)
|
||||||
return unless ::Utils::Path.loadable_package_path?(path, :cask)
|
|
||||||
|
return if Homebrew::EnvConfig.forbid_packages_from_paths? &&
|
||||||
|
!path.realpath.to_s.start_with?("#{Caskroom.path}/", "#{HOMEBREW_LIBRARY}/Taps/")
|
||||||
|
|
||||||
new(path)
|
new(path)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -733,7 +733,7 @@ module Homebrew
|
|||||||
formulae_names = removable_formulae.map(&:full_name).sort
|
formulae_names = removable_formulae.map(&:full_name).sort
|
||||||
|
|
||||||
verb = dry_run ? "Would autoremove" : "Autoremoving"
|
verb = dry_run ? "Would autoremove" : "Autoremoving"
|
||||||
oh1 "#{verb} #{formulae_names.count} unneeded #{Utils.pluralize("formula", formulae_names.count)}:"
|
oh1 "#{verb} #{formulae_names.count} unneeded #{Utils.pluralize("formula", formulae_names.count, plural: "e")}:"
|
||||||
puts formulae_names.join("\n")
|
puts formulae_names.join("\n")
|
||||||
return if dry_run
|
return if dry_run
|
||||||
|
|
||||||
|
|||||||
@ -233,8 +233,8 @@ module Homebrew
|
|||||||
.map(&:name)
|
.map(&:name)
|
||||||
next if dep_names.blank?
|
next if dep_names.blank?
|
||||||
|
|
||||||
ohai "Would install #{::Utils.pluralize("dependency", dep_names.count, include_count: true)} " \
|
ohai "Would install #{::Utils.pluralize("dependenc", dep_names.count, plural: "ies", singular: "y",
|
||||||
"for #{cask.full_name}:"
|
include_count: true)} for #{cask.full_name}:"
|
||||||
puts dep_names.join(" ")
|
puts dep_names.join(" ")
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
|
|||||||
@ -57,7 +57,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
info = Utils.pluralize("tap", tap_count, include_count: true)
|
info = Utils.pluralize("tap", tap_count, include_count: true)
|
||||||
info += ", #{private_count} private"
|
info += ", #{private_count} private"
|
||||||
info += ", #{Utils.pluralize("formula", formula_count, include_count: true)}"
|
info += ", #{Utils.pluralize("formula", formula_count, plural: "e", include_count: true)}"
|
||||||
info += ", #{Utils.pluralize("command", command_count, include_count: true)}"
|
info += ", #{Utils.pluralize("command", command_count, include_count: true)}"
|
||||||
info += ", #{HOMEBREW_TAP_DIRECTORY.dup.abv}" if HOMEBREW_TAP_DIRECTORY.directory?
|
info += ", #{HOMEBREW_TAP_DIRECTORY.dup.abv}" if HOMEBREW_TAP_DIRECTORY.directory?
|
||||||
puts info
|
puts info
|
||||||
|
|||||||
@ -842,7 +842,7 @@ class ReporterHub
|
|||||||
msg = ""
|
msg = ""
|
||||||
|
|
||||||
if outdated_formulae.positive?
|
if outdated_formulae.positive?
|
||||||
noun = Utils.pluralize("formula", outdated_formulae)
|
noun = Utils.pluralize("formula", outdated_formulae, plural: "e")
|
||||||
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{noun}"
|
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{noun}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -294,7 +294,9 @@ module Homebrew
|
|||||||
errors_summary = Utils.pluralize("problem", total_problems_count, include_count: true)
|
errors_summary = Utils.pluralize("problem", total_problems_count, include_count: true)
|
||||||
|
|
||||||
error_sources = []
|
error_sources = []
|
||||||
error_sources << Utils.pluralize("formula", formula_count, include_count: true) if formula_count.positive?
|
if formula_count.positive?
|
||||||
|
error_sources << Utils.pluralize("formula", formula_count, plural: "e", include_count: true)
|
||||||
|
end
|
||||||
error_sources << Utils.pluralize("cask", cask_count, include_count: true) if cask_count.positive?
|
error_sources << Utils.pluralize("cask", cask_count, include_count: true) if cask_count.positive?
|
||||||
error_sources << Utils.pluralize("tap", tap_count, include_count: true) if tap_count.positive?
|
error_sources << Utils.pluralize("tap", tap_count, include_count: true) if tap_count.positive?
|
||||||
|
|
||||||
|
|||||||
@ -579,7 +579,7 @@ class UnbottledError < RuntimeError
|
|||||||
require "utils"
|
require "utils"
|
||||||
|
|
||||||
msg = <<~EOS
|
msg = <<~EOS
|
||||||
The following #{Utils.pluralize("formula", formulae.count)} cannot be installed from #{Utils.pluralize("bottle", formulae.count)} and must be
|
The following #{Utils.pluralize("formula", formulae.count, plural: "e")} cannot be installed from #{Utils.pluralize("bottle", formulae.count)} and must be
|
||||||
built from source.
|
built from source.
|
||||||
#{formulae.to_sentence}
|
#{formulae.to_sentence}
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
# typed: strict
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require "extend/os/linux/cask/artifact/relocated" if OS.linux?
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# typed: strict
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module OS
|
|
||||||
module Linux
|
|
||||||
module Cask
|
|
||||||
module Artifact
|
|
||||||
module Relocated
|
|
||||||
extend T::Helpers
|
|
||||||
|
|
||||||
requires_ancestor { ::Cask::Artifact::Relocated }
|
|
||||||
|
|
||||||
sig { params(file: Pathname, altname: Pathname, command: T.class_of(SystemCommand)).returns(T.nilable(SystemCommand::Result)) }
|
|
||||||
def add_altname_metadata(file, altname, command:)
|
|
||||||
# no-op on Linux: /usr/bin/xattr for setting extended attributes is not available there.
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Cask::Artifact::Relocated.prepend(OS::Linux::Cask::Artifact::Relocated)
|
|
||||||
@ -1,13 +1,26 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "os/linux/ld"
|
|
||||||
require "utils/output"
|
require "utils/output"
|
||||||
|
|
||||||
module OS
|
module OS
|
||||||
module Linux
|
module Linux
|
||||||
module Install
|
module Install
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
# This is a list of known paths to the host dynamic linker on Linux if
|
||||||
|
# the host glibc is new enough. The symlink_ld_so method will fail if
|
||||||
|
# the host linker cannot be found in this list.
|
||||||
|
DYNAMIC_LINKERS = %w[
|
||||||
|
/lib64/ld-linux-x86-64.so.2
|
||||||
|
/lib64/ld64.so.2
|
||||||
|
/lib/ld-linux.so.3
|
||||||
|
/lib/ld-linux.so.2
|
||||||
|
/lib/ld-linux-aarch64.so.1
|
||||||
|
/lib/ld-linux-armhf.so.3
|
||||||
|
/system/bin/linker64
|
||||||
|
/system/bin/linker
|
||||||
|
].freeze
|
||||||
|
|
||||||
# We link GCC runtime libraries that are not specifically used for Fortran,
|
# We link GCC runtime libraries that are not specifically used for Fortran,
|
||||||
# which are linked by the GCC formula. We only use the versioned shared libraries
|
# which are linked by the GCC formula. We only use the versioned shared libraries
|
||||||
# as the other shared and static libraries are only used at build time where
|
# as the other shared and static libraries are only used at build time where
|
||||||
@ -54,7 +67,7 @@ module OS
|
|||||||
|
|
||||||
ld_so = HOMEBREW_PREFIX/"opt/glibc/bin/ld.so"
|
ld_so = HOMEBREW_PREFIX/"opt/glibc/bin/ld.so"
|
||||||
unless ld_so.readable?
|
unless ld_so.readable?
|
||||||
ld_so = OS::Linux::Ld.system_ld_so
|
ld_so = DYNAMIC_LINKERS.find { |s| File.executable? s }
|
||||||
if ld_so.blank?
|
if ld_so.blank?
|
||||||
::Kernel.raise "Unable to locate the system's dynamic linker" unless brew_ld_so.readable?
|
::Kernel.raise "Unable to locate the system's dynamic linker" unless brew_ld_so.readable?
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ require "tab"
|
|||||||
require "utils"
|
require "utils"
|
||||||
require "utils/bottles"
|
require "utils/bottles"
|
||||||
require "utils/output"
|
require "utils/output"
|
||||||
require "utils/path"
|
|
||||||
require "service"
|
require "service"
|
||||||
require "utils/curl"
|
require "utils/curl"
|
||||||
require "deprecate_disable"
|
require "deprecate_disable"
|
||||||
@ -728,7 +727,29 @@ module Formulary
|
|||||||
end
|
end
|
||||||
|
|
||||||
return unless path.expand_path.exist?
|
return unless path.expand_path.exist?
|
||||||
return unless ::Utils::Path.loadable_package_path?(path, :formula)
|
|
||||||
|
if Homebrew::EnvConfig.forbid_packages_from_paths?
|
||||||
|
path_realpath = path.realpath.to_s
|
||||||
|
path_string = path.to_s
|
||||||
|
if (path_realpath.end_with?(".rb") || path_string.end_with?(".rb")) &&
|
||||||
|
!path_realpath.start_with?("#{HOMEBREW_CELLAR}/", "#{HOMEBREW_LIBRARY}/Taps/") &&
|
||||||
|
!path_string.start_with?("#{HOMEBREW_CELLAR}/", "#{HOMEBREW_LIBRARY}/Taps/")
|
||||||
|
if path_string.include?("./") || path_string.end_with?(".rb") || path_string.count("/") != 2
|
||||||
|
raise <<~WARNING
|
||||||
|
Homebrew requires formulae to be in a tap, rejecting:
|
||||||
|
#{path_string} (#{path_realpath})
|
||||||
|
|
||||||
|
To create a tap, run e.g.
|
||||||
|
brew tap-new <user|org>/<repository>
|
||||||
|
To create a formula in a tap run e.g.
|
||||||
|
brew create <url> --tap=<user|org>/<repository>
|
||||||
|
WARNING
|
||||||
|
elsif path_string.count("/") == 2
|
||||||
|
# Looks like a tap, let's quietly return but not error.
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if (tap = Tap.from_path(path))
|
if (tap = Tap.from_path(path))
|
||||||
# Only treat symlinks in taps as aliases.
|
# Only treat symlinks in taps as aliases.
|
||||||
|
|||||||
@ -405,7 +405,8 @@ module Homebrew
|
|||||||
return if formulae_names_to_install.empty?
|
return if formulae_names_to_install.empty?
|
||||||
|
|
||||||
if dry_run
|
if dry_run
|
||||||
ohai "Would install #{Utils.pluralize("formula", formulae_names_to_install.count, include_count: true)}:"
|
ohai "Would install #{Utils.pluralize("formula", formulae_names_to_install.count,
|
||||||
|
plural: "e", include_count: true)}:"
|
||||||
puts formulae_names_to_install.join(" ")
|
puts formulae_names_to_install.join(" ")
|
||||||
|
|
||||||
formula_installers.each do |fi|
|
formula_installers.each do |fi|
|
||||||
@ -428,8 +429,8 @@ module Homebrew
|
|||||||
def print_dry_run_dependencies(formula, dependencies)
|
def print_dry_run_dependencies(formula, dependencies)
|
||||||
return if dependencies.empty?
|
return if dependencies.empty?
|
||||||
|
|
||||||
ohai "Would install #{Utils.pluralize("dependency", dependencies.count, include_count: true)} " \
|
ohai "Would install #{Utils.pluralize("dependenc", dependencies.count, plural: "ies", singular: "y",
|
||||||
"for #{formula.name}:"
|
include_count: true)} for #{formula.name}:"
|
||||||
formula_names = dependencies.map { |(dep, _options)| yield dep.to_formula }
|
formula_names = dependencies.map { |(dep, _options)| yield dep.to_formula }
|
||||||
puts formula_names.join(" ")
|
puts formula_names.join(" ")
|
||||||
end
|
end
|
||||||
@ -445,7 +446,7 @@ module Homebrew
|
|||||||
|
|
||||||
sizes = compute_total_sizes(formulae, debug: args.debug?)
|
sizes = compute_total_sizes(formulae, debug: args.debug?)
|
||||||
|
|
||||||
puts "#{::Utils.pluralize("Formula", formulae.count)} \
|
puts "#{::Utils.pluralize("Formula", formulae.count, plural: "e")} \
|
||||||
(#{formulae.count}): #{formulae.join(", ")}\n\n"
|
(#{formulae.count}): #{formulae.join(", ")}\n\n"
|
||||||
puts "Download Size: #{disk_usage_readable(sizes.fetch(:download))}"
|
puts "Download Size: #{disk_usage_readable(sizes.fetch(:download))}"
|
||||||
puts "Install Size: #{disk_usage_readable(sizes.fetch(:installed))}"
|
puts "Install Size: #{disk_usage_readable(sizes.fetch(:installed))}"
|
||||||
|
|||||||
@ -5,69 +5,37 @@ module OS
|
|||||||
module Linux
|
module Linux
|
||||||
# Helper functions for querying `ld` information.
|
# Helper functions for querying `ld` information.
|
||||||
module Ld
|
module Ld
|
||||||
# This is a list of known paths to the host dynamic linker on Linux if
|
sig { returns(String) }
|
||||||
# the host glibc is new enough. Brew will fail to create a symlink for
|
def self.brewed_ld_so_diagnostics
|
||||||
# ld.so if the host linker cannot be found in this list.
|
@brewed_ld_so_diagnostics ||= T.let({}, T.nilable(T::Hash[Pathname, String]))
|
||||||
DYNAMIC_LINKERS = %w[
|
|
||||||
/lib64/ld-linux-x86-64.so.2
|
|
||||||
/lib64/ld64.so.2
|
|
||||||
/lib/ld-linux.so.3
|
|
||||||
/lib/ld-linux.so.2
|
|
||||||
/lib/ld-linux-aarch64.so.1
|
|
||||||
/lib/ld-linux-armhf.so.3
|
|
||||||
/system/bin/linker64
|
|
||||||
/system/bin/linker
|
|
||||||
].freeze
|
|
||||||
|
|
||||||
# The path to the system's dynamic linker or `nil` if not found
|
brewed_ld_so = HOMEBREW_PREFIX/"lib/ld.so"
|
||||||
sig { returns(T.nilable(Pathname)) }
|
return "" unless brewed_ld_so.exist?
|
||||||
def self.system_ld_so
|
|
||||||
@system_ld_so ||= T.let(nil, T.nilable(Pathname))
|
|
||||||
@system_ld_so ||= begin
|
|
||||||
linker = DYNAMIC_LINKERS.find { |s| File.executable? s }
|
|
||||||
Pathname(linker) if linker
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
sig { params(brewed: T::Boolean).returns(String) }
|
brewed_ld_so_target = brewed_ld_so.readlink
|
||||||
def self.ld_so_diagnostics(brewed: true)
|
@brewed_ld_so_diagnostics[brewed_ld_so_target] ||= begin
|
||||||
@ld_so_diagnostics ||= T.let({}, T.nilable(T::Hash[Pathname, String]))
|
ld_so_output = Utils.popen_read(brewed_ld_so, "--list-diagnostics")
|
||||||
|
|
||||||
ld_so_target = if brewed
|
|
||||||
ld_so = HOMEBREW_PREFIX/"lib/ld.so"
|
|
||||||
return "" unless ld_so.exist?
|
|
||||||
|
|
||||||
ld_so.readlink
|
|
||||||
else
|
|
||||||
ld_so = system_ld_so
|
|
||||||
return "" unless ld_so&.exist?
|
|
||||||
|
|
||||||
ld_so
|
|
||||||
end
|
|
||||||
|
|
||||||
@ld_so_diagnostics[ld_so_target] ||= begin
|
|
||||||
ld_so_output = Utils.popen_read(ld_so, "--list-diagnostics")
|
|
||||||
ld_so_output if $CHILD_STATUS.success?
|
ld_so_output if $CHILD_STATUS.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ld_so_diagnostics[ld_so_target].to_s
|
@brewed_ld_so_diagnostics[brewed_ld_so_target].to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(brewed: T::Boolean).returns(String) }
|
sig { returns(String) }
|
||||||
def self.sysconfdir(brewed: true)
|
def self.sysconfdir
|
||||||
fallback_sysconfdir = "/etc"
|
fallback_sysconfdir = "/etc"
|
||||||
|
|
||||||
match = ld_so_diagnostics(brewed:).match(/path.sysconfdir="(.+)"/)
|
match = brewed_ld_so_diagnostics.match(/path.sysconfdir="(.+)"/)
|
||||||
return fallback_sysconfdir unless match
|
return fallback_sysconfdir unless match
|
||||||
|
|
||||||
match.captures.compact.first || fallback_sysconfdir
|
match.captures.compact.first || fallback_sysconfdir
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(brewed: T::Boolean).returns(T::Array[String]) }
|
sig { returns(T::Array[String]) }
|
||||||
def self.system_dirs(brewed: true)
|
def self.system_dirs
|
||||||
dirs = []
|
dirs = []
|
||||||
|
|
||||||
ld_so_diagnostics(brewed:).split("\n").each do |line|
|
brewed_ld_so_diagnostics.split("\n").each do |line|
|
||||||
match = line.match(/path.system_dirs\[0x.*\]="(.*)"/)
|
match = line.match(/path.system_dirs\[0x.*\]="(.*)"/)
|
||||||
next unless match
|
next unless match
|
||||||
|
|
||||||
@ -77,9 +45,9 @@ module OS
|
|||||||
dirs
|
dirs
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(conf_path: T.any(Pathname, String), brewed: T::Boolean).returns(T::Array[String]) }
|
sig { params(conf_path: T.any(Pathname, String)).returns(T::Array[String]) }
|
||||||
def self.library_paths(conf_path = "ld.so.conf", brewed: true)
|
def self.library_paths(conf_path = Pathname(sysconfdir)/"ld.so.conf")
|
||||||
conf_file = Pathname(sysconfdir(brewed:))/conf_path
|
conf_file = Pathname(conf_path)
|
||||||
return [] unless conf_file.exist?
|
return [] unless conf_file.exist?
|
||||||
return [] unless conf_file.file?
|
return [] unless conf_file.file?
|
||||||
return [] unless conf_file.readable?
|
return [] unless conf_file.readable?
|
||||||
@ -100,7 +68,8 @@ module OS
|
|||||||
line.sub!(/\s*#.*$/, "")
|
line.sub!(/\s*#.*$/, "")
|
||||||
|
|
||||||
if line.start_with?(/\s*include\s+/)
|
if line.start_with?(/\s*include\s+/)
|
||||||
wildcard = Pathname(line.sub(/^\s*include\s+/, "")).expand_path(directory)
|
include_path = Pathname(line.sub(/^\s*include\s+/, "")).expand_path
|
||||||
|
wildcard = include_path.absolute? ? include_path : directory/include_path
|
||||||
|
|
||||||
Dir.glob(wildcard.to_s).each do |include_file|
|
Dir.glob(wildcard.to_s).each do |include_file|
|
||||||
paths += library_paths(include_file)
|
paths += library_paths(include_file)
|
||||||
|
|||||||
@ -93,7 +93,7 @@ module Homebrew
|
|||||||
|
|
||||||
wait = 2 ** @try
|
wait = 2 ** @try
|
||||||
unless quiet
|
unless quiet
|
||||||
what = Utils.pluralize("try", tries_remaining)
|
what = Utils.pluralize("tr", tries_remaining, plural: "ies", singular: "y")
|
||||||
ohai "Retrying download in #{wait}s... (#{tries_remaining} #{what} left)"
|
ohai "Retrying download in #{wait}s... (#{tries_remaining} #{what} left)"
|
||||||
end
|
end
|
||||||
sleep wait
|
sleep wait
|
||||||
|
|||||||
@ -34,7 +34,7 @@ module Homebrew
|
|||||||
unofficial = Tap.all.sum { |tap| tap.official? ? 0 : tap.formula_files.size }
|
unofficial = Tap.all.sum { |tap| tap.official? ? 0 : tap.formula_files.size }
|
||||||
if unofficial.positive?
|
if unofficial.positive?
|
||||||
opoo "Use `--eval-all` to search #{unofficial} additional " \
|
opoo "Use `--eval-all` to search #{unofficial} additional " \
|
||||||
"#{Utils.pluralize("formula", unofficial)} in third party taps."
|
"#{Utils.pluralize("formula", unofficial, plural: "e")} in third party taps."
|
||||||
end
|
end
|
||||||
descriptions = Homebrew::API::Formula.all_formulae.transform_values { |data| data["desc"] }
|
descriptions = Homebrew::API::Formula.all_formulae.transform_values { |data| data["desc"] }
|
||||||
Descriptions.search(string_or_regex, search_type, descriptions, eval_all, cache_store_hash: true).print
|
Descriptions.search(string_or_regex, search_type, descriptions, eval_all, cache_store_hash: true).print
|
||||||
|
|||||||
@ -738,7 +738,7 @@ class Tap
|
|||||||
end
|
end
|
||||||
|
|
||||||
if (formula_count = formula_files.count).positive?
|
if (formula_count = formula_files.count).positive?
|
||||||
contents << Utils.pluralize("formula", formula_count, include_count: true)
|
contents << Utils.pluralize("formula", formula_count, plural: "e", include_count: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
contents
|
contents
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require "cask/artifact/relocated"
|
|
||||||
|
|
||||||
RSpec.describe Cask::Artifact::Relocated, :cask do
|
|
||||||
let(:cask) do
|
|
||||||
Cask::Cask.new("test-cask") do
|
|
||||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
|
|
||||||
homepage "https://brew.sh/"
|
|
||||||
version "1.0"
|
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:command) { NeverSudoSystemCommand }
|
|
||||||
let(:artifact) { described_class.new(cask, "test_file.txt") }
|
|
||||||
|
|
||||||
describe "#add_altname_metadata" do
|
|
||||||
let(:file) { Pathname("/tmp/test_file.txt") }
|
|
||||||
let(:altname) { Pathname("alternate_name.txt") }
|
|
||||||
|
|
||||||
before do
|
|
||||||
allow(file).to receive_messages(basename: Pathname("test_file.txt"), writable?: true, realpath: file)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when running on Linux", :needs_linux do
|
|
||||||
it "is a no-op and does not call xattr commands" do
|
|
||||||
expect(command).not_to receive(:run)
|
|
||||||
expect(command).not_to receive(:run!)
|
|
||||||
|
|
||||||
artifact.send(:add_altname_metadata, file, altname, command: command)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when running on macOS", :needs_macos do
|
|
||||||
before do
|
|
||||||
stdout_double = instance_double(SystemCommand::Result, stdout: "")
|
|
||||||
allow(command).to receive(:run).and_return(stdout_double)
|
|
||||||
allow(command).to receive(:run!)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "calls xattr commands to set metadata" do
|
|
||||||
expect(command).to receive(:run).with("/usr/bin/xattr",
|
|
||||||
args: ["-p", "com.apple.metadata:kMDItemAlternateNames", file],
|
|
||||||
print_stderr: false)
|
|
||||||
expect(command).to receive(:run!).twice
|
|
||||||
|
|
||||||
artifact.send(:add_altname_metadata, file, altname, command: command)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -236,73 +236,4 @@ RSpec.describe Cask::CaskLoader, :cask do
|
|||||||
expect(described_class.load_prefer_installed("test-cask").tap).to eq(foo_tap)
|
expect(described_class.load_prefer_installed("test-cask").tap).to eq(foo_tap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "FromPathLoader with symlinked taps" do
|
|
||||||
let(:cask_token) { "testcask" }
|
|
||||||
let(:tmpdir) { mktmpdir }
|
|
||||||
let(:real_tap_path) { tmpdir / "real_tap" }
|
|
||||||
let(:homebrew_prefix) { tmpdir / "homebrew" }
|
|
||||||
let(:taps_dir) { homebrew_prefix / "Library" / "Taps" / "testuser" }
|
|
||||||
let(:symlinked_tap_path) { taps_dir / "homebrew-testtap" }
|
|
||||||
let(:cask_file_path) { symlinked_tap_path / "Casks" / "#{cask_token}.rb" }
|
|
||||||
let(:cask_content) do
|
|
||||||
<<~RUBY
|
|
||||||
cask "#{cask_token}" do
|
|
||||||
version "1.0.0"
|
|
||||||
sha256 "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
|
|
||||||
|
|
||||||
url "https://example.com/#{cask_token}-\#{version}.dmg"
|
|
||||||
name "Test Cask"
|
|
||||||
desc "A test cask for symlink testing"
|
|
||||||
homepage "https://example.com"
|
|
||||||
|
|
||||||
app "TestCask.app"
|
|
||||||
end
|
|
||||||
RUBY
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
tmpdir.rmtree if tmpdir.exist?
|
|
||||||
end
|
|
||||||
|
|
||||||
before do
|
|
||||||
# Create real tap directory structure
|
|
||||||
(real_tap_path / "Casks").mkpath
|
|
||||||
(real_tap_path / "Casks" / "#{cask_token}.rb").write(cask_content)
|
|
||||||
|
|
||||||
# Create homebrew prefix structure
|
|
||||||
taps_dir.mkpath
|
|
||||||
|
|
||||||
# Create symlink to the tap (this simulates what setup-homebrew does)
|
|
||||||
symlinked_tap_path.make_symlink(real_tap_path)
|
|
||||||
|
|
||||||
# Set HOMEBREW_LIBRARY to our test prefix for the security check
|
|
||||||
stub_const("HOMEBREW_LIBRARY", homebrew_prefix / "Library")
|
|
||||||
allow(Homebrew::EnvConfig).to receive(:forbid_packages_from_paths?).and_return(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when HOMEBREW_FORBID_PACKAGES_FROM_PATHS is enabled" do
|
|
||||||
it "allows loading casks from symlinked taps" do
|
|
||||||
loader = Cask::CaskLoader::FromPathLoader.try_new(cask_file_path)
|
|
||||||
expect(loader).not_to be_nil
|
|
||||||
expect(loader).to be_a(Cask::CaskLoader::FromPathLoader)
|
|
||||||
|
|
||||||
cask = loader.load(config: nil)
|
|
||||||
expect(cask.token).to eq(cask_token)
|
|
||||||
expect(cask.version).to eq(Version.new("1.0.0"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when HOMEBREW_FORBID_PACKAGES_FROM_PATHS is disabled" do
|
|
||||||
before do
|
|
||||||
allow(Homebrew::EnvConfig).to receive(:forbid_packages_from_paths?).and_return(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "allows loading casks from symlinked taps" do
|
|
||||||
loader = Cask::CaskLoader::FromPathLoader.try_new(cask_file_path)
|
|
||||||
expect(loader).not_to be_nil
|
|
||||||
expect(loader).to be_a(Cask::CaskLoader::FromPathLoader)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,61 +4,6 @@ require "os/linux/ld"
|
|||||||
require "tmpdir"
|
require "tmpdir"
|
||||||
|
|
||||||
RSpec.describe OS::Linux::Ld do
|
RSpec.describe OS::Linux::Ld do
|
||||||
let(:diagnostics) do
|
|
||||||
<<~EOS
|
|
||||||
path.prefix="/usr"
|
|
||||||
path.sysconfdir="/usr/local/etc"
|
|
||||||
path.system_dirs[0x0]="/lib64"
|
|
||||||
path.system_dirs[0x1]="/var/lib"
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "::system_ld_so" do
|
|
||||||
let(:ld_so) { "/lib/ld-linux.so.3" }
|
|
||||||
|
|
||||||
before do
|
|
||||||
allow(File).to receive(:executable?).and_return(false)
|
|
||||||
described_class.instance_variable_set(:@system_ld_so, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns the path to a known dynamic linker" do
|
|
||||||
allow(File).to receive(:executable?).with(ld_so).and_return(true)
|
|
||||||
expect(described_class.system_ld_so).to eq(Pathname(ld_so))
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns nil when there is no known dynamic linker" do
|
|
||||||
expect(described_class.system_ld_so).to be_nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "::sysconfdir" do
|
|
||||||
it "returns path.sysconfdir" do
|
|
||||||
allow(described_class).to receive(:ld_so_diagnostics).and_return(diagnostics)
|
|
||||||
expect(described_class.sysconfdir).to eq("/usr/local/etc")
|
|
||||||
expect(described_class.sysconfdir(brewed: false)).to eq("/usr/local/etc")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns fallback on blank diagnostics" do
|
|
||||||
allow(described_class).to receive(:ld_so_diagnostics).and_return("")
|
|
||||||
expect(described_class.sysconfdir).to eq("/etc")
|
|
||||||
expect(described_class.sysconfdir(brewed: false)).to eq("/etc")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "::system_dirs" do
|
|
||||||
it "returns all path.system_dirs" do
|
|
||||||
allow(described_class).to receive(:ld_so_diagnostics).and_return(diagnostics)
|
|
||||||
expect(described_class.system_dirs).to eq(["/lib64", "/var/lib"])
|
|
||||||
expect(described_class.system_dirs(brewed: false)).to eq(["/lib64", "/var/lib"])
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns an empty array on blank diagnostics" do
|
|
||||||
allow(described_class).to receive(:ld_so_diagnostics).and_return("")
|
|
||||||
expect(described_class.system_dirs).to eq([])
|
|
||||||
expect(described_class.system_dirs(brewed: false)).to eq([])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "::library_paths" do
|
describe "::library_paths" do
|
||||||
ld_etc = Pathname("")
|
ld_etc = Pathname("")
|
||||||
before do
|
before do
|
||||||
|
|||||||
@ -251,7 +251,7 @@ module Homebrew
|
|||||||
ohai "No outdated dependents to upgrade!" unless dry_run
|
ohai "No outdated dependents to upgrade!" unless dry_run
|
||||||
else
|
else
|
||||||
installed_formulae = (dry_run ? formulae : FormulaInstaller.installed.to_a).dup
|
installed_formulae = (dry_run ? formulae : FormulaInstaller.installed.to_a).dup
|
||||||
formula_plural = Utils.pluralize("formula", installed_formulae.count)
|
formula_plural = Utils.pluralize("formula", installed_formulae.count, plural: "e")
|
||||||
upgrade_verb = dry_run ? "Would upgrade" : "Upgrading"
|
upgrade_verb = dry_run ? "Would upgrade" : "Upgrading"
|
||||||
ohai "#{upgrade_verb} #{Utils.pluralize("dependent", upgradeable.count,
|
ohai "#{upgrade_verb} #{Utils.pluralize("dependent", upgradeable.count,
|
||||||
include_count: true)} of upgraded #{formula_plural}:"
|
include_count: true)} of upgraded #{formula_plural}:"
|
||||||
|
|||||||
@ -160,15 +160,6 @@ module Utils
|
|||||||
params(stem: String, count: Integer, plural: String, singular: String, include_count: T::Boolean).returns(String)
|
params(stem: String, count: Integer, plural: String, singular: String, include_count: T::Boolean).returns(String)
|
||||||
}
|
}
|
||||||
def self.pluralize(stem, count, plural: "s", singular: "", include_count: false)
|
def self.pluralize(stem, count, plural: "s", singular: "", include_count: false)
|
||||||
case stem
|
|
||||||
when "formula"
|
|
||||||
plural = "e"
|
|
||||||
when "dependency", "try"
|
|
||||||
stem = stem.delete_suffix("y")
|
|
||||||
plural = "ies"
|
|
||||||
singular = "y"
|
|
||||||
end
|
|
||||||
|
|
||||||
prefix = include_count ? "#{count} " : ""
|
prefix = include_count ? "#{count} " : ""
|
||||||
suffix = (count == 1) ? singular : plural
|
suffix = (count == 1) ? singular : plural
|
||||||
"#{prefix}#{stem}#{suffix}"
|
"#{prefix}#{stem}#{suffix}"
|
||||||
|
|||||||
@ -10,44 +10,5 @@ module Utils
|
|||||||
child_pathname.ascend { |p| return true if p == parent_pathname }
|
child_pathname.ascend { |p| return true if p == parent_pathname }
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(path: Pathname, package_type: Symbol).returns(T::Boolean) }
|
|
||||||
def self.loadable_package_path?(path, package_type)
|
|
||||||
return true unless Homebrew::EnvConfig.forbid_packages_from_paths?
|
|
||||||
|
|
||||||
path_realpath = path.realpath.to_s
|
|
||||||
path_string = path.to_s
|
|
||||||
|
|
||||||
allowed_paths = ["#{HOMEBREW_LIBRARY}/Taps/"]
|
|
||||||
allowed_paths << if package_type == :formula
|
|
||||||
"#{HOMEBREW_CELLAR}/"
|
|
||||||
else
|
|
||||||
"#{Cask::Caskroom.path}/"
|
|
||||||
end
|
|
||||||
|
|
||||||
return true if !path_realpath.end_with?(".rb") && !path_string.end_with?(".rb")
|
|
||||||
return true if allowed_paths.any? { |path| path_realpath.start_with?(path) }
|
|
||||||
return true if allowed_paths.any? { |path| path_string.start_with?(path) }
|
|
||||||
|
|
||||||
# Looks like a local path, Ruby file and not a tap.
|
|
||||||
if path_string.include?("./") || path_string.end_with?(".rb") || path_string.count("/") != 2
|
|
||||||
package_type_plural = Utils.pluralize(package_type.to_s, 2)
|
|
||||||
path_realpath_if_different = " (#{path_realpath})" if path_realpath != path_string
|
|
||||||
create_flag = " --cask" if package_type == :cask
|
|
||||||
|
|
||||||
raise <<~WARNING
|
|
||||||
Homebrew requires #{package_type_plural} to be in a tap, rejecting:
|
|
||||||
#{path_string}#{path_realpath_if_different}
|
|
||||||
|
|
||||||
To create a tap, run e.g.
|
|
||||||
brew tap-new <user|org>/<repository>
|
|
||||||
To create a #{package_type} in a tap run e.g.
|
|
||||||
brew create#{create_flag} <url> --tap=<user|org>/<repository>
|
|
||||||
WARNING
|
|
||||||
else
|
|
||||||
# Looks like a tap, let's quietly reject but not error.
|
|
||||||
path_string.count("/") != 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
16
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
16
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
@ -55,7 +55,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/regexp_parser-2.11.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/regexp_parser-2.11.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/simpleidn-0.2.3/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.4.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.4.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rexml-3.4.4/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rexml-3.4.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/kramdown-2.5.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/kramdown-2.5.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/language_server-protocol-3.17.0.5/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/language_server-protocol-3.17.0.5/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/lint_roller-1.1.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/lint_roller-1.1.0/lib")
|
||||||
@ -89,16 +89,16 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-3.13.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-3.13.1/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-github-3.0.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-github-3.0.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-retry-0.6.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-retry-0.6.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.6.12521/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.6.12479/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-sorbet-1.9.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-sorbet-1.9.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec_junit_formatter-0.6.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec_junit_formatter-0.6.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.46.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.46.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-emoji-4.1.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-emoji-4.0.4/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-3.2.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-3.1.5/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.80.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.80.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-md-2.0.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-md-2.0.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.26.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.25.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.7.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.7.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.10.5/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.10.5/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.26.1/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.26.1/lib")
|
||||||
@ -109,9 +109,9 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov_json_formatter-0.1.4/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov_json_formatter-0.1.4/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-0.22.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-0.22.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-cobertura-3.1.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-cobertura-3.1.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.6.12521-universal-darwin/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.6.12479-universal-darwin/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.6.12521/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.6.12479/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.6.12521/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.6.12479/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.4.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.4.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.7.6/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.7.6/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stackprof-0.2.27")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stackprof-0.2.27")
|
||||||
|
|||||||
@ -132,14 +132,17 @@ module T::Props
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Shorthand helper to define a `prop` with `immutable => true`
|
# Shorthand helper to define a `prop` with `immutable => true`
|
||||||
sig { params(name: Symbol, cls: T.untyped, rules: T.untyped).void }
|
sig { params(name: Symbol, cls_or_args: T.untyped, args: T.untyped).void }
|
||||||
def const(name, cls, **rules)
|
def const(name, cls_or_args, **args)
|
||||||
if rules.key?(:immutable)
|
if (cls_or_args.is_a?(Hash) && cls_or_args.key?(:immutable)) || args.key?(:immutable)
|
||||||
Kernel.raise ArgumentError.new("Cannot pass 'immutable' argument when using 'const' keyword to define a prop")
|
Kernel.raise ArgumentError.new("Cannot pass 'immutable' argument when using 'const' keyword to define a prop")
|
||||||
end
|
end
|
||||||
|
|
||||||
rules[:immutable] = true
|
if cls_or_args.is_a?(Hash)
|
||||||
self.prop(name, cls, **rules)
|
self.prop(name, **cls_or_args.merge(immutable: true))
|
||||||
|
else
|
||||||
|
self.prop(name, cls_or_args, **args.merge(immutable: true))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def included(child)
|
def included(child)
|
||||||
@ -238,9 +238,7 @@ class T::Props::Decorator
|
|||||||
end
|
end
|
||||||
|
|
||||||
if rules.keys.any? { |k| !valid_rule_key?(k) }
|
if rules.keys.any? { |k| !valid_rule_key?(k) }
|
||||||
invalid_keys = rules.keys.reject { |k| valid_rule_key?(k) }
|
raise ArgumentError.new("At least one invalid prop arg supplied in #{self}: #{rules.keys.inspect}")
|
||||||
suffix = invalid_keys.size == 1 ? "" : "s"
|
|
||||||
raise ArgumentError.new("Invalid prop arg#{suffix} supplied in #{self}: #{invalid_keys.inspect}")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if !rules[:clobber_existing_method!] && !rules[:without_accessors] && BANNED_METHOD_NAMES.include?(name.to_sym)
|
if !rules[:clobber_existing_method!] && !rules[:without_accessors] && BANNED_METHOD_NAMES.include?(name.to_sym)
|
||||||
@ -34,8 +34,6 @@ module T::Types
|
|||||||
case other
|
case other
|
||||||
when TEnum
|
when TEnum
|
||||||
@val == other.val
|
@val == other.val
|
||||||
when Simple
|
|
||||||
other.raw_type.===(@val)
|
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user