language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | b3c82ae1cfd761eb1cb9c9cf9ca25979cfdac8f9.json | sorbet: Update RBI files.
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -12647,8 +12647,8 @@ end
class Object
include ::Minitest::Expectations
include ::ActiveSupport::Tryable
- include ::Utils::Curl
include ::SystemCommand::Mixin
+ include ::Utils::Curl
include ::ActiveSupport::Dependencies::Loadable
include ::ActiveSupport::ForkTracker::CoreExtPrivate
include ::ActiveSupport::ForkTracker::CoreExt | false |
Other | Homebrew | brew | 0db7c0ba8a1e5234c6265c93da96dcf57ceb8f38.json | formula: add -DBUILD_TESTING=OFF to std_cmake_args | Library/Homebrew/formula.rb | @@ -1457,6 +1457,7 @@ def std_cmake_args
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_VERBOSE_MAKEFILE=ON
-Wno-dev
+ -DBUILD_TESTING=OFF
]
# Avoid false positives for clock_gettime support on 10.11. | false |
Other | Homebrew | brew | 635e58e9aaf692e3006c216916b17a2c13f51d0c.json | software_spec: fix bottle domain fallback handling | Library/Homebrew/formula.rb | @@ -364,7 +364,7 @@ def head_only?
# @private
sig { returns(T.nilable(Bottle)) }
def bottle
- Bottle.new(self, bottle_specification) if bottled?
+ @bottle ||= Bottle.new(self, bottle_specification) if bottled?
end
# The description of the software.
@@ -1906,7 +1906,7 @@ def bottle_hash
checksum = collector_os[:checksum].hexdigest
filename = Bottle::Filename.create(self, os, bottle_spec.rebuild)
- path, = bottle_spec.path_resolved_basename(name, checksum, filename)
+ path, = Utils::Bottles.path_resolved_basename(bottle_spec.root_url, name, checksum, filename)
url = "#{bottle_spec.root_url}/#{path}"
hash["files"][os] = { | true |
Other | Homebrew | brew | 635e58e9aaf692e3006c216916b17a2c13f51d0c.json | software_spec: fix bottle domain fallback handling | Library/Homebrew/resource.rb | @@ -174,6 +174,7 @@ def url(val = nil, **specs)
@specs.merge!(specs)
@using = @specs.delete(:using)
@download_strategy = DownloadStrategyDetector.detect(url, using)
+ @downloader = nil
end
def version(val = nil) | true |
Other | Homebrew | brew | 635e58e9aaf692e3006c216916b17a2c13f51d0c.json | software_spec: fix bottle domain fallback handling | Library/Homebrew/software_spec.rb | @@ -309,29 +309,24 @@ def initialize(formula, spec)
checksum, tag, cellar = spec.checksum_for(Utils::Bottles.tag)
- filename = Filename.create(formula, tag, spec.rebuild)
-
- path, resolved_basename = spec.path_resolved_basename(@name, checksum, filename)
-
- @resource.url("#{spec.root_url}/#{path}", select_download_strategy(spec.root_url_specs))
- @resource.version = formula.pkg_version
- @resource.checksum = checksum
- @resource.downloader.resolved_basename = resolved_basename if resolved_basename.present?
@prefix = spec.prefix
+ @tag = tag
@cellar = cellar
@rebuild = spec.rebuild
+
+ @resource.version = formula.pkg_version
+ @resource.checksum = checksum
+
+ root_url(spec.root_url, spec.root_url_specs)
end
def fetch(verify_download_integrity: true)
- # add the default bottle domain as a fallback mirror
- if @resource.download_strategy == CurlDownloadStrategy &&
- @resource.url.start_with?(Homebrew::EnvConfig.bottle_domain)
- fallback_url = @resource.url
- .sub(/^#{Regexp.escape(Homebrew::EnvConfig.bottle_domain)}/,
- HOMEBREW_BOTTLE_DEFAULT_DOMAIN)
- @resource.mirror(fallback_url) if [@resource.url, *@resource.mirrors].exclude?(fallback_url)
- end
@resource.fetch(verify_download_integrity: verify_download_integrity)
+ rescue DownloadError
+ raise unless fallback_on_error
+
+ fetch_tab
+ retry
end
def clear_cache
@@ -355,6 +350,10 @@ def stage
def fetch_tab
# a checksum is used later identifying the correct tab but we do not have the checksum for the manifest/tab
github_packages_manifest_resource&.fetch(verify_download_integrity: false)
+ rescue DownloadError
+ raise unless fallback_on_error
+
+ retry
end
def tab_attributes
@@ -403,7 +402,7 @@ def github_packages_manifest_resource
image_name = GitHubPackages.image_formula_name(@name)
image_tag = GitHubPackages.image_version_rebuild(version_rebuild)
- resource.url("#{@spec.root_url}/#{image_name}/manifests/#{image_tag}", {
+ resource.url("#{root_url}/#{image_name}/manifests/#{image_tag}", {
using: CurlGitHubPackagesDownloadStrategy,
headers: ["Accept: application/vnd.oci.image.index.v1+json"],
})
@@ -413,9 +412,33 @@ def github_packages_manifest_resource
end
def select_download_strategy(specs)
- specs[:using] ||= DownloadStrategyDetector.detect(@spec.root_url)
+ specs[:using] ||= DownloadStrategyDetector.detect(@root_url)
specs
end
+
+ def fallback_on_error
+ # Use the default bottle domain as a fallback mirror
+ if @resource.url.start_with?(Homebrew::EnvConfig.bottle_domain) &&
+ Homebrew::EnvConfig.bottle_domain != HOMEBREW_BOTTLE_DEFAULT_DOMAIN
+ opoo "Bottle missing, falling back to the default domain..."
+ root_url(HOMEBREW_BOTTLE_DEFAULT_DOMAIN)
+ @github_packages_manifest_resource = nil
+ true
+ else
+ false
+ end
+ end
+
+ def root_url(val = nil, specs = {})
+ return @root_url if val.nil?
+
+ @root_url = val
+
+ filename = Filename.create(resource.owner, @tag, @spec.rebuild)
+ path, resolved_basename = Utils::Bottles.path_resolved_basename(val, name, resource.checksum, filename)
+ @resource.url("#{val}/#{path}", select_download_strategy(specs))
+ @resource.downloader.resolved_basename = resolved_basename if resolved_basename.present?
+ end
end
class BottleSpecification
@@ -453,15 +476,6 @@ def root_url(var = nil, specs = {})
end
end
- def path_resolved_basename(name, checksum, filename)
- if root_url.match?(GitHubPackages::URL_REGEX)
- image_name = GitHubPackages.image_formula_name(name)
- ["#{image_name}/blobs/sha256:#{checksum}", filename&.github_packages]
- else
- filename&.url_encode
- end
- end
-
def cellar(val = nil)
if val.present?
odeprecated( | true |
Other | Homebrew | brew | 635e58e9aaf692e3006c216916b17a2c13f51d0c.json | software_spec: fix bottle domain fallback handling | Library/Homebrew/utils/bottles.rb | @@ -85,6 +85,15 @@ def formula_contents(bottle_file,
contents
end
+
+ def path_resolved_basename(root_url, name, checksum, filename)
+ if root_url.match?(GitHubPackages::URL_REGEX)
+ image_name = GitHubPackages.image_formula_name(name)
+ ["#{image_name}/blobs/sha256:#{checksum}", filename&.github_packages]
+ else
+ filename&.url_encode
+ end
+ end
end
# Denotes the arch and OS of a bottle. | true |
Other | Homebrew | brew | b358ffd4404eb36dea846bf027fd5acedb9c2ec9.json | Apply suggestions from code review | bin/brew | @@ -80,13 +80,15 @@ export HOMEBREW_PREFIX
export HOMEBREW_REPOSITORY
export HOMEBREW_LIBRARY
+# set from user environment
# shellcheck disable=SC2154
# Use VISUAL if HOMEBREW_EDITOR and EDITOR are unset.
if [[ -z "${HOMEBREW_EDITOR}" && -n "${VISUAL}" ]]
then
export HOMEBREW_EDITOR="${VISUAL}"
fi
+# set from user environment
# shellcheck disable=SC2154
# Set CI variable for Azure Pipelines and Jenkins
# (Set by default on GitHub Actions, Circle and Travis CI)
@@ -95,6 +97,7 @@ then
export CI="1"
fi
+# set from user environment
# shellcheck disable=SC2154
if [[ -z "${HOMEBREW_NO_ENV_FILTERING}" ]]
then | false |
Other | Homebrew | brew | a74d6060f317c360106d81c461827cb016752d39.json | settings: use quieter `system_command!`
`safe_system` always outputs what it's running which isn't necessary in
this case. | Library/Homebrew/settings.rb | @@ -1,12 +1,15 @@
# typed: true
# frozen_string_literal: true
+require "system_command"
+
module Homebrew
# Helper functions for reading and writing settings.
#
# @api private
module Settings
extend T::Sig
+ include SystemCommand::Mixin
module_function
@@ -24,7 +27,7 @@ def write(setting, value, repo: HOMEBREW_REPOSITORY)
return unless (repo/".git/config").exist?
repo.cd do
- safe_system "git", "config", "--replace-all", "homebrew.#{setting}", value.to_s
+ system_command! "git", args: ["config", "--replace-all", "homebrew.#{setting}", value.to_s]
end
end
@@ -34,7 +37,7 @@ def delete(setting, repo: HOMEBREW_REPOSITORY)
return if read(setting, repo: repo).blank?
repo.cd do
- safe_system "git", "config", "--unset-all", "homebrew.#{setting}"
+ system_command! "git", args: ["config", "--unset-all", "homebrew.#{setting}"]
end
end
end | false |
Other | Homebrew | brew | 1feed79e69859c9e93d5627636772550f4da7800.json | Use File.read over IO.read | Library/Homebrew/dev-cmd/bottle.rb | @@ -567,7 +567,7 @@ def bottle_formula(f, args:)
def parse_json_files(filenames)
filenames.map do |filename|
- JSON.parse(IO.read(filename))
+ JSON.parse(File.read(filename))
end
end
| true |
Other | Homebrew | brew | 1feed79e69859c9e93d5627636772550f4da7800.json | Use File.read over IO.read | Library/Homebrew/dev-cmd/pr-upload.rb | @@ -91,7 +91,7 @@ def pr_upload
odie "No bottle JSON files found in the current working directory" if json_files.empty?
bottles_hash = json_files.reduce({}) do |hash, json_file|
- hash.deep_merge(JSON.parse(IO.read(json_file)))
+ hash.deep_merge(JSON.parse(File.read(json_file)))
end
if args.root_url | true |
Other | Homebrew | brew | 56a72fe2b1e35acb0df4179ecc79c7873a6f5d49.json | debrew/irb: fix trap handling | Library/Homebrew/debrew/irb.rb | @@ -5,8 +5,6 @@
# @private
module IRB
- def self.parse_opts(argv: nil); end
-
def self.start_within(binding)
unless @setup_done
setup(nil, argv: [])
@@ -19,7 +17,7 @@ def self.start_within(binding)
@CONF[:IRB_RC]&.call(irb.context)
@CONF[:MAIN_CONTEXT] = irb.context
- trap("SIGINT") do
+ prev_trap = trap("SIGINT") do
irb.signal_handle
end
@@ -28,6 +26,7 @@ def self.start_within(binding)
irb.eval_input
end
ensure
+ trap("SIGINT", prev_trap)
irb_at_exit
end
end | false |
Other | Homebrew | brew | 49285fb88c2b0845d9d4847b89e32ac9b54206e9.json | formulary: introduce ignore_errors parameter | Library/Homebrew/formulary.rb | @@ -47,24 +47,35 @@ def self.clear_cache
super
end
- def self.load_formula(name, path, contents, namespace, flags:)
+ def self.load_formula(name, path, contents, namespace, flags:, ignore_errors:)
raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if Homebrew::EnvConfig.disable_load_formula?
require "formula"
+ require "ignorable"
mod = Module.new
remove_const(namespace) if const_defined?(namespace)
const_set(namespace, mod)
- begin
+ eval_formula = lambda do
# Set `BUILD_FLAGS` in the formula's namespace so we can
# access them from within the formula's class scope.
mod.const_set(:BUILD_FLAGS, flags)
mod.module_eval(contents, path)
rescue NameError, ArgumentError, ScriptError, MethodDeprecatedError, MacOSVersionError => e
- remove_const(namespace)
- raise FormulaUnreadableError.new(name, e)
+ if e.is_a?(Ignorable::ExceptionMixin)
+ e.ignore
+ else
+ remove_const(namespace)
+ raise FormulaUnreadableError.new(name, e)
+ end
end
+ if ignore_errors
+ Ignorable.hook_raise(&eval_formula)
+ else
+ eval_formula.call
+ end
+
class_name = class_s(name)
begin
@@ -79,10 +90,10 @@ def self.load_formula(name, path, contents, namespace, flags:)
end
end
- def self.load_formula_from_path(name, path, flags:)
+ def self.load_formula_from_path(name, path, flags:, ignore_errors:)
contents = path.open("r") { |f| ensure_utf8_encoding(f).read }
namespace = "FormulaNamespace#{Digest::MD5.hexdigest(path.to_s)}"
- klass = load_formula(name, path, contents, namespace, flags: flags)
+ klass = load_formula(name, path, contents, namespace, flags: flags, ignore_errors: ignore_errors)
cache[path] = klass
end
@@ -150,23 +161,24 @@ def initialize(name, path)
# Gets the formula instance.
# `alias_path` can be overridden here in case an alias was used to refer to
# a formula that was loaded in another way.
- def get_formula(spec, alias_path: nil, force_bottle: false, flags: [])
+ def get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false)
alias_path ||= self.alias_path
- klass(flags: flags).new(name, path, spec, alias_path: alias_path, force_bottle: force_bottle)
+ klass(flags: flags, ignore_errors: ignore_errors)
+ .new(name, path, spec, alias_path: alias_path, force_bottle: force_bottle)
end
- def klass(flags:)
- load_file(flags: flags) unless Formulary.formula_class_defined?(path)
+ def klass(flags:, ignore_errors:)
+ load_file(flags: flags, ignore_errors: ignore_errors) unless Formulary.formula_class_defined?(path)
Formulary.formula_class_get(path)
end
private
- def load_file(flags:)
+ def load_file(flags:, ignore_errors:)
$stderr.puts "#{$PROGRAM_NAME} (#{self.class.name}): loading #{path}" if debug?
raise FormulaUnavailableError, name unless path.file?
- Formulary.load_formula_from_path(name, path, flags: flags)
+ Formulary.load_formula_from_path(name, path, flags: flags, ignore_errors: ignore_errors)
end
end
@@ -191,10 +203,11 @@ def initialize(bottle_name)
super name, Formulary.path(full_name)
end
- def get_formula(spec, force_bottle: false, flags: [], **)
+ def get_formula(spec, force_bottle: false, flags: [], ignore_errors: false, **)
formula = begin
contents = Utils::Bottles.formula_contents @bottle_filename, name: name
- Formulary.from_contents(name, path, contents, spec, force_bottle: force_bottle, flags: flags)
+ Formulary.from_contents(name, path, contents, spec, force_bottle: force_bottle,
+ flags: flags, ignore_errors: ignore_errors)
rescue FormulaUnreadableError => e
opoo <<~EOS
Unreadable formula in #{@bottle_filename}:
@@ -245,7 +258,7 @@ def initialize(url)
super formula, HOMEBREW_CACHE_FORMULA/File.basename(uri.path)
end
- def load_file(flags:)
+ def load_file(flags:, ignore_errors:)
if %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(?:/Formula)?/(?<formula_name>[\w+-.@]+).rb} =~ url
raise UsageError, "Installation of #{formula_name} from a GitHub commit URL is unsupported! " \
"`brew extract #{formula_name}` to a stable tap on GitHub instead."
@@ -309,7 +322,7 @@ def formula_name_path(tapped_name, warn: true)
[name, path]
end
- def get_formula(spec, alias_path: nil, force_bottle: false, flags: [])
+ def get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false)
super
rescue FormulaUnreadableError => e
raise TapFormulaUnreadableError.new(tap, name, e.formula_error), "", e.backtrace
@@ -319,7 +332,7 @@ def get_formula(spec, alias_path: nil, force_bottle: false, flags: [])
raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace
end
- def load_file(flags:)
+ def load_file(flags:, ignore_errors:)
super
rescue MethodDeprecatedError => e
e.issues_url = tap.issues_url || tap.to_s
@@ -348,10 +361,10 @@ def initialize(name, path, contents)
super name, path
end
- def klass(flags:)
+ def klass(flags:, ignore_errors:)
$stderr.puts "#{$PROGRAM_NAME} (#{self.class.name}): loading #{path}" if debug?
namespace = "FormulaNamespace#{Digest::MD5.hexdigest(contents.to_s)}"
- Formulary.load_formula(name, path, contents, namespace, flags: flags)
+ Formulary.load_formula(name, path, contents, namespace, flags: flags, ignore_errors: ignore_errors)
end
end
@@ -362,7 +375,10 @@ def klass(flags:)
# * a formula pathname
# * a formula URL
# * a local bottle reference
- def self.factory(ref, spec = :stable, alias_path: nil, from: nil, force_bottle: false, flags: [])
+ def self.factory(
+ ref, spec = :stable, alias_path: nil, from: nil,
+ force_bottle: false, flags: [], ignore_errors: false
+ )
raise ArgumentError, "Formulae must have a ref!" unless ref
cache_key = "#{ref}-#{spec}-#{alias_path}-#{from}"
@@ -372,7 +388,8 @@ def self.factory(ref, spec = :stable, alias_path: nil, from: nil, force_bottle:
end
formula = loader_for(ref, from: from).get_formula(spec, alias_path: alias_path,
- force_bottle: force_bottle, flags: flags)
+ force_bottle: force_bottle, flags: flags,
+ ignore_errors: ignore_errors)
if factory_cached?
cache[:formulary_factory] ||= {}
cache[:formulary_factory][cache_key] ||= formula
@@ -433,9 +450,13 @@ def self.from_keg(keg, spec = nil, alias_path: nil, force_bottle: false, flags:
end
# Return a {Formula} instance directly from contents.
- def self.from_contents(name, path, contents, spec = :stable, alias_path: nil, force_bottle: false, flags: [])
+ def self.from_contents(
+ name, path, contents, spec = :stable, alias_path: nil,
+ force_bottle: false, flags: [], ignore_errors: false
+ )
FormulaContentsLoader.new(name, path, contents)
- .get_formula(spec, alias_path: alias_path, force_bottle: force_bottle, flags: flags)
+ .get_formula(spec, alias_path: alias_path, force_bottle: force_bottle,
+ flags: flags, ignore_errors: ignore_errors)
end
def self.to_rack(ref) | false |
Other | Homebrew | brew | 8b808308c292e7079a85460dac13d13e1db453aa.json | Add ignorable module | Library/Homebrew/debrew.rb | @@ -3,42 +3,14 @@
require "mutex_m"
require "debrew/irb"
-require "warnings"
-Warnings.ignore(/warning: callcc is obsolete; use Fiber instead/) do
- require "continuation"
-end
+require "ignorable"
# Helper module for debugging formulae.
#
# @api private
module Debrew
extend Mutex_m
- # Marks exceptions which can be ignored and provides
- # the ability to jump back to where it was raised.
- module Ignorable
- attr_accessor :continuation
-
- def ignore
- continuation.call
- end
- end
-
- # Module for allowing to ignore exceptions.
- module Raise
- def raise(*)
- callcc do |continuation|
- super
- rescue Exception => e # rubocop:disable Lint/RescueException
- e.extend(Ignorable)
- e.continuation = continuation
- super(e)
- end
- end
-
- alias fail raise
- end
-
# Module for allowing to debug formulae.
module Formula
def install
@@ -106,28 +78,28 @@ def self.choose
class << self
extend Predicable
- alias original_raise raise
attr_predicate :active?
attr_reader :debugged_exceptions
end
def self.debrew
@active = true
- Object.include Raise
+ Ignorable.hook_raise
begin
yield
rescue SystemExit
- original_raise
+ raise
rescue Exception => e # rubocop:disable Lint/RescueException
e.ignore if debug(e) == :ignore # execution jumps back to where the exception was thrown
ensure
+ Ignorable.unhook_raise
@active = false
end
end
def self.debug(e)
- original_raise(e) if !active? || !debugged_exceptions.add?(e) || !try_lock
+ raise(e) if !active? || !debugged_exceptions.add?(e) || !try_lock
begin
puts e.backtrace.first.to_s
@@ -137,15 +109,15 @@ def self.debug(e)
Menu.choose do |menu|
menu.prompt = "Choose an action: "
- menu.choice(:raise) { original_raise(e) }
- menu.choice(:ignore) { return :ignore } if e.is_a?(Ignorable)
+ menu.choice(:raise) { raise(e) }
+ menu.choice(:ignore) { return :ignore } if e.is_a?(Ignorable::ExceptionMixin)
menu.choice(:backtrace) { puts e.backtrace }
- if e.is_a?(Ignorable)
+ if e.is_a?(Ignorable::ExceptionMixin)
menu.choice(:irb) do
puts "When you exit this IRB session, execution will continue."
set_trace_func proc { |event, _, _, id, binding, klass|
- if klass == Raise && id == :raise && event == "return"
+ if klass == Object && id == :raise && event == "return"
set_trace_func(nil)
synchronize { IRB.start_within(binding) }
end | true |
Other | Homebrew | brew | 8b808308c292e7079a85460dac13d13e1db453aa.json | Add ignorable module | Library/Homebrew/ignorable.rb | @@ -0,0 +1,58 @@
+# typed: false
+# frozen_string_literal: true
+
+require "warnings"
+Warnings.ignore(/warning: callcc is obsolete; use Fiber instead/) do
+ require "continuation"
+end
+
+# Provides the ability to optionally ignore errors raised and continue execution.
+#
+# @api private
+module Ignorable
+ # Marks exceptions which can be ignored and provides
+ # the ability to jump back to where it was raised.
+ module ExceptionMixin
+ attr_accessor :continuation
+
+ def ignore
+ continuation.call
+ end
+ end
+
+ def self.hook_raise
+ Object.class_eval do
+ alias_method :original_raise, :raise
+
+ def raise(*)
+ callcc do |continuation|
+ super
+ rescue Exception => e # rubocop:disable Lint/RescueException
+ unless e.is_a?(ScriptError)
+ e.extend(ExceptionMixin)
+ e.continuation = continuation
+ end
+ super(e)
+ end
+ end
+
+ alias_method :fail, :raise
+ end
+
+ return unless block_given?
+
+ yield
+ unhook_raise
+ end
+
+ def self.unhook_raise
+ Object.class_eval do
+ # False positive - https://github.com/rubocop/rubocop/issues/5022
+ # rubocop:disable Lint/DuplicateMethods
+ alias_method :raise, :original_raise
+ alias_method :fail, :original_raise
+ # rubocop:enable Lint/DuplicateMethods
+ undef :original_raise
+ end
+ end
+end | true |
Other | Homebrew | brew | f578673253b00f1e236303bb997297e6c95d65da.json | add GitHub Actions to explanation | bin/brew | @@ -87,7 +87,7 @@ then
fi
# Set CI variable for Azure Pipelines and Jenkins
-# (Set by default on Circle and Travis CI)
+# (Set by default on GitHub Actions, Circle and Travis CI)
if [[ -z "$CI" ]] && [[ -n "$TF_BUILD" || -n "$JENKINS_HOME" ]]
then
export CI="1" | false |
Other | Homebrew | brew | ad22854bcb924fdc103bb3a3ea2b0358d8f0726a.json | brew.sh: remove problematic HOMEBREW_BOTTLE_DOMAIN export
Partially fixes #11123. | Library/Homebrew/brew.sh | @@ -587,11 +587,6 @@ then
export HOMEBREW_RUBY_WARNINGS="-W1"
fi
-if [[ -z "$HOMEBREW_BOTTLE_DOMAIN" ]]
-then
- export HOMEBREW_BOTTLE_DOMAIN="$HOMEBREW_BOTTLE_DEFAULT_DOMAIN"
-fi
-
export HOMEBREW_BREW_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/brew"
if [[ -z "$HOMEBREW_BREW_GIT_REMOTE" ]]
then | false |
Other | Homebrew | brew | ae91ec277231a5f3df42af8c27c555a0cee3403e.json | github_packages: handle "manifest unknown" | Library/Homebrew/github_packages.rb | @@ -235,7 +235,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, keep_old:
inspect_result = system_command(skopeo, print_stderr: false, args: inspect_args)
# Order here is important
- if !inspect_result.status.success? && inspect_result.stderr.exclude?("name unknown")
+ if !inspect_result.status.success? && !inspect_result.stderr.match?(/(name|manifest) unknown/)
# We got an error, and it was not about the tag or package being unknown.
if warn_on_error
opoo "#{image_uri} inspection returned an error, skipping upload!\n#{inspect_result.stderr}" | false |
Other | Homebrew | brew | 627381e949233ec90e4ea4ffc9d0e811f68619b9.json | formula_installer: fix version scheme not being set in the tab | Library/Homebrew/formula_installer.rb | @@ -1160,6 +1160,7 @@ def pour
tab.aliases = formula.aliases
tab.arch = Hardware::CPU.arch
tab.source["versions"]["stable"] = formula.stable.version.to_s
+ tab.source["versions"]["version_scheme"] = formula.version_scheme
tab.source["path"] = formula.specified_path.to_s
tab.source["tap_git_head"] = formula.tap&.git_head
tab.tap = formula.tap | false |
Other | Homebrew | brew | b8d60c7fd6269aca252d56c4109d2e59cd60fdda.json | bottle: Restore old filename for non-GitHub package URLs
The fix for #11090 in bd3f1d28e78bbc3e632b5439f001c6a2b3032fd9 changed the bottle json content but the downloader still expects bottles at the old location. | Library/Homebrew/dev-cmd/bottle.rb | @@ -507,6 +507,12 @@ def bottle_formula(f, args:)
return unless args.json?
+ bottle_filename = if bottle.root_url.match?(GitHubPackages::URL_REGEX)
+ filename.github_packages
+ else
+ filename.bintray
+ end
+
json = {
f.full_name => {
"formula" => {
@@ -532,7 +538,7 @@ def bottle_formula(f, args:)
"date" => Pathname(local_filename).mtime.strftime("%F"),
"tags" => {
bottle_tag.to_s => {
- "filename" => filename.github_packages,
+ "filename" => bottle_filename,
"local_filename" => local_filename,
"sha256" => sha256,
"formulae_brew_sh_path" => formulae_brew_sh_path, | false |
Other | Homebrew | brew | 0f90267bd0ffdd6ebff241a9703173bdb1ced74e.json | dev-cmd/bottle: fix incorrect Cellar value in JSON | Library/Homebrew/dev-cmd/bottle.rb | @@ -527,7 +527,7 @@ def bottle_formula(f, args:)
"bottle" => {
"root_url" => bottle.root_url,
"prefix" => bottle.prefix,
- "cellar" => bottle.cellar.to_s,
+ "cellar" => bottle_cellar.to_s,
"rebuild" => bottle.rebuild,
"date" => Pathname(local_filename).mtime.strftime("%F"),
"tags" => { | false |
Other | Homebrew | brew | 86c241ab42744f075484740583580c12e388db8e.json | Make search and create arguments mandatory
Co-Authored-By: Nanda H Krishna <me@nandahkrishna.com> | Library/Homebrew/help.rb | @@ -16,7 +16,7 @@ module Help
# NOTE: Keep lines less than 80 characters! Wrapping is just not cricket.
HOMEBREW_HELP = <<~EOS
Example usage:
- brew search [TEXT|/REGEX/]
+ brew search TEXT|/REGEX/
brew info [FORMULA|CASK...]
brew install FORMULA|CASK...
brew update
@@ -30,7 +30,7 @@ module Help
brew install --verbose --debug FORMULA|CASK
Contributing:
- brew create [URL [--no-fetch]]
+ brew create URL [--no-fetch]
brew edit [FORMULA|CASK...]
Further help: | false |
Other | Homebrew | brew | a19047e964f70865a1cb3d67a3842ab7b06f1805.json | sorbet: Update RBI files.
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -8404,6 +8404,11 @@ module Homebrew::Livecheck::Strategy
extend ::T::Private::Methods::SingletonMethodHooks
end
+class Homebrew::Service
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
module Homebrew::Settings
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks | false |
Other | Homebrew | brew | f2064750f578c58335719ccf0ed33bd09c3d2ee3.json | Add casks to default help text | Library/Homebrew/help.rb | @@ -17,21 +17,21 @@ module Help
HOMEBREW_HELP = <<~EOS
Example usage:
brew search [TEXT|/REGEX/]
- brew info [FORMULA...]
- brew install FORMULA...
+ brew info [FORMULA|CASK...]
+ brew install FORMULA|CASK...
brew update
- brew upgrade [FORMULA...]
- brew uninstall FORMULA...
- brew list [FORMULA...]
+ brew upgrade [FORMULA|CASK...]
+ brew uninstall FORMULA|CASK...
+ brew list [FORMULA|CASK...]
Troubleshooting:
brew config
brew doctor
- brew install --verbose --debug FORMULA
+ brew install --verbose --debug FORMULA|CASK
Contributing:
brew create [URL [--no-fetch]]
- brew edit [FORMULA...]
+ brew edit [FORMULA|CASK...]
Further help:
brew commands | false |
Other | Homebrew | brew | fca71c28aeda8605c0568bbd8bff399fe900fa34.json | bintray: fix filename for bottle uploads | Library/Homebrew/bintray.rb | @@ -217,8 +217,9 @@ def upload_bottles(bottles_hash, publish_package: false, warn_on_error: false)
bintray_repo = bottle_hash["bintray"]["repository"]
bottle_count = bottle_hash["bottle"]["tags"].length
- bottle_hash["bottle"]["tags"].each do |_tag, tag_hash|
- filename = tag_hash["filename"] # URL encoded in Bottle::Filename#bintray
+ bottle_hash["bottle"]["tags"].each do |tag, tag_hash|
+ filename = Bottle::Filename.create(bottle_hash["formula"]["name"], tag,
+ bottle_hash["bottle"]["rebuild"]).bintray
sha256 = tag_hash["sha256"]
delete_instructions = file_delete_instructions(bintray_repo, bintray_package, filename)
| false |
Other | Homebrew | brew | e574f320fc89aa7fc73e0edf66198a4fe6979e1c.json | software_spec: remove debug statement | Library/Homebrew/software_spec.rb | @@ -314,7 +314,6 @@ def initialize(formula, spec)
@resource.url("#{spec.root_url}/#{path}", select_download_strategy(spec.root_url_specs))
@resource.downloader.resolved_basename = resolved_basename if resolved_basename.present?
- p resolved_basename
@resource.version = formula.pkg_version
@resource.checksum = checksum
@prefix = spec.prefix | false |
Other | Homebrew | brew | 218f9cd37fc5a9c70b126cafd6e2f66f7779a7b0.json | sorbet: Update RBI files.
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -29881,6 +29881,11 @@ class Utils::Bottles::Collector
extend ::T::Private::Methods::SingletonMethodHooks
end
+class Utils::Bottles::Tag
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
module Utils::Inreplace
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks | false |
Other | Homebrew | brew | a3063882e6fa40c4905a56fa162e0731e44be312.json | tests: fix a option bug | Library/Homebrew/dev-cmd/tests.rb | @@ -114,7 +114,7 @@ def tests
%W[
--combine-stderr
--serialize-stdout
- --runtime-log "#{parallel_rspec_log_path}"
+ --runtime-log #{parallel_rspec_log_path}
]
else
%w[ | false |
Other | Homebrew | brew | 279a0683afed964e2896091ee5c4150bef78c0f6.json | Update RBI files for nokogiri. | Library/Homebrew/sorbet/rbi/gems/nokogiri@1.11.3.rbi | @@ -1,6 +1,6 @@
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `nokogiri` gem.
-# Please instead update this file by running `tapioca sync`.
+# Please instead update this file by running `bin/tapioca sync`.
# typed: true
@@ -742,7 +742,7 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
def collect_namespaces; end
def create_cdata(string, &block); end
def create_comment(string, &block); end
- def create_element(name, *args, &block); end
+ def create_element(name, *contents_or_attrs, &block); end
def create_entity(*_arg0); end
def create_text_node(string, &block); end
def decorate(node); end | false |
Other | Homebrew | brew | 2ed333947874ea4291a9007afbda15c2f56b2e35.json | software_spec: fix handling of default non-host Cellar | Library/Homebrew/software_spec.rb | @@ -430,7 +430,6 @@ class BottleSpecification
def initialize
@rebuild = 0
@prefix = Homebrew::DEFAULT_PREFIX
- @all_tags_cellar = Homebrew::DEFAULT_CELLAR
@repository = Homebrew::DEFAULT_REPOSITORY
@collector = Utils::Bottles::Collector.new
@root_url_specs = {}
@@ -472,7 +471,7 @@ def cellar(val = nil)
# )
# end
- return collector.dig(Utils::Bottles.tag, :cellar) || @all_tags_cellar if val.nil?
+ return collector.dig(Utils::Bottles.tag, :cellar) || @all_tags_cellar || Homebrew::DEFAULT_CELLAR if val.nil?
@all_tags_cellar = val
end
@@ -534,6 +533,14 @@ def sha256(hash)
end
cellar ||= all_tags_cellar
+ cellar ||= if tag.to_s.end_with?("_linux")
+ Homebrew::DEFAULT_LINUX_CELLAR
+ elsif tag.to_s.start_with?("arm64_")
+ Homebrew::DEFAULT_MACOS_ARM_CELLAR
+ else
+ Homebrew::DEFAULT_MACOS_CELLAR
+ end
+
collector[tag] = { checksum: Checksum.new(digest), cellar: cellar }
end
| true |
Other | Homebrew | brew | 2ed333947874ea4291a9007afbda15c2f56b2e35.json | software_spec: fix handling of default non-host Cellar | Library/Homebrew/test/dev-cmd/bottle_spec.rb | @@ -586,7 +586,7 @@ def install
new_catalina_sha256 = "ec6d7f08412468f28dee2be17ad8cd8b883b16b34329efcecce019b8c9736428"
new_hash = { "tags" => { "catalina" => { "sha256" => new_catalina_sha256 } } }
expected_checksum_hash = { mojave: "7571772bf7a0c9fe193e70e521318b53993bee6f351976c9b6e01e00d13d6c3f" }
- expected_checksum_hash[:cellar] = Homebrew::DEFAULT_CELLAR
+ expected_checksum_hash[:cellar] = Homebrew::DEFAULT_MACOS_CELLAR
expect(homebrew.merge_bottle_spec([:sha256], old_spec, new_hash)).to eq [
["sha256 catalina: old: #{old_catalina_sha256.inspect}, new: #{new_catalina_sha256.inspect}"],
[expected_checksum_hash], | true |
Other | Homebrew | brew | e2b8fbca082b69dd66f8ba4057501b5fcb02fdb0.json | sorbet: Update RBI files.
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -5637,11 +5637,6 @@ class Cask::Artifact::AbstractArtifact
extend ::T::Private::Methods::SingletonMethodHooks
end
-class Cask::Audit
- extend ::T::Private::Methods::MethodHooks
- extend ::T::Private::Methods::SingletonMethodHooks
-end
-
module Cask::Cache
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
@@ -8307,21 +8302,87 @@ module Homebrew::Livecheck::SkipConditions
extend ::T::Private::Methods::SingletonMethodHooks
end
+class Homebrew::Livecheck::Strategy::Apache
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Bitbucket
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Cpan
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class Homebrew::Livecheck::Strategy::ElectronBuilder
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end
+class Homebrew::Livecheck::Strategy::Git
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::GithubLatest
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Gnome
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Gnu
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Hackage
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class Homebrew::Livecheck::Strategy::HeaderMatch
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end
+class Homebrew::Livecheck::Strategy::Launchpad
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Npm
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class Homebrew::Livecheck::Strategy::PageMatch
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end
+class Homebrew::Livecheck::Strategy::Pypi
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Sourceforge
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
+class Homebrew::Livecheck::Strategy::Sparkle::Item
+ def short_version(*args, &block); end
+
+ def version(*args, &block); end
+end
+
class Homebrew::Livecheck::Strategy::Sparkle::Item
def self.[](*_); end
@@ -8333,12 +8394,12 @@ class Homebrew::Livecheck::Strategy::Sparkle
extend ::T::Private::Methods::SingletonMethodHooks
end
-module Homebrew::Livecheck::Strategy
+class Homebrew::Livecheck::Strategy::Xorg
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end
-module Homebrew::Livecheck
+module Homebrew::Livecheck::Strategy
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end | false |
Other | Homebrew | brew | d707c0bbd8e925fe9ad1c02e515effc435353b41.json | github_packages: remove invalid docker tag characters.
Some versions have `+` in them. | Library/Homebrew/github_packages.rb | @@ -110,6 +110,11 @@ def self.image_formula_name(formula_name)
.tr("+", "x")
end
+ def self.image_version_rebuild(version_rebuild)
+ # invalid docker tag characters
+ version_rebuild.tr("+", ".")
+ end
+
private
IMAGE_CONFIG_SCHEMA_URI = "https://opencontainers.org/schema/image/config"
@@ -183,22 +188,23 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:,
rebuild = bottle_hash["bottle"]["rebuild"]
version_rebuild = GitHubPackages.version_rebuild(version, rebuild)
- image_formula_name = GitHubPackages.image_formula_name(formula_name)
- image_tag = "#{GitHubPackages.root_url(org, repo, DOCKER_PREFIX)}/#{image_formula_name}:#{version_rebuild}"
+ image_name = GitHubPackages.image_formula_name(formula_name)
+ image_tag = GitHubPackages.image_version_rebuild(version_rebuild)
+ image_uri = "#{GitHubPackages.root_url(org, repo, DOCKER_PREFIX)}/#{image_name}:#{image_tag}"
puts
- inspect_args = ["inspect", image_tag.to_s]
+ inspect_args = ["inspect", image_uri.to_s]
if dry_run
puts "#{skopeo} #{inspect_args.join(" ")} --dest-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN"
else
inspect_args << "--dest-creds=#{user}:#{token}"
inspect_result = system_command(skopeo, args: args)
if inspect_result.status.success?
if warn_on_error
- opoo "#{image_tag} already exists, skipping upload!"
+ opoo "#{image_uri} already exists, skipping upload!"
return
else
- odie "#{image_tag} already exists!"
+ odie "#{image_uri} already exists!"
end
end
end
@@ -343,7 +349,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:,
"org.opencontainers.image.ref.name" => version_rebuild)
puts
- args = ["copy", "--all", "oci:#{root}", image_tag.to_s]
+ args = ["copy", "--all", "oci:#{root}", image_uri.to_s]
if dry_run
puts "#{skopeo} #{args.join(" ")} --dest-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN"
else | true |
Other | Homebrew | brew | d707c0bbd8e925fe9ad1c02e515effc435353b41.json | github_packages: remove invalid docker tag characters.
Some versions have `+` in them. | Library/Homebrew/software_spec.rb | @@ -403,7 +403,8 @@ def github_packages_manifest_resource
resource.version(version_rebuild)
image_name = GitHubPackages.image_formula_name(@name)
- resource.url("#{@spec.root_url}/#{image_name}/manifests/#{version_rebuild}", {
+ image_tag = GitHubPackages.image_version_rebuild(version_rebuild)
+ resource.url("#{@spec.root_url}/#{image_name}/manifests/#{image_tag}", {
using: CurlGitHubPackagesDownloadStrategy,
headers: ["Accept: application/vnd.oci.image.index.v1+json"],
}) | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/bundle_version.rb | @@ -17,7 +17,11 @@ class BundleVersion
sig { params(info_plist_path: Pathname).returns(T.nilable(T.attached_class)) }
def self.from_info_plist(info_plist_path)
plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
+ from_info_plist_content(plist)
+ end
+ sig { params(plist: T::Hash[String, T.untyped]).returns(T.nilable(T.attached_class)) }
+ def self.from_info_plist_content(plist)
short_version = plist["CFBundleShortVersionString"].presence
version = plist["CFBundleVersion"].presence
| true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/livecheck.rb | @@ -501,8 +501,7 @@ def latest_version(formula_or_cask, json: false, full_name: false, verbose: fals
regex_provided: livecheck_regex.present?,
block_provided: livecheck.strategy_block.present?,
)
- strategy = Strategy.from_symbol(livecheck_strategy)
- strategy ||= strategies.first
+ strategy = Strategy.from_symbol(livecheck_strategy) || strategies.first
strategy_name = livecheck_strategy_names[strategy]
if debug
@@ -514,24 +513,29 @@ def latest_version(formula_or_cask, json: false, full_name: false, verbose: fals
puts "Regex: #{livecheck_regex.inspect}" if livecheck_regex.present?
end
- if livecheck_strategy == :page_match && (livecheck_regex.blank? && livecheck.strategy_block.blank?)
- odebug "#{strategy_name} strategy requires a regex or block"
- next
- end
-
- if livecheck_strategy.present? && livecheck_url.blank?
- odebug "#{strategy_name} strategy requires a URL"
- next
- end
-
- if livecheck_strategy.present? && strategies.exclude?(strategy)
- odebug "#{strategy_name} strategy does not apply to this URL"
- next
+ if livecheck_strategy.present?
+ if livecheck_strategy == :page_match && (livecheck_regex.blank? && livecheck.strategy_block.blank?)
+ odebug "#{strategy_name} strategy requires a regex or block"
+ next
+ elsif livecheck_url.blank?
+ odebug "#{strategy_name} strategy requires a URL"
+ next
+ elsif strategies.exclude?(strategy)
+ odebug "#{strategy_name} strategy does not apply to this URL"
+ next
+ end
end
next if strategy.blank?
- strategy_data = strategy.find_versions(url, livecheck_regex, &livecheck.strategy_block)
+ strategy_data = begin
+ strategy.find_versions(url, livecheck_regex, cask: cask, &livecheck.strategy_block)
+ rescue ArgumentError => e
+ raise unless e.message.include?("unknown keyword: cask")
+
+ odeprecated "`def self.find_versions` in `#{strategy}` without a `cask` parameter"
+ strategy.find_versions(url, livecheck_regex, &livecheck.strategy_block)
+ end
match_version_map = strategy_data[:matches]
regex = strategy_data[:regex]
messages = strategy_data[:messages]
@@ -559,7 +563,9 @@ def latest_version(formula_or_cask, json: false, full_name: false, verbose: fals
end
end
- if debug && match_version_map.present?
+ next if match_version_map.blank?
+
+ if debug
puts
puts "Matched Versions:"
@@ -572,8 +578,6 @@ def latest_version(formula_or_cask, json: false, full_name: false, verbose: fals
end
end
- next if match_version_map.blank?
-
version_info = {
latest: Version.new(match_version_map.values.max_by { |v| LivecheckVersion.create(formula_or_cask, v) }),
} | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy.rb | @@ -148,6 +148,7 @@ def self.page_content(url)
require_relative "strategy/bitbucket"
require_relative "strategy/cpan"
require_relative "strategy/electron_builder"
+require_relative "strategy/extract_plist"
require_relative "strategy/git"
require_relative "strategy/github_latest"
require_relative "strategy/gnome" | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/apache.rb | @@ -21,6 +21,8 @@ module Strategy
#
# @api public
class Apache
+ extend T::Sig
+
# The `Regexp` used to determine if the strategy applies to the URL.
URL_MATCH_REGEX = %r{
^https?://www\.apache\.org
@@ -45,7 +47,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
@@ -60,7 +70,7 @@ def self.find_versions(url, regex = nil, &block)
# * `/href=["']?example-v?(\d+(?:\.\d+)+)-bin\.zip/i`
regex ||= /href=["']?#{Regexp.escape(match[:prefix])}v?(\d+(?:\.\d+)+)#{Regexp.escape(suffix)}/i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/bitbucket.rb | @@ -28,6 +28,8 @@ module Strategy
#
# @api public
class Bitbucket
+ extend T::Sig
+
# The `Regexp` used to determine if the strategy applies to the URL.
URL_MATCH_REGEX = %r{
^https?://bitbucket\.org
@@ -52,7 +54,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
@@ -71,7 +81,7 @@ def self.find_versions(url, regex = nil, &block)
# * `/href=.*?example-v?(\d+(?:\.\d+)+)\.t/i`
regex ||= /href=.*?#{Regexp.escape(match[:prefix])}v?(\d+(?:\.\d+)+)#{Regexp.escape(suffix)}/i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/cpan.rb | @@ -18,6 +18,8 @@ module Strategy
#
# @api public
class Cpan
+ extend T::Sig
+
NICE_NAME = "CPAN"
# The `Regexp` used to determine if the strategy applies to the URL.
@@ -43,7 +45,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
@@ -55,7 +65,7 @@ def self.find_versions(url, regex = nil, &block)
# Example regex: `/href=.*?Brew[._-]v?(\d+(?:\.\d+)*)\.t/i`
regex ||= /href=.*?#{match[:prefix]}[._-]v?(\d+(?:\.\d+)*)#{Regexp.escape(suffix)}/i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/electron_builder.rb | @@ -64,10 +64,11 @@ def self.version_from_content(content, &block)
params(
url: String,
regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
block: T.nilable(T.proc.params(arg0: Hash).returns(String)),
).returns(T::Hash[Symbol, T.untyped])
}
- def self.find_versions(url, regex = nil, &block)
+ def self.find_versions(url, regex, cask: nil, &block)
raise ArgumentError, "The #{T.must(name).demodulize} strategy does not support a regex." if regex
match_data = { matches: {}, regex: regex, url: url } | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/extract_plist.rb | @@ -0,0 +1,91 @@
+# typed: true
+# frozen_string_literal: true
+
+require "bundle_version"
+require "unversioned_cask_checker"
+require_relative "page_match"
+
+module Homebrew
+ module Livecheck
+ module Strategy
+ # The {ExtractPlist} strategy downloads the file at a URL and
+ # extracts versions from contained `.plist` files.
+ #
+ # @api private
+ class ExtractPlist
+ extend T::Sig
+
+ # A priority of zero causes livecheck to skip the strategy. We only
+ # apply {ExtractPlist} using `strategy :extract_plist` in a `livecheck` block,
+ # as we can't automatically determine when this can be successfully
+ # applied to a URL without fetching the content.
+ PRIORITY = 0
+
+ # The `Regexp` used to determine if the strategy applies to the URL.
+ URL_MATCH_REGEX = %r{^https?://}i.freeze
+
+ # Whether the strategy can be applied to the provided URL.
+ # The strategy will technically match any HTTP URL but is
+ # only usable with a `livecheck` block containing a regex
+ # or block.
+ sig { params(url: String).returns(T::Boolean) }
+ def self.match?(url)
+ URL_MATCH_REGEX.match?(url)
+ end
+
+ # @api private
+ Item = Struct.new(
+ # @api private
+ :bundle_version,
+ keyword_init: true,
+ ) do
+ extend T::Sig
+
+ extend Forwardable
+
+ # @api public
+ delegate version: :bundle_version
+
+ # @api public
+ delegate short_version: :bundle_version
+ end
+
+ # Checks the content at the URL for new versions.
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: Cask::Cask,
+ block: T.nilable(T.proc.params(arg0: T::Hash[String, Item]).returns(String)),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask:, &block)
+ raise ArgumentError, "The #{T.must(name).demodulize} strategy does not support a regex." if regex
+ raise ArgumentError, "The #{T.must(name).demodulize} strategy only supports casks." unless T.unsafe(cask)
+
+ match_data = { matches: {}, regex: regex, url: url }
+
+ unversioned_cask_checker = UnversionedCaskChecker.new(cask)
+ versions = unversioned_cask_checker.all_versions.transform_values { |v| Item.new(bundle_version: v) }
+
+ if block
+ match = block.call(versions)
+
+ unless T.unsafe(match).is_a?(String)
+ raise TypeError, "Return value of `strategy :extract_plist` block must be a string."
+ end
+
+ match_data[:matches][match] = Version.new(match) if match
+ elsif versions.any?
+ versions.each_value do |item|
+ version = item.bundle_version.nice_version
+ match_data[:matches][version] = Version.new(version)
+ end
+ end
+
+ match_data
+ end
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/git.rb | @@ -24,6 +24,8 @@ module Strategy
#
# @api public
class Git
+ extend T::Sig
+
# The priority of the strategy on an informal scale of 1 to 10 (from
# lowest to highest).
PRIORITY = 8
@@ -74,7 +76,16 @@ def self.match?(url)
# @param url [String] the URL of the Git repository to check
# @param regex [Regexp] the regex to use for matching versions
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: T::Array[String])
+ .returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match_data = { matches: {}, regex: regex, url: url }
tags_data = tag_info(url, regex) | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/github_latest.rb | @@ -32,6 +32,8 @@ module Strategy
#
# @api public
class GithubLatest
+ extend T::Sig
+
NICE_NAME = "GitHub - Latest"
# A priority of zero causes livecheck to skip the strategy. We do this
@@ -60,7 +62,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.sub(/\.git$/i, "").match(URL_MATCH_REGEX)
# Example URL: `https://github.com/example/example/releases/latest`
@@ -69,7 +79,7 @@ def self.find_versions(url, regex = nil, &block)
# The default regex is the same for all URLs using this strategy
regex ||= %r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/gnome.rb | @@ -17,6 +17,8 @@ module Strategy
#
# @api public
class Gnome
+ extend T::Sig
+
NICE_NAME = "GNOME"
# The `Regexp` used to determine if the strategy applies to the URL.
@@ -40,7 +42,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
page_url = "https://download.gnome.org/sources/#{match[:package_name]}/cache.json"
@@ -57,7 +67,7 @@ def self.find_versions(url, regex = nil, &block)
# Example regex: `/example-(\d+\.([0-8]\d*?)?[02468](?:\.\d+)*?)\.t/i`
regex ||= /#{Regexp.escape(match[:package_name])}-(\d+\.([0-8]\d*?)?[02468](?:\.\d+)*?)\.t/i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/gnu.rb | @@ -29,6 +29,8 @@ module Strategy
#
# @api public
class Gnu
+ extend T::Sig
+
NICE_NAME = "GNU"
# The `Regexp` used to determine if the strategy applies to the URL.
@@ -52,7 +54,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
# The directory listing page for the project's files
@@ -68,7 +78,7 @@ def self.find_versions(url, regex = nil, &block)
# Example regex: `%r{href=.*?example[._-]v?(\d+(?:\.\d+)*)(?:\.[a-z]+|/)}i`
regex ||= %r{href=.*?#{match[:project_name]}[._-]v?(\d+(?:\.\d+)*)(?:\.[a-z]+|/)}i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/hackage.rb | @@ -17,6 +17,8 @@ module Strategy
#
# @api public
class Hackage
+ extend T::Sig
+
# A `Regexp` used in determining if the strategy applies to the URL and
# also as part of extracting the package name from the URL basename.
PACKAGE_NAME_REGEX = /(?<package_name>.+?)-\d+/i.freeze
@@ -45,7 +47,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = File.basename(url).match(FILENAME_REGEX)
# A page containing a directory listing of the latest source tarball
@@ -54,7 +64,7 @@ def self.find_versions(url, regex = nil, &block)
# Example regex: `%r{<h3>example-(.*?)/?</h3>}i`
regex ||= %r{<h3>#{Regexp.escape(match[:package_name])}-(.*?)/?</h3>}i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/header_match.rb | @@ -35,8 +35,16 @@ def self.match?(url)
# Checks the final URL for new versions after following all redirections,
# using the provided regex for matching.
- sig { params(url: String, regex: T.nilable(Regexp)).returns(T::Hash[Symbol, T.untyped]) }
- def self.find_versions(url, regex, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: T::Hash[String, String])
+ .returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match_data = { matches: {}, regex: regex, url: url }
headers = Strategy.page_headers(url)
@@ -45,7 +53,7 @@ def self.find_versions(url, regex, &block)
merged_headers = headers.reduce(&:merge)
if block
- match = block.call(merged_headers, regex)
+ match = yield merged_headers, regex
else
match = nil
| true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/launchpad.rb | @@ -23,6 +23,8 @@ module Strategy
#
# @api public
class Launchpad
+ extend T::Sig
+
# The `Regexp` used to determine if the strategy applies to the URL.
URL_MATCH_REGEX = %r{
^https?://(?:[^/]+?\.)*launchpad\.net
@@ -43,7 +45,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
# The main page for the project on Launchpad
@@ -52,7 +62,7 @@ def self.find_versions(url, regex = nil, &block)
# The default regex is the same for all URLs using this strategy
regex ||= %r{class="[^"]*version[^"]*"[^>]*>\s*Latest version is (.+)\s*</}
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/npm.rb | @@ -17,6 +17,8 @@ module Strategy
#
# @api public
class Npm
+ extend T::Sig
+
NICE_NAME = "npm"
# The `Regexp` used to determine if the strategy applies to the URL.
@@ -39,7 +41,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
page_url = "https://www.npmjs.com/package/#{match[:package_name]}?activeTab=versions"
@@ -49,7 +59,7 @@ def self.find_versions(url, regex = nil, &block)
# * `%r{href=.*?/package/@example/example/v/(\d+(?:\.\d+)+)"}i`
regex ||= %r{href=.*?/package/#{Regexp.escape(match[:package_name])}/v/(\d+(?:\.\d+)+)"}i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/page_match.rb | @@ -81,11 +81,12 @@ def self.page_matches(content, regex, &block)
params(
url: String,
regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
provided_content: T.nilable(String),
block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
).returns(T::Hash[Symbol, T.untyped])
}
- def self.find_versions(url, regex, provided_content = nil, &block)
+ def self.find_versions(url, regex, cask: nil, provided_content: nil, &block)
match_data = { matches: {}, regex: regex, url: url }
content = if provided_content.is_a?(String) | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/pypi.rb | @@ -17,6 +17,8 @@ module Strategy
#
# @api public
class Pypi
+ extend T::Sig
+
NICE_NAME = "PyPI"
# The `Regexp` used to extract the package name and suffix (e.g., file
@@ -49,7 +51,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = File.basename(url).match(FILENAME_REGEX)
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
@@ -64,7 +74,7 @@ def self.find_versions(url, regex = nil, &block)
re_suffix = Regexp.escape(suffix)
regex ||= %r{href=.*?/packages.*?/#{re_package_name}[._-]v?(\d+(?:\.\d+)*(?:[._-]post\d+)?)#{re_suffix}}i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/sourceforge.rb | @@ -31,6 +31,8 @@ module Strategy
#
# @api public
class Sourceforge
+ extend T::Sig
+
NICE_NAME = "SourceForge"
# The `Regexp` used to determine if the strategy applies to the URL.
@@ -55,7 +57,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
match = url.match(URL_MATCH_REGEX)
page_url = "https://sourceforge.net/projects/#{match[:project_name]}/rss"
@@ -65,7 +75,7 @@ def self.find_versions(url, regex = nil, &block)
# create something that works for most URLs.
regex ||= %r{url=.*?/#{Regexp.escape(match[:project_name])}/files/.*?[-_/](\d+(?:[-.]\d+)+)[-_/%.]}i
- PageMatch.find_versions(page_url, regex, &block)
+ PageMatch.find_versions(page_url, regex, cask: cask, &block)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/sparkle.rb | @@ -32,12 +32,24 @@ def self.match?(url)
URL_MATCH_REGEX.match?(url)
end
- Item = Struct.new(:title, :url, :bundle_version, :short_version, :version, keyword_init: true) do
+ # @api private
+ Item = Struct.new(
+ # @api public
+ :title,
+ # @api public
+ :url,
+ # @api private
+ :bundle_version,
+ keyword_init: true,
+ ) do
extend T::Sig
extend Forwardable
+ # @api public
delegate version: :bundle_version
+
+ # @api public
delegate short_version: :bundle_version
end
@@ -74,8 +86,6 @@ def self.item_from_content(content)
title: title,
url: url,
bundle_version: bundle_version,
- short_version: bundle_version&.short_version,
- version: bundle_version&.version,
}.compact
Item.new(**data) unless data.empty?
@@ -85,8 +95,15 @@ def self.item_from_content(content)
end
# Checks the content at the URL for new versions.
- sig { params(url: String, regex: T.nilable(Regexp)).returns(T::Hash[Symbol, T.untyped]) }
- def self.find_versions(url, regex, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: Item).returns(String)),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
raise ArgumentError, "The #{T.must(name).demodulize} strategy does not support a regex." if regex
match_data = { matches: {}, regex: regex, url: url }
@@ -96,7 +113,13 @@ def self.find_versions(url, regex, &block)
if (item = item_from_content(content))
match = if block
- block.call(item)&.to_s
+ value = block.call(item)
+
+ unless T.unsafe(value).is_a?(String)
+ raise TypeError, "Return value of `strategy :sparkle` block must be a string."
+ end
+
+ value
else
item.bundle_version&.nice_version
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/livecheck/strategy/xorg.rb | @@ -38,6 +38,8 @@ module Strategy
#
# @api public
class Xorg
+ extend T::Sig
+
NICE_NAME = "X.Org"
# A `Regexp` used in determining if the strategy applies to the URL and
@@ -78,7 +80,15 @@ def self.match?(url)
# @param url [String] the URL of the content to check
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
- def self.find_versions(url, regex = nil, &block)
+ sig {
+ params(
+ url: String,
+ regex: T.nilable(Regexp),
+ cask: T.nilable(Cask::Cask),
+ block: T.nilable(T.proc.params(arg0: String).returns(T.any(T::Array[String], String))),
+ ).returns(T::Hash[Symbol, T.untyped])
+ }
+ def self.find_versions(url, regex, cask: nil, &block)
file_name = File.basename(url)
match = file_name.match(FILENAME_REGEX)
@@ -92,7 +102,7 @@ def self.find_versions(url, regex = nil, &block)
# Use the cached page content to avoid duplicate fetches
cached_content = @page_data[page_url]
- match_data = PageMatch.find_versions(page_url, regex, cached_content, &block)
+ match_data = PageMatch.find_versions(page_url, regex, provided_content: cached_content, cask: cask, &block)
# Cache any new page content
@page_data[page_url] = match_data[:content] if match_data[:content].present? | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/test/livecheck/strategy/page_match_spec.rb | @@ -79,7 +79,8 @@
describe "::find_versions?" do
it "finds versions in provided_content" do
- expect(page_match.find_versions(url, regex, page_content)).to eq(find_versions_cached_return_hash)
+ expect(page_match.find_versions(url, regex, provided_content: page_content))
+ .to eq(find_versions_cached_return_hash)
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/test/livecheck/strategy/sparkle_spec.rb | @@ -10,26 +10,13 @@
let(:appcast_data) {
{
- title: "Version 1.2.3",
- url: "https://www.example.com/example/example.tar.gz",
- bundle_version: Homebrew::BundleVersion.new("1.2.3", "1234"),
- short_version: "1.2.3",
- version: "1234",
+ title: "Version 1.2.3",
+ url: "https://www.example.com/example/example.tar.gz",
+ short_version: "1.2.3",
+ version: "1234",
}
}
- let(:appcast_item) {
- Homebrew::Livecheck::Strategy::Sparkle::Item.new(
- {
- title: appcast_data[:title],
- url: appcast_data[:url],
- bundle_version: appcast_data[:bundle_version],
- short_version: appcast_data[:bundle_version]&.short_version,
- version: appcast_data[:bundle_version]&.version,
- },
- )
- }
-
let(:appcast_xml) {
<<~EOS
<?xml version="1.0" encoding="utf-8"?>
@@ -65,10 +52,10 @@
it "returns an Item when given XML data" do
expect(item_from_appcast_xml).to be_a(Homebrew::Livecheck::Strategy::Sparkle::Item)
- expect(item_from_appcast_xml.title).to eq(appcast_item.title)
- expect(item_from_appcast_xml.url).to eq(appcast_item.url)
- expect(item_from_appcast_xml.bundle_version.short_version).to eq(appcast_item.bundle_version.short_version)
- expect(item_from_appcast_xml.bundle_version.version).to eq(appcast_item.bundle_version.version)
+ expect(item_from_appcast_xml.title).to eq(appcast_data[:title])
+ expect(item_from_appcast_xml.url).to eq(appcast_data[:url])
+ expect(item_from_appcast_xml.short_version).to eq(appcast_data[:short_version])
+ expect(item_from_appcast_xml.version).to eq(appcast_data[:version])
end
end
end | true |
Other | Homebrew | brew | a210b1a04ef52354c52ac3851582cc9ead805996.json | Add `extract_plist` strategy. | Library/Homebrew/unversioned_cask_checker.rb | @@ -60,6 +60,56 @@ def top_level_info_plists(paths)
end
end
+ sig { returns(T::Hash[String, BundleVersion]) }
+ def all_versions
+ versions = {}
+
+ parse_info_plist = proc do |info_plist_path|
+ plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
+
+ id = plist["CFBundleIdentifier"]
+ version = BundleVersion.from_info_plist_content(plist)
+
+ versions[id] = version if id && version
+ end
+
+ Dir.mktmpdir do |dir|
+ dir = Pathname(dir)
+
+ installer.extract_primary_container(to: dir)
+
+ info_plist_paths = apps.flat_map do |app|
+ top_level_info_plists(Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist")).sort
+ end
+
+ info_plist_paths.each(&parse_info_plist)
+
+ pkg_paths = pkgs.flat_map do |pkg|
+ Pathname.glob(dir/"**"/pkg.path.basename).sort
+ end
+
+ pkg_paths.each do |pkg_path|
+ Dir.mktmpdir do |extract_dir|
+ extract_dir = Pathname(extract_dir)
+ FileUtils.rmdir extract_dir
+
+ system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
+
+ top_level_info_plist_paths = top_level_info_plists(Pathname.glob(extract_dir/"**/Contents/Info.plist"))
+
+ top_level_info_plist_paths.each(&parse_info_plist)
+ ensure
+ Cask::Utils.gain_permissions_remove(extract_dir)
+ extract_dir.mkpath
+ end
+ end
+
+ nil
+ end
+
+ versions
+ end
+
sig { returns(T.nilable(String)) }
def guess_cask_version
if apps.empty? && pkgs.empty? | true |
Other | Homebrew | brew | 9476ba2d2f1dd60082e0a708f5683f678557e733.json | repair cache key and add restore key | .github/workflows/tests.yml | @@ -208,7 +208,8 @@ jobs:
uses: actions/cache@v1
with:
path: tests
- key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec
+ key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-${{ github.sha }}
+ restore-keys: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec
- name: Run brew tests
run: |
@@ -299,7 +300,8 @@ jobs:
uses: actions/cache@v1
with:
path: tests
- key: ${{ runner.os }}-parallel_runtime_rspec.log
+ key: ${{ runner.os }}-parallel_runtime_rspec-${{ github.sha }}
+ restore-keys: ${{ runner.os }}-parallel_runtime_rspec
- name: Run brew tests
run: brew tests --online --coverage | false |
Other | Homebrew | brew | 5cae3f409640c2afbb1f87eaf99e790aba735f35.json | dev-cmd/bottle: fix license output.
Don't output the complex license object but instead use the same format
we use for `Formula#to_hash`. | Library/Homebrew/dev-cmd/bottle.rb | @@ -532,7 +532,7 @@ def bottle_formula(f, args:)
"tap_git_revision" => tap_git_revision,
"tap_git_remote" => tap_git_remote,
"desc" => f.desc,
- "license" => f.license,
+ "license" => SPDX.license_expression_to_string(f.license),
"homepage" => f.homepage,
},
"bottle" => { | false |
Other | Homebrew | brew | 3c308aa031c81443f086a4f0ffb187ecbbefb175.json | create different tests log with each options | .github/workflows/tests.yml | @@ -207,9 +207,8 @@ jobs:
- name: Cache parallel tests log
uses: actions/cache@v1
with:
- path: tests/parallel_runtime_rspec.log
- key: ${{ runner.os }}-parallel_runtime_rspec.log
- restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log
+ path: tests
+ key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec
- name: Run brew tests
run: |
@@ -299,9 +298,8 @@ jobs:
- name: Cache parallel tests log
uses: actions/cache@v1
with:
- path: tests/parallel_runtime_rspec.log
+ path: tests
key: ${{ runner.os }}-parallel_runtime_rspec.log
- restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log
- name: Run brew tests
run: brew tests --online --coverage | true |
Other | Homebrew | brew | 3c308aa031c81443f086a4f0ffb187ecbbefb175.json | create different tests log with each options | Library/Homebrew/dev-cmd/tests.rb | @@ -98,10 +98,16 @@ def tests
Dir.glob("test/**/*_spec.rb")
end
+ parallel_rspec_log_name = "parallel_runtime_rspec"
+ parallel_rspec_log_name = "#{parallel_rspec_log_name}.no_compat" if args.no_compat?
+ parallel_rspec_log_name = "#{parallel_rspec_log_name}.generic" if args.generic?
+ parallel_rspec_log_name = "#{parallel_rspec_log_name}.online" if args.online?
+ parallel_rspec_log_name = "#{parallel_rspec_log_name}.log"
+
parallel_rspec_log_path = if ENV["CI"]
- "tests/parallel_runtime_rspec.log"
+ "tests/#{parallel_rspec_log_name}"
else
- "#{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log"
+ "#{HOMEBREW_CACHE}/#{parallel_rspec_log_name}"
end
parallel_args = if ENV["CI"] | true |
Other | Homebrew | brew | 229e035a3dbc3268683c9f045eb7a58c19f500f7.json | Update PAT regex | Library/Homebrew/utils/github/api.rb | @@ -21,7 +21,7 @@ module GitHub
#{ALL_SCOPES_URL}
#{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
EOS
- GITHUB_PAT_REGEX = /^(?:[a-f0-9]{40}|gp1_[A-Za-z0-9_]{40,255})$/.freeze
+ GITHUB_PERSONAL_ACCESS_TOKEN_REGEX = /^(?:[a-f0-9]{40}|ghp_\w{36,251})$/.freeze
# Helper functions to access the GitHub API.
#
@@ -128,7 +128,7 @@ def keychain_username_password
# Don't use passwords from the keychain unless they look like
# GitHub Personal Access Tokens:
# https://github.com/Homebrew/brew/issues/6862#issuecomment-572610344
- return unless GITHUB_PAT_REGEX.match?(github_password)
+ return unless GITHUB_PERSONAL_ACCESS_TOKEN_REGEX.match?(github_password)
github_password
rescue Errno::EPIPE | false |
Other | Homebrew | brew | 2852d9f0de7e49a138357b35f1f5c25e0607c15b.json | GHCR: Use reject to remove empty hash values | Library/Homebrew/github_packages.rb | @@ -206,8 +206,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
"org.opencontainers.image.url" => bottle_hash["formula"]["homepage"],
"org.opencontainers.image.vendor" => org,
"org.opencontainers.image.version" => version,
- }
- delete_blank_hash_values(formula_annotations_hash)
+ }.reject { |_, v| v.blank? }
manifests = bottle_hash["bottle"]["tags"].map do |bottle_tag, tag_hash|
local_file = tag_hash["local_filename"]
@@ -248,8 +247,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
architecture: architecture,
os: os,
"os.version" => os_version,
- }
- delete_blank_hash_values(platform_hash)
+ }.reject { |_, v| v.blank? }
tar_sha256 = Digest::SHA256.hexdigest(
Utils.safe_popen_read("gunzip", "--stdout", "--decompress", local_file),
@@ -268,17 +266,15 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
"sh.brew.bottle.digest" => tar_gz_sha256,
"sh.brew.bottle.glibc.version" => glibc_version,
"sh.brew.tab" => tab.to_json,
- }
- delete_blank_hash_values(descriptor_annotations_hash)
+ }.reject { |_, v| v.blank? }
annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
{
"org.opencontainers.image.created" => created_date,
"org.opencontainers.image.documentation" => documentation,
"org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
},
- ).sort.to_h
- delete_blank_hash_values(annotations_hash)
+ ).reject { |_, v| v.blank? }.sort.to_h
image_manifest = {
schemaVersion: 2,
@@ -386,10 +382,4 @@ def write_hash(directory, hash, filename = nil)
[sha256, json.size]
end
-
- def delete_blank_hash_values(hash)
- hash.each do |key, value|
- hash.delete(key) if value.blank?
- end
- end
end | false |
Other | Homebrew | brew | 6eebcf46f7222fed06f51775f0acc4cc69db00ce.json | workflows/tests: remove version comments
Dependabot doesn't bump them | .github/workflows/tests.yml | @@ -210,7 +210,7 @@ jobs:
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - uses: codecov/codecov-action@fcebab03f26c7530a22baa63f06b3e0515f0c7cd # v1.2.1
+ - uses: codecov/codecov-action@fcebab03f26c7530a22baa63f06b3e0515f0c7cd
test-default-formula-linux:
name: test default formula (Linux)
@@ -292,4 +292,4 @@ jobs:
- run: brew test-bot --only-formulae --test-default-formula
- - uses: codecov/codecov-action@fcebab03f26c7530a22baa63f06b3e0515f0c7cd # v1.2.1
+ - uses: codecov/codecov-action@fcebab03f26c7530a22baa63f06b3e0515f0c7cd | false |
Other | Homebrew | brew | 52335b5d5cc3abe0e49369243b17017ed4a398fc.json | Update RBI files for rubocop. | Library/Homebrew/sorbet/rbi/gems/rubocop@1.12.1.rbi | @@ -2180,6 +2180,8 @@ class RuboCop::Cop::Layout::EmptyLineAfterGuardClause < ::RuboCop::Cop::Base
def last_argument_is_heredoc?(node); end
def last_heredoc_argument(node); end
def next_line_empty?(line); end
+ def next_line_empty_or_enable_directive_comment?(line); end
+ def next_line_enable_directive_comment?(line); end
def next_line_rescue_or_ensure?(node); end
def next_sibling_empty_or_guard_clause?(node); end
def next_sibling_parent_empty_or_else?(node); end
@@ -3144,6 +3146,7 @@ class RuboCop::Cop::Layout::MultilineMethodCallIndentation < ::RuboCop::Cop::Bas
def receiver_alignment_base(node); end
def relative_to_receiver_message(rhs); end
def relevant_node?(send_node); end
+ def right_hand_side(send_node); end
def semantic_alignment_base(node, rhs); end
def semantic_alignment_node(node); end
def should_align_with_base?; end
@@ -3185,6 +3188,7 @@ class RuboCop::Cop::Layout::MultilineOperationIndentation < ::RuboCop::Cop::Base
def message(node, lhs, rhs); end
def offending_range(node, lhs, rhs, given_style); end
def relevant_node?(node); end
+ def right_hand_side(send_node); end
def should_align?(node, rhs, given_style); end
end
@@ -6206,8 +6210,6 @@ module RuboCop::Cop::MultilineExpressionIndentation
def part_of_assignment_rhs(node, candidate); end
def part_of_block_body?(candidate, block_node); end
def postfix_conditional?(node); end
- def regular_method_right_hand_side(send_node); end
- def right_hand_side(send_node); end
def valid_method_rhs_candidate?(candidate, node); end
def valid_rhs?(candidate, ancestor); end
def valid_rhs_candidate?(candidate, node); end
@@ -9301,6 +9303,7 @@ class RuboCop::Cop::Style::MultilineMethodSignature < ::RuboCop::Cop::Base
def correction_exceeds_max_line_length?(node); end
def definition_width(node); end
def indentation_width(node); end
+ def last_line_source_of_arguments(arguments); end
def max_line_length; end
def opening_line(node); end
end
@@ -10082,6 +10085,7 @@ class RuboCop::Cop::Style::RedundantBegin < ::RuboCop::Cop::Base
def empty_begin?(node); end
def register_offense(node); end
def replace_begin_with_statement(corrector, offense_range, node); end
+ def restore_removed_comments(corrector, offense_range, node, first_child); end
def valid_begin_assignment?(node); end
def valid_context_using_only_begin?(node); end
end
@@ -12123,6 +12127,7 @@ class RuboCop::DirectiveComment
def cop_names; end
def cops; end
def disabled?; end
+ def enabled?; end
def enabled_all?; end
def line_number; end
def match?(cop_names); end | false |
Other | Homebrew | brew | a28b419d9d465f5168ac25aaf2fde9059e152007.json | CurlGitHubPackagesDownloadStrategy: Fix 3rd party
Fix CurlGitHubPackagesDownloadStrategy for third party taps. | Library/Homebrew/software_spec.rb | @@ -306,9 +306,7 @@ def initialize(formula, spec)
filename = Filename.create(formula, tag, spec.rebuild).bintray
- # TODO: this will need adjusted when if we use GitHub Packages by default
- path, resolved_basename = if (bottle_domain = Homebrew::EnvConfig.bottle_domain.presence) &&
- bottle_domain.start_with?(GitHubPackages::URL_PREFIX)
+ path, resolved_basename = if spec.root_url.match?(GitHubPackages::URL_REGEX)
["#{@name}/blobs/sha256:#{checksum}", filename]
else
filename
@@ -443,13 +441,18 @@ def prefix=(prefix)
def root_url(var = nil, specs = {})
if var.nil?
- @root_url ||= if Homebrew::EnvConfig.bottle_domain.start_with?(GitHubPackages::URL_PREFIX)
+ @root_url ||= if Homebrew::EnvConfig.bottle_domain.match?(GitHubPackages::URL_REGEX)
GitHubPackages.root_url(tap.user, tap.repo).to_s
else
"#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}"
end
else
- @root_url = var
+ @root_url = if var.to_s.start_with? "docker://"
+ _, registry, org, repo = *var.match(%r{docker://([\w.-]+)/([\w-]+)/([\w-]+)})
+ GitHubPackages.root_url(org, repo, "https://#{registry}/v2/").to_s
+ else
+ var
+ end
@root_url_specs.merge!(specs)
end
end | false |
Other | Homebrew | brew | e627885e16b5ea2df0414ddc5dd6f5a44abe4d13.json | OCI: Move CPU variant to sh.brew.cpu.variant | Library/Homebrew/github_packages.rb | @@ -194,6 +194,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
created_date = bottle_hash["bottle"]["date"]
formula_annotations_hash = {
+ "com.github.package.type" => GITHUB_PACKAGE_TYPE,
"org.opencontainers.image.created" => created_date,
"org.opencontainers.image.description" => bottle_hash["formula"]["desc"],
"org.opencontainers.image.documentation" => documentation,
@@ -233,24 +234,17 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
raise TypeError, "unknown tab['built_on']['os']: #{tab["built_on"]["os"]}" if os.blank?
os_version = tab["built_on"]["os_version"] if tab["built_on"].present?
- os_version = case os
+ case os
when "darwin"
- os_version || "macOS #{MacOS::Version.from_symbol(bottle_tag)}"
+ os_version ||= "macOS #{MacOS::Version.from_symbol(bottle_tag)}"
when "linux"
- (os_version || "Ubuntu 16.04.7").delete_suffix " LTS"
- else
- os_version
- end
-
- glibc_version = if os == "linux"
- (tab["built_on"]["glibc_version"] if tab["built_on"].present?) || "2.23"
+ os_version = (os_version || "Ubuntu 16.04.7").delete_suffix " LTS"
+ glibc_version = (tab["built_on"]["glibc_version"] if tab["built_on"].present?) || "2.23"
+ cpu_variant = tab["oldest_cpu_family"] || "core2"
end
- variant = tab["oldest_cpu_family"] || "core2" if os == "linux"
-
platform_hash = {
architecture: architecture,
- variant: variant,
os: os,
"os.version" => os_version,
}.compact
@@ -265,15 +259,21 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
tag = GitHubPackages.version_rebuild(version, rebuild, bottle_tag)
- annotations_hash = formula_annotations_hash.merge({
- "org.opencontainers.image.created" => created_date,
- "org.opencontainers.image.documentation" => documentation,
- "org.opencontainers.image.ref.name" => tag,
- "org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
- "com.github.package.type" => GITHUB_PACKAGE_TYPE,
- "sh.brew.bottle.glibc.version" => glibc_version,
- "sh.brew.tab" => tab.to_json,
- }).compact.sort.to_h
+ descriptor_annotations_hash = {
+ "org.opencontainers.image.ref.name" => tag,
+ "sh.brew.bottle.cpu.variant" => cpu_variant,
+ "sh.brew.bottle.digest" => tar_gz_sha256,
+ "sh.brew.bottle.glibc.version" => glibc_version,
+ "sh.brew.tab" => tab.to_json,
+ }.compact
+
+ annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
+ {
+ "org.opencontainers.image.created" => created_date,
+ "org.opencontainers.image.documentation" => documentation,
+ "org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
+ },
+ ).compact.sort.to_h
image_manifest = {
schemaVersion: 2,
@@ -300,12 +300,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
digest: "sha256:#{manifest_json_sha256}",
size: manifest_json_size,
platform: platform_hash,
- annotations: {
- "org.opencontainers.image.ref.name" => tag,
- "sh.brew.bottle.digest" => tar_gz_sha256,
- "sh.brew.bottle.glibc.version" => glibc_version,
- "sh.brew.tab" => tab.to_json,
- }.compact,
+ annotations: descriptor_annotations_hash,
}
end
| false |
Other | Homebrew | brew | c25b33a454d078e8b30b1b4c5c3d1ba43561733a.json | sorbet: Update RBI files.
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -6252,6 +6252,10 @@ module CopHelper
extend ::RSpec::Its
end
+class CurlDownloadStrategy
+ include ::AbstractDownloadStrategy::Compat_Fetch
+end
+
class CxxStdlib
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks | false |
Other | Homebrew | brew | f35baa27522997712b6c1a45ef19793ad839b6f9.json | OCI: Add sh.brew.tab to the image manifest
The tab is needed to install the package using
the SHA-256 of the single-architecture image. | Library/Homebrew/github_packages.rb | @@ -272,6 +272,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
"org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
"com.github.package.type" => GITHUB_PACKAGE_TYPE,
"sh.brew.bottle.glibc.version" => glibc_version,
+ "sh.brew.tab" => tab.to_json,
}).compact.sort.to_h
image_manifest = { | false |
Other | Homebrew | brew | ab04cfed831cf82232f4c1d815ada5f112133a71.json | Improve `_fetch` compatibility layer. | Library/Homebrew/compat/early/download_strategy.rb | @@ -2,21 +2,41 @@
# frozen_string_literal: true
class AbstractDownloadStrategy
- module Compat
+ module CompatFetch
def fetch(timeout: nil)
super()
end
end
+ module Compat_Fetch # rubocop:disable Naming/ClassAndModuleCamelCase
+ def _fetch(*args, **options)
+ options[:timeout] = nil unless options.key?(:timeout)
+
+ begin
+ super
+ rescue ArgumentError => e
+ raise unless e.message.include?("timeout")
+
+ odeprecated "`def _fetch` in a subclass of `CurlDownloadStrategy`"
+ options.delete(:timeout)
+ super(*args, **options)
+ end
+ end
+ end
+
class << self
def method_added(method)
if method == :fetch && instance_method(method).arity.zero?
- odeprecated "`def fetch` in a subclass of #{self}",
+ odeprecated "`def fetch` in a subclass of `#{self}`",
"`def fetch(timeout: nil, **options)` and output a warning " \
"when `options` contains new unhandled options"
class_eval do
- prepend Compat
+ prepend CompatFetch
+ end
+ elsif method == :_fetch
+ class_eval do
+ prepend Compat_Fetch
end
end
| true |
Other | Homebrew | brew | ab04cfed831cf82232f4c1d815ada5f112133a71.json | Improve `_fetch` compatibility layer. | Library/Homebrew/compat/late.rb | @@ -1,4 +1,2 @@
# typed: strict
# frozen_string_literal: true
-
-require_relative "late/download_strategy" | true |
Other | Homebrew | brew | ab04cfed831cf82232f4c1d815ada5f112133a71.json | Improve `_fetch` compatibility layer. | Library/Homebrew/compat/late/download_strategy.rb | @@ -1,20 +0,0 @@
-# typed: false
-# frozen_string_literal: true
-
-class CurlDownloadStrategy
- module Compat
- def _fetch(*args, **options)
- unless options.key?(:timeout)
- odeprecated "#{self.class}#_fetch"
- options[:timeout] = nil
- end
- super(*args, **options)
- end
- end
-
- prepend Compat
-end
-
-class CurlPostDownloadStrategy
- prepend Compat
-end | true |
Other | Homebrew | brew | 7fbe08e857b46402f57b1eefa92f7f52cfb92276.json | add a directory for test log | .github/workflows/tests.yml | @@ -201,6 +201,9 @@ jobs:
- name: Install Bundler RubyGems
run: brew install-bundler-gems
+ - name: Create parallel test log
+ run: mkdir tests
+
- name: Run brew tests
run: |
# brew tests doesn't like world writable directories
@@ -215,7 +218,7 @@ jobs:
- name: Cache parallel tests log
uses: actions/cache@v1
with:
- path: parallel_runtime_rspec.log
+ path: tests/parallel_runtime_rspec.log
key: ${{ runner.os }}-parallel_runtime_rspec.log
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log
| true |
Other | Homebrew | brew | 7fbe08e857b46402f57b1eefa92f7f52cfb92276.json | add a directory for test log | Library/Homebrew/dev-cmd/tests.rb | @@ -98,8 +98,8 @@ def tests
Dir.glob("test/**/*_spec.rb")
end
- parallel_rspec_log_path =if ENV["CI"]
- "parallel_runtime_rspec.log"
+ parallel_rspec_log_path = if ENV["CI"]
+ "tests/parallel_runtime_rspec.log"
else
"#{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log"
end | true |
Other | Homebrew | brew | 7f5a97d1f3674c889d2d62c03e5b4e558d2ad771.json | change directory for log | .github/workflows/tests.yml | @@ -204,7 +204,7 @@ jobs:
- name: Cache parallel tests log
uses: actions/cache@v1
with:
- path: /tests/parallel_runtime_rspec.log
+ path: /tmp/parallel_runtime_rspec.log
key: ${{ runner.os }}-parallel_runtime_rspec-${{ hashFiles('**/parallel_runtime_rspec.log') }}
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log
| true |
Other | Homebrew | brew | 7f5a97d1f3674c889d2d62c03e5b4e558d2ad771.json | change directory for log | Library/Homebrew/dev-cmd/tests.rb | @@ -99,7 +99,7 @@ def tests
end
parallel_rspec_log_path =if ENV["CI"]
- "/tests/parallel_runtime_rspec.log"
+ "/tmp/parallel_runtime_rspec.log"
else
"#{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log"
end | true |
Other | Homebrew | brew | 72a79d934e9c52a8468a6eab4708f36228fff2c6.json | Fix audit annotations for casks. | Library/Homebrew/cask/audit.rb | @@ -96,15 +96,15 @@ def warnings
@warnings ||= []
end
- def add_error(message)
- errors << message
+ def add_error(message, location: nil)
+ errors << ({ message: message, location: location })
end
- def add_warning(message)
+ def add_warning(message, location: nil)
if strict?
- add_error message
+ add_error message, location: location
else
- warnings << message
+ warnings << ({ message: message, location: location })
end
end
@@ -134,12 +134,12 @@ def summary(include_passed: false, include_warnings: true)
summary = ["audit for #{cask}: #{result}"]
errors.each do |error|
- summary << " #{Formatter.error("-")} #{error}"
+ summary << " #{Formatter.error("-")} #{error[:message]}"
end
if include_warnings
warnings.each do |warning|
- summary << " #{Formatter.warning("-")} #{warning}"
+ summary << " #{Formatter.warning("-")} #{warning[:message]}"
end
end
| true |
Other | Homebrew | brew | 72a79d934e9c52a8468a6eab4708f36228fff2c6.json | Fix audit annotations for casks. | Library/Homebrew/cask/cmd/audit.rb | @@ -59,8 +59,6 @@ def run
display_failures_only: args.display_failures_only?,
)
- self.class.print_annotations(results)
-
failed_casks = results.reject { |_, result| result[:errors].empty? }.map(&:first)
return if failed_casks.empty?
@@ -103,23 +101,9 @@ def self.audit_casks(
casks.map do |cask|
odebug "Auditing Cask #{cask}"
- [cask, Auditor.audit(cask, **options)]
+ [cask.sourcefile_path, Auditor.audit(cask, **options)]
end.to_h
end
-
- def self.print_annotations(results)
- return unless ENV["GITHUB_ACTIONS"]
-
- results.each do |cask, result|
- cask_path = cask.sourcefile_path
- annotations = (result[:warnings].map { |w| [:warning, w] } + result[:errors].map { |e| [:error, e] })
- .map { |type, message| GitHub::Actions::Annotation.new(type, message, file: cask_path) }
-
- annotations.each do |annotation|
- puts annotation if annotation.relevant?
- end
- end
- end
end
end
end | true |
Other | Homebrew | brew | 72a79d934e9c52a8468a6eab4708f36228fff2c6.json | Fix audit annotations for casks. | Library/Homebrew/dev-cmd/audit.rb | @@ -166,7 +166,7 @@ def audit
spdx_license_data = SPDX.license_data
spdx_exception_data = SPDX.exception_data
new_formula_problem_lines = []
- audit_formulae.sort.each do |f|
+ formula_results = audit_formulae.sort.map do |f|
only = only_cops ? ["style"] : args.only
options = {
new_formula: new_formula,
@@ -184,31 +184,25 @@ def audit
fa = FormulaAuditor.new(f, **options)
fa.audit
- next if fa.problems.empty? && fa.new_formula_problems.empty?
-
- formula_count += 1
- problem_count += fa.problems.size
- problem_lines = format_problem_lines(fa.problems)
- corrected_problem_count += options.fetch(:style_offenses, []).count(&:corrected?)
- new_formula_problem_lines += format_problem_lines(fa.new_formula_problems)
- if args.display_filename?
- puts problem_lines.map { |s| "#{f.path}: #{s}" }
- else
- puts "#{f.full_name}:", problem_lines.map { |s| " #{s}" }
- end
-
- next unless ENV["GITHUB_ACTIONS"]
- (fa.problems + fa.new_formula_problems).each do |message:, location:|
- annotation = GitHub::Actions::Annotation.new(
- :error, message, file: f.path, line: location&.line, column: location&.column
- )
- puts annotation if annotation.relevant?
+ if fa.problems.any? || fa.new_formula_problems.any?
+ formula_count += 1
+ problem_count += fa.problems.size
+ problem_lines = format_problem_lines(fa.problems)
+ corrected_problem_count += options.fetch(:style_offenses, []).count(&:corrected?)
+ new_formula_problem_lines += format_problem_lines(fa.new_formula_problems)
+ if args.display_filename?
+ puts problem_lines.map { |s| "#{f.path}: #{s}" }
+ else
+ puts "#{f.full_name}:", problem_lines.map { |s| " #{s}" }
+ end
end
- end
- casks_results = if audit_casks.empty?
- []
+ [f.path, { errors: fa.problems + fa.new_formula_problems, warnings: [] }]
+ end.to_h
+
+ cask_results = if audit_casks.empty?
+ {}
else
require "cask/cmd/audit"
@@ -228,33 +222,55 @@ def audit
)
end
- failed_casks = casks_results.reject { |_, result| result[:errors].empty? }
+ failed_casks = cask_results.reject { |_, result| result[:errors].empty? }
cask_count = failed_casks.count
cask_problem_count = failed_casks.sum { |_, result| result[:warnings].count + result[:errors].count }
new_formula_problem_count += new_formula_problem_lines.count
total_problems_count = problem_count + new_formula_problem_count + cask_problem_count + tap_problem_count
- return unless total_problems_count.positive?
- puts new_formula_problem_lines.map { |s| " #{s}" }
+ if total_problems_count.positive?
+ puts new_formula_problem_lines.map { |s| " #{s}" }
+
+ errors_summary = "#{total_problems_count} #{"problem".pluralize(total_problems_count)}"
- errors_summary = "#{total_problems_count} #{"problem".pluralize(total_problems_count)}"
+ error_sources = []
+ error_sources << "#{formula_count} #{"formula".pluralize(formula_count)}" if formula_count.positive?
+ error_sources << "#{cask_count} #{"cask".pluralize(cask_count)}" if cask_count.positive?
+ error_sources << "#{tap_count} #{"tap".pluralize(tap_count)}" if tap_count.positive?
- error_sources = []
- error_sources << "#{formula_count} #{"formula".pluralize(formula_count)}" if formula_count.positive?
- error_sources << "#{cask_count} #{"cask".pluralize(cask_count)}" if cask_count.positive?
- error_sources << "#{tap_count} #{"tap".pluralize(tap_count)}" if tap_count.positive?
+ errors_summary += " in #{error_sources.to_sentence}" if error_sources.any?
- errors_summary += " in #{error_sources.to_sentence}" if error_sources.any?
+ errors_summary += " detected"
- errors_summary += " detected"
+ if corrected_problem_count.positive?
+ errors_summary += ", #{corrected_problem_count} #{"problem".pluralize(corrected_problem_count)} corrected"
+ end
+
+ ofail errors_summary
+ end
- if corrected_problem_count.positive?
- errors_summary += ", #{corrected_problem_count} #{"problem".pluralize(corrected_problem_count)} corrected"
+ return unless ENV["GITHUB_ACTIONS"]
+
+ annotations = formula_results.merge(cask_results).flat_map do |path, result|
+ (
+ result[:warnings].map { |w| [:warning, w] } +
+ result[:errors].map { |e| [:error, e] }
+ ).map do |type, problem|
+ GitHub::Actions::Annotation.new(
+ type,
+ problem[:message],
+ file: path,
+ line: problem[:location]&.line,
+ column: problem[:location]&.column,
+ )
+ end
end
- ofail errors_summary
+ annotations.each do |annotation|
+ puts annotation if annotation.relevant?
+ end
end
def format_problem_lines(problems) | true |
Other | Homebrew | brew | 72a79d934e9c52a8468a6eab4708f36228fff2c6.json | Fix audit annotations for casks. | Library/Homebrew/test/cask/audit_spec.rb | @@ -4,11 +4,11 @@
require "cask/audit"
describe Cask::Audit, :cask do
- def include_msg?(messages, msg)
+ def include_msg?(problems, msg)
if msg.is_a?(Regexp)
- Array(messages).any? { |m| m =~ msg }
+ Array(problems).any? { |problem| problem[:message] =~ msg }
else
- Array(messages).include?(msg)
+ Array(problems).any? { |problem| problem[:message] == msg }
end
end
| true |
Other | Homebrew | brew | 244cacf1c4593d47a3d27a46b9a91ade161ae557.json | github_packages: Add platform.variant on Linux only | Library/Homebrew/github_packages.rb | @@ -246,24 +246,14 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
(tab["built_on"]["glibc_version"] if tab["built_on"].present?) || "2.23"
end
- variant = if architecture == "arm64"
- "v8"
- elsif tab["oldest_cpu_family"]
- tab["oldest_cpu_family"]
- elsif architecture == "amd64"
- if os == "darwin"
- Hardware.oldest_cpu(OS::Mac::Version.new(os_version[/macOS ([0-9]+\.[0-9]+)/, 1])).to_s
- else
- "core2"
- end
- end
+ variant = tab["oldest_cpu_family"] || "core2" if os == "linux"
platform_hash = {
architecture: architecture,
variant: variant,
os: os,
"os.version" => os_version,
- }
+ }.compact
tar_sha256 = Digest::SHA256.hexdigest(
Utils.safe_popen_read("gunzip", "--stdout", "--decompress", local_file),
) | false |
Other | Homebrew | brew | 2b7824f7de4a5587112226edb466deabd04ba30a.json | github_packages: Use hash compact | Library/Homebrew/github_packages.rb | @@ -205,10 +205,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
"org.opencontainers.image.url" => bottle_hash["formula"]["homepage"],
"org.opencontainers.image.vendor" => org,
"org.opencontainers.image.version" => version,
- }
- formula_annotations_hash.each do |key, value|
- formula_annotations_hash.delete(key) if value.blank?
- end
+ }.compact
manifests = bottle_hash["bottle"]["tags"].map do |bottle_tag, tag_hash|
local_file = tag_hash["local_filename"]
@@ -272,10 +269,7 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
"org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
"com.github.package.type" => GITHUB_PACKAGE_TYPE,
"sh.brew.bottle.glibc.version" => glibc_version,
- }).sort.to_h
- annotations_hash.each do |key, value|
- annotations_hash.delete(key) if value.blank?
- end
+ }).compact.sort.to_h
image_manifest = {
schemaVersion: 2, | false |
Other | Homebrew | brew | 82a787fdc7408228288a06a94a4715da83d03dfd.json | sorbet: Update RBI files.
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -532,14 +532,6 @@ class ActiveSupport::CurrentAttributes
def _reset_callbacks(); end
def _run_reset_callbacks(&block); end
-
- def attributes(); end
-
- def attributes=(attributes); end
-
- def reset(); end
-
- def set(set_attributes); end
end
class ActiveSupport::CurrentAttributes
@@ -561,17 +553,9 @@ class ActiveSupport::CurrentAttributes
def self.before_reset(&block); end
- def self.clear_all(); end
-
def self.instance(); end
- def self.reset(*args, &block); end
-
- def self.reset_all(); end
-
def self.resets(&block); end
-
- def self.set(*args, &block); end
end
module ActiveSupport::Dependencies
@@ -2928,99 +2912,12 @@ end
class Bootsnap::CompileCache::Error
end
-module Bootsnap::CompileCache::ISeq
-end
-
-module Bootsnap::CompileCache::ISeq::InstructionSequenceMixin
- def compile_option=(hash); end
-
- def load_iseq(path); end
-end
-
-module Bootsnap::CompileCache::ISeq::InstructionSequenceMixin
-end
-
-module Bootsnap::CompileCache::ISeq
- def self.cache_dir(); end
-
- def self.cache_dir=(cache_dir); end
-
- def self.compile_option_updated(); end
-
- def self.fetch(path, cache_dir: T.unsafe(nil)); end
-
- def self.input_to_output(_data, _kwargs); end
-
- def self.input_to_storage(_, path); end
-
- def self.install!(cache_dir); end
-
- def self.precompile(path, cache_dir: T.unsafe(nil)); end
-
- def self.storage_to_output(binary, _args); end
-end
-
-module Bootsnap::CompileCache::Native
-end
-
-module Bootsnap::CompileCache::Native
- def self.compile_option_crc32=(compile_option_crc32); end
-
- def self.coverage_running?(); end
-
- def self.fetch(_, _1, _2, _3); end
-
- def self.precompile(_, _1, _2); end
-end
-
class Bootsnap::CompileCache::PermissionError
end
class Bootsnap::CompileCache::PermissionError
end
-class Bootsnap::CompileCache::Uncompilable
-end
-
-class Bootsnap::CompileCache::Uncompilable
-end
-
-module Bootsnap::CompileCache::YAML
-end
-
-module Bootsnap::CompileCache::YAML::Patch
- def load_file(path, *args); end
-end
-
-module Bootsnap::CompileCache::YAML::Patch
-end
-
-module Bootsnap::CompileCache::YAML
- def self.cache_dir(); end
-
- def self.cache_dir=(cache_dir); end
-
- def self.init!(); end
-
- def self.input_to_output(data, kwargs); end
-
- def self.input_to_storage(contents, _); end
-
- def self.install!(cache_dir); end
-
- def self.msgpack_factory(); end
-
- def self.msgpack_factory=(msgpack_factory); end
-
- def self.precompile(path, cache_dir: T.unsafe(nil)); end
-
- def self.storage_to_output(data, kwargs); end
-
- def self.supported_options(); end
-
- def self.supported_options=(supported_options); end
-end
-
module Bootsnap::CompileCache
def self.permission_error(path); end
@@ -3151,13 +3048,6 @@ module Bootsnap::LoadPathCache::ChangeObserver
def self.register(observer, arr); end
end
-module Bootsnap::LoadPathCache::CoreExt
-end
-
-module Bootsnap::LoadPathCache::CoreExt
- def self.make_load_error(path); end
-end
-
class Bootsnap::LoadPathCache::FallbackScan
end
@@ -5782,15 +5672,6 @@ module Cask::Caskroom
extend ::T::Private::Methods::SingletonMethodHooks
end
-class Cask::Cmd::AbstractCommand
- include ::Homebrew::Search::Extension
-end
-
-class Cask::Cmd::AbstractCommand
- extend ::T::Private::Methods::MethodHooks
- extend ::T::Private::Methods::SingletonMethodHooks
-end
-
class Cask::Config
def appdir(); end
@@ -7164,6 +7045,8 @@ end
class Errno::EBADRPC
end
+Errno::ECAPMODE = Errno::NOERROR
+
Errno::EDEADLOCK = Errno::NOERROR
class Errno::EDEVERR
@@ -7184,6 +7067,13 @@ end
Errno::EIPSEC = Errno::NOERROR
+class Errno::ELAST
+ Errno = ::T.let(nil, ::T.untyped)
+end
+
+class Errno::ELAST
+end
+
class Errno::ENEEDAUTH
Errno = ::T.let(nil, ::T.untyped)
end
@@ -7205,6 +7095,8 @@ end
class Errno::ENOPOLICY
end
+Errno::ENOTCAPABLE = Errno::NOERROR
+
class Errno::ENOTSUP
Errno = ::T.let(nil, ::T.untyped)
end
@@ -7247,12 +7139,7 @@ end
class Errno::EPWROFF
end
-class Errno::EQFULL
- Errno = ::T.let(nil, ::T.untyped)
-end
-
-class Errno::EQFULL
-end
+Errno::EQFULL = Errno::ELAST
class Errno::ERPCMISMATCH
Errno = ::T.let(nil, ::T.untyped)
@@ -8452,14 +8339,6 @@ module Homebrew::Livecheck
extend ::T::Private::Methods::SingletonMethodHooks
end
-module Homebrew::MissingFormula
- extend ::T::Private::Methods::SingletonMethodHooks
-end
-
-module Homebrew::Search
- include ::Homebrew::Search::Extension
-end
-
module Homebrew::Settings
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
@@ -9534,8 +9413,6 @@ class IRB::DefaultEncodings
def external=(_); end
- def internal(); end
-
def internal=(_); end
end
@@ -9810,13 +9687,11 @@ module Kernel
extend ::T::Private::Methods::SingletonMethodHooks
def self.at_exit(); end
- def self.autoload(_, _1); end
-
def self.fork(); end
def self.gem(dep, *reqs); end
- def self.load(path, wrap=T.unsafe(nil)); end
+ def self.load(*_); end
def self.require(path); end
end
@@ -12126,8 +12001,6 @@ class Module
def anonymous?(); end
- def autoload_without_bootsnap(_, _1); end
-
def context(*a, &b); end
def deprecate(*method_names); end
@@ -12480,9 +12353,13 @@ end
Net::HTTPFatalErrorCode = Net::HTTPClientError
-Net::HTTPInformation::EXCEPTION_TYPE = Net::HTTPError
+class Net::HTTPInformation
+end
+
+Net::HTTPInformationCode::EXCEPTION_TYPE = Net::HTTPError
-Net::HTTPInformationCode = Net::HTTPInformation
+class Net::HTTPInformation
+end
class Net::HTTPLoopDetected
HAS_BODY = ::T.let(nil, ::T.untyped)
@@ -12542,9 +12419,13 @@ Net::HTTPServerErrorCode = Net::HTTPServerError
Net::HTTPSession = Net::HTTP
-Net::HTTPSuccess::EXCEPTION_TYPE = Net::HTTPError
+class Net::HTTPSuccess
+end
-Net::HTTPSuccessCode = Net::HTTPSuccess
+Net::HTTPSuccessCode::EXCEPTION_TYPE = Net::HTTPError
+
+class Net::HTTPSuccess
+end
class Net::HTTPURITooLong
HAS_BODY = ::T.let(nil, ::T.untyped)
@@ -12714,7 +12595,6 @@ class Object
def to_query(key); end
def to_yaml(options=T.unsafe(nil)); end
- APPLE_GEM_HOME = ::T.let(nil, ::T.untyped)
ARGF = ::T.let(nil, ::T.untyped)
ARGV = ::T.let(nil, ::T.untyped)
BUG_REPORTS_URL = ::T.let(nil, ::T.untyped)
@@ -12780,8 +12660,6 @@ class Object
RUBY_DESCRIPTION = ::T.let(nil, ::T.untyped)
RUBY_ENGINE = ::T.let(nil, ::T.untyped)
RUBY_ENGINE_VERSION = ::T.let(nil, ::T.untyped)
- RUBY_FRAMEWORK = ::T.let(nil, ::T.untyped)
- RUBY_FRAMEWORK_VERSION = ::T.let(nil, ::T.untyped)
RUBY_PATCHLEVEL = ::T.let(nil, ::T.untyped)
RUBY_PATH = ::T.let(nil, ::T.untyped)
RUBY_PLATFORM = ::T.let(nil, ::T.untyped)
@@ -12834,7 +12712,11 @@ class OpenSSL::KDF::KDFError
end
module OpenSSL::KDF
+ def self.hkdf(*_); end
+
def self.pbkdf2_hmac(*_); end
+
+ def self.scrypt(*_); end
end
class OpenSSL::OCSP::Request
@@ -12843,20 +12725,29 @@ end
OpenSSL::PKCS7::Signer = OpenSSL::PKCS7::SignerInfo
+class OpenSSL::PKey::EC
+ EXPLICIT_CURVE = ::T.let(nil, ::T.untyped)
+end
+
class OpenSSL::PKey::EC::Point
def to_octet_string(_); end
end
module OpenSSL::SSL
+ OP_ALLOW_NO_DHE_KEX = ::T.let(nil, ::T.untyped)
OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = ::T.let(nil, ::T.untyped)
OP_CRYPTOPRO_TLSEXT_BUG = ::T.let(nil, ::T.untyped)
OP_LEGACY_SERVER_CONNECT = ::T.let(nil, ::T.untyped)
+ OP_NO_ENCRYPT_THEN_MAC = ::T.let(nil, ::T.untyped)
+ OP_NO_RENEGOTIATION = ::T.let(nil, ::T.untyped)
+ OP_NO_TLSv1_3 = ::T.let(nil, ::T.untyped)
OP_SAFARI_ECDHE_ECDSA_BUG = ::T.let(nil, ::T.untyped)
OP_TLSEXT_PADDING = ::T.let(nil, ::T.untyped)
SSL2_VERSION = ::T.let(nil, ::T.untyped)
SSL3_VERSION = ::T.let(nil, ::T.untyped)
TLS1_1_VERSION = ::T.let(nil, ::T.untyped)
TLS1_2_VERSION = ::T.let(nil, ::T.untyped)
+ TLS1_3_VERSION = ::T.let(nil, ::T.untyped)
TLS1_VERSION = ::T.let(nil, ::T.untyped)
end
@@ -17188,8 +17079,6 @@ class Pry
def self.in_critical_section?(); end
- def self.init(); end
-
def self.initial_session?(); end
def self.initial_session_setup(); end
@@ -17268,7 +17157,6 @@ module Psych
end
module Psych
- extend ::Bootsnap::CompileCache::YAML::Patch
def self.add_builtin_type(type_tag, &block); end
def self.add_domain_type(domain, type_tag, &block); end
@@ -28035,10 +27923,6 @@ class RubyVM::AbstractSyntaxTree::Node
def pretty_print_children(q, names=T.unsafe(nil)); end
end
-class RubyVM::InstructionSequence
- extend ::Bootsnap::CompileCache::ISeq::InstructionSequenceMixin
-end
-
module RubyVM::MJIT
end
@@ -28931,7 +28815,6 @@ class Socket
IPV6_PATHMTU = ::T.let(nil, ::T.untyped)
IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped)
IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped)
- IP_DONTFRAG = ::T.let(nil, ::T.untyped)
IP_PORTRANGE = ::T.let(nil, ::T.untyped)
IP_RECVDSTADDR = ::T.let(nil, ::T.untyped)
IP_RECVIF = ::T.let(nil, ::T.untyped)
@@ -29023,7 +28906,6 @@ module Socket::Constants
IPV6_PATHMTU = ::T.let(nil, ::T.untyped)
IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped)
IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped)
- IP_DONTFRAG = ::T.let(nil, ::T.untyped)
IP_PORTRANGE = ::T.let(nil, ::T.untyped)
IP_RECVDSTADDR = ::T.let(nil, ::T.untyped)
IP_RECVIF = ::T.let(nil, ::T.untyped)
@@ -29934,10 +29816,6 @@ class Utils::Bottles::Collector
extend ::T::Private::Methods::SingletonMethodHooks
end
-module Utils::Bottles
- extend ::T::Private::Methods::SingletonMethodHooks
-end
-
module Utils::Inreplace
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks | false |
Other | Homebrew | brew | 695d44847a7b232dd57aa5728d5b030228339922.json | Adjust YARD config. | Library/Homebrew/.yardopts | @@ -7,6 +7,7 @@
--exclude test/
--exclude vendor/
--exclude compat/
+extend/os/**/*.rb
**/*.rb
-
*.md | true |
Other | Homebrew | brew | 695d44847a7b232dd57aa5728d5b030228339922.json | Adjust YARD config. | Library/Homebrew/README.md | @@ -1,6 +1,6 @@
# Homebrew Ruby API
-This is the public API for [Homebrew](https://github.com/Homebrew).
+This is the API for [Homebrew](https://github.com/Homebrew).
The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private.
| true |
Other | Homebrew | brew | 695d44847a7b232dd57aa5728d5b030228339922.json | Adjust YARD config. | Library/Homebrew/yard/templates/default/docstring/html/internal.erb | @@ -1,5 +1,5 @@
<p class="note private">
<strong>This <%= object.type %> is part of an internal API.</strong>
This <%= object.type %> may only be used internally in repositories owned by <a href="https://github.com/Homebrew">Homebrew</a>, except in casks or formulae.
- Third parties should avoid using this <%= object.type %> if possible, as it may be removed or be changed without warning.
+ Third parties should avoid using this <%= object.type %> if possible, as it may be removed or changed without warning.
</p> | true |
Other | Homebrew | brew | 695d44847a7b232dd57aa5728d5b030228339922.json | Adjust YARD config. | Library/Homebrew/yard/templates/default/docstring/html/private.erb | @@ -1,5 +1,5 @@
<p class="note private">
<strong>This <%= object.type %> is part of a private API.</strong>
This <%= object.type %> may only be used in the <a href="https://github.com/Homebrew/brew">Homebrew/brew</a> repository.
- Third parties should avoid using this <%= object.type %> if possible, as it may be removed or be changed without warning.
+ Third parties should avoid using this <%= object.type %> if possible, as it may be removed or changed without warning.
</p> | true |
Other | Homebrew | brew | 695d44847a7b232dd57aa5728d5b030228339922.json | Adjust YARD config. | Library/Homebrew/yard/templates/default/layout/html/footer.erb | @@ -0,0 +1,3 @@
+<div id="footer">
+ Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
+</div> | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | .gitignore | @@ -32,6 +32,9 @@
**/vendor/bundle/ruby/*/gems/*/*
**/vendor/bundle/ruby/*/specifications
+# Ignore YARD files
+**/.yardoc
+
# Unignore vendored gems
!**/vendor/bundle/ruby/*/gems/*/lib
!**/vendor/bundle/ruby/*/gems/rubocop-performance-*/config | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | .yardopts | @@ -1,10 +0,0 @@
---title "Homebrew"
---main Library/Homebrew/README.md
---markup markdown
---no-private
---exclude Library/Homebrew/test/
---exclude Library/Homebrew/vendor/
---exclude Library/Homebrew/compat/
-Library/Homebrew/**/*.rb
--
-*.md | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/.yardopts | @@ -0,0 +1,12 @@
+--title "Homebrew Ruby API"
+--main README.md
+--markup markdown
+--no-private
+--load yard/ignore_directives.rb
+--template-path yard/templates
+--exclude test/
+--exclude vendor/
+--exclude compat/
+**/*.rb
+-
+*.md | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/README.md | @@ -1,6 +1,6 @@
-# Homebrew's Formula API
+# Homebrew Ruby API
-This is the public API for Homebrew.
+This is the public API for [Homebrew](https://github.com/Homebrew).
The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private.
| true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/sorbet/rbi/todo.rbi | @@ -3,6 +3,8 @@
# typed: strong
module ::StackProf; end
+module ::YARD::Docstring; end
+module ::YARD::DocstringParser; end
module DependencyCollector::Compat; end
module GitHubPackages::JSONSchemer; end
module OS::Mac::Version::NULL; end | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/yard/ignore_directives.rb | @@ -0,0 +1,11 @@
+# typed: false
+# frozen_string_literal: true
+
+# from https://github.com/lsegal/yard/issues/484#issuecomment-442586899
+class IgnoreDirectiveDocstringParser < YARD::DocstringParser
+ def parse_content(content)
+ super(content&.sub(/(\A(typed|.*rubocop)|TODO):.*/m, ""))
+ end
+end
+
+YARD::Docstring.default_parser = IgnoreDirectiveDocstringParser | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/yard/templates/default/docstring/html/internal.erb | @@ -0,0 +1,5 @@
+<p class="note private">
+ <strong>This <%= object.type %> is part of an internal API.</strong>
+ This <%= object.type %> may only be used internally in repositories owned by <a href="https://github.com/Homebrew">Homebrew</a>, except in casks or formulae.
+ Third parties should avoid using this <%= object.type %> if possible, as it may be removed or be changed without warning.
+</p> | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/yard/templates/default/docstring/html/private.erb | @@ -0,0 +1,5 @@
+<p class="note private">
+ <strong>This <%= object.type %> is part of a private API.</strong>
+ This <%= object.type %> may only be used in the <a href="https://github.com/Homebrew/brew">Homebrew/brew</a> repository.
+ Third parties should avoid using this <%= object.type %> if possible, as it may be removed or be changed without warning.
+</p> | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/yard/templates/default/docstring/html/setup.rb | @@ -0,0 +1,14 @@
+# typed: false
+# frozen_string_literal: true
+
+def init
+ super
+
+ return if sections.empty?
+
+ sections[:index].place(:internal).before(:private)
+end
+
+def internal
+ erb(:internal) if object.has_tag?(:api) && object.tag(:api).text == "internal"
+end | true |
Other | Homebrew | brew | 7ada54886818ecadbd74aded0e3c9d6d2e63bc94.json | Move YARD config into `Library/Homebrew`. | Library/Homebrew/yard/templates/default/module/html/item_summary.erb | @@ -0,0 +1,39 @@
+
+<li class="<%= @item.visibility %> <%= @item.has_tag?(:deprecated) ? 'deprecated' : '' %>">
+ <span class="summary_signature">
+ <% if @item.tags(:overload).size == 1 %>
+ <%= signature(@item.tag(:overload), true, false, !@item.attr_info) %>
+ <% else %>
+ <%= signature(@item, true, false, !@item.attr_info) %>
+ <% end %>
+ <% if @item.aliases.size > 0 %>
+ (also: <%= @item.aliases.map {|o| h(o.name(true)) }.join(", ") %>)
+ <% end %>
+ </span>
+ <% if object != @item.namespace %>
+ <span class="note title not_defined_here">
+ <%= @item.namespace.type == :class ? 'inherited' : (@item.scope == :class ? 'extended' : 'included') %>
+ from <%= linkify @item, object.relative_path(@item.namespace) %>
+ </span>
+ <% end %>
+ <% if @item.constructor? %>
+ <span class="note title constructor">constructor</span>
+ <% end %>
+ <% if rw = @item.attr_info %>
+ <% if !run_verifier([rw[:read]].compact).empty? && run_verifier([rw[:write]].compact).empty? %>
+ <span class="note title readonly">readonly</span>
+ <% end %>
+ <% if !run_verifier([rw[:write]].compact).empty? && run_verifier([rw[:read]].compact).empty? %>
+ <span class="note title writeonly">writeonly</span>
+ <% end %>
+ <% end %>
+ <% if @item.visibility != :public %><span class="note title <%= @item.visibility %>"><%= @item.visibility %></span><% end %>
+ <% if @item.has_tag?(:abstract) %><span class="abstract note title">abstract</span><% end %>
+ <% if @item.has_tag?(:deprecated) %><span class="deprecated note title">deprecated</span><% end %>
+ <% if @item.has_tag?(:api) && @item.tag(:api).text != 'public' %><span class="private note title"><%= @item.tag(:api).text %></span><% end %>
+ <% if @item.has_tag?(:deprecated) %>
+ <span class="summary_desc"><strong>Deprecated.</strong> <%= htmlify_line @item.tag(:deprecated).text %></span>
+ <% else %>
+ <span class="summary_desc"><%= htmlify_line docstring_summary(@item) %></span>
+ <% end %>
+</li> | true |
Other | Homebrew | brew | 4e94f75bcb10971ef421e075f297a4e35d52fcd1.json | github_packages: Add glibc to os.version on Linux | Library/Homebrew/github_packages.rb | @@ -235,10 +235,18 @@ def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, dry_run:)
end
raise TypeError, "unknown tab['built_on']['os']: #{tab["built_on"]["os"]}" if os.blank?
- os_version = if tab["built_on"].present? && tab["built_on"]["os_version"].present?
- tab["built_on"]["os_version"]
+ os_version = tab["built_on"]["os_version"] if tab["built_on"].present?
+ os_version = case os
+ when "darwin"
+ os_version || "macOS #{MacOS::Version.from_symbol(bottle_tag)}"
+ when "linux"
+ glibc_version = tab["built_on"]["glibc_version"] if tab["built_on"].present?
+ os_version ||= "Ubuntu 16.04.7"
+ glibc_version ||= "2.23"
+ os_version = os_version.delete_suffix " LTS"
+ "#{os_version} glibc #{glibc_version}"
else
- MacOS::Version.from_symbol(bottle_tag).to_s
+ os_version
end
platform_hash = { | false |
Other | Homebrew | brew | e26b13a74ab9d6c2aa480f54677cece668b51098.json | Add Codecov on macOS builds | .github/workflows/tests.yml | @@ -301,3 +301,5 @@ jobs:
HOMEBREW_LANGUAGES: en-GB
- run: brew test-bot --only-formulae --test-default-formula
+
+ - uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 # v1.2.1 | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.