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 | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/libcurl.pc | @@ -0,0 +1,40 @@
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 2001 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
+
+# This should most probably benefit from getting a "Requires:" field added
+# dynamically by configure.
+#
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP"
+supported_features="AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO MultiSSL NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy"
+
+Name: libcurl
+URL: https://curl.haxx.se/
+Description: Library to transfer files with ftp, http, etc.
+Version: 7.64.1
+Libs: -L${libdir} -lcurl
+Libs.private: -lldap -lz
+Cflags: | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/libedit.pc | @@ -0,0 +1,12 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: libedit
+Description: command line editor library provides generic line editing, history, and tokenization functions.
+Version: 3.0
+Requires:
+Libs: -L${libdir} -ledit
+Cflags: -I${includedir}/editline | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/libexslt.pc | @@ -0,0 +1,13 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+
+Name: libexslt
+Version: 0.8.17
+Description: EXSLT Extension library
+Requires: libxml-2.0
+Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm
+Cflags: | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/libffi.pc | @@ -0,0 +1,12 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+toolexeclibdir=${libdir}
+includedir=${prefix}/include/ffi
+
+Name: libffi
+Description: Library supporting Foreign Function Interfaces
+Version: 3.3-rc0
+Libs: -L${toolexeclibdir} -lffi
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/libxml-2.0.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+modules=1
+
+Name: libXML
+Version: 2.9.4
+Description: libXML library version2.
+Requires:
+Libs: -L${libdir} -lxml2
+Libs.private: -lz -lpthread -licucore -lm
+Cflags: | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/libxslt.pc | @@ -0,0 +1,13 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+
+Name: libxslt
+Version: 1.1.29
+Description: XSLT library version 2.
+Requires: libxml-2.0
+Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm
+Cflags: | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/ncurses.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/ncursesw.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/sqlite3.pc | @@ -0,0 +1,12 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: SQLite
+Description: SQL database engine
+Version: 3.32.3
+Libs: -L${libdir} -lsqlite3
+Libs.private:
+Cflags: | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/uuid.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+sharedlibdir=${libdir}
+includedir=${prefix}/include/uuid
+
+Name: uuid
+Description: Universally unique id library
+Version: 1.0
+
+Requires:
+Libs:
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 3f10815f4f85e6279c9f739e6d3984855deb03d3.json | os/mac/pkgconfig: add pc files for Big Sur 11.1 | Library/Homebrew/os/mac/pkgconfig/11.1/zlib.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+sharedlibdir=${libdir}
+includedir=${prefix}/include
+
+Name: zlib
+Description: zlib compression library
+Version: 1.2.11
+
+Requires:
+Libs: -L${libdir} -L${sharedlibdir} -lz
+Cflags: | true |
Other | Homebrew | brew | 05b496194af2340826bc9d33ee8118186b1e6487.json | Fix version mapping. | Library/Homebrew/test/unversioned_cask_checker_spec.rb | @@ -16,6 +16,7 @@
["1.0", "1"] => "1.0",
["1.0", "0"] => "1.0",
["1.2.3.4000", "4000"] => "1.2.3.4000",
+ ["5", "5.0.45"] => "5.0.45",
}
expected_mappings.each do |(short_version, version), expected_version| | true |
Other | Homebrew | brew | 05b496194af2340826bc9d33ee8118186b1e6487.json | Fix version mapping. | Library/Homebrew/unversioned_cask_checker.rb | @@ -72,18 +72,15 @@ def self.version_from_package_info(package_info_path)
def self.decide_between_versions(short_version, version)
return short_version if short_version == version
- short_version_match = short_version&.match?(/\A\d+(\.\d+)+\Z/)
- version_match = version&.match?(/\A\d+(\.\d+)+\Z/)
+ if short_version && version
+ return version if version.match?(/\A\d+(\.\d+)+\Z/) && version.start_with?("#{short_version}.")
+ return short_version if short_version.match?(/\A\d+(\.\d+)+\Z/) && short_version.start_with?("#{version}.")
- if short_version_match && version_match
- return version if version.length > short_version.length && version.start_with?("#{short_version}.")
- return short_version if short_version.length > version.length && short_version.start_with?("#{version}.")
- end
-
- if short_version&.match?(/\A\d+(\.\d+)*\Z/) && version&.match?(/\A\d+\Z/)
- return short_version if short_version.start_with?("#{version}.") || short_version.end_with?(".#{version}")
+ if short_version.match?(/\A\d+(\.\d+)*\Z/) && version.match?(/\A\d+\Z/)
+ return short_version if short_version.start_with?("#{version}.") || short_version.end_with?(".#{version}")
- return "#{short_version},#{version}"
+ return "#{short_version},#{version}"
+ end
end
short_version || version | true |
Other | Homebrew | brew | c6876ba65c7bcd5204a4f05a1f13f6004e733d85.json | Add `UnversionedCaskChecker` helper class. | Library/Homebrew/cask/cask.rbi | @@ -2,6 +2,8 @@
module Cask
class Cask
+ def artifacts; end
+
def homepage; end
end
end | true |
Other | Homebrew | brew | c6876ba65c7bcd5204a4f05a1f13f6004e733d85.json | Add `UnversionedCaskChecker` helper class. | Library/Homebrew/dev-cmd/bump-unversioned-casks.rb | @@ -6,6 +6,7 @@
require "cask/cask_loader"
require "cli/parser"
require "tap"
+require "unversioned_cask_checker"
module Homebrew
extend T::Sig
@@ -21,11 +22,11 @@ def self.bump_unversioned_casks_args
Check all casks with unversioned URLs in a given <tap> for updates.
EOS
switch "-n", "--dry-run",
- description: "List what would be done, but do not actually do anything."
+ description: "Do everything except caching state and opening pull requests."
flag "--limit=",
description: "Maximum runtime in minutes."
flag "--state-file=",
- description: "File for keeping track of state."
+ description: "File for caching state."
named 1
end
@@ -58,18 +59,18 @@ def self.bump_unversioned_casks
unversioned_casks = unversioned_cask_files.map { |path| Cask::CaskLoader.load(path) }
- ohai "Unversioned Casks:"
- puts "Total: #{unversioned_casks.count}"
- puts "Single-App: #{unversioned_casks.count { |c| single_app_cask?(c) }}"
- puts "Single-Pkg: #{unversioned_casks.count { |c| single_pkg_cask?(c) }}"
+ ohai "Unversioned Casks: #{unversioned_casks.count}"
checked, unchecked = unversioned_casks.partition { |c| state.key?(c.full_name) }
queue = Queue.new
+ # Start with random casks which have not been checked.
unchecked.shuffle.each do |c|
queue.enq c
end
+
+ # Continue with previously checked casks, ordered by when they were last checked.
checked.sort_by { |c| state.dig(c.full_name, "check_time") }.each do |c|
queue.enq c
end
@@ -82,7 +83,9 @@ def self.bump_unversioned_casks
ohai "Checking #{cask.full_name}"
- unless single_app_cask?(cask) || single_pkg_cask?(cask)
+ unversioned_cask_checker = UnversionedCaskChecker.new(cask)
+
+ unless unversioned_cask_checker.single_app_cask? || unversioned_cask_checker.single_pkg_cask?
opoo "Skipping, not a single-app or PKG cask."
next
end
@@ -108,18 +111,16 @@ def self.bump_unversioned_casks
end
if last_time != time || last_file_size != file_size
- installer = Cask::Installer.new(cask, verify_download_integrity: false)
-
begin
- cached_download = installer.download
+ cached_download = unversioned_cask_checker.installer.download
rescue => e
onoe e
next
end
sha256 = cached_download.sha256
- if last_sha256 != sha256 && (version = guess_cask_version(cask, installer))
+ if last_sha256 != sha256 && (version = unversioned_cask_checker.guess_cask_version)
if cask.version == version
oh1 "Cask #{cask} is up-to-date at #{version}"
else
@@ -148,146 +149,14 @@ def self.bump_unversioned_casks
end
end
- next if args.dry_run?
-
state[cask.full_name] = {
"sha256" => sha256,
"check_time" => check_time.iso8601,
"time" => time&.iso8601,
"file_size" => file_size,
}
- state_file.atomic_write JSON.generate(state)
- end
- end
-
- sig { params(cask: Cask::Cask, installer: Cask::Installer).returns(T.nilable(String)) }
- def self.guess_cask_version(cask, installer)
- apps = cask.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }
- pkgs = cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Pkg) }
-
- if apps.empty? && pkgs.empty?
- opoo "Cask #{cask} does not contain any apps or PKG installers."
- return
- end
-
- Dir.mktmpdir do |dir|
- dir = Pathname(dir)
-
- begin
- installer.extract_primary_container(to: dir)
- rescue => e
- onoe e
- next
- end
-
- info_plist_paths = apps.flat_map do |app|
- Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist")
- end
-
- info_plist_paths.each do |info_plist_path|
- if (version = version_from_info_plist(info_plist_path))
- return version
- end
- end
-
- pkg_paths = pkgs.flat_map do |pkg|
- Pathname.glob(dir/"**"/pkg.path.basename)
- end
-
- pkg_paths.each do |pkg_path|
- packages =
- system_command!("installer", args: ["-plist", "-pkginfo", "-pkg", pkg_path])
- .plist
- .map { |package| package.fetch("Package") }
- .uniq
-
- Dir.mktmpdir do |extract_dir|
- extract_dir = Pathname(extract_dir)
- FileUtils.rmdir extract_dir
-
- begin
- system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
- rescue => e
- onoe "Failed to extract #{pkg_path.basename}: #{e}"
- next
- end
-
- package_info_path = extract_dir/"PackageInfo"
- if package_info_path.exist?
- if (version = version_from_package_info(package_info_path))
- return version
- end
- elsif packages.count == 1
- onoe "#{pkg_path.basename} does not contain a `PackageInfo` file."
- end
-
- opoo "#{pkg_path.basename} contains multiple packages: (#{packages.join(", ")})" if packages.count != 1
-
- $stderr.puts Pathname.glob(extract_dir/"**/*")
- .map { |path|
- regex = %r{\A(.*?\.(app|qlgenerator|saver|plugin|kext|bundle|osax))/.*\Z}
- path.to_s.sub(regex, '\1')
- }.uniq
- ensure
- Cask::Utils.gain_permissions_remove(extract_dir)
- extract_dir.mkpath
- end
- end
-
- nil
- end
- end
-
- sig { params(info_plist_path: Pathname).returns(T.nilable(String)) }
- def self.version_from_info_plist(info_plist_path)
- plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
-
- short_version = plist["CFBundleShortVersionString"].presence
- version = plist["CFBundleVersion"].presence
-
- return decide_between_versions(short_version, version) if short_version && version
- end
-
- sig { params(package_info_path: Pathname).returns(T.nilable(String)) }
- def self.version_from_package_info(package_info_path)
- contents = package_info_path.read
-
- short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1].presence
- version = contents[/CFBundleVersion="([^"]*)"/, 1].presence
-
- return decide_between_versions(short_version, version) if short_version && version
- end
-
- sig do
- params(short_version: T.nilable(String), version: T.nilable(String))
- .returns(T.nilable(String))
- end
- def self.decide_between_versions(short_version, version)
- return short_version if short_version == version
-
- short_version_match = short_version&.match?(/\A\d+(\.\d+)+\Z/)
- version_match = version&.match?(/\A\d+(\.\d+)+\Z/)
-
- if short_version_match && version_match
- return version if version.length > short_version.length && version.start_with?("#{short_version}.")
- return short_version if short_version.length > version.length && short_version.start_with?("#{version}.")
+ state_file.atomic_write JSON.generate(state) unless args.dry_run?
end
-
- if short_version&.match?(/\A\d+(\.\d+)*\Z/) && version&.match?(/\A\d+\Z/)
- return short_version if short_version.start_with?("#{version}.") || short_version.end_with?(".#{version}")
-
- return "#{short_version},#{version}"
- end
-
- short_version || version
- end
-
- def self.single_app_cask?(cask)
- cask.artifacts.count { |a| a.is_a?(Cask::Artifact::App) } == 1
- end
-
- def self.single_pkg_cask?(cask)
- cask.artifacts.count { |a| a.is_a?(Cask::Artifact::Pkg) } == 1
end
end | true |
Other | Homebrew | brew | c6876ba65c7bcd5204a4f05a1f13f6004e733d85.json | Add `UnversionedCaskChecker` helper class. | Library/Homebrew/test/dev-cmd/bump-unversioned-casks_spec.rb | @@ -2,29 +2,7 @@
# frozen_string_literal: true
require "cmd/shared_examples/args_parse"
-require "dev-cmd/bump-unversioned-casks"
describe "Homebrew.bump_unversioned_casks_args" do
it_behaves_like "parseable arguments"
-
- describe "::decide_between_versions" do
- expected_mappings = {
- [nil, nil] => nil,
- ["1.2", nil] => "1.2",
- [nil, "1.2.3"] => "1.2.3",
- ["1.2", "1.2.3"] => "1.2.3",
- ["1.2.3", "1.2"] => "1.2.3",
- ["1.2.3", "8312"] => "1.2.3,8312",
- ["2021", "2006"] => "2021,2006",
- ["1.0", "1"] => "1.0",
- ["1.0", "0"] => "1.0",
- ["1.2.3.4000", "4000"] => "1.2.3.4000",
- }
-
- expected_mappings.each do |(short_version, version), expected_version|
- it "maps (#{short_version}, #{version}) to #{expected_version}" do
- expect(Homebrew.decide_between_versions(short_version, version)).to eq expected_version
- end
- end
- end
end | true |
Other | Homebrew | brew | c6876ba65c7bcd5204a4f05a1f13f6004e733d85.json | Add `UnversionedCaskChecker` helper class. | Library/Homebrew/test/unversioned_cask_checker_spec.rb | @@ -0,0 +1,28 @@
+# typed: false
+# frozen_string_literal: true
+
+require "unversioned_cask_checker"
+
+describe Homebrew::UnversionedCaskChecker do
+ describe "::decide_between_versions" do
+ expected_mappings = {
+ [nil, nil] => nil,
+ ["1.2", nil] => "1.2",
+ [nil, "1.2.3"] => "1.2.3",
+ ["1.2", "1.2.3"] => "1.2.3",
+ ["1.2.3", "1.2"] => "1.2.3",
+ ["1.2.3", "8312"] => "1.2.3,8312",
+ ["2021", "2006"] => "2021,2006",
+ ["1.0", "1"] => "1.0",
+ ["1.0", "0"] => "1.0",
+ ["1.2.3.4000", "4000"] => "1.2.3.4000",
+ }
+
+ expected_mappings.each do |(short_version, version), expected_version|
+ it "maps (#{short_version}, #{version}) to #{expected_version}" do
+ expect(described_class.decide_between_versions(short_version, version))
+ .to eq expected_version
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | c6876ba65c7bcd5204a4f05a1f13f6004e733d85.json | Add `UnversionedCaskChecker` helper class. | Library/Homebrew/unversioned_cask_checker.rb | @@ -0,0 +1,167 @@
+# typed: true
+# frozen_string_literal: true
+
+require "cask/cask"
+require "cask/installer"
+
+module Homebrew
+ # Check unversioned casks for updates by extracting their
+ # contents and guessing the version from contained files.
+ #
+ # @api private
+ class UnversionedCaskChecker
+ extend T::Sig
+
+ sig { returns(Cask::Cask) }
+ attr_reader :cask
+
+ sig { params(cask: Cask::Cask).void }
+ def initialize(cask)
+ @cask = cask
+ end
+
+ sig { returns(Cask::Installer) }
+ def installer
+ @installer ||= Cask::Installer.new(cask, verify_download_integrity: false)
+ end
+
+ sig { returns(T::Array[Cask::Artifact::App]) }
+ def apps
+ @apps ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }
+ end
+
+ sig { returns(T::Array[Cask::Artifact::Pkg]) }
+ def pkgs
+ @pkgs ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Pkg) }
+ end
+
+ sig { returns(T::Boolean) }
+ def single_app_cask?
+ apps.count == 1
+ end
+
+ sig { returns(T::Boolean) }
+ def single_pkg_cask?
+ pkgs.count == 1
+ end
+
+ sig { params(info_plist_path: Pathname).returns(T.nilable(String)) }
+ def self.version_from_info_plist(info_plist_path)
+ plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
+
+ short_version = plist["CFBundleShortVersionString"].presence
+ version = plist["CFBundleVersion"].presence
+
+ return decide_between_versions(short_version, version) if short_version && version
+ end
+
+ sig { params(package_info_path: Pathname).returns(T.nilable(String)) }
+ def self.version_from_package_info(package_info_path)
+ contents = package_info_path.read
+
+ short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1].presence
+ version = contents[/CFBundleVersion="([^"]*)"/, 1].presence
+
+ return decide_between_versions(short_version, version) if short_version && version
+ end
+
+ sig do
+ params(short_version: T.nilable(String), version: T.nilable(String))
+ .returns(T.nilable(String))
+ end
+ def self.decide_between_versions(short_version, version)
+ return short_version if short_version == version
+
+ short_version_match = short_version&.match?(/\A\d+(\.\d+)+\Z/)
+ version_match = version&.match?(/\A\d+(\.\d+)+\Z/)
+
+ if short_version_match && version_match
+ return version if version.length > short_version.length && version.start_with?("#{short_version}.")
+ return short_version if short_version.length > version.length && short_version.start_with?("#{version}.")
+ end
+
+ if short_version&.match?(/\A\d+(\.\d+)*\Z/) && version&.match?(/\A\d+\Z/)
+ return short_version if short_version.start_with?("#{version}.") || short_version.end_with?(".#{version}")
+
+ return "#{short_version},#{version}"
+ end
+
+ short_version || version
+ end
+
+ sig { returns(T.nilable(String)) }
+ def guess_cask_version
+ if apps.empty? && pkgs.empty?
+ opoo "Cask #{cask} does not contain any apps or PKG installers."
+ return
+ end
+
+ Dir.mktmpdir do |dir|
+ dir = Pathname(dir)
+
+ installer.yield_self do |i|
+ i.extract_primary_container(to: dir)
+ rescue ErrorDuringExecution => e
+ onoe e
+ return nil
+ end
+
+ info_plist_paths = apps.flat_map do |app|
+ Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist")
+ end
+
+ info_plist_paths.each do |info_plist_path|
+ if (version = self.class.version_from_info_plist(info_plist_path))
+ return version
+ end
+ end
+
+ pkg_paths = pkgs.flat_map do |pkg|
+ Pathname.glob(dir/"**"/pkg.path.basename)
+ end
+
+ pkg_paths.each do |pkg_path|
+ packages =
+ system_command!("installer", args: ["-plist", "-pkginfo", "-pkg", pkg_path])
+ .plist
+ .map { |package| package.fetch("Package") }
+ .uniq
+
+ Dir.mktmpdir do |extract_dir|
+ extract_dir = Pathname(extract_dir)
+ FileUtils.rmdir extract_dir
+
+ begin
+ system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
+ rescue ErrorDuringExecution => e
+ onoe "Failed to extract #{pkg_path.basename}: #{e}"
+ next
+ end
+
+ package_info_path = extract_dir/"PackageInfo"
+ if package_info_path.exist?
+ if (version = self.class.version_from_package_info(package_info_path))
+ return version
+ end
+ elsif packages.count == 1
+ onoe "#{pkg_path.basename} does not contain a `PackageInfo` file."
+ end
+
+ opoo "#{pkg_path.basename} contains multiple packages: (#{packages.join(", ")})" if packages.count != 1
+
+ $stderr.puts Pathname.glob(extract_dir/"**/*")
+ .map { |path|
+ regex = %r{\A(.*?\.(app|qlgenerator|saver|plugin|kext|bundle|osax))/.*\Z}
+ path.to_s.sub(regex, '\1')
+ }.uniq
+ ensure
+ Cask::Utils.gain_permissions_remove(extract_dir)
+ extract_dir.mkpath
+ end
+ end
+
+ nil
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | c6876ba65c7bcd5204a4f05a1f13f6004e733d85.json | Add `UnversionedCaskChecker` helper class. | docs/Manpage.md | @@ -904,11 +904,11 @@ present, "revision 1" will be added.
Check all casks with unversioned URLs in a given *`tap`* for updates.
* `-n`, `--dry-run`:
- List what would be done, but do not actually do anything.
+ Do everything except caching state and opening pull requests.
* `--limit`:
Maximum runtime in minutes.
* `--state-file`:
- File for keeping track of state.
+ File for caching state.
### `cat` *`formula`*|*`cask`*
| true |
Other | Homebrew | brew | c6876ba65c7bcd5204a4f05a1f13f6004e733d85.json | Add `UnversionedCaskChecker` helper class. | manpages/brew.1 | @@ -1250,15 +1250,15 @@ Check all casks with unversioned URLs in a given \fItap\fR for updates\.
.
.TP
\fB\-n\fR, \fB\-\-dry\-run\fR
-List what would be done, but do not actually do anything\.
+Do everything except caching state and opening pull requests\.
.
.TP
\fB\-\-limit\fR
Maximum runtime in minutes\.
.
.TP
\fB\-\-state\-file\fR
-File for keeping track of state\.
+File for caching state\.
.
.SS "\fBcat\fR \fIformula\fR|\fIcask\fR"
Display the source of a \fIformula\fR or \fIcask\fR\. | true |
Other | Homebrew | brew | 91ce799fe2c7432795a0f74e5ce84b6fd272d1f4.json | Ignore empty version strings. | Library/Homebrew/dev-cmd/bump-unversioned-casks.rb | @@ -233,8 +233,8 @@ def self.guess_cask_version(cask, installer)
def self.version_from_info_plist(info_plist_path)
plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
- short_version = plist["CFBundleShortVersionString"]
- version = plist["CFBundleVersion"]
+ short_version = plist["CFBundleShortVersionString"].presence
+ version = plist["CFBundleVersion"].presence
return decide_between_versions(short_version, version) if short_version && version
end
@@ -243,8 +243,8 @@ def self.version_from_info_plist(info_plist_path)
def self.version_from_package_info(package_info_path)
contents = package_info_path.read
- short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1]
- version = contents[/CFBundleVersion="([^"]*)"/, 1]
+ short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1].presence
+ version = contents[/CFBundleVersion="([^"]*)"/, 1].presence
return decide_between_versions(short_version, version) if short_version && version
end | false |
Other | Homebrew | brew | 933499089cbba28ba37cc8671685c85d6cd9c6e0.json | Add test for `decide_between_versions`. | Library/Homebrew/dev-cmd/bump-unversioned-casks.rb | @@ -186,7 +186,7 @@ def self.guess_cask_version(cask, installer)
end
info_plist_paths.each do |info_plist_path|
- if (version = version_from_info_plist(cask, info_plist_path))
+ if (version = version_from_info_plist(info_plist_path))
return version
end
end
@@ -211,7 +211,7 @@ def self.guess_cask_version(cask, installer)
package_info_path = extract_dir/"PackageInfo"
if package_info_path.exist?
- if (version = version_from_package_info(cask, package_info_path))
+ if (version = version_from_package_info(package_info_path))
return version
end
else
@@ -229,47 +229,44 @@ def self.guess_cask_version(cask, installer)
end
end
- sig { params(cask: Cask::Cask, info_plist_path: Pathname).returns(T.nilable(String)) }
- def self.version_from_info_plist(cask, info_plist_path)
+ sig { params(info_plist_path: Pathname).returns(T.nilable(String)) }
+ def self.version_from_info_plist(info_plist_path)
plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
short_version = plist["CFBundleShortVersionString"]
version = plist["CFBundleVersion"]
- return decide_between_versions(cask, short_version, version) if short_version && version
+ return decide_between_versions(short_version, version) if short_version && version
end
- sig { params(cask: Cask::Cask, package_info_path: Pathname).returns(T.nilable(String)) }
- def self.version_from_package_info(cask, package_info_path)
+ sig { params(package_info_path: Pathname).returns(T.nilable(String)) }
+ def self.version_from_package_info(package_info_path)
contents = package_info_path.read
short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1]
version = contents[/CFBundleVersion="([^"]*)"/, 1]
- return decide_between_versions(cask, short_version, version) if short_version && version
+ return decide_between_versions(short_version, version) if short_version && version
end
sig do
- params(cask: Cask::Cask, short_version: T.nilable(String), version: T.nilable(String))
+ params(short_version: T.nilable(String), version: T.nilable(String))
.returns(T.nilable(String))
end
- def self.decide_between_versions(cask, short_version, version)
- return "#{short_version},#{version}" if short_version && version && cask.version.include?(",")
+ def self.decide_between_versions(short_version, version)
- return cask.version.to_s if [short_version, version].include?(cask.version.to_s)
+ return short_version if short_version == version
short_version_match = short_version&.match?(/\A\d+(\.\d+)+\Z/)
version_match = version&.match?(/\A\d+(\.\d+)+\Z/)
if short_version_match && version_match
return version if version.length > short_version.length && version.start_with?(short_version)
return short_version if short_version.length > version.length && short_version.start_with?(version)
- elsif short_version_match
- return short_version
- elsif version_match
- return version
end
+ return "#{short_version},#{version}" if short_version&.match?(/\A\d+(\.\d+)*\Z/) && version&.match?(/\A\d+\Z/)
+
short_version || version
end
| true |
Other | Homebrew | brew | 933499089cbba28ba37cc8671685c85d6cd9c6e0.json | Add test for `decide_between_versions`. | Library/Homebrew/test/dev-cmd/bump-unversioned-casks_spec.rb | @@ -0,0 +1,27 @@
+# typed: false
+# frozen_string_literal: true
+
+require "cmd/shared_examples/args_parse"
+require "dev-cmd/bump-unversioned-casks"
+
+describe "Homebrew.bump_unversioned_casks_args" do
+ it_behaves_like "parseable arguments"
+
+ describe "::decide_between_versions" do
+ expected_mappings = {
+ [nil, nil] => nil,
+ ["1.2", nil] => "1.2",
+ [nil, "1.2.3"] => "1.2.3",
+ ["1.2", "1.2.3"] => "1.2.3",
+ ["1.2.3", "1.2"] => "1.2.3",
+ ["1.2.3", "8312"] => "1.2.3,8312",
+ ["2021", "2006"] => "2021,2006",
+ }
+
+ expected_mappings.each do |(short_version, version), expected_version|
+ it "maps (#{short_version}, #{version}) to #{expected_version}" do
+ expect(Homebrew.decide_between_versions(short_version, version)).to eq expected_version
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | bf46814dddade04338d85aea51d9446830c01e0a.json | Skip casks before extracting. | Library/Homebrew/dev-cmd/bump-unversioned-casks.rb | @@ -82,6 +82,11 @@ def self.bump_unversioned_casks
ohai "Checking #{cask.full_name}"
+ unless single_app_cask?(cask) || single_pkg_cask?(cask)
+ opoo "Skipping, cask #{cask} it not a single-app or PKG cask."
+ next
+ end
+
last_state = state.fetch(cask.full_name, {})
last_check_time = last_state["check_time"]&.yield_self { |t| Time.parse(t) }
| false |
Other | Homebrew | brew | a3182a6386cdb3d5d581cc300ef27e55a388865d.json | Extract package into new temporary directory. | Library/Homebrew/dev-cmd/bump-unversioned-casks.rb | @@ -198,19 +198,22 @@ def self.guess_cask_version(cask, installer)
.uniq
if packages.count == 1
- extract_dir = dir/pkg_path.stem
- system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
+ Dir.mktmpdir do |extract_dir|
+ extract_dir = Pathname(extract_dir)
+ FileUtils.rmdir extract_dir
- package_info_path = extract_dir/"PackageInfo"
- if package_info_path.exist?
- if (version = version_from_package_info(cask, package_info_path))
- return version
+ system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
+
+ package_info_path = extract_dir/"PackageInfo"
+ if package_info_path.exist?
+ if (version = version_from_package_info(cask, package_info_path))
+ return version
+ end
+ else
+ onoe "#{pkg_path.basename} does not contain a `PackageInfo` file."
+ next
end
- else
- onoe "#{pkg_path.basename} does not contain a `PackageInfo` file."
- next
end
-
else
opoo "Skipping, #{pkg_path.basename} contains multiple packages."
next | false |
Other | Homebrew | brew | ef1ea75c08f34ae7153db4244207edfda4c3c558.json | Add support for single-package casks. | Library/Homebrew/cask/artifact/pkg.rb | @@ -15,7 +15,7 @@ module Artifact
#
# @api private
class Pkg < AbstractArtifact
- attr_reader :pkg_relative_path, :path, :stanza_options
+ attr_reader :path, :stanza_options
def self.from_args(cask, path, **stanza_options)
stanza_options.assert_valid_keys!(:allow_untrusted, :choices) | true |
Other | Homebrew | brew | ef1ea75c08f34ae7153db4244207edfda4c3c558.json | Add support for single-package casks. | Library/Homebrew/dev-cmd/bump-unversioned-casks.rb | @@ -82,11 +82,6 @@ def self.bump_unversioned_casks
ohai "Checking #{cask.full_name}"
- unless single_app_cask?(cask)
- opoo "Skipping, not a single-app cask."
- next
- end
-
last_state = state.fetch(cask.full_name, {})
last_check_time = last_state["check_time"]&.yield_self { |t| Time.parse(t) }
@@ -164,7 +159,12 @@ def self.bump_unversioned_casks
sig { params(cask: Cask::Cask, installer: Cask::Installer).returns(T.nilable(String)) }
def self.guess_cask_version(cask, installer)
apps = cask.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }
- return if apps.count != 1
+ pkgs = cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Pkg) }
+
+ if apps.empty? && pkgs.empty?
+ opoo "Cask #{cask} does not contain any apps or PKG installers."
+ return
+ end
Dir.mktmpdir do |dir|
dir = Pathname(dir)
@@ -176,28 +176,84 @@ def self.guess_cask_version(cask, installer)
next
end
- plists = apps.flat_map do |app|
+ info_plist_paths = apps.flat_map do |app|
Pathname.glob(dir/"**"/app.source.basename/"Contents"/"Info.plist")
end
- next if plists.empty?
- plist = plists.first
+ info_plist_paths.each do |info_plist_path|
+ if (version = version_from_info_plist(cask, info_plist_path))
+ return version
+ end
+ end
+
+ pkg_paths = pkgs.flat_map do |pkg|
+ Pathname.glob(dir/"**"/pkg.path.basename)
+ end
+
+ pkg_paths.each do |pkg_path|
+ packages =
+ system_command!("installer", args: ["-plist", "-pkginfo", "-pkg", pkg_path])
+ .plist
+ .map { |package| package.fetch("Package") }
+ .uniq
+
+ if packages.count == 1
+ extract_dir = dir/pkg_path.stem
+ system_command! "pkgutil", args: ["--expand-full", pkg_path, extract_dir]
+
+ package_info_path = extract_dir/"PackageInfo"
+ if package_info_path.exist?
+ if (version = version_from_package_info(cask, package_info_path))
+ return version
+ end
+ else
+ onoe "#{pkg_path.basename} does not contain a `PackageInfo` file."
+ next
+ end
+
+ else
+ opoo "Skipping, #{pkg_path.basename} contains multiple packages."
+ next
+ end
+ end
+
+ nil
+ end
+ end
+
+ sig { params(cask: Cask::Cask, info_plist_path: Pathname).returns(T.nilable(String)) }
+ def self.version_from_info_plist(cask, info_plist_path)
+ plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
- system_command! "plutil", args: ["-convert", "xml1", plist]
- plist = Plist.parse_xml(plist.read)
+ short_version = plist["CFBundleShortVersionString"]
+ version = plist["CFBundleVersion"]
- short_version = plist["CFBundleShortVersionString"]
- version = plist["CFBundleVersion"]
+ return decide_between_versions(cask, short_version, version) if short_version && version
+ end
- return "#{short_version},#{version}" if cask.version.include?(",")
+ sig { params(cask: Cask::Cask, package_info_path: Pathname).returns(T.nilable(String)) }
+ def self.version_from_package_info(cask, package_info_path)
+ contents = package_info_path.read
- return cask.version.to_s if [short_version, version].include?(cask.version.to_s)
+ short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1]
+ version = contents[/CFBundleVersion="([^"]*)"/, 1]
- return short_version if short_version&.match(/\A\d+(\.\d+)+\Z/)
- return version if version&.match(/\A\d+(\.\d+)+\Z/)
+ return decide_between_versions(cask, short_version, version) if short_version && version
+ end
- short_version || version
- end
+ sig do
+ params(cask: Cask::Cask, short_version: T.nilable(String), version: T.nilable(String))
+ .returns(T.nilable(String))
+ end
+ def self.decide_between_versions(cask, short_version, version)
+ return "#{short_version},#{version}" if short_version && version && cask.version.include?(",")
+
+ return cask.version.to_s if [short_version, version].include?(cask.version.to_s)
+
+ return short_version if short_version&.match(/\A\d+(\.\d+)+\Z/)
+ return version if version&.match(/\A\d+(\.\d+)+\Z/)
+
+ short_version || version
end
def self.single_app_cask?(cask) | true |
Other | Homebrew | brew | d768b6649a8682431a49397ae79c192bcdc1e219.json | bottle: add tests for json merging
- Extract the json reading from the json merging: it makes the code hard to understand.
This helps for the separation of concerns: the jsons are read in one method;
and merged in a second one
- Added a first test to check the merge function
No change in behaviour was done, this change is just there to increase code coverage
and to prepare for #9315 | Library/Homebrew/dev-cmd/bottle.rb | @@ -436,9 +436,15 @@ def bottle_formula(f, args:)
end
end
- def merge(args:)
- bottles_hash = args.named.reduce({}) do |hash, json_file|
- hash.deep_merge(JSON.parse(IO.read(json_file))) do |key, first, second|
+ def parse_json_files(filenames)
+ filenames.map do |filename|
+ JSON.parse(IO.read(filename))
+ end
+ end
+
+ def merge_json_files(json_files)
+ json_files.reduce({}) do |hash, json_file|
+ hash.deep_merge(json_file) do |key, first, second|
if key == "cellar"
# Prioritize HOMEBREW_CELLAR over :any over :any_skip_relocation
cellars = [first, second]
@@ -452,6 +458,10 @@ def merge(args:)
second
end
end
+ end
+
+ def merge(args:)
+ bottles_hash = merge_json_files(parse_json_files(args.named))
any_cellars = ["any", "any_skip_relocation"]
bottles_hash.each do |formula_name, bottle_hash| | true |
Other | Homebrew | brew | d768b6649a8682431a49397ae79c192bcdc1e219.json | bottle: add tests for json merging
- Extract the json reading from the json merging: it makes the code hard to understand.
This helps for the separation of concerns: the jsons are read in one method;
and merged in a second one
- Added a first test to check the merge function
No change in behaviour was done, this change is just there to increase code coverage
and to prepare for #9315 | Library/Homebrew/test/dev-cmd/bottle_spec.rb | @@ -2,6 +2,7 @@
# frozen_string_literal: true
require "cmd/shared_examples/args_parse"
+require "dev-cmd/bottle"
describe "Homebrew.bottle_args" do
it_behaves_like "parseable arguments"
@@ -40,3 +41,156 @@
end
end
end
+
+describe Homebrew do
+ subject(:homebrew) { described_class }
+
+ def stub_hash(parameters)
+ <<~EOS
+ {
+ "#{parameters[:name]}":{
+ "formula":{
+ "pkg_version":"#{parameters[:version]}",
+ "path":"#{parameters[:path]}"
+ },
+ "bottle":{
+ "root_url":"https://homebrew.bintray.com/bottles",
+ "prefix":"/usr/local",
+ "cellar":"#{parameters[:cellar]}",
+ "rebuild":0,
+ "tags":{
+ "#{parameters[:os]}":{
+ "filename":"#{parameters[:filename]}",
+ "local_filename":"#{parameters[:local_filename]}",
+ "sha256":"#{parameters[:sha256]}"
+ }
+ }
+ },
+ "bintray":{
+ "package":"#{parameters[:name]}",
+ "repository":"bottles"
+ }
+ }
+ }
+ EOS
+ end
+
+ let(:hello_hash_big_sur) {
+ JSON.parse(
+ stub_hash(
+ {
+ "name": "hello",
+ "version": "1.0",
+ "path": "/home/hello.rb",
+ "cellar": "any_skip_relocation",
+ "os": "big_sur",
+ "filename": "hello-1.0.big_sur.bottle.tar.gz",
+ "local_filename": "hello--1.0.big_sur.bottle.tar.gz",
+ "sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
+ },
+ ),
+ )
+ }
+ let(:hello_hash_catalina) {
+ JSON.parse(
+ stub_hash(
+ {
+ "name": "hello",
+ "version": "1.0",
+ "path": "/home/hello.rb",
+ "cellar": "any_skip_relocation",
+ "os": "catalina",
+ "filename": "hello-1.0.catalina.bottle.tar.gz",
+ "local_filename": "hello--1.0.catalina.bottle.tar.gz",
+ "sha256": "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
+ },
+ ),
+ )
+ }
+ let(:unzip_hash_big_sur) {
+ JSON.parse(
+ stub_hash(
+ {
+ "name": "unzip",
+ "version": "2.0",
+ "path": "/home/unzip.rb",
+ "cellar": "any_skip_relocation",
+ "os": "big_sur",
+ "filename": "unzip-2.0.big_sur.bottle.tar.gz",
+ "local_filename": "unzip--2.0.big_sur.bottle.tar.gz",
+ "sha256": "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
+ },
+ ),
+ )
+ }
+ let(:unzip_hash_catalina) {
+ JSON.parse(
+ stub_hash(
+ {
+ "name": "unzip",
+ "version": "2.0",
+ "path": "/home/unzip.rb",
+ "cellar": "any",
+ "os": "catalina",
+ "filename": "unzip-2.0.catalina.bottle.tar.gz",
+ "local_filename": "unzip--2.0.catalina.bottle.tar.gz",
+ "sha256": "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
+ },
+ ),
+ )
+ }
+
+ specify "::parse_json_files" do
+ Tempfile.open("hello--1.0.big_sur.bottle.json") do |f|
+ f.write(
+ stub_hash(
+ {
+ "name": "hello",
+ "version": "1.0",
+ "path": "/home/hello.rb",
+ "cellar": "any_skip_relocation",
+ "os": "big_sur",
+ "filename": "hello-1.0.big_sur.bottle.tar.gz",
+ "local_filename": "hello--1.0.big_sur.bottle.tar.gz",
+ "sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
+ },
+ ),
+ )
+ f.close
+ expect(
+ homebrew.parse_json_files([f.path]).first["hello"]["bottle"]["tags"]["big_sur"]["filename"],
+ ).to eq("hello-1.0.big_sur.bottle.tar.gz")
+ end
+ end
+
+ specify "::merge_json_files" do
+ bottles_hash = homebrew.merge_json_files(
+ [hello_hash_big_sur, hello_hash_catalina, unzip_hash_big_sur, unzip_hash_catalina],
+ )
+
+ hello_hash = bottles_hash["hello"]
+ expect(hello_hash["bottle"]["cellar"]).to eq("any_skip_relocation")
+ expect(hello_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("hello-1.0.big_sur.bottle.tar.gz")
+ expect(hello_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("hello--1.0.big_sur.bottle.tar.gz")
+ expect(hello_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
+ "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
+ )
+ expect(hello_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("hello-1.0.catalina.bottle.tar.gz")
+ expect(hello_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("hello--1.0.catalina.bottle.tar.gz")
+ expect(hello_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
+ "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
+ )
+ unzip_hash = bottles_hash["unzip"]
+ expect(unzip_hash["bottle"]["cellar"]).to eq("any")
+ expect(unzip_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("unzip-2.0.big_sur.bottle.tar.gz")
+ expect(unzip_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("unzip--2.0.big_sur.bottle.tar.gz")
+ expect(unzip_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
+ "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
+ )
+ expect(unzip_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("unzip-2.0.catalina.bottle.tar.gz")
+ expect(unzip_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("unzip--2.0.catalina.bottle.tar.gz")
+ expect(unzip_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
+ "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
+ )
+ end
+end | true |
Other | Homebrew | brew | 9d90ef29eb5094167c7e70e7f5e086ca529dc653.json | cmd/update: improve shallow clone message. | Library/Homebrew/cmd/update.sh | @@ -390,23 +390,29 @@ EOS
fi
fi
- # Homebrew/homebrew-core is extremely expensive to perform shallow clones on
- # so, on GitHub's request, don't allow it.
if [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/shallow" ]]
then
odie <<EOS
homebrew-core is a shallow clone. To \`brew update\` first run:
git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" fetch --unshallow
+This restriction has been made on GitHub's request because updating shallow
+clones is an extremely expensive operation due to the tree layout and traffic of
+Homebrew/homebrew-core. We don't do this for you automatically to avoid
+repeatedly performing an expensive unshallow operation in CI systems (which
+should instead be fixed to not use shallow clones). Sorry for the inconvenience!
EOS
fi
- # Homebrew/homebrew-cask is also extremely expensive to perform shallow clones
- # on so, on GitHub's request, don't allow it.
if [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/shallow" ]]
then
odie <<EOS
homebrew-cask is a shallow clone. To \`brew update\` first run:
git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask" fetch --unshallow
+This restriction has been made on GitHub's request because updating shallow
+clones is an extremely expensive operation due to the tree layout and traffic of
+Homebrew/homebrew-cask. We don't do this for you automatically to avoid
+repeatedly performing an expensive unshallow operation in CI systems (which
+should instead be fixed to not use shallow clones). Sorry for the inconvenience!
EOS
fi
| false |
Other | Homebrew | brew | 532864b0ef0109a9efa8bca15c50c99f531b65b1.json | dev-cmd/dispatch-build-bottle: remove testing code.
This was accidentally merged in https://github.com/Homebrew/brew/pull/9444. | Library/Homebrew/dev-cmd/dispatch-build-bottle.rb | @@ -58,8 +58,6 @@ def dispatch_build_bottle
else
macos.to_s
end
- p macos_label
- odie "no"
tap = Tap.fetch(args.tap || CoreTap.instance.name)
user, repo = tap.full_name.split("/") | false |
Other | Homebrew | brew | e51e0685b14ce15493fd09b6f9c60b578f0b8296.json | Update RBI files for sorbet. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -8041,6 +8041,11 @@ module GitHub
extend ::T::Private::Methods::SingletonMethodHooks
end
+module GitRepositoryExtension
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class HTTP::Cookie
def self.parse(set_cookie, origin, options=T.unsafe(nil), &block); end
end | false |
Other | Homebrew | brew | 8b206dfa335d55f3fa59f9bfd4c5701e246f851c.json | git_extensions: move commit_message from utils/git | Library/Homebrew/dev-cmd/pr-pull.rb | @@ -89,7 +89,7 @@ def separate_commit_message(message)
end
def signoff!(path, pr: nil, dry_run: false)
- subject, body, trailers = separate_commit_message(Utils::Git.commit_message(path))
+ subject, body, trailers = separate_commit_message(path.git_commit_message)
if pr
# This is a tap pull request and approving reviewers should also sign-off.
@@ -156,7 +156,7 @@ def reword_formula_commit(commit, file, reason: "", verbose: false, resolve: fal
new_formula = Utils::Git.file_at_commit(path, file, "HEAD")
bump_subject = determine_bump_subject(old_formula, new_formula, formula_file, reason: reason).strip
- subject, body, trailers = separate_commit_message(Utils::Git.commit_message(path))
+ subject, body, trailers = separate_commit_message(path.git_commit_message)
if subject != bump_subject && !subject.start_with?("#{formula_name}:")
safe_system("git", "-C", path, "commit", "--amend", "-q",
@@ -181,7 +181,7 @@ def squash_formula_commits(commits, file, reason: "", verbose: false, resolve: f
messages = []
trailers = []
commits.each do |commit|
- subject, body, trailer = separate_commit_message(Utils::Git.commit_message(path, commit))
+ subject, body, trailer = separate_commit_message(path.git_commit_message(commit))
body = body.lines.map { |line| " #{line.strip}" }.join("\n")
messages << "* #{subject}\n#{body}".strip
trailers << trailer | true |
Other | Homebrew | brew | 8b206dfa335d55f3fa59f9bfd4c5701e246f851c.json | git_extensions: move commit_message from utils/git | Library/Homebrew/extend/git_repository.rb | @@ -85,4 +85,12 @@ def git_last_commit_date
Utils.popen_read("git", "show", "-s", "--format=%cd", "--date=short", "HEAD", chdir: self).chomp.presence
end
+
+ # Gets the full commit message of the specified commit, or of the HEAD commit if unspecified.
+ sig { params(commit: String).returns(T.nilable(String)) }
+ def git_commit_message(commit = "HEAD")
+ return unless git? && Utils::Git.available?
+
+ Utils.popen_read("git", "log", "-1", "--pretty=%B", commit, "--", chdir: self, err: :out).strip.presence
+ end
end | true |
Other | Homebrew | brew | 8b206dfa335d55f3fa59f9bfd4c5701e246f851c.json | git_extensions: move commit_message from utils/git | Library/Homebrew/test/dev-cmd/pr-pull_spec.rb | @@ -38,7 +38,7 @@ class Foo < Formula
EOS
end
let(:formula_file) { path/"Formula/foo.rb" }
- let(:path) { Tap::TAP_DIRECTORY/"homebrew/homebrew-foo" }
+ let(:path) { (Tap::TAP_DIRECTORY/"homebrew/homebrew-foo").extend(GitRepositoryExtension) }
describe "Homebrew.pr_pull_args" do
it_behaves_like "parseable arguments"
@@ -59,8 +59,8 @@ class Foo < Formula
File.open(formula_file, "w") { |f| f.write(formula_version) }
safe_system Utils::Git.git, "commit", formula_file, "-m", "version", "--author=#{secondary_author}"
described_class.autosquash!(original_hash, path: path)
- expect(Utils::Git.commit_message(path)).to include("foo 2.0")
- expect(Utils::Git.commit_message(path)).to include("Co-authored-by: #{secondary_author}")
+ expect(path.git_commit_message).to include("foo 2.0")
+ expect(path.git_commit_message).to include("Co-authored-by: #{secondary_author}")
end
end
end
@@ -75,7 +75,7 @@ class Foo < Formula
safe_system Utils::Git.git, "commit", "-m", "foo 1.0 (new formula)"
end
described_class.signoff!(path)
- expect(Utils::Git.commit_message(path)).to include("Signed-off-by:")
+ expect(path.git_commit_message).to include("Signed-off-by:")
end
end
| true |
Other | Homebrew | brew | 8b206dfa335d55f3fa59f9bfd4c5701e246f851c.json | git_extensions: move commit_message from utils/git | Library/Homebrew/test/utils/git_spec.rb | @@ -52,19 +52,6 @@
let(:files_hash2) { [@h2[0..6], ["README.md"]] }
let(:cherry_pick_commit) { @cherry_pick_commit[0..6] }
- describe "#commit_message" do
- it "returns the commit message" do
- expect(described_class.commit_message(HOMEBREW_CACHE, file_hash1)).to eq("File added")
- expect(described_class.commit_message(HOMEBREW_CACHE, file_hash2)).to eq("written to File")
- end
-
- it "errors when commit doesn't exist" do
- expect {
- described_class.commit_message(HOMEBREW_CACHE, "bad_refspec")
- }.to raise_error(ErrorDuringExecution, /bad revision/)
- end
- end
-
describe "#cherry_pick!" do
it "can cherry pick a commit" do
expect(described_class.cherry_pick!(HOMEBREW_CACHE, cherry_pick_commit)).to be_truthy | true |
Other | Homebrew | brew | 8b206dfa335d55f3fa59f9bfd4c5701e246f851c.json | git_extensions: move commit_message from utils/git | Library/Homebrew/utils/git.rb | @@ -89,8 +89,9 @@ def file_at_commit(repo, file, commit)
end
def commit_message(repo, commit = nil)
+ odeprecated "Utils::Git.commit_message(repo)", "Pathname(repo).git_commit_message"
commit ||= "HEAD"
- Utils.safe_popen_read(git, "-C", repo, "log", "-1", "--pretty=%B", commit, "--", err: :out).strip
+ Pathname(repo).extend(GitRepositoryExtension).git_commit_message(commit)
end
def ensure_installed! | true |
Other | Homebrew | brew | 92d3eda91425db1b5bf41a7ac02cc2d500106d8f.json | git_extensions: move origin_branch from utils/git | Library/Homebrew/dev-cmd/bump-cask-pr.rb | @@ -77,8 +77,8 @@ def bump_cask_pr
old_hash = cask.sha256.to_s
tap_full_name = cask.tap&.full_name
- origin_branch = Utils::Git.origin_branch(cask.tap.path) if cask.tap
- origin_branch ||= "origin/master"
+ default_remote_branch = cask.tap.path.git_origin_branch if cask.tap
+ default_remote_branch ||= "master"
previous_branch = "-"
check_open_pull_requests(cask, tap_full_name, args: args)
@@ -200,7 +200,7 @@ def bump_cask_pr
pr_info = {
sourcefile_path: cask.sourcefile_path,
old_contents: old_contents,
- origin_branch: origin_branch,
+ remote_branch: default_remote_branch,
branch_name: "bump-#{cask.token}-#{new_version.tr(",:", "-")}",
commit_message: "Update #{cask.token} from #{old_version} to #{new_version}",
previous_branch: previous_branch, | true |
Other | Homebrew | brew | 92d3eda91425db1b5bf41a7ac02cc2d500106d8f.json | git_extensions: move origin_branch from utils/git | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -84,44 +84,38 @@ def bump_formula_pr_args
end
def use_correct_linux_tap(formula, args:)
- if OS.linux? && formula.tap.core_tap?
- tap_full_name = formula.tap.full_name.gsub("linuxbrew", "homebrew")
- homebrew_core_url = "https://github.com/#{tap_full_name}"
- homebrew_core_remote = "homebrew"
- homebrew_core_branch = "master"
- origin_branch = "#{homebrew_core_remote}/#{homebrew_core_branch}"
- previous_branch = Utils.popen_read("git -C \"#{formula.tap.path}\" symbolic-ref -q --short HEAD").chomp
- previous_branch = "master" if previous_branch.empty?
- formula_path = formula.path.to_s[%r{(Formula/.*)}, 1]
-
- if args.dry_run? || args.write?
- ohai "git remote add #{homebrew_core_remote} #{homebrew_core_url}"
- ohai "git fetch #{homebrew_core_remote} #{homebrew_core_branch}"
- ohai "git cat-file -e #{origin_branch}:#{formula_path}"
- ohai "git checkout #{origin_branch}"
- return tap_full_name, origin_branch, previous_branch
- else
- formula.path.parent.cd do
- unless Utils.popen_read("git remote -v").match?(%r{^homebrew.*Homebrew/homebrew-core.*$})
- ohai "Adding #{homebrew_core_remote} remote"
- safe_system "git", "remote", "add", homebrew_core_remote, homebrew_core_url
- end
- ohai "Fetching #{origin_branch}"
- safe_system "git", "fetch", homebrew_core_remote, homebrew_core_branch
- if quiet_system "git", "cat-file", "-e", "#{origin_branch}:#{formula_path}"
- ohai "#{formula.full_name} exists in #{origin_branch}"
- safe_system "git", "checkout", origin_branch
- return tap_full_name, origin_branch, previous_branch
- end
- end
- end
+ default_origin_branch = formula.tap.path.git_origin_branch if formula.tap
+
+ return formula.tap&.full_name, "origin", default_origin_branch, "-" if !OS.linux? || !formula.tap.core_tap?
+
+ tap_full_name = formula.tap.full_name.gsub("linuxbrew", "homebrew")
+ homebrew_core_url = "https://github.com/#{tap_full_name}"
+ homebrew_core_remote = "homebrew"
+ previous_branch = formula.tap.path.git_branch || "master"
+ formula_path = formula.path.relative_path_from(formula.tap.path)
+ full_origin_branch = "#{homebrew_core_remote}/#{default_origin_branch}"
+
+ if args.dry_run? || args.write?
+ ohai "git remote add #{homebrew_core_remote} #{homebrew_core_url}"
+ ohai "git fetch #{homebrew_core_remote} HEAD #{default_origin_branch}"
+ ohai "git cat-file -e #{full_origin_branch}:#{formula_path}"
+ ohai "git checkout #{full_origin_branch}"
+ return tap_full_name, homebrew_core_remote, default_origin_branch, previous_branch
end
- if formula.tap
- origin_branch = Utils.popen_read("git", "-C", formula.tap.path.to_s, "symbolic-ref", "-q", "--short",
- "refs/remotes/origin/HEAD").chomp.presence
+
+ formula.tap.path.cd do
+ unless Utils.popen_read("git remote -v").match?(%r{^homebrew.*Homebrew/homebrew-core.*$})
+ ohai "Adding #{homebrew_core_remote} remote"
+ safe_system "git", "remote", "add", homebrew_core_remote, homebrew_core_url
+ end
+ ohai "Fetching remote #{homebrew_core_remote}"
+ safe_system "git", "fetch", homebrew_core_remote, "HEAD", default_origin_branch
+ if quiet_system "git", "cat-file", "-e", "#{full_origin_branch}:#{formula_path}"
+ ohai "#{formula.full_name} exists in #{full_origin_branch}"
+ safe_system "git", "checkout", full_origin_branch
+ return tap_full_name, homebrew_core_remote, default_origin_branch, previous_branch
+ end
end
- origin_branch ||= "origin/master"
- [formula.tap&.full_name, origin_branch, "-"]
end
def bump_formula_pr
@@ -142,7 +136,7 @@ def bump_formula_pr
odie "This formula is disabled!" if formula.disabled?
- tap_full_name, origin_branch, previous_branch = use_correct_linux_tap(formula, args: args)
+ tap_full_name, remote, remote_branch, previous_branch = use_correct_linux_tap(formula, args: args)
check_open_pull_requests(formula, tap_full_name, args: args)
new_version = args.version
@@ -355,7 +349,8 @@ def bump_formula_pr
sourcefile_path: formula.path,
old_contents: old_contents,
additional_files: alias_rename,
- origin_branch: origin_branch,
+ remote: remote,
+ remote_branch: remote_branch,
branch_name: "bump-#{formula.name}-#{new_formula_version}",
commit_message: "#{formula.name} #{new_formula_version}",
previous_branch: previous_branch, | true |
Other | Homebrew | brew | 92d3eda91425db1b5bf41a7ac02cc2d500106d8f.json | git_extensions: move origin_branch from utils/git | Library/Homebrew/dev-cmd/pr-pull.rb | @@ -385,11 +385,8 @@ def pr_pull
_, user, repo, pr = *url_match
odie "Not a GitHub pull request: #{arg}" unless pr
- current_branch = tap.path.git_branch
- origin_branch = Utils::Git.origin_branch(tap.path).split("/").last
-
- if current_branch != origin_branch || args.branch_okay? || args.clean?
- opoo "Current branch is #{current_branch}: do you need to pull inside #{origin_branch}?"
+ if !tap.path.git_default_origin_branch? || args.branch_okay? || args.clean?
+ opoo "Current branch is #{tap.path.git_branch}: do you need to pull inside #{tap.path.git_origin_branch}?"
end
ohai "Fetching #{tap} pull request ##{pr}" | true |
Other | Homebrew | brew | 92d3eda91425db1b5bf41a7ac02cc2d500106d8f.json | git_extensions: move origin_branch from utils/git | Library/Homebrew/diagnostic.rb | @@ -572,16 +572,9 @@ def check_tap_git_branch
return unless Utils::Git.available?
commands = Tap.map do |tap|
- next unless tap.path.git?
- next if tap.path.git_origin.blank?
+ next if tap.path.git_default_origin_branch?
- branch = tap.path.git_branch
- next if branch.blank?
-
- origin_branch = Utils::Git.origin_branch(tap.path)&.split("/")&.last
- next if origin_branch == branch
-
- "git -C $(brew --repo #{tap.name}) checkout #{origin_branch}"
+ "git -C $(brew --repo #{tap.name}) checkout #{tap.path.git_origin_branch}"
end.compact
return if commands.blank? | true |
Other | Homebrew | brew | 92d3eda91425db1b5bf41a7ac02cc2d500106d8f.json | git_extensions: move origin_branch from utils/git | Library/Homebrew/extend/git_repository.rb | @@ -63,6 +63,21 @@ def git_branch
Utils.popen_read("git", "rev-parse", "--abbrev-ref", "HEAD", chdir: self).chomp.presence
end
+ # Gets the name of the default origin HEAD branch.
+ sig { returns(T.nilable(String)) }
+ def git_origin_branch
+ return unless git? && Utils::Git.available?
+
+ Utils.popen_read("git", "symbolic-ref", "-q", "--short", "refs/remotes/origin/HEAD", chdir: self)
+ .chomp.presence&.split("/")&.last
+ end
+
+ # Returns true if the repository's current branch matches the default origin branch.
+ sig { returns(T.nilable(T::Boolean)) }
+ def git_default_origin_branch?
+ git_origin_branch == git_branch
+ end
+
# Returns the date of the last commit, in YYYY-MM-DD format.
sig { returns(T.nilable(String)) }
def git_last_commit_date | true |
Other | Homebrew | brew | 92d3eda91425db1b5bf41a7ac02cc2d500106d8f.json | git_extensions: move origin_branch from utils/git | Library/Homebrew/utils/git.rb | @@ -135,8 +135,8 @@ def setup_gpg!
end
def origin_branch(repo)
- Utils.popen_read(git, "-C", repo, "symbolic-ref", "-q", "--short",
- "refs/remotes/origin/HEAD").chomp.presence
+ odeprecated "Utils::Git.origin_branch(repo)", "Pathname(repo).git_origin_branch"
+ Pathname(repo).extend(GitRepositoryExtension).git_origin_branch
end
def current_branch(repo) | true |
Other | Homebrew | brew | 92d3eda91425db1b5bf41a7ac02cc2d500106d8f.json | git_extensions: move origin_branch from utils/git | Library/Homebrew/utils/github.rb | @@ -679,7 +679,8 @@ def create_bump_pr(info, args:)
sourcefile_path = info[:sourcefile_path]
old_contents = info[:old_contents]
additional_files = info[:additional_files] || []
- origin_branch = info[:origin_branch]
+ remote = info[:remote] || "origin"
+ remote_branch = info[:remote_branch]
branch = info[:branch_name]
commit_message = info[:commit_message]
previous_branch = info[:previous_branch]
@@ -688,7 +689,6 @@ def create_bump_pr(info, args:)
pr_message = info[:pr_message]
sourcefile_path.parent.cd do
- _, base_branch = origin_branch.split("/")
git_dir = Utils.popen_read("git rev-parse --git-dir").chomp
shallow = !git_dir.empty? && File.exist?("#{git_dir}/shallow")
changed_files = [sourcefile_path]
@@ -698,12 +698,12 @@ def create_bump_pr(info, args:)
ohai "try to fork repository with GitHub API" unless args.no_fork?
ohai "git fetch --unshallow origin" if shallow
ohai "git add #{changed_files.join(" ")}"
- ohai "git checkout --no-track -b #{branch} #{origin_branch}"
+ ohai "git checkout --no-track -b #{branch} #{remote}/#{remote_branch}"
ohai "git commit --no-edit --verbose --message='#{commit_message}'" \
" -- #{changed_files.join(" ")}"
ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}"
ohai "git checkout --quiet #{previous_branch}"
- ohai "create pull request with GitHub API (base branch: #{base_branch})"
+ ohai "create pull request with GitHub API (base branch: #{remote_branch})"
else
unless args.commit?
@@ -723,7 +723,7 @@ def create_bump_pr(info, args:)
end
safe_system "git", "add", *changed_files
- safe_system "git", "checkout", "--no-track", "-b", branch, origin_branch unless args.commit?
+ safe_system "git", "checkout", "--no-track", "-b", branch, "#{remote}/#{remote_branch}" unless args.commit?
safe_system "git", "commit", "--no-edit", "--verbose",
"--message=#{commit_message}",
"--", *changed_files
@@ -746,7 +746,7 @@ def create_bump_pr(info, args:)
begin
url = GitHub.create_pull_request(tap_full_name, commit_message,
- "#{username}:#{branch}", base_branch, pr_message)["html_url"]
+ "#{username}:#{branch}", remote_branch, pr_message)["html_url"]
if args.no_browse?
puts url
else | true |
Other | Homebrew | brew | d802b3755a6df6a9c1081061017d1d995c34771a.json | utils/git: remove redundant current_branch | Library/Homebrew/dev-cmd/pr-pull.rb | @@ -385,7 +385,7 @@ def pr_pull
_, user, repo, pr = *url_match
odie "Not a GitHub pull request: #{arg}" unless pr
- current_branch = Utils::Git.current_branch(tap.path)
+ current_branch = tap.path.git_branch
origin_branch = Utils::Git.origin_branch(tap.path).split("/").last
if current_branch != origin_branch || args.branch_okay? || args.clean? | true |
Other | Homebrew | brew | d802b3755a6df6a9c1081061017d1d995c34771a.json | utils/git: remove redundant current_branch | Library/Homebrew/utils/git.rb | @@ -140,7 +140,8 @@ def origin_branch(repo)
end
def current_branch(repo)
- Utils.popen_read("git", "-C", repo, "symbolic-ref", "--short", "HEAD").chomp.presence
+ odeprecated "Utils::Git.current_branch(repo)", "Pathname(repo).git_branch"
+ Pathname(repo).extend(GitRepositoryExtension).git_branch
end
# Special case of `git cherry-pick` that permits non-verbose output and | true |
Other | Homebrew | brew | 75be0ca4d08de6d00b1fe17ae1aee20f80c25ade.json | git_repository: add type signatures and comments | Library/Homebrew/extend/git_repository.rb | @@ -1,50 +1,70 @@
-# typed: false
+# typed: strict
# frozen_string_literal: true
require "utils/git"
require "utils/popen"
+# Extensions to {Pathname} for querying Git repository information.
+# @see Utils::Git
+# @api private
module GitRepositoryExtension
+ extend T::Sig
+
+ sig { returns(T::Boolean) }
def git?
join(".git").exist?
end
+ # Gets the URL of the Git origin remote.
+ sig { returns(T.nilable(String)) }
def git_origin
return unless git? && Utils::Git.available?
Utils.popen_read("git", "config", "--get", "remote.origin.url", chdir: self).chomp.presence
end
+ # Sets the URL of the Git origin remote.
+ sig { params(origin: String).returns(T.nilable(T::Boolean)) }
def git_origin=(origin)
return unless git? && Utils::Git.available?
safe_system "git", "remote", "set-url", "origin", origin, chdir: self
end
+ # Gets the full commit hash of the HEAD commit.
+ sig { returns(T.nilable(String)) }
def git_head
return unless git? && Utils::Git.available?
Utils.popen_read("git", "rev-parse", "--verify", "-q", "HEAD", chdir: self).chomp.presence
end
+ # Gets a short commit hash of the HEAD commit.
+ sig { returns(T.nilable(String)) }
def git_short_head
return unless git? && Utils::Git.available?
Utils.popen_read("git", "rev-parse", "--short=4", "--verify", "-q", "HEAD", chdir: self).chomp.presence
end
+ # Gets the relative date of the last commit, e.g. "1 hour ago"
+ sig { returns(T.nilable(String)) }
def git_last_commit
return unless git? && Utils::Git.available?
Utils.popen_read("git", "show", "-s", "--format=%cr", "HEAD", chdir: self).chomp.presence
end
+ # Gets the name of the currently checked-out branch, or HEAD if the repository is in a detached HEAD state.
+ sig { returns(T.nilable(String)) }
def git_branch
return unless git? && Utils::Git.available?
Utils.popen_read("git", "rev-parse", "--abbrev-ref", "HEAD", chdir: self).chomp.presence
end
+ # Returns the date of the last commit, in YYYY-MM-DD format.
+ sig { returns(T.nilable(String)) }
def git_last_commit_date
return unless git? && Utils::Git.available?
| true |
Other | Homebrew | brew | 75be0ca4d08de6d00b1fe17ae1aee20f80c25ade.json | git_repository: add type signatures and comments | Library/Homebrew/extend/git_repository.rbi | @@ -0,0 +1,8 @@
+# typed: strict
+
+module GitRepositoryExtension
+ include Kernel
+
+ sig { params(args: T.any(String, Pathname)).returns(Pathname) }
+ def join(*args); end
+end | true |
Other | Homebrew | brew | 75be0ca4d08de6d00b1fe17ae1aee20f80c25ade.json | git_repository: add type signatures and comments | Library/Homebrew/utils/git.rb | @@ -4,6 +4,7 @@
module Utils
# Helper functions for querying Git information.
#
+ # @see GitRepositoryExtension
# @api private
module Git
module_function | true |
Other | Homebrew | brew | 7ef88f1966235c59216ec31836abedd6487f7cfc.json | Livecheck: Skip URL processing for GithubLatest | Library/Homebrew/livecheck/livecheck.rb | @@ -25,6 +25,11 @@ module Livecheck
lolg.it
].freeze
+ STRATEGY_SYMBOLS_TO_SKIP_PREPROCESS_URL = [
+ :github_latest,
+ :page_match,
+ ].freeze
+
UNSTABLE_VERSION_KEYWORDS = %w[
alpha
beta
@@ -381,8 +386,8 @@ def latest_version(formula, args:)
next
end
- # Do not preprocess the URL when livecheck.strategy is set to :page_match
- url = if livecheck_strategy == :page_match
+ # Only preprocess the URL when it's appropriate
+ url = if STRATEGY_SYMBOLS_TO_SKIP_PREPROCESS_URL.include?(livecheck_strategy)
original_url
else
preprocess_url(original_url) | false |
Other | Homebrew | brew | d173b57c4203915365b967d1c61fad49bd325536.json | github_latest: modify strategy and tests | Library/Homebrew/livecheck/strategy/github_latest.rb | @@ -7,10 +7,11 @@ module Strategy
# The {GithubLatest} strategy identifies versions of software at
# github.com by checking a repository's latest release page.
#
- # GitHub URLs take a few differemt formats:
+ # GitHub URLs take a few different formats:
#
- # * `https://github.com/example/example/releases/download/1.2.3/example-1.2.3.zip`
+ # * `https://github.com/example/example/releases/download/1.2.3/example-1.2.3.tar.gz`
# * `https://github.com/example/example/archive/v1.2.3.tar.gz`
+ # * `https://github.com/downloads/example/example/example-1.2.3.tar.gz`
#
# This strategy is used when latest releases are marked for software hosted
# on GitHub. It is necessary to use `strategy :github_latest` in a `livecheck`
@@ -21,10 +22,12 @@ module Strategy
#
# @api public
class GithubLatest
- NICE_NAME = "GitHub Latest"
+ NICE_NAME = "GitHub - Latest"
+
+ PRIORITY = 0
# The `Regexp` used to determine if the strategy applies to the URL.
- URL_MATCH_REGEX = /github.com/i.freeze
+ URL_MATCH_REGEX = %r{//github\.com(?:/downloads)?(?:/[^/]+){2}}i.freeze
# Whether the strategy can be applied to the provided URL.
#
@@ -41,7 +44,7 @@ def self.match?(url)
# @param regex [Regexp] a regex used for matching versions in content
# @return [Hash]
def self.find_versions(url, regex = nil)
- %r{github\.com/(?<username>[\da-z\-]+)/(?<repository>[\da-z_\-]+)}i =~ url
+ %r{github\.com/(?:downloads/)?(?<username>[^/]+)/(?<repository>[^/]+)}i =~ url.sub(/\.git$/i, "")
# The page containing the latest release
page_url = "https://github.com/#{username}/#{repository}/releases/latest" | true |
Other | Homebrew | brew | d173b57c4203915365b967d1c61fad49bd325536.json | github_latest: modify strategy and tests | Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb | @@ -6,17 +6,24 @@
describe Homebrew::Livecheck::Strategy::GithubLatest do
subject(:github_latest) { described_class }
- let(:github_download_url) { "https://github.com/example/example/releases/download/1.2.3/example-1.2.3.zip" }
- let(:github_archive_url) { "https://github.com/example/example/archive/v1.2.3.tar.gz" }
+ let(:github_release_artifact_url) {
+ "https://github.com/example/example/releases/download/1.2.3/example-1.2.3.zip"
+ }
+ let(:github_tag_archive_url) { "https://github.com/example/example/archive/v1.2.3.tar.gz" }
+ let(:github_repository_upload_url) { "https://github.com/downloads/example/example/example-1.2.3.tar.gz" }
let(:non_github_url) { "https://brew.sh/test" }
describe "::match?" do
- it "returns true if the argument provided is a GitHub Download URL" do
- expect(github_latest.match?(github_download_url)).to be true
+ it "returns true if the argument provided is a GitHub release artifact URL" do
+ expect(github_latest.match?(github_release_artifact_url)).to be true
end
- it "returns true if the argument provided is a GitHub Archive URL" do
- expect(github_latest.match?(github_archive_url)).to be true
+ it "returns true if the argument provided is a GitHub tag archive URL" do
+ expect(github_latest.match?(github_tag_archive_url)).to be true
+ end
+
+ it "returns true if the argument provided is a GitHub repository upload URL" do
+ expect(github_latest.match?(github_repository_upload_url)).to be true
end
it "returns false if the argument provided is not a GitHub URL" do | true |
Other | Homebrew | brew | f96b8e713875fee683299cda6000834fae594255.json | livecheck: add GithubLatest strategy | Library/Homebrew/livecheck/strategy.rb | @@ -78,6 +78,7 @@ def from_url(url, regex_provided = nil)
require_relative "strategy/apache"
require_relative "strategy/bitbucket"
require_relative "strategy/git"
+require_relative "strategy/github_latest"
require_relative "strategy/gnome"
require_relative "strategy/gnu"
require_relative "strategy/hackage" | true |
Other | Homebrew | brew | f96b8e713875fee683299cda6000834fae594255.json | livecheck: add GithubLatest strategy | Library/Homebrew/livecheck/strategy/github_latest.rb | @@ -0,0 +1,59 @@
+# typed: false
+# frozen_string_literal: true
+
+module Homebrew
+ module Livecheck
+ module Strategy
+ # The {GithubLatest} strategy identifies versions of software at
+ # github.com by checking a repository's latest release page.
+ #
+ # GitHub URLs take a few differemt formats:
+ #
+ # * `https://github.com/example/example/releases/download/1.2.3/example-1.2.3.zip`
+ # * `https://github.com/example/example/archive/v1.2.3.tar.gz`
+ #
+ # This strategy is used when latest releases are marked for software hosted
+ # on GitHub. It is necessary to use `strategy :github_latest` in a `livecheck`
+ # block for Livecheck to use this strategy.
+ #
+ # The default regex identifies versions from `href` attributes containing the
+ # tag name.
+ #
+ # @api public
+ class GithubLatest
+ NICE_NAME = "GitHub Latest"
+
+ # The `Regexp` used to determine if the strategy applies to the URL.
+ URL_MATCH_REGEX = /github.com/i.freeze
+
+ # Whether the strategy can be applied to the provided URL.
+ #
+ # @param url [String] the URL to match against
+ # @return [Boolean]
+ def self.match?(url)
+ URL_MATCH_REGEX.match?(url)
+ end
+
+ # Generates a URL and regex (if one isn't provided) and passes them
+ # to {PageMatch.find_versions} to identify versions in the content.
+ #
+ # @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)
+ %r{github\.com/(?<username>[\da-z\-]+)/(?<repository>[\da-z_\-]+)}i =~ url
+
+ # The page containing the latest release
+ page_url = "https://github.com/#{username}/#{repository}/releases/latest"
+
+ # The default regex applies to most repositories, but may have to be
+ # replaced with a specific regex when the tag names contain the package
+ # name or other characters apart from the version.
+ regex ||= %r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i
+
+ Homebrew::Livecheck::Strategy::PageMatch.find_versions(page_url, regex)
+ end
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | f96b8e713875fee683299cda6000834fae594255.json | livecheck: add GithubLatest strategy | Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb | @@ -0,0 +1,26 @@
+# typed: false
+# frozen_string_literal: true
+
+require "livecheck/strategy/github_latest"
+
+describe Homebrew::Livecheck::Strategy::GithubLatest do
+ subject(:github_latest) { described_class }
+
+ let(:github_download_url) { "https://github.com/example/example/releases/download/1.2.3/example-1.2.3.zip" }
+ let(:github_archive_url) { "https://github.com/example/example/archive/v1.2.3.tar.gz" }
+ let(:non_github_url) { "https://brew.sh/test" }
+
+ describe "::match?" do
+ it "returns true if the argument provided is a GitHub Download URL" do
+ expect(github_latest.match?(github_download_url)).to be true
+ end
+
+ it "returns true if the argument provided is a GitHub Archive URL" do
+ expect(github_latest.match?(github_archive_url)).to be true
+ end
+
+ it "returns false if the argument provided is not a GitHub URL" do
+ expect(github_latest.match?(non_github_url)).to be false
+ end
+ end
+end | true |
Other | Homebrew | brew | 2a197af07610bb399ed87156062b13cd52e94b48.json | Add CPU family for Apple’s M1 SoC
According to reports, XNU’s CPU family identifier previously used for
the Westmere family (which Homebrew mislabels as the Arrandale family)
is now being reused for one of Apple’s M1 SoC models.
Resolve the conflict by splitting the list of CPU families and adding a
microarchitecture check.
Sources for the values:
- https://github.com/Homebrew/brew/issues/7857#issuecomment-728739049
- https://en.wikipedia.org/wiki/Comparison_of_ARMv8-A_cores
- Direct messages | Library/Homebrew/extend/os/mac/hardware/cpu.rb | @@ -22,33 +22,10 @@ def type
end
def family
- case sysctl_int("hw.cpufamily")
- when 0x73d67300 # Yonah: Core Solo/Duo
- :core
- when 0x426f69ef # Merom: Core 2 Duo
- :core2
- when 0x78ea4fbc # Penryn
- :penryn
- when 0x6b5a4cd2 # Nehalem
- :nehalem
- when 0x573B5EEC # Arrandale
- :arrandale
- when 0x5490B78C # Sandy Bridge
- :sandybridge
- when 0x1F65E835 # Ivy Bridge
- :ivybridge
- when 0x10B282DC # Haswell
- :haswell
- when 0x582ed09c # Broadwell
- :broadwell
- when 0x37fc219f # Skylake
- :skylake
- when 0x0f817246 # Kaby Lake
- :kabylake
- when 0x38435547 # Ice Lake
- :icelake
- when 0x07d34b9f # ARMv8.3-A (Vortex, Tempest)
- :arm_vortex_tempest
+ if arm?
+ arm_family
+ elsif intel?
+ intel_family
else
:dunno
end
@@ -124,6 +101,48 @@ def physical_cpu_arm64?
private
+ def arm_family
+ case sysctl_int("hw.cpufamily")
+ when 0x07d34b9f # ARMv8.3-A (Vortex, Tempest)
+ :arm_vortex_tempest
+ when 0x573b5eec, 0x1b588bb3 # ARMv8.4-A (Firestorm, Icestorm)
+ :arm_firestorm_icestorm
+ else
+ :dunno
+ end
+ end
+
+ def intel_family
+ case sysctl_int("hw.cpufamily")
+ when 0x73d67300 # Yonah: Core Solo/Duo
+ :core
+ when 0x426f69ef # Merom: Core 2 Duo
+ :core2
+ when 0x78ea4fbc # Penryn
+ :penryn
+ when 0x6b5a4cd2 # Nehalem
+ :nehalem
+ when 0x573b5eec # Arrandale
+ :arrandale
+ when 0x5490b78c # Sandy Bridge
+ :sandybridge
+ when 0x1f65e835 # Ivy Bridge
+ :ivybridge
+ when 0x10b282dc # Haswell
+ :haswell
+ when 0x582ed09c # Broadwell
+ :broadwell
+ when 0x37fc219f # Skylake
+ :skylake
+ when 0x0f817246 # Kaby Lake
+ :kabylake
+ when 0x38435547 # Ice Lake
+ :icelake
+ else
+ :dunno
+ end
+ end
+
def sysctl_bool(key)
sysctl_int(key) == 1
end | true |
Other | Homebrew | brew | 2a197af07610bb399ed87156062b13cd52e94b48.json | Add CPU family for Apple’s M1 SoC
According to reports, XNU’s CPU family identifier previously used for
the Westmere family (which Homebrew mislabels as the Arrandale family)
is now being reused for one of Apple’s M1 SoC models.
Resolve the conflict by splitting the list of CPU families and adding a
microarchitecture check.
Sources for the values:
- https://github.com/Homebrew/brew/issues/7857#issuecomment-728739049
- https://en.wikipedia.org/wiki/Comparison_of_ARMv8-A_cores
- Direct messages | Library/Homebrew/test/hardware/cpu_spec.rb | @@ -22,6 +22,7 @@
describe "::family" do
let(:cpu_families) {
[
+ :arm_firestorm_icestorm,
:arm_vortex_tempest,
:arrandale,
:atom,
@@ -48,5 +49,28 @@
it "returns the current CPU's family name as a symbol, or :dunno if it cannot be detected" do
expect(cpu_families).to include described_class.family
end
+
+ context "when hw.cpufamily is 0x573b5eec on a Mac", :needs_macos do
+ before do
+ allow(described_class)
+ .to receive(:sysctl_int)
+ .with("hw.cpufamily")
+ .and_return(0x573b5eec)
+ end
+
+ it "returns :arm_firestorm_icestorm on ARM" do
+ allow(described_class).to receive(:arm?).and_return(true)
+ allow(described_class).to receive(:intel?).and_return(false)
+
+ expect(described_class.family).to eq(:arm_firestorm_icestorm)
+ end
+
+ it "returns :westmere on Intel" do
+ allow(described_class).to receive(:arm?).and_return(false)
+ allow(described_class).to receive(:intel?).and_return(true)
+
+ expect(described_class.family).to eq(:westmere)
+ end
+ end
end
end | true |
Other | Homebrew | brew | 623840a304eae1b12c3f4671171f376b1c7365a8.json | workflows/tests: consolidate macOS tests.
We have a limited number of macOS workers (for the Homebrew
organisation) and queuing these seems to be slowing things down overall
compared to when we had one big job.
Linux throughput is still significantly quicker so it makes sense to
split up those jobs for providing quick feedback on breakages that are
cross-platform (which ends up being most but definitely not all of
them). | .github/workflows/tests.yml | @@ -43,28 +43,15 @@ jobs:
hadolint Dockerfile
tap-syntax:
- name: ${{ matrix.name }}
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- include:
- - name: tap syntax (Linux)
- os: ubuntu-latest
- core-tap: linuxbrew-core
- - name: tap syntax (macOS)
- os: macos-latest
- core-tap: homebrew-core
+ name: tap syntax (Linux)
+ runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- run: brew test-bot --only-cleanup-before
- - name: Set up Xcode
- if: matrix.os == 'macos-11.0'
- run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer
-
- run: brew config
- name: Cache Bundler RubyGems
@@ -86,63 +73,23 @@ jobs:
brew update-test --to-tag
brew update-test --commit=HEAD
- - name: Set up all Homebrew taps
- if: runner.os == 'macOS'
- run: |
- brew tap homebrew/cask
- brew tap homebrew/cask-drivers
- brew tap homebrew/cask-fonts
- brew tap homebrew/cask-versions
- brew update-reset Library/Taps/homebrew/homebrew-bundle \
- Library/Taps/homebrew/homebrew-cask \
- Library/Taps/homebrew/homebrew-cask-versions \
- Library/Taps/homebrew/homebrew-services
-
- name: Run brew readall on all taps
run: brew readall --aliases
- - name: Run brew style on ${{ matrix.core-tap }}
+ - name: Run brew style on linuxbrew-core
run: brew style --display-cop-names homebrew/core
- - name: Run brew style on official taps
- if: runner.os == 'macOS'
- run: |
- brew style --display-cop-names homebrew/bundle \
- homebrew/services \
- homebrew/test-bot
-
- - name: Run brew style on cask taps
- if: runner.os == 'macOS'
- run: |
- brew style --display-cop-names homebrew/cask \
- homebrew/cask-drivers \
- homebrew/cask-fonts \
- homebrew/cask-versions
-
- name: Run brew audit --skip-style on all taps
run: brew audit --skip-style
vendored-gems:
- name: ${{ matrix.name }}
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- include:
- - name: vendored gems (Linux)
- os: ubuntu-latest
- core-tap: linuxbrew-core
- - name: vendored gems (macOS)
- os: macos-11.0
- core-tap: homebrew-core
+ name: vendored gems (Linux)
+ runs-on: ubuntu-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- - name: Set up Xcode
- if: matrix.os == 'macos-11.0'
- run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer
-
- name: Configure Git user
uses: Homebrew/actions/git-user-config@master
with:
@@ -180,39 +127,21 @@ jobs:
tests:
name: ${{ matrix.name }}
- runs-on: ${{ matrix.os }}
+ runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: tests (no-compatibility mode)
- os: ubuntu-latest
test-flags: --no-compat --online --coverage
- name: tests (generic OS)
- os: ubuntu-latest
test-flags: --generic --online --coverage
- name: tests (Linux)
- os: ubuntu-latest
- test-flags: --online --coverage
- - name: tests (macOS)
- os: macos-11.0
test-flags: --online --coverage
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- - name: Set up Xcode
- if: matrix.os == 'macos-11.0'
- run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer
-
- - name: Install brew tests dependencies
- if: runner.os == 'macOS'
- run: |
- brew install subversion
- Library/Homebrew/shims/scm/svn --homebrew=print-path
- which svn
- which svnadmin
-
- name: Cache Bundler RubyGems
uses: actions/cache@v1
with:
@@ -225,42 +154,105 @@ jobs:
- name: Run brew tests
run: |
- if ${{ runner.os == 'Linux' }}; then
- # brew tests doesn't like world writable directories
- sudo chmod -R g-w,o-w /home/linuxbrew/.linuxbrew/Homebrew
- elif ${{ runner.os == 'macOS' }}; then
- # These cannot be queried at the macOS level on GitHub Actions.
- export HOMEBREW_LANGUAGES='en-GB'
- fi
-
- if ${{ contains(matrix.test-flags, '--coverage') }}; then
- # Set variables for coverage reporting.
- export HOMEBREW_CODECOV_TOKEN='3ea0364c-80ce-47a3-9fba-93a940d4b5d7'
- fi
+ # brew tests doesn't like world writable directories
+ sudo chmod -R g-w,o-w /home/linuxbrew/.linuxbrew/Homebrew
brew tests ${{ matrix.test-flags }}
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ HOMEBREW_CODECOV_TOKEN: 3ea0364c-80ce-47a3-9fba-93a940d4b5d7
- test-default-formula:
- name: ${{ matrix.name }}
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- include:
- - name: test default formula (Linux)
- os: ubuntu-latest
- - name: test default formula (macOS)
- os: macos-latest
+ test-default-formula-linux:
+ name: test default formula (Linux)
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up Homebrew
+ id: set-up-homebrew
+ uses: Homebrew/actions/setup-homebrew@master
+
+ - run: brew test-bot --only-cleanup-before
+
+ - run: brew test-bot --only-formulae --test-default-formula
+
+ test-everything:
+ name: test everything (macOS)
+ runs-on: macos-11.0
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Set up Xcode
- if: matrix.os == 'macos-11.0'
run: sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer
- run: brew test-bot --only-cleanup-before
+ - run: brew config
+
+ # Can't cache this because we need to check that it doesn't fail the
+ # "uncommitted RubyGems" step with a cold cache.
+ - name: Install Bundler RubyGems
+ run: brew install-bundler-gems
+
+ - name: Check for uncommitted RubyGems
+ run: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby
+
+ - run: brew doctor
+
+ - name: Run brew update-tests
+ if: github.event_name == 'pull_request'
+ run: |
+ brew update-test
+ brew update-test --to-tag
+ brew update-test --commit=HEAD
+
+ - name: Set up all Homebrew taps
+ run: |
+ brew tap homebrew/cask
+ brew tap homebrew/cask-drivers
+ brew tap homebrew/cask-fonts
+ brew tap homebrew/cask-versions
+ brew update-reset Library/Taps/homebrew/homebrew-bundle \
+ Library/Taps/homebrew/homebrew-cask \
+ Library/Taps/homebrew/homebrew-cask-versions \
+ Library/Taps/homebrew/homebrew-services
+
+ - name: Run brew readall on all taps
+ run: brew readall --aliases
+
+ - name: Run brew style on homebrew-core
+ run: brew style --display-cop-names homebrew/core
+
+ - name: Run brew style on official taps
+ run: |
+ brew style --display-cop-names homebrew/bundle \
+ homebrew/services \
+ homebrew/test-bot
+
+ - name: Run brew style on cask taps
+ run: |
+ brew style --display-cop-names homebrew/cask \
+ homebrew/cask-drivers \
+ homebrew/cask-fonts \
+ homebrew/cask-versions
+
+ - name: Run brew audit --skip-style on all taps
+ run: brew audit --skip-style
+
+ - name: Install brew tests dependencies
+ run: |
+ brew install subversion
+ Library/Homebrew/shims/scm/svn --homebrew=print-path
+ which svn
+ which svnadmin
+
+ - name: Run brew tests
+ run: brew tests --online --coverage
+ env:
+ HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # Set variables for coverage reporting.
+ HOMEBREW_CODECOV_TOKEN: 3ea0364c-80ce-47a3-9fba-93a940d4b5d7
+ # These cannot be queried at the macOS level on GitHub Actions.
+ HOMEBREW_LANGUAGES: en-GB
+
- run: brew test-bot --only-formulae --test-default-formula | false |
Other | Homebrew | brew | e2ce4ab1b68c5ec234944e798038334f2a257131.json | add flags to deps --installed | Library/Homebrew/cmd/deps.rb | @@ -57,8 +57,14 @@ def deps_args
description: "Switch into the mode used by the `--all` option, but only list dependencies "\
"for each provided <formula>, one formula per line. This is used for "\
"debugging the `--installed`/`--all` display mode."
-
+ switch "--formula", "--formulae",
+ depends_on: "--installed",
+ description: "Treat all named arguments as formulae."
+ switch "--cask", "--casks",
+ depends_on: "--installed",
+ description: "Treat all named arguments as casks."
conflicts "--installed", "--all"
+ conflicts "--formula", "--cask"
formula_options
end
end
@@ -82,7 +88,13 @@ def deps
dependents = if args.named.present?
sorted_dependents(args.named.to_formulae_and_casks)
elsif args.installed?
- sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ if args.formula? && !args.cask?
+ sorted_dependents(Formula.installed)
+ elsif args.cask? && !args.formula?
+ sorted_dependents(Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ else
+ sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ end
else
raise FormulaUnspecifiedError
end
@@ -100,8 +112,14 @@ def deps
if args.no_named?
raise FormulaUnspecifiedError unless args.installed?
- puts_deps sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args))),
- recursive: recursive, args: args
+ sorted_dependents_formulae_and_casks = if args.formula? && !args.cask?
+ sorted_dependents(Formula.installed)
+ elsif args.cask? && !args.formula?
+ sorted_dependents(Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ else
+ sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ end
+ puts_deps sorted_dependents_formulae_and_casks, recursive: recursive, args: args
return
end
| true |
Other | Homebrew | brew | e2ce4ab1b68c5ec234944e798038334f2a257131.json | add flags to deps --installed | docs/Manpage.md | @@ -129,6 +129,10 @@ show the intersection of dependencies for each formula.
List dependencies for all available formulae.
* `--for-each`:
Switch into the mode used by the `--all` option, but only list dependencies for each provided *`formula`*, one formula per line. This is used for debugging the `--installed`/`--all` display mode.
+* `--formula`:
+ Treat all named arguments as formulae.
+* `--cask`:
+ Treat all named arguments as casks.
### `desc` [*`options`*] (*`text`*|`/`*`text`*`/`|*`formula`*)
| true |
Other | Homebrew | brew | e2ce4ab1b68c5ec234944e798038334f2a257131.json | add flags to deps --installed | manpages/brew.1 | @@ -152,6 +152,14 @@ List dependencies for all available formulae\.
\fB\-\-for\-each\fR
Switch into the mode used by the \fB\-\-all\fR option, but only list dependencies for each provided \fIformula\fR, one formula per line\. This is used for debugging the \fB\-\-installed\fR/\fB\-\-all\fR display mode\.
.
+.TP
+\fB\-\-formula\fR
+Treat all named arguments as formulae\.
+.
+.TP
+\fB\-\-cask\fR
+Treat all named arguments as casks\.
+.
.SS "\fBdesc\fR [\fIoptions\fR] (\fItext\fR|\fB/\fR\fItext\fR\fB/\fR|\fIformula\fR)"
Display \fIformula\fR\'s name and one\-line description\. Formula descriptions are cached; the cache is created on the first search, making that search slower than subsequent ones\.
. | true |
Other | Homebrew | brew | 22a3025f6e42ba25e168baf098c2b038bb99cbb9.json | utils/pypi: return nil for non-pypi-packages from url | Library/Homebrew/test/utils/pypi_spec.rb | @@ -172,5 +172,13 @@
it "updates url to new version" do
expect(described_class.update_pypi_url(old_package_url, "5.29.0")).to eq package_url
end
+
+ it "returns nil for invalid versions" do
+ expect(described_class.update_pypi_url(old_package_url, "0.0.0")).to eq nil
+ end
+
+ it "returns nil for non-pypi urls" do
+ expect(described_class.update_pypi_url("https://brew.sh/foo-1.0.tgz", "1.1")).to eq nil
+ end
end
end | true |
Other | Homebrew | brew | 22a3025f6e42ba25e168baf098c2b038bb99cbb9.json | utils/pypi: return nil for non-pypi-packages from url | Library/Homebrew/utils/pypi.rb | @@ -110,8 +110,12 @@ def <=>(other)
def update_pypi_url(url, version)
package = Package.new url, is_url: true
+ return unless package.valid_pypi_package?
+
_, url = package.pypi_info(version: version)
url
+ rescue ArgumentError
+ nil
end
# Return true if resources were checked (even if no change). | true |
Other | Homebrew | brew | 33fccb46ca109bfcdbdbce78e7a06a4c22bbd31c.json | add two flag to deps --installed | Library/Homebrew/cmd/deps.rb | @@ -57,8 +57,15 @@ def deps_args
description: "Switch into the mode used by the `--all` option, but only list dependencies "\
"for each provided <formula>, one formula per line. This is used for "\
"debugging the `--installed`/`--all` display mode."
+ switch "--formula", "--formulae",
+ depends_on: "--installed",
+ description: "Treat all named arguments as formulae."
+ switch "--cask", "--casks",
+ depends_on: "--installed",
+ description: "Treat all named arguments as casks."
conflicts "--installed", "--all"
+ conflicts "--formula", "--cask"
formula_options
end
end
@@ -82,7 +89,13 @@ def deps
dependents = if args.named.present?
sorted_dependents(args.named.to_formulae_and_casks)
elsif args.installed?
- sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ if args.formula? && !args.cask?
+ sorted_dependents(Formula.installed)
+ elsif args.cask? && !args.formula?
+ sorted_dependents(Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ else
+ sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ end
else
raise FormulaUnspecifiedError
end
@@ -100,8 +113,14 @@ def deps
if args.no_named?
raise FormulaUnspecifiedError unless args.installed?
- puts_deps sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args))),
- recursive: recursive, args: args
+ sorted_dependents_formulae_and_casks = if args.formula? && !args.cask?
+ sorted_dependents(Formula.installed)
+ elsif args.cask? && !args.formula?
+ sorted_dependents(Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ else
+ sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args)))
+ end
+ pus_deps sorted_dependents_formulae_and_casks, recursive: recursive, args: args
return
end
| true |
Other | Homebrew | brew | 33fccb46ca109bfcdbdbce78e7a06a4c22bbd31c.json | add two flag to deps --installed | docs/Manpage.md | @@ -129,6 +129,10 @@ show the intersection of dependencies for each formula.
List dependencies for all available formulae.
* `--for-each`:
Switch into the mode used by the `--all` option, but only list dependencies for each provided *`formula`*, one formula per line. This is used for debugging the `--installed`/`--all` display mode.
+* `--formula`:
+ Treat all named arguments as formulae.
+* `--cask`:
+ Treat all named arguments as casks.
### `desc` [*`options`*] (*`text`*|`/`*`text`*`/`|*`formula`*)
| true |
Other | Homebrew | brew | 33fccb46ca109bfcdbdbce78e7a06a4c22bbd31c.json | add two flag to deps --installed | manpages/brew.1 | @@ -152,6 +152,14 @@ List dependencies for all available formulae\.
\fB\-\-for\-each\fR
Switch into the mode used by the \fB\-\-all\fR option, but only list dependencies for each provided \fIformula\fR, one formula per line\. This is used for debugging the \fB\-\-installed\fR/\fB\-\-all\fR display mode\.
.
+.TP
+\fB\-\-formula\fR
+Treat all named arguments as formulae\.
+.
+.TP
+\fB\-\-cask\fR
+Treat all named arguments as casks\.
+.
.SS "\fBdesc\fR [\fIoptions\fR] (\fItext\fR|\fB/\fR\fItext\fR\fB/\fR|\fIformula\fR)"
Display \fIformula\fR\'s name and one\-line description\. Formula descriptions are cached; the cache is created on the first search, making that search slower than subsequent ones\.
. | true |
Other | Homebrew | brew | cb4ed5a8c20fc6d50883204ea79024a765e56b00.json | workflows/tests: run vendored gems on macOS 11.
All existing workflows using this seem to be broken. | .github/workflows/tests.yml | @@ -132,7 +132,7 @@ jobs:
os: ubuntu-latest
core-tap: linuxbrew-core
- name: vendored gems (macOS)
- os: macos-latest
+ os: macos-11.0
core-tap: homebrew-core
steps:
- name: Set up Homebrew | false |
Other | Homebrew | brew | 32901b71f551478226acf571f77ba6ad59ab461b.json | Update RBI files for rubocop-rspec. | Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.3.0.rbi | @@ -1116,6 +1116,8 @@ RuboCop::AST::NodePattern::LexerRex::IDENTIFIER = T.let(T.unsafe(nil), Regexp)
class RuboCop::AST::NodePattern::LexerRex::LexerError < ::StandardError
end
+RuboCop::AST::NodePattern::LexerRex::NODE_TYPE = T.let(T.unsafe(nil), Regexp)
+
RuboCop::AST::NodePattern::LexerRex::REGEXP = T.let(T.unsafe(nil), Regexp)
RuboCop::AST::NodePattern::LexerRex::REGEXP_BODY = T.let(T.unsafe(nil), Regexp)
@@ -1350,6 +1352,8 @@ RuboCop::AST::NodePattern::Sets::SET_ABSTRACT_OVERRIDE_OVERRIDABLE_ETC = T.let(T
RuboCop::AST::NodePattern::Sets::SET_ADD_DEPENDENCY_ADD_RUNTIME_DEPENDENCY_ADD_DEVELOPMENT_DEPENDENCY = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_AFTER_ACTION_APPEND_AFTER_ACTION_APPEND_AROUND_ACTION_ETC = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_ALL_CONTEXT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_AND_RETURN_AND_RAISE_AND_THROW_ETC = T.let(T.unsafe(nil), Set)
@@ -1358,6 +1362,8 @@ RuboCop::AST::NodePattern::Sets::SET_ANY_ALL_NORETURN_ETC = T.let(T.unsafe(nil),
RuboCop::AST::NodePattern::Sets::SET_ANY_INSTANCE_ALLOW_ANY_INSTANCE_OF_EXPECT_ANY_INSTANCE_OF = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_AP_P_PP_ETC = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_ATTR_READER_ATTR_WRITER_ATTR_ACCESSOR = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_ATTR_READER_ATTR_WRITER_ATTR_ACCESSOR_ATTR = T.let(T.unsafe(nil), Set)
@@ -1366,10 +1372,14 @@ RuboCop::AST::NodePattern::Sets::SET_BACKGROUND_SCENARIO_XSCENARIO_ETC = T.let(T
RuboCop::AST::NodePattern::Sets::SET_BEFORE_AFTER = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_BELONGS_TO_HAS_ONE_HAS_MANY_HAS_AND_BELONGS_TO_MANY = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_BE_EQ_EQL_EQUAL = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_BE_TRUTHY_BE_FALSEY_BE_FALSY_ETC = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_BINWRITE_SYSWRITE_WRITE_WRITE_NONBLOCK = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_CALLER_CALLER_LOCATIONS = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_CALL_RUN = T.let(T.unsafe(nil), Set)
@@ -1392,6 +1402,10 @@ RuboCop::AST::NodePattern::Sets::SET_CONTEXT_SHARED_CONTEXT = T.let(T.unsafe(nil
RuboCop::AST::NodePattern::Sets::SET_COUNT_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_CREATED_AT_UPDATED_AT = T.let(T.unsafe(nil), Set)
+
+RuboCop::AST::NodePattern::Sets::SET_CREATED_AT_UPDATED_AT_2 = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD_DEFINE_SINGLETON_METHOD = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_DESCRIBE_FEATURE = T.let(T.unsafe(nil), Set)
@@ -1412,12 +1426,16 @@ RuboCop::AST::NodePattern::Sets::SET_ESCAPE_ENCODE_UNESCAPE_DECODE = T.let(T.uns
RuboCop::AST::NodePattern::Sets::SET_EXACTLY_AT_LEAST_AT_MOST = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_EXECUTE_REMOVE_BELONGS_TO = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_EXPECT_ALLOW = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_FACTORYGIRL_FACTORYBOT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_FIRST_LAST__ETC = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_FIRST_TAKE = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_FIXNUM_BIGNUM = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_FLATTEN_FLATTEN = T.let(T.unsafe(nil), Set)
@@ -1426,14 +1444,22 @@ RuboCop::AST::NodePattern::Sets::SET_FORMAT_SPRINTF_PRINTF = T.let(T.unsafe(nil)
RuboCop::AST::NodePattern::Sets::SET_GEMCUTTER_RUBYGEMS_RUBYFORGE = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_GET_POST_PUT_ETC = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_GSUB_GSUB = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_GSUB_GSUB_SUB_SUB = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_HAS_MANY_HAS_ONE = T.let(T.unsafe(nil), Set)
+
+RuboCop::AST::NodePattern::Sets::SET_HAS_MANY_HAS_ONE_BELONGS_TO = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_INCLUDE_EXTEND_PREPEND = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_INCLUDE_MEMBER = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_INSERT_INSERT = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EVAL_CLASS_EVAL_MODULE_EVAL = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EXEC_CLASS_EXEC_MODULE_EXEC = T.let(T.unsafe(nil), Set)
@@ -1464,6 +1490,8 @@ RuboCop::AST::NodePattern::Sets::SET_NEW_OPEN = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_NIL_ = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_ONLY_EXCEPT = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_PIPELINE_PIPELINE_R_PIPELINE_RW_ETC = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_PRIVATE_PROTECTED = T.let(T.unsafe(nil), Set)
@@ -1494,10 +1522,16 @@ RuboCop::AST::NodePattern::Sets::SET_RECEIVE_RECEIVE_MESSAGE_CHAIN = T.let(T.uns
RuboCop::AST::NodePattern::Sets::SET_REDUCE_INJECT = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_REFERER_REFERRER = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_REJECT_REJECT = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_RENDER_REDIRECT_TO = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_REQUIRE_REQUIRE_RELATIVE = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_RETURNING_UNIQUE_BY = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_SELECT_FILTER_FIND_ALL_REJECT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT = T.let(T.unsafe(nil), Set)
@@ -1506,6 +1540,10 @@ RuboCop::AST::NodePattern::Sets::SET_SEND_PUBLIC_SEND___SEND__ = T.let(T.unsafe(
RuboCop::AST::NodePattern::Sets::SET_SHOULD_SHOULD_NOT = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_SINCE_FROM_NOW_AFTER_ETC = T.let(T.unsafe(nil), Set)
+
+RuboCop::AST::NodePattern::Sets::SET_SKIP_AFTER_ACTION_SKIP_AROUND_ACTION_SKIP_BEFORE_ACTION_SKIP_ACTION_CALLBACK = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_SKIP_PENDING = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_SORT_BY_SORT = T.let(T.unsafe(nil), Set)
@@ -1530,10 +1568,16 @@ RuboCop::AST::NodePattern::Sets::SET_TO_ENUM_ENUM_FOR = T.let(T.unsafe(nil), Set
RuboCop::AST::NodePattern::Sets::SET_TO_I_TO_F_TO_C = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_TRANSLATE_LOCALIZE = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_TRUE_FALSE = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_TRY_TRY = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_TYPE_TEMPLATE_TYPE_MEMBER = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET_UNIQ_DISTINCT = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET_ZERO_POSITIVE_NEGATIVE = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET__ = T.let(T.unsafe(nil), Set) | true |
Other | Homebrew | brew | 32901b71f551478226acf571f77ba6ad59ab461b.json | Update RBI files for rubocop-rspec. | Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@2.0.1.rbi | @@ -1112,6 +1112,57 @@ class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Base
def block_loc(send_node); end
end
+module RuboCop::Cop::RSpec::Rails
+end
+
+class RuboCop::Cop::RSpec::Rails::HttpStatus < ::RuboCop::Cop::RSpec::Base
+ include(::RuboCop::Cop::ConfigurableEnforcedStyle)
+ extend(::RuboCop::Cop::AutoCorrector)
+
+ def http_status(param0 = T.unsafe(nil)); end
+ def on_send(node); end
+
+ private
+
+ def checker_class; end
+end
+
+class RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker
+ def initialize(node); end
+
+ def message; end
+ def node; end
+ def offensive?; end
+ def preferred_style; end
+
+ private
+
+ def allowed_symbol?; end
+ def number; end
+ def symbol; end
+end
+
+RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker::ALLOWED_STATUSES = T.let(T.unsafe(nil), Array)
+
+RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker::MSG = T.let(T.unsafe(nil), String)
+
+class RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker
+ def initialize(node); end
+
+ def message; end
+ def node; end
+ def offensive?; end
+ def preferred_style; end
+
+ private
+
+ def custom_http_status_code?; end
+ def number; end
+ def symbol; end
+end
+
+RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker::MSG = T.let(T.unsafe(nil), String)
+
class RuboCop::Cop::RSpec::ReceiveCounts < ::RuboCop::Cop::RSpec::Base
extend(::RuboCop::Cop::AutoCorrector)
| true |
Other | Homebrew | brew | 32901b71f551478226acf571f77ba6ad59ab461b.json | Update RBI files for rubocop-rspec. | Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | @@ -28085,31 +28085,10 @@ class RuboCop::AST::NodePattern::Parser
end
module RuboCop::AST::NodePattern::Sets
- SET_AFTER_ACTION_APPEND_AFTER_ACTION_APPEND_AROUND_ACTION_ETC = ::T.let(nil, ::T.untyped)
- SET_AP_P_PP_ETC = ::T.let(nil, ::T.untyped)
- SET_BELONGS_TO_HAS_ONE_HAS_MANY_HAS_AND_BELONGS_TO_MANY = ::T.let(nil, ::T.untyped)
- SET_BINWRITE_SYSWRITE_WRITE_WRITE_NONBLOCK = ::T.let(nil, ::T.untyped)
SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped)
- SET_CREATED_AT_UPDATED_AT = ::T.let(nil, ::T.untyped)
- SET_CREATED_AT_UPDATED_AT_2 = ::T.let(nil, ::T.untyped)
SET_DEPENDS_ON_USES_FROM_MACOS = ::T.let(nil, ::T.untyped)
- SET_EXECUTE_REMOVE_BELONGS_TO = ::T.let(nil, ::T.untyped)
- SET_FIRST_TAKE = ::T.let(nil, ::T.untyped)
- SET_GET_POST_PUT_ETC = ::T.let(nil, ::T.untyped)
- SET_HAS_MANY_HAS_ONE = ::T.let(nil, ::T.untyped)
- SET_HAS_MANY_HAS_ONE_BELONGS_TO = ::T.let(nil, ::T.untyped)
SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
- SET_INSERT_INSERT = ::T.let(nil, ::T.untyped)
- SET_ONLY_EXCEPT = ::T.let(nil, ::T.untyped)
- SET_REFERER_REFERRER = ::T.let(nil, ::T.untyped)
- SET_RENDER_REDIRECT_TO = ::T.let(nil, ::T.untyped)
- SET_RETURNING_UNIQUE_BY = ::T.let(nil, ::T.untyped)
- SET_SINCE_FROM_NOW_AFTER_ETC = ::T.let(nil, ::T.untyped)
- SET_SKIP_AFTER_ACTION_SKIP_AROUND_ACTION_SKIP_BEFORE_ACTION_SKIP_ACTION_CALLBACK = ::T.let(nil, ::T.untyped)
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
- SET_TRANSLATE_LOCALIZE = ::T.let(nil, ::T.untyped)
- SET_TRY_TRY = ::T.let(nil, ::T.untyped)
- SET_UNIQ_DISTINCT = ::T.let(nil, ::T.untyped)
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
end
@@ -28309,56 +28288,6 @@ class RuboCop::Cop::FormulaCop
def required_dependency_name?(param0, param1); end
end
-module RuboCop::Cop::RSpec::Rails
-end
-
-class RuboCop::Cop::RSpec::Rails::HttpStatus
- include ::RuboCop::Cop::ConfigurableEnforcedStyle
- def http_status(param0=T.unsafe(nil)); end
-
- def on_send(node); end
-end
-
-class RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker
- def initialize(node); end
-
- def message(); end
-
- def node(); end
-
- def offensive?(); end
-
- def preferred_style(); end
- ALLOWED_STATUSES = ::T.let(nil, ::T.untyped)
- MSG = ::T.let(nil, ::T.untyped)
-end
-
-class RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker
-end
-
-class RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker
- def initialize(node); end
-
- def message(); end
-
- def node(); end
-
- def offensive?(); end
-
- def preferred_style(); end
- MSG = ::T.let(nil, ::T.untyped)
-end
-
-class RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker
-end
-
-class RuboCop::Cop::RSpec::Rails::HttpStatus
- extend ::RuboCop::Cop::AutoCorrector
-end
-
-module RuboCop::Cop::RSpec::Rails
-end
-
module RuboCop::RSpec::ExpectOffense
def expect_correction(correction, loop: T.unsafe(nil)); end
| true |
Other | Homebrew | brew | 1bfd2ac0e2613b0f5ceb0d5da16c9ff512b5dd4d.json | Fix wrong `force` keyword. | Library/Homebrew/cmd/fetch.rb | @@ -125,14 +125,10 @@ def fetch
else
cask = formula_or_cask
- options = {
- force: args.force?,
- quarantine: args.quarantine?,
- }.compact
+ quarantine = args.quarantine?
+ quarantine = true if quarantine.nil?
- options[:quarantine] = true if options[:quarantine].nil?
-
- download = Cask::Download.new(cask, **options)
+ download = Cask::Download.new(cask, quarantine: quarantine)
fetch_cask(download, args: args)
end
end | false |
Other | Homebrew | brew | d98595d1f1aa0713074855bd9a90fbac0ce046f9.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 | @@ -2914,8 +2914,6 @@ class Addrinfo
end
class Array
- def excluding(*elements); end
-
def extract_options!(); end
def fifth(); end
@@ -2926,8 +2924,6 @@ class Array
def from(position); end
- def including(*elements); end
-
def second(); end
def second_to_last(); end
@@ -2949,8 +2945,6 @@ class Array
def to_sentence(options=T.unsafe(nil)); end
def to_xml(options=T.unsafe(nil)); end
-
- def without(*elements); end
end
class Array
@@ -6835,7 +6829,23 @@ module Enumerable
def chain(*_); end
- def sum(*_); end
+ def exclude?(object); end
+
+ def excluding(*elements); end
+
+ def including(*elements); end
+
+ def index_by(); end
+
+ def index_with(default=T.unsafe(nil)); end
+
+ def many?(); end
+
+ def pluck(*keys); end
+
+ def sum(identity=T.unsafe(nil), &block); end
+
+ def without(*elements); end
end
class Enumerator
@@ -7949,6 +7959,11 @@ class Homebrew::CLI::Args
extend ::T::Private::Methods::SingletonMethodHooks
end
+class Homebrew::CLI::NamedArgs
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class Homebrew::CLI::Parser
include ::Homebrew::CLI::Parser::Compat
end
@@ -8086,6 +8101,11 @@ module Homebrew::EnvConfig
def self.verbose_using_dots?(); end
end
+module Homebrew::Fetch
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class Homebrew::FormulaCreator
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
@@ -13290,6 +13310,11 @@ module OS::Mac::Xcode
extend ::T::Private::Methods::SingletonMethodHooks
end
+module OS
+ extend ::T::Private::Methods::MethodHooks
+ extend ::T::Private::Methods::SingletonMethodHooks
+end
+
class Object
include ::ActiveSupport::Dependencies::Loadable
include ::ActiveSupport::Tryable
@@ -13343,16 +13368,23 @@ class Object
HOMEBREW_DATA_PATH = ::T.let(nil, ::T.untyped)
HOMEBREW_DEFAULT_CACHE = ::T.let(nil, ::T.untyped)
HOMEBREW_DEFAULT_LOGS = ::T.let(nil, ::T.untyped)
+ HOMEBREW_DEFAULT_PREFIX = ::T.let(nil, ::T.untyped)
HOMEBREW_DEFAULT_TEMP = ::T.let(nil, ::T.untyped)
HOMEBREW_LIBRARY = ::T.let(nil, ::T.untyped)
HOMEBREW_LIBRARY_PATH = ::T.let(nil, ::T.untyped)
HOMEBREW_LINKED_KEGS = ::T.let(nil, ::T.untyped)
+ HOMEBREW_LINUX_DEFAULT_PREFIX = ::T.let(nil, ::T.untyped)
HOMEBREW_LOCKS = ::T.let(nil, ::T.untyped)
HOMEBREW_LOGS = ::T.let(nil, ::T.untyped)
+ HOMEBREW_MACOS_ARM_DEFAULT_PREFIX = ::T.let(nil, ::T.untyped)
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = ::T.let(nil, ::T.untyped)
HOMEBREW_PATCHELF_RB_WRITE = ::T.let(nil, ::T.untyped)
HOMEBREW_PINNED_KEGS = ::T.let(nil, ::T.untyped)
HOMEBREW_PREFIX = ::T.let(nil, ::T.untyped)
+ HOMEBREW_PRODUCT = ::T.let(nil, ::T.untyped)
+ HOMEBREW_PULL_API_REGEX = ::T.let(nil, ::T.untyped)
+ HOMEBREW_PULL_OR_COMMIT_URL_REGEX = ::T.let(nil, ::T.untyped)
+ HOMEBREW_RELEASES_URL_REGEX = ::T.let(nil, ::T.untyped)
HOMEBREW_REPOSITORY = ::T.let(nil, ::T.untyped)
HOMEBREW_REQUIRED_RUBY_VERSION = ::T.let(nil, ::T.untyped)
HOMEBREW_SHIMS_PATH = ::T.let(nil, ::T.untyped)
@@ -13361,6 +13393,11 @@ class Object
HOMEBREW_TAP_FORMULA_REGEX = ::T.let(nil, ::T.untyped)
HOMEBREW_TAP_PATH_REGEX = ::T.let(nil, ::T.untyped)
HOMEBREW_TEMP = ::T.let(nil, ::T.untyped)
+ HOMEBREW_USER_AGENT_CURL = ::T.let(nil, ::T.untyped)
+ HOMEBREW_USER_AGENT_FAKE_SAFARI = ::T.let(nil, ::T.untyped)
+ HOMEBREW_USER_AGENT_RUBY = ::T.let(nil, ::T.untyped)
+ HOMEBREW_VERSION = ::T.let(nil, ::T.untyped)
+ HOMEBREW_WWW = ::T.let(nil, ::T.untyped)
OFFICIAL_CASK_TAPS = ::T.let(nil, ::T.untyped)
OFFICIAL_CMD_TAPS = ::T.let(nil, ::T.untyped)
OPTION_DESC_WIDTH = ::T.let(nil, ::T.untyped)
@@ -13369,13 +13406,15 @@ class Object
PATCH_B_SHA256 = ::T.let(nil, ::T.untyped)
REQUIRED_RUBY_X = ::T.let(nil, ::T.untyped)
REQUIRED_RUBY_Y = ::T.let(nil, ::T.untyped)
+ RUBY_BIN = ::T.let(nil, ::T.untyped)
RUBY_COPYRIGHT = ::T.let(nil, ::T.untyped)
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)
RUBY_RELEASE_DATE = ::T.let(nil, ::T.untyped)
RUBY_REVISION = ::T.let(nil, ::T.untyped)
@@ -25738,6 +25777,8 @@ class Range
def entries(); end
+ def sum(identity=T.unsafe(nil)); end
+
def to_a(); end
end
@@ -28584,6 +28625,8 @@ class String
def ends_with?(*_); end
+ def exclude?(string); end
+
def fast_xs(); end
def first(limit=T.unsafe(nil)); end | false |
Other | Homebrew | brew | 6f097685493b82330bbae2a743038745e6892a2b.json | Add missing require in `dev-cmd/irb`. | Library/Homebrew/dev-cmd/irb.rb | @@ -1,6 +1,7 @@
# typed: false
# frozen_string_literal: true
+require "formulary"
require "cli/parser"
class Symbol | false |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/.rubocop.yml | @@ -26,10 +26,6 @@ Cask/Desc:
Description: 'Ensure that the desc stanza conforms to various content and style checks.'
Enabled: true
-Cask/HomepageMatchesUrl:
- Description: 'Ensure that the homepage and url match, otherwise add a comment. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment'
- Enabled: true
-
Cask/HomepageUrlTrailingSlash:
Description: 'Ensure that the homepage url has a slash after the domain name.'
Enabled: true | true |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/Homebrew/cask/audit.rb | @@ -52,6 +52,9 @@ def run!
check_sha256
check_desc
check_url
+ check_unnecessary_verified
+ check_missing_verified
+ check_no_match
check_generic_artifacts
check_token_valid
check_token_bad_words
@@ -345,6 +348,80 @@ def bad_osdn_url?
bad_url_format?(/osd/, [%r{\Ahttps?://([^/]+.)?dl\.osdn\.jp/}])
end
+ def homepage
+ URI(cask.homepage.to_s).host
+ end
+
+ def domain
+ URI(cask.url.to_s).host
+ end
+
+ def url_match_homepage?
+ host = cask.url.to_s.downcase
+ host_uri = URI(host)
+ host = if host.match?(/:\d/) && host_uri.port != 80
+ "#{host_uri.host}:#{host_uri.port}"
+ else
+ host_uri.host
+ end
+ home = homepage.downcase
+ if (split_host = host.split(".")).length >= 3
+ host = split_host[-2..].join(".")
+ end
+ if (split_home = homepage.split(".")).length >= 3
+ home = split_home[-2..].join(".")
+ end
+ host == home
+ end
+
+ def strip_url_scheme(url)
+ url.sub(%r{^.*://(www\.)?}, "")
+ end
+
+ def url_from_verified
+ cask.url.verified.sub(%r{^https?://}, "")
+ end
+
+ def verified_matches_url?
+ strip_url_scheme(cask.url.to_s).start_with?(url_from_verified)
+ end
+
+ def verified_present?
+ cask.url.verified.present?
+ end
+
+ def url_includes_file?
+ cask.url.to_s.start_with?("file://")
+ end
+
+ def check_unnecessary_verified
+ return unless verified_present?
+ return unless url_match_homepage?
+ return unless verified_matches_url?
+
+ add_warning "The URL's #{domain} matches the homepage #{homepage}, " \
+ "the `verified` parameter of the `url` stanza is unnecessary. " \
+ "See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-verified"
+ end
+
+ def check_missing_verified
+ return if url_includes_file?
+ return if url_match_homepage?
+ return if verified_present?
+
+ add_warning "#{domain} does not match #{homepage}, a `verified` parameter of the `url` has to be added. " \
+ " See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-verified"
+ end
+
+ def check_no_match
+ return if url_match_homepage?
+ return unless verified_present?
+ return if !url_match_homepage? && verified_matches_url?
+
+ add_warning "#{url_from_verified} does not match #{strip_url_scheme(cask.url.to_s)}. " \
+ "See https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-verified"
+ end
+
def check_generic_artifacts
cask.artifacts.select { |a| a.is_a?(Artifact::Artifact) }.each do |artifact|
unless artifact.target.absolute? | true |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/Homebrew/cask/url.rb | @@ -8,7 +8,7 @@ class URL
extend T::Sig
attr_reader :uri, :specs,
- :using,
+ :verified, :using,
:tag, :branch, :revisions, :revision,
:trust_cert, :cookies, :referer, :header, :user_agent,
:data
@@ -19,6 +19,7 @@ class URL
sig do
params(
uri: T.any(URI::Generic, String),
+ verified: T.nilable(String),
using: T.nilable(Symbol),
tag: T.nilable(String),
branch: T.nilable(String),
@@ -34,6 +35,7 @@ class URL
end
def initialize(
uri,
+ verified: nil,
using: nil,
tag: nil,
branch: nil,
@@ -49,6 +51,7 @@ def initialize(
@uri = URI(uri)
specs = {}
+ specs[:verified] = @verified = verified
specs[:using] = @using = using
specs[:tag] = @tag = tag
specs[:branch] = @branch = branch | true |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/Homebrew/rubocops/cask/homepage_matches_url.rb | @@ -1,180 +0,0 @@
-# typed: false
-# frozen_string_literal: true
-
-require "forwardable"
-
-module RuboCop
- module Cop
- module Cask
- # This cop checks that a cask's homepage matches the download URL,
- # or if it doesn't, checks if a comment in the form
- # `# example.com was verified as official when first introduced to the cask`
- # is present.
- class HomepageMatchesUrl < Cop
- extend Forwardable
- include CaskHelp
-
- REFERENCE_URL =
- "https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/" \
- "cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment"
-
- COMMENT_FORMAT = /# [^ ]+ was verified as official when first introduced to the cask/.freeze
-
- MSG_NO_MATCH = "`%<url>s` does not match `%<full_url>s`"
-
- MSG_MISSING = ("`%<domain>s` does not match `%<homepage>s`, a comment has to be added " \
- "above the `url` stanza. For details, see " + REFERENCE_URL).freeze
-
- MSG_WRONG_FORMAT = ("`%<comment>s` does not match the expected comment format. " \
- "For details, see " + REFERENCE_URL).freeze
-
- MSG_UNNECESSARY = "The URL's domain `%<domain>s` matches the homepage `%<homepage>s`, " \
- "the comment above the `url` stanza is unnecessary"
-
- def on_cask(cask_block)
- @cask_block = cask_block
- return unless homepage_stanza
-
- add_offenses
- end
-
- private
-
- attr_reader :cask_block
-
- def_delegators :cask_block, :cask_node, :toplevel_stanzas,
- :sorted_toplevel_stanzas
-
- def add_offenses
- toplevel_stanzas.select(&:url?).each do |url|
- next if add_offense_unnecessary_comment(url)
- next if add_offense_missing_comment(url)
- next if add_offense_no_match(url)
- next if add_offense_wrong_format(url)
- end
- end
-
- def add_offense_unnecessary_comment(stanza)
- return unless comment?(stanza)
- return unless url_match_homepage?(stanza)
- return unless comment_matches_format?(stanza)
- return unless comment_matches_url?(stanza)
-
- comment = comment(stanza).loc.expression
- add_offense(comment,
- location: comment,
- message: format(MSG_UNNECESSARY, domain: domain(stanza), homepage: homepage))
- end
-
- def add_offense_missing_comment(stanza)
- return if url_match_homepage?(stanza)
- return if !url_match_homepage?(stanza) && comment?(stanza)
-
- range = stanza.source_range
- url_domain = domain(stanza)
- add_offense(range, location: range, message: format(MSG_MISSING, domain: url_domain, homepage: homepage))
- end
-
- def add_offense_no_match(stanza)
- return if url_match_homepage?(stanza)
- return unless comment?(stanza)
- return if !url_match_homepage?(stanza) && comment_matches_url?(stanza)
-
- comment = comment(stanza).loc.expression
- add_offense(comment,
- location: comment,
- message: format(MSG_NO_MATCH, url: url_from_comment(stanza), full_url: full_url(stanza)))
- end
-
- def add_offense_wrong_format(stanza)
- return if url_match_homepage?(stanza)
- return unless comment?(stanza)
- return if comment_matches_format?(stanza)
-
- comment = comment(stanza).loc.expression
- add_offense(comment,
- location: comment,
- message: format(MSG_WRONG_FORMAT, comment: comment(stanza).text))
- end
-
- def comment?(stanza)
- !stanza.comments.empty?
- end
-
- def comment(stanza)
- stanza.comments.last
- end
-
- def comment_matches_format?(stanza)
- comment(stanza).text =~ COMMENT_FORMAT
- end
-
- def url_from_comment(stanza)
- comment(stanza).text
- .sub(/[^ ]*# ([^ ]+) .*/, '\1')
- end
-
- def comment_matches_url?(stanza)
- full_url(stanza).include?(url_from_comment(stanza))
- end
-
- def strip_url_scheme(url)
- url.sub(%r{^.*://(www\.)?}, "")
- end
-
- def domain(stanza)
- strip_url_scheme(extract_url(stanza)).gsub(%r{^([^/]+).*}, '\1')
- end
-
- def extract_url(stanza)
- string = stanza.stanza_node.children[2]
- return string.str_content if string.str_type?
-
- string.to_s.gsub(%r{.*"([a-z0-9]+://[^"]+)".*}m, '\1')
- end
-
- def url_match_homepage?(stanza)
- host = extract_url(stanza).downcase
- host_uri = begin
- URI(remove_non_ascii(host))
- rescue URI::InvalidURIError
- # Can't check if we can't parse.
- nil
- end
-
- return true if host_uri.blank?
-
- host = if host.match?(/:\d/) && host_uri.port != 80
- "#{host_uri.host}:#{host_uri.port}"
- else
- host_uri.host
- end
- home = homepage.downcase
- if (split_host = host.split(".")).length >= 3
- host = split_host[-2..].join(".")
- end
- if (split_home = homepage.split(".")).length >= 3
- home = split_home[-2..].join(".")
- end
- host == home
- end
-
- def full_url(stanza)
- strip_url_scheme(extract_url(stanza))
- end
-
- def homepage
- URI(remove_non_ascii(extract_url(homepage_stanza))).host
- end
-
- def homepage_stanza
- toplevel_stanzas.find(&:homepage?)
- end
-
- def remove_non_ascii(string)
- string.gsub(/\P{ASCII}/, "")
- end
- end
- end
- end
-end | true |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/Homebrew/rubocops/rubocop-cask.rb | @@ -13,7 +13,6 @@
require "rubocops/cask/mixin/cask_help"
require "rubocops/cask/mixin/on_homepage_stanza"
require "rubocops/cask/desc"
-require "rubocops/cask/homepage_matches_url"
require "rubocops/cask/homepage_url_trailing_slash"
require "rubocops/cask/no_dsl_version"
require "rubocops/cask/stanza_order" | true |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/Homebrew/test/cask/audit_spec.rb | @@ -887,5 +887,80 @@ def tmp_cask(name, text)
expect(subject).to pass
end
end
+
+ context "when the url matches the homepage" do
+ let(:cask_token) { "foo" }
+ let(:cask) do
+ tmp_cask cask_token.to_s, <<~RUBY
+ cask '#{cask_token}' do
+ version '1.0'
+ sha256 '8dd95daa037ac02455435446ec7bc737b34567afe9156af7d20b2a83805c1d8a'
+ url 'https://foo.brew.sh/foo.zip'
+ name 'Audit'
+ desc 'Audit Description'
+ homepage 'https://foo.brew.sh'
+ app 'Audit.app'
+ end
+ RUBY
+ end
+
+ it { is_expected.to pass }
+ end
+
+ context "when the url does not match the homepage" do
+ let(:cask_token) { "foo" }
+ let(:cask) do
+ tmp_cask cask_token.to_s, <<~RUBY
+ cask '#{cask_token}' do
+ version '1.8.0_72,8.13.0.5'
+ sha256 '8dd95daa037ac02455435446ec7bc737b34567afe9156af7d20b2a83805c1d8a'
+ url 'https://brew.sh/foo.zip'
+ name 'Audit'
+ desc 'Audit Description'
+ homepage 'https://foo.example.org'
+ app 'Audit.app'
+ end
+ RUBY
+ end
+
+ it { is_expected.to warn_with(/a `verified` parameter of the `url` has to be added./) }
+ end
+
+ context "when the url does not match the homepage with verified" do
+ let(:cask_token) { "foo" }
+ let(:cask) do
+ tmp_cask cask_token.to_s, <<~RUBY
+ cask '#{cask_token}' do
+ version '1.8.0_72,8.13.0.5'
+ sha256 '8dd95daa037ac02455435446ec7bc737b34567afe9156af7d20b2a83805c1d8a'
+ url 'https://brew.sh/foo.zip', verified: 'brew.sh'
+ name 'Audit'
+ desc 'Audit Description'
+ homepage 'https://foo.example.org'
+ app 'Audit.app'
+ end
+ RUBY
+ end
+
+ it { is_expected.to pass }
+ end
+
+ context "when there is no homepage" do
+ let(:cask_token) { "foo" }
+ let(:cask) do
+ tmp_cask cask_token.to_s, <<~RUBY
+ cask '#{cask_token}' do
+ version '1.8.0_72,8.13.0.5'
+ sha256 '8dd95daa037ac02455435446ec7bc737b34567afe9156af7d20b2a83805c1d8a'
+ url 'https://brew.sh/foo.zip'
+ name 'Audit'
+ desc 'Audit Description'
+ app 'Audit.app'
+ end
+ RUBY
+ end
+
+ it { is_expected.to fail_with(/a homepage stanza is required/) }
+ end
end
end | true |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/Homebrew/test/rubocops/cask/homepage_matches_url_spec.rb | @@ -1,216 +0,0 @@
-# typed: false
-# frozen_string_literal: true
-
-require "rubocops/rubocop-cask"
-require "test/rubocops/cask/shared_examples/cask_cop"
-
-describe RuboCop::Cop::Cask::HomepageMatchesUrl do
- include CaskCop
-
- subject(:cop) { described_class.new }
-
- context "when the url matches the homepage and there is no comment" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- url 'https://foo.brew.sh/foo.zip'
- homepage 'https://foo.brew.sh'
- end
- CASK
- end
-
- include_examples "does not report any offenses"
- end
-
- context "when the url matches the homepage and the url stanza has " \
- "a referrer and no interpolation" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- url 'https://foo.brew.sh/foo.zip',
- referrer: 'https://brew.sh/foo/'
- homepage 'https://foo.brew.sh'
- end
- CASK
- end
-
- include_examples "does not report any offenses"
- end
-
- context "when the url matches the homepage and the url stanza has " \
- "a referrer and interpolation" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- version '1.8.0_72,8.13.0.5'
- url "https://foo.brew.sh/foo-\#{version.after_comma}-\#{version.minor}.\#{version.patch}.\#{version.before_comma.sub(\%r{.*_}, '')}.zip",
- referrer: 'https://brew.sh/foo/'
- homepage 'https://foo.brew.sh'
- end
- CASK
- end
-
- include_examples "does not report any offenses"
- end
-
- context "when the url matches the homepage but there is a comment " \
- "which does not match the url" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- # this is just a comment with information
- url 'https://brew.sh/foo.zip'
- homepage 'https://brew.sh'
- end
- CASK
- end
-
- include_examples "does not report any offenses"
- end
-
- context "when the url matches the homepage " \
- "but there is a comment matching the url" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- # foo.brew.sh was verified as official when first introduced to the cask
- url 'https://foo.brew.sh/foo.zip'
- homepage 'https://foo.brew.sh'
- end
- CASK
- end
- let(:expected_offenses) do
- [{
- message: "The URL's domain `foo.brew.sh` matches the homepage " \
- "`foo.brew.sh`, the comment above the `url` stanza is " \
- "unnecessary",
- severity: :convention,
- line: 2,
- column: 2,
- source: "# foo.brew.sh was verified as official when " \
- "first introduced to the cask",
- }]
- end
-
- include_examples "reports offenses"
- end
-
- context "when the url does not match the homepage" do
- context "when there is a comment matching the url " \
- "but not matching the expected format" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- # brew.sh was verified as official
- url 'https://brew.sh/foo.zip'
- homepage 'https://foo.example.org'
- end
- CASK
- end
- let(:expected_offenses) do
- [{
- message: "`# brew.sh was verified as official` does not " \
- "match the expected comment format. For details, see " \
- "https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/" \
- "cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment",
- severity: :convention,
- line: 2,
- column: 2,
- source: "# brew.sh was verified as official",
- }]
- end
-
- include_examples "reports offenses"
- end
-
- context "when there is a comment matching the url " \
- "and does not have slashes" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- # brew.sh was verified as official when first introduced to the cask
- url 'https://brew.sh/foo.zip'
- homepage 'https://foo.example.org'
- end
- CASK
- end
-
- include_examples "does not report any offenses"
- end
-
- context "when there is a comment matching the url and has slashes" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- # brew.sh/vendor/app was verified as official when first introduced to the cask
- url 'https://downloads.brew.sh/vendor/app/foo.zip'
- homepage 'https://vendor.example.org/app/'
- end
- CASK
- end
-
- include_examples "does not report any offenses"
- end
-
- context "when there is a comment which does not match the url" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- # brew.sh was verified as official when first introduced to the cask
- url 'https://example.org/foo.zip'
- homepage 'https://foo.brew.sh'
- end
- CASK
- end
- let(:expected_offenses) do
- [{
- message: "`brew.sh` does not match `example.org/foo.zip`",
- severity: :convention,
- line: 2,
- column: 2,
- source: "# brew.sh was verified as official when " \
- "first introduced to the cask",
- }]
- end
-
- include_examples "reports offenses"
- end
-
- context "when the comment is missing" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- url 'https://brew.sh/foo.zip'
- homepage 'https://example.org'
- end
- CASK
- end
- let(:expected_offenses) do
- [{
- message: "`brew.sh` does not match `example.org`, a comment " \
- "has to be added above the `url` stanza. For details, see " \
- "https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/" \
- "cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment",
- severity: :convention,
- line: 2,
- column: 2,
- source: "url 'https://brew.sh/foo.zip'",
- }]
- end
-
- include_examples "reports offenses"
- end
- end
-
- context "when there is no homepage" do
- let(:source) do
- <<-CASK.undent
- cask 'foo' do
- url 'https://brew.sh/foo.zip'
- end
- CASK
- end
-
- include_examples "does not report any offenses"
- end
-end | true |
Other | Homebrew | brew | 058a1c3645e28a5e9add92bdd21b6a2aa95b2503.json | add verified parameter in url | Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb | @@ -1,3 +1,11 @@
cask "generic-artifact-relative-target" do
+ version "1.2.3"
+ sha256 "d5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2"
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/AppWithBinary.zip"
+ name "With Binary"
+ desc "Cask with a binary stanza"
+ homepage "https://brew.sh/with-binary"
+
artifact "Caffeine.app", target: "Caffeine.app"
end | true |
Other | Homebrew | brew | f8ff0f465f44943c470a2e683519d2b5459f109e.json | tap: add tests for formula list methods | Library/Homebrew/test/spec_helper.rb | @@ -241,6 +241,10 @@ def find_files
CoreTap.instance.path/".git",
CoreTap.instance.alias_dir,
CoreTap.instance.path/"formula_renames.json",
+ CoreTap.instance.path/"tap_migrations.json",
+ CoreTap.instance.path/"audit_exceptions",
+ CoreTap.instance.path/"style_exceptions",
+ CoreTap.instance.path/"pypi_formula_mappings.json",
*Pathname.glob("#{HOMEBREW_CELLAR}/*/"),
]
| true |
Other | Homebrew | brew | f8ff0f465f44943c470a2e683519d2b5459f109e.json | tap: add tests for formula list methods | Library/Homebrew/test/tap_spec.rb | @@ -18,6 +18,8 @@
before do
path.mkpath
+ (path/"audit_exceptions").mkpath
+ (path/"style_exceptions").mkpath
end
def setup_tap_files
@@ -38,6 +40,27 @@ class Foo < Formula
{ "removed-formula": "homebrew/foo" }
JSON
+ %w[audit_exceptions style_exceptions].each do |exceptions_directory|
+ (path/"#{exceptions_directory}/formula_list.json").write <<~JSON
+ [ "foo", "bar" ]
+ JSON
+
+ (path/"#{exceptions_directory}/formula_hash.json").write <<~JSON
+ { "foo": "foo1", "bar": "bar1" }
+ JSON
+ end
+
+ (path/"pypi_formula_mappings.json").write <<~JSON
+ {
+ "formula1": "foo",
+ "formula2": {
+ "package_name": "foo",
+ "extra_packages": ["bar"],
+ "exclude_packages": ["baz"]
+ }
+ }
+ JSON
+
[
cmd_file,
manpage_file,
@@ -320,6 +343,66 @@ def setup_git_repo
expect(described_class.each).to be_an_instance_of(Enumerator)
end
end
+
+ describe "Formula Lists" do
+ describe "#formula_renames" do
+ it "returns the formula_renames hash" do
+ setup_tap_files
+
+ expected_result = { "oldname" => "foo" }
+ expect(subject.formula_renames).to eq expected_result
+ end
+ end
+
+ describe "#tap_migrations" do
+ it "returns the tap_migrations hash" do
+ setup_tap_files
+
+ expected_result = { "removed-formula" => "homebrew/foo" }
+ expect(subject.tap_migrations).to eq expected_result
+ end
+ end
+
+ describe "#audit_exceptions" do
+ it "returns the audit_exceptions hash" do
+ setup_tap_files
+
+ expected_result = {
+ formula_list: ["foo", "bar"],
+ formula_hash: { "foo" => "foo1", "bar" => "bar1" },
+ }
+ expect(subject.audit_exceptions).to eq expected_result
+ end
+ end
+
+ describe "#style_exceptions" do
+ it "returns the style_exceptions hash" do
+ setup_tap_files
+
+ expected_result = {
+ formula_list: ["foo", "bar"],
+ formula_hash: { "foo" => "foo1", "bar" => "bar1" },
+ }
+ expect(subject.style_exceptions).to eq expected_result
+ end
+ end
+
+ describe "#pypi_formula_mappings" do
+ it "returns the pypi_formula_mappings hash" do
+ setup_tap_files
+
+ expected_result = {
+ "formula1" => "foo",
+ "formula2" => {
+ "package_name" => "foo",
+ "extra_packages" => ["bar"],
+ "exclude_packages" => ["baz"],
+ },
+ }
+ expect(subject.pypi_formula_mappings).to eq expected_result
+ end
+ end
+ end
end
describe CoreTap do
@@ -341,13 +424,26 @@ def setup_git_repo
end
specify "files" do
+ path = CoreTap::TAP_DIRECTORY/"homebrew/homebrew-core"
formula_file = subject.formula_dir/"foo.rb"
formula_file.write <<~RUBY
class Foo < Formula
url "https://brew.sh/foo-1.0.tar.gz"
end
RUBY
+ formula_list_file_json = '{ "foo": "foo1", "bar": "bar1" }'
+ formula_list_file_contents = { "foo" => "foo1", "bar" => "bar1" }
+ %w[
+ formula_renames.json
+ tap_migrations.json
+ audit_exceptions/formula_list.json
+ style_exceptions/formula_hash.json
+ pypi_formula_mappings.json
+ ].each do |file|
+ (path/file).write formula_list_file_json
+ end
+
alias_file = subject.alias_dir/"bar"
alias_file.parent.mkpath
ln_s formula_file, alias_file
@@ -358,5 +454,11 @@ class Foo < Formula
expect(subject.aliases).to eq(["bar"])
expect(subject.alias_table).to eq("bar" => "foo")
expect(subject.alias_reverse_table).to eq("foo" => ["bar"])
+
+ expect(subject.formula_renames).to eq formula_list_file_contents
+ expect(subject.tap_migrations).to eq formula_list_file_contents
+ expect(subject.audit_exceptions).to eq({ formula_list: formula_list_file_contents })
+ expect(subject.style_exceptions).to eq({ formula_hash: formula_list_file_contents })
+ expect(subject.pypi_formula_mappings).to eq formula_list_file_contents
end
end | true |
Other | Homebrew | brew | ba63619f8efacd04ca6e75b593fec3fc95f56edb.json | tests: remove final reference to formula_exist | Library/Homebrew/test/spec_helper.rb | @@ -47,7 +47,6 @@
require "test/support/helper/spec/shared_context/homebrew_cask" if OS.mac?
require "test/support/helper/spec/shared_context/integration_test"
-require "test/support/helper/spec/shared_examples/formulae_exist"
TEST_DIRECTORIES = [
CoreTap.instance.path/"Formula", | false |
Other | Homebrew | brew | 80a46edee487163cb853c6a4ab81e5b81dc54d77.json | tap: add style_exceptions configuration | Library/Homebrew/rubocops/extend/formula.rb | @@ -35,6 +35,7 @@ def on_class(node)
class_node, parent_class_node, @body = *node
@formula_name = Pathname.new(@file_path).basename(".rb").to_s
+ @tap_style_exceptions = nil
audit_formula(node, class_node, parent_class_node, @body)
end
@@ -472,6 +473,31 @@ def formula_tap
match_obj[1]
end
+ # Returns whether the current formula exists in the given style exception list
+ def tap_style_exception?(list)
+ if @tap_style_exceptions.blank? && formula_tap.present?
+ @tap_style_exceptions = {}
+
+ style_exceptions_dir = "#{File.dirname(File.dirname(@file_path))}/style_exceptions/*.json"
+ Pathname.glob(style_exceptions_dir).each do |exception_file|
+ list_name = exception_file.basename.to_s.chomp(".json").to_sym
+ list_contents = begin
+ JSON.parse exception_file.read
+ rescue JSON::ParserError
+ nil
+ end
+ next if list_contents.blank?
+
+ @tap_style_exceptions[list_name] = list_contents
+ end
+ end
+
+ return false if @tap_style_exceptions.blank?
+ return false unless @tap_style_exceptions.key? list
+
+ @tap_style_exceptions[list].include? @formula_name
+ end
+
private
def formula_class?(node) | true |
Other | Homebrew | brew | 80a46edee487163cb853c6a4ab81e5b81dc54d77.json | tap: add style_exceptions configuration | Library/Homebrew/tap.rb | @@ -21,12 +21,14 @@ class Tap
HOMEBREW_TAP_FORMULA_RENAMES_FILE = "formula_renames.json"
HOMEBREW_TAP_MIGRATIONS_FILE = "tap_migrations.json"
HOMEBREW_TAP_AUDIT_EXCEPTIONS_DIR = "audit_exceptions"
+ HOMEBREW_TAP_STYLE_EXCEPTIONS_DIR = "style_exceptions"
HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS = "pypi_formula_mappings.json"
HOMEBREW_TAP_JSON_FILES = %W[
#{HOMEBREW_TAP_FORMULA_RENAMES_FILE}
#{HOMEBREW_TAP_MIGRATIONS_FILE}
#{HOMEBREW_TAP_AUDIT_EXCEPTIONS_DIR}/*.json
+ #{HOMEBREW_TAP_STYLE_EXCEPTIONS_DIR}/*.json
#{HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS}
].freeze
@@ -114,6 +116,7 @@ def clear_cache
@formula_renames = nil
@tap_migrations = nil
@audit_exceptions = nil
+ @style_exceptions = nil
@pypi_formula_mappings = nil
@config = nil
remove_instance_variable(:@private) if instance_variable_defined?(:@private)
@@ -567,6 +570,12 @@ def audit_exceptions
@audit_exceptions = read_formula_list_directory "#{HOMEBREW_TAP_AUDIT_EXCEPTIONS_DIR}/*"
end
+ # Hash with style exceptions
+ sig { returns(Hash) }
+ def style_exceptions
+ @style_exceptions = read_formula_list_directory "#{HOMEBREW_TAP_STYLE_EXCEPTIONS_DIR}/*"
+ end
+
# Hash with pypi formula mappings
sig { returns(Hash) }
def pypi_formula_mappings
@@ -760,6 +769,15 @@ def audit_exceptions
end
end
+ # @private
+ def style_exceptions
+ @style_exceptions ||= begin
+ self.class.ensure_installed!
+ super
+ end
+ end
+
+ # @private
def pypi_formula_mappings
@pypi_formula_mappings ||= begin
self.class.ensure_installed! | true |
Other | Homebrew | brew | 80a46edee487163cb853c6a4ab81e5b81dc54d77.json | tap: add style_exceptions configuration | Library/Homebrew/tap_auditor.rb | @@ -8,13 +8,14 @@ module Homebrew
class TapAuditor
extend T::Sig
- attr_reader :name, :path, :tap_audit_exceptions, :tap_pypi_formula_mappings, :problems
+ attr_reader :name, :path, :tap_audit_exceptions, :tap_style_exceptions, :tap_pypi_formula_mappings, :problems
sig { params(tap: Tap, strict: T.nilable(T::Boolean)).void }
def initialize(tap, strict:)
@name = tap.name
@path = tap.path
@tap_audit_exceptions = tap.audit_exceptions
+ @tap_style_exceptions = tap.style_exceptions
@tap_pypi_formula_mappings = tap.pypi_formula_mappings
@problems = []
end
@@ -38,6 +39,7 @@ def audit_json_files
sig { void }
def audit_tap_formula_lists
check_formula_list_directory "audit_exceptions", @tap_audit_exceptions
+ check_formula_list_directory "style_exceptions", @tap_style_exceptions
check_formula_list "pypi_formula_mappings", @tap_pypi_formula_mappings
end
| true |
Other | Homebrew | brew | 97c9a952d3a78f532a2caaa5efdad743513018ff.json | Recognize AMD CPUs on Linux | Library/Homebrew/extend/os/linux/hardware/cpu.rb | @@ -20,12 +20,24 @@ def family
# See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers
# and https://github.com/llvm-mirror/llvm/blob/HEAD/lib/Support/Host.cpp
# and https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures#Roadmap
+ vendor_id = cpuinfo[/^vendor_id\s*: (.*)/, 1]
cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i
cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i
unknown = :"unknown_0x#{cpu_family.to_s(16)}_0x#{cpu_model.to_s(16)}"
- case cpu_family
+ case vendor_id
+ when "GenuineIntel"
+ intel_family(cpu_family, cpu_model) || unknown
+ when "AuthenticAMD"
+ amd_family(cpu_family) || unknown
+ else
+ unknown
+ end
+ end
+
+ def intel_family(family, model)
+ case family
when 0x06
- case cpu_model
+ case model
when 0x3a, 0x3e
:ivybridge
when 0x2a, 0x2d
@@ -52,20 +64,39 @@ def family
:cannonlake
when 0x6a, 0x6c, 0x7d, 0x7e
:icelake
- else
- unknown
end
when 0x0f
- case cpu_model
+ case model
when 0x06
:presler
when 0x03, 0x04
:prescott
- else
- unknown
end
- else
- unknown
+ end
+ end
+
+ def amd_family(family)
+ case family
+ when 0x06
+ :amd_k7
+ when 0x0f
+ :amd_k8
+ when 0x10
+ :amd_k10
+ when 0x11
+ :amd_k8_k10_hybrid
+ when 0x12
+ :amd_k12
+ when 0x14
+ :bobcat
+ when 0x15
+ :bulldozer
+ when 0x16
+ :jaguar
+ when 0x17
+ :zen
+ when 0x19
+ :zen3
end
end
| false |
Other | Homebrew | brew | 7d9758a05ecf8cef93ba919568579cd0bee58c82.json | Fix RuboCop offenses. | Library/Homebrew/extend/os/mac/hardware/cpu.rb | @@ -77,7 +77,7 @@ def features
"machdep.cpu.features",
"machdep.cpu.extfeatures",
"machdep.cpu.leaf7_features",
- ).split(" ").map { |s| s.downcase.to_sym }
+ ).split.map { |s| s.downcase.to_sym }
end
def sse4? | true |
Other | Homebrew | brew | 7d9758a05ecf8cef93ba919568579cd0bee58c82.json | Fix RuboCop offenses. | Library/Homebrew/formula.rb | @@ -2010,7 +2010,7 @@ def system(cmd, *args)
@exec_count += 1
logfn = format("#{logs}/#{active_log_prefix}%02<exec_count>d.%<cmd_base>s",
exec_count: @exec_count,
- cmd_base: File.basename(cmd).split(" ").first)
+ cmd_base: File.basename(cmd).split.first)
logs.mkpath
File.open(logfn, "w") do |log| | true |
Other | Homebrew | brew | 7d9758a05ecf8cef93ba919568579cd0bee58c82.json | Fix RuboCop offenses. | Library/Homebrew/formula_installer.rb | @@ -1217,7 +1217,7 @@ def forbidden_license_check
pattern = /#{s.to_s.tr("_", " ")}/i
forbidden_licenses.sub!(pattern, s.to_s)
end
- forbidden_licenses = forbidden_licenses.split(" ").to_h do |license|
+ forbidden_licenses = forbidden_licenses.split.to_h do |license|
[license, SPDX.license_version_info(license)]
end
| true |
Other | Homebrew | brew | 7d9758a05ecf8cef93ba919568579cd0bee58c82.json | Fix RuboCop offenses. | Library/Homebrew/rubocops/livecheck.rb | @@ -146,7 +146,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
def autocorrect(node)
lambda do |corrector|
- pattern = node.source.split(" ")[1..].join
+ pattern = node.source.split[1..].join
corrector.replace(node.source_range, "regex(#{pattern})")
end
end | true |
Other | Homebrew | brew | 7d9758a05ecf8cef93ba919568579cd0bee58c82.json | Fix RuboCop offenses. | Library/Homebrew/test/exceptions_spec.rb | @@ -81,6 +81,7 @@
let(:mod) do
Module.new do
class Bar < Requirement; end
+
class Baz < Formula; end
end
end | true |
Other | Homebrew | brew | 10f2a39f9ca5f7893d3488e6ce9fb3e43039cd52.json | Remove unneeded quotes. | .github/workflows/tests.yml | @@ -50,10 +50,10 @@ jobs:
include:
- name: tap syntax (Linux)
os: ubuntu-latest
- core-tap: "linuxbrew-core"
+ core-tap: linuxbrew-core
- name: tap syntax (macOS)
os: macos-11.0
- core-tap: "homebrew-core"
+ core-tap: homebrew-core
steps:
- name: Set up Homebrew
id: set-up-homebrew
@@ -130,10 +130,10 @@ jobs:
include:
- name: vendored gems (Linux)
os: ubuntu-latest
- core-tap: "linuxbrew-core"
+ core-tap: linuxbrew-core
- name: vendored gems (macOS)
os: macos-11.0
- core-tap: "homebrew-core"
+ core-tap: homebrew-core
steps:
- name: Set up Homebrew
id: set-up-homebrew
@@ -184,10 +184,10 @@ jobs:
strategy:
matrix:
include:
- - name: "tests (no-compatibility mode)"
+ - name: tests (no-compatibility mode)
os: ubuntu-latest
test-flags: --no-compat --online --coverage
- - name: "tests (generic OS)"
+ - name: tests (generic OS)
os: ubuntu-latest
test-flags: --generic --online --coverage
- name: tests (Linux) | false |
Other | Homebrew | brew | da8d91bd053c315ff72430043a7481f26f32e04a.json | Fix `.simplecov` exit status for integration tests. | Library/Homebrew/.simplecov | @@ -30,16 +30,17 @@ SimpleCov.start do
SimpleCov.print_error_status = false
SimpleCov.at_exit do
- $stdout.reopen("/dev/null")
-
# Just save result, but don't write formatted output.
coverage_result = Coverage.result
# TODO: this method is private, find a better way.
SimpleCov.send(:add_not_loaded_files, coverage_result)
simplecov_result = SimpleCov::Result.new(coverage_result)
SimpleCov::ResultMerger.store_result(simplecov_result)
- exit! SimpleCov.exit_status_from_exception || 0
+ # If an integration test raises a `SystemExit` exception on exit,
+ # exit immediately using the same status code to avoid reporting
+ # an error when expecting a non-successful exit status.
+ raise if $ERROR_INFO.is_a?(SystemExit)
end
else
command_name "#{command_name} (#{$PROCESS_ID})" | true |
Other | Homebrew | brew | da8d91bd053c315ff72430043a7481f26f32e04a.json | Fix `.simplecov` exit status for integration tests. | Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb | @@ -13,7 +13,8 @@
matcher :be_a_success do
match do |actual|
status = actual.is_a?(Proc) ? actual.call : actual
- status.respond_to?(:success?) && status.success?
+ expect(status).to respond_to(:success?)
+ status.success?
end
def supports_block_expectations? | true |
Other | Homebrew | brew | 8298f95677c939f42299ba4c42d1bd89a38c6179.json | Increase timeout for integration tests. | Library/Homebrew/test/spec_helper.rb | @@ -80,7 +80,11 @@
if ENV["CI"]
config.verbose_retry = true
config.display_try_failure_messages = true
- config.default_retry_count = 2
+
+ config.around(:each, :integration_test) do |example|
+ example.metadata[:timeout] ||= 120
+ example.run
+ end
config.around(:each, :needs_network) do |example|
example.metadata[:timeout] ||= 120 | false |
Other | Homebrew | brew | 2552ecb1e7b4148123e3b83990aee05a0a452271.json | Add missing `require`s for `style` spec. | Library/Homebrew/test/cask/cmd/style_spec.rb | @@ -3,6 +3,9 @@
require "open3"
+require "cli/args"
+require "cli/named_args"
+
require_relative "shared_examples/invalid_option"
describe Cask::Cmd::Style, :cask do | false |
Other | Homebrew | brew | 91893c42f87256582593d74c3cac536a2fc3c81d.json | Update RBI files for rubocop-performance. | Library/Homebrew/sorbet/rbi/gems/regexp_parser@2.0.0.rbi | @@ -5,9 +5,6 @@
# typed: true
module Regexp::Expression
- class << self
- def parsed(exp); end
- end
end
class Regexp::Expression::Alternation < ::Regexp::Expression::SequenceOperation
@@ -86,7 +83,7 @@ end
class Regexp::Expression::Backreference::Base < ::Regexp::Expression::Base
def match_length; end
def referenced_expression; end
- def referenced_expression=(_); end
+ def referenced_expression=(_arg0); end
end
class Regexp::Expression::Backreference::Name < ::Regexp::Expression::Backreference::Base
@@ -126,21 +123,24 @@ end
class Regexp::Expression::Backreference::NumberRelative < ::Regexp::Expression::Backreference::Number
def effective_number; end
- def effective_number=(_); end
+ def effective_number=(_arg0); end
def reference; end
end
class Regexp::Expression::Base
+ include(::RuboCop::Ext::RegexpParser::Expression::Base)
+
def initialize(token, options = T.unsafe(nil)); end
def =~(string, offset = T.unsafe(nil)); end
def a?; end
def ascii_classes?; end
def attributes; end
+ def base_length; end
def case_insensitive?; end
def coded_offset; end
def conditional_level; end
- def conditional_level=(_); end
+ def conditional_level=(_arg0); end
def d?; end
def default_classes?; end
def extended?; end
@@ -152,44 +152,44 @@ class Regexp::Expression::Base
def is?(test_token, test_type = T.unsafe(nil)); end
def lazy?; end
def level; end
- def level=(_); end
+ def level=(_arg0); end
def m?; end
def match(string, offset = T.unsafe(nil)); end
def match?(string); end
def matches?(string); end
def multiline?; end
def nesting_level; end
- def nesting_level=(_); end
+ def nesting_level=(_arg0); end
def offset; end
def one_of?(scope, top = T.unsafe(nil)); end
def options; end
- def options=(_); end
+ def options=(_arg0); end
def possessive?; end
def quantified?; end
def quantifier; end
- def quantifier=(_); end
+ def quantifier=(_arg0); end
def quantifier_affix(expression_format); end
def quantify(token, text, min = T.unsafe(nil), max = T.unsafe(nil), mode = T.unsafe(nil)); end
def quantity; end
def reluctant?; end
def repetitions; end
def set_level; end
- def set_level=(_); end
+ def set_level=(_arg0); end
def starts_at; end
def strfre(format = T.unsafe(nil), indent_offset = T.unsafe(nil), index = T.unsafe(nil)); end
def strfregexp(format = T.unsafe(nil), indent_offset = T.unsafe(nil), index = T.unsafe(nil)); end
def terminal?; end
def text; end
- def text=(_); end
+ def text=(_arg0); end
def to_h; end
def to_re(format = T.unsafe(nil)); end
def to_s(format = T.unsafe(nil)); end
def token; end
- def token=(_); end
+ def token=(_arg0); end
def ts; end
- def ts=(_); end
+ def ts=(_arg0); end
def type; end
- def type=(_); end
+ def type=(_arg0); end
def type?(test_type); end
def u?; end
def unicode_classes?; end
@@ -202,17 +202,19 @@ class Regexp::Expression::Base
end
class Regexp::Expression::CharacterSet < ::Regexp::Expression::Subexpression
+ include(::RuboCop::Ext::RegexpParser::Expression::CharacterSet)
+
def initialize(token, options = T.unsafe(nil)); end
def close; end
def closed; end
- def closed=(_); end
+ def closed=(_arg0); end
def closed?; end
def match_length; end
def negate; end
def negated?; end
def negative; end
- def negative=(_); end
+ def negative=(_arg0); end
def negative?; end
def to_s(format = T.unsafe(nil)); end
end
@@ -289,7 +291,7 @@ class Regexp::Expression::Conditional::Condition < ::Regexp::Expression::Base
def match_length; end
def reference; end
def referenced_expression; end
- def referenced_expression=(_); end
+ def referenced_expression=(_arg0); end
end
class Regexp::Expression::Conditional::Expression < ::Regexp::Expression::Subexpression
@@ -302,7 +304,7 @@ class Regexp::Expression::Conditional::Expression < ::Regexp::Expression::Subexp
def match_length; end
def reference; end
def referenced_expression; end
- def referenced_expression=(_); end
+ def referenced_expression=(_arg0); end
def to_s(format = T.unsafe(nil)); end
end
@@ -411,9 +413,9 @@ class Regexp::Expression::Group::Capture < ::Regexp::Expression::Group::Base
def capturing?; end
def identifier; end
def number; end
- def number=(_); end
+ def number=(_arg0); end
def number_at_level; end
- def number_at_level=(_); end
+ def number_at_level=(_arg0); end
end
class Regexp::Expression::Group::Comment < ::Regexp::Expression::Group::Base
@@ -434,10 +436,13 @@ end
class Regexp::Expression::Group::Options < ::Regexp::Expression::Group::Base
def option_changes; end
- def option_changes=(_); end
+ def option_changes=(_arg0); end
end
class Regexp::Expression::Group::Passive < ::Regexp::Expression::Group::Base
+ def implicit=(_arg0); end
+ def implicit?; end
+ def to_s(format = T.unsafe(nil)); end
end
module Regexp::Expression::Keep
@@ -462,6 +467,8 @@ end
class Regexp::Expression::Quantifier
def initialize(token, text, min, max, mode); end
+ def ==(other); end
+ def eq(other); end
def greedy?; end
def lazy?; end
def max; end
@@ -483,17 +490,13 @@ end
Regexp::Expression::Quantifier::MODES = T.let(T.unsafe(nil), Array)
class Regexp::Expression::Root < ::Regexp::Expression::Subexpression
- def initialize(*args); end
-
class << self
def build(options = T.unsafe(nil)); end
def build_token; end
end
end
class Regexp::Expression::Sequence < ::Regexp::Expression::Subexpression
- def initialize(*args); end
-
def quantify(token, text, min = T.unsafe(nil), max = T.unsafe(nil), mode = T.unsafe(nil)); end
def starts_at; end
def ts; end
@@ -528,7 +531,7 @@ class Regexp::Expression::Subexpression < ::Regexp::Expression::Base
def each_expression(include_self = T.unsafe(nil), &block); end
def empty?(*args, &block); end
def expressions; end
- def expressions=(_); end
+ def expressions=(_arg0); end
def fetch(*args, &block); end
def flat_map(include_self = T.unsafe(nil), &block); end
def index(*args, &block); end
@@ -802,17 +805,17 @@ class Regexp::Lexer
def break_codepoint_list(token); end
def break_literal(token); end
def conditional_nesting; end
- def conditional_nesting=(_); end
+ def conditional_nesting=(_arg0); end
def descend(type, token); end
def merge_condition(current); end
def nesting; end
- def nesting=(_); end
+ def nesting=(_arg0); end
def set_nesting; end
- def set_nesting=(_); end
+ def set_nesting=(_arg0); end
def shift; end
- def shift=(_); end
+ def shift=(_arg0); end
def tokens; end
- def tokens=(_); end
+ def tokens=(_arg0); end
class << self
def lex(input, syntax = T.unsafe(nil), options: T.unsafe(nil), &block); end
@@ -842,17 +845,17 @@ class Regexp::MatchLength
private
def base_max; end
- def base_max=(_); end
+ def base_max=(_arg0); end
def base_min; end
- def base_min=(_); end
+ def base_min=(_arg0); end
def exp_class; end
- def exp_class=(_); end
+ def exp_class=(_arg0); end
def max_rep; end
- def max_rep=(_); end
+ def max_rep=(_arg0); end
def min_rep; end
- def min_rep=(_); end
+ def min_rep=(_arg0); end
def reify; end
- def reify=(_); end
+ def reify=(_arg0); end
def test_regexp; end
class << self
@@ -876,19 +879,20 @@ class Regexp::Parser
def backref(token); end
def captured_group_count_at_level; end
def captured_group_counts; end
- def captured_group_counts=(_); end
+ def captured_group_counts=(_arg0); end
def close_completed_character_set_range; end
def close_group; end
def close_set; end
def conditional(token); end
def conditional_nesting; end
- def conditional_nesting=(_); end
+ def conditional_nesting=(_arg0); end
def count_captured_group; end
def decrease_nesting; end
def escape(token); end
def extract_options(input, options); end
def free_space(token); end
def group(token); end
+ def increase_level(exp); end
def intersection(token); end
def interval(target_node, token); end
def keep(token); end
@@ -897,25 +901,25 @@ class Regexp::Parser
def nest(exp); end
def nest_conditional(exp); end
def nesting; end
- def nesting=(_); end
+ def nesting=(_arg0); end
def node; end
- def node=(_); end
+ def node=(_arg0); end
def open_group(token); end
def open_set(token); end
def options_group(token); end
def options_stack; end
- def options_stack=(_); end
+ def options_stack=(_arg0); end
def parse_token(token); end
def posixclass(token); end
def property(token); end
def quantifier(token); end
def range(token); end
def root; end
- def root=(_); end
+ def root=(_arg0); end
def sequence_operation(klass, token); end
def set(token); end
def switching_options; end
- def switching_options=(_); end
+ def switching_options=(_arg0); end
def total_captured_group_count; end
def type(token); end
def update_transplanted_subtree(exp, new_parent); end
@@ -943,36 +947,37 @@ end
Regexp::Parser::VERSION = T.let(T.unsafe(nil), String)
class Regexp::Scanner
- def emit(type, token, text, ts, te); end
+ def emit(type, token, text); end
def scan(input_object, options: T.unsafe(nil), &block); end
private
def append_literal(data, ts, te); end
def block; end
- def block=(_); end
+ def block=(_arg0); end
+ def char_pos; end
+ def char_pos=(_arg0); end
def conditional_stack; end
- def conditional_stack=(_); end
- def copy(data, range); end
+ def conditional_stack=(_arg0); end
+ def copy(data, ts, te); end
def emit_literal; end
def emit_meta_control_sequence(data, ts, te, token); end
- def emit_options(text, ts, te); end
+ def emit_options(text); end
def free_spacing; end
- def free_spacing=(_); end
+ def free_spacing=(_arg0); end
def free_spacing?(input_object, options); end
def group_depth; end
- def group_depth=(_); end
+ def group_depth=(_arg0); end
def in_group?; end
def in_set?; end
def literal; end
- def literal=(_); end
+ def literal=(_arg0); end
def set_depth; end
- def set_depth=(_); end
+ def set_depth=(_arg0); end
def spacing_stack; end
- def spacing_stack=(_); end
- def text(data, ts, te, soff = T.unsafe(nil)); end
+ def spacing_stack=(_arg0); end
def tokens; end
- def tokens=(_); end
+ def tokens=(_arg0); end
def validation_error(type, what, reason); end
class << self
@@ -1503,10 +1508,10 @@ class Regexp::Token < ::Struct
def level; end
def level=(_); end
def next; end
- def next=(_); end
+ def next=(_arg0); end
def offset; end
def previous; end
- def previous=(_); end
+ def previous=(_arg0); end
def set_level; end
def set_level=(_); end
def te; end
@@ -1521,9 +1526,9 @@ class Regexp::Token < ::Struct
def type=(_); end
class << self
- def [](*_); end
+ def [](*_arg0); end
def inspect; end
def members; end
- def new(*_); end
+ def new(*_arg0); end
end
end | true |
Other | Homebrew | brew | 91893c42f87256582593d74c3cac536a2fc3c81d.json | Update RBI files for rubocop-performance. | Library/Homebrew/sorbet/rbi/gems/rubocop-ast@1.2.0.rbi | @@ -24,9 +24,16 @@ class RuboCop::AST::AndNode < ::RuboCop::AST::Node
def inverse_operator; end
end
+class RuboCop::AST::ArgNode < ::RuboCop::AST::Node
+ def default?; end
+ def default_value; end
+ def name; end
+end
+
class RuboCop::AST::ArgsNode < ::RuboCop::AST::Node
include(::RuboCop::AST::CollectionNode)
+ def argument_list; end
def empty_and_without_delimiters?; end
end
@@ -51,6 +58,7 @@ end
class RuboCop::AST::BlockNode < ::RuboCop::AST::Node
include(::RuboCop::AST::MethodIdentifierPredicates)
+ def argument_list; end
def arguments; end
def arguments?; end
def body; end
@@ -65,6 +73,10 @@ class RuboCop::AST::BlockNode < ::RuboCop::AST::Node
def send_node; end
def single_line?; end
def void_context?; end
+
+ private
+
+ def numbered_arguments; end
end
class RuboCop::AST::BreakNode < ::RuboCop::AST::Node
@@ -308,6 +320,9 @@ module RuboCop::AST::Ext::Range
def line_span(exclude_end: T.unsafe(nil)); end
end
+module RuboCop::AST::Ext::RangeMinMax
+end
+
class RuboCop::AST::FloatNode < ::RuboCop::AST::Node
include(::RuboCop::AST::BasicLiteralNode)
include(::RuboCop::AST::NumericNode)
@@ -1179,10 +1194,6 @@ RuboCop::AST::NodePattern::Node::FunctionCall = RuboCop::AST::NodePattern::Node:
RuboCop::AST::NodePattern::Node::MAP = T.let(T.unsafe(nil), Hash)
-module RuboCop::AST::NodePattern::Node::MapMinMax
- def map_min_max(enum); end
-end
-
class RuboCop::AST::NodePattern::Node::Predicate < ::RuboCop::AST::NodePattern::Node
def arg_list; end
def method_name; end
@@ -1211,15 +1222,12 @@ end
class RuboCop::AST::NodePattern::Node::Subsequence < ::RuboCop::AST::NodePattern::Node
include(::RuboCop::AST::NodePattern::Node::ForbidInSeqHead)
- include(::RuboCop::AST::NodePattern::Node::MapMinMax)
def arity; end
def in_sequence_head; end
end
class RuboCop::AST::NodePattern::Node::Union < ::RuboCop::AST::NodePattern::Node
- include(::RuboCop::AST::NodePattern::Node::MapMinMax)
-
def arity; end
def in_sequence_head; end
end
@@ -1378,16 +1386,12 @@ RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE_STRUCT = T.let(T.unsafe(nil), Set)
-RuboCop::AST::NodePattern::Sets::SET_COLLECT_COMPACT_FLATTEN_ETC = T.let(T.unsafe(nil), Set)
-
RuboCop::AST::NodePattern::Sets::SET_CONSTANTIZE_CONSTANTS_CONST_GET = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_CONTEXT_SHARED_CONTEXT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_COUNT_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
-RuboCop::AST::NodePattern::Sets::SET_DEBUGGER_BYEBUG_REMOTE_BYEBUG = T.let(T.unsafe(nil), Set)
-
RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD_DEFINE_SINGLETON_METHOD = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_DESCRIBE_FEATURE = T.let(T.unsafe(nil), Set)
@@ -1412,8 +1416,6 @@ RuboCop::AST::NodePattern::Sets::SET_EXPECT_ALLOW = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_FACTORYGIRL_FACTORYBOT = T.let(T.unsafe(nil), Set)
-RuboCop::AST::NodePattern::Sets::SET_FIRST_LAST_POP_ETC = T.let(T.unsafe(nil), Set)
-
RuboCop::AST::NodePattern::Sets::SET_FIRST_LAST__ETC = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_FIXNUM_BIGNUM = T.let(T.unsafe(nil), Set)
@@ -1472,8 +1474,6 @@ RuboCop::AST::NodePattern::Sets::SET_PROC_LAMBDA = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_PROP_CONST = T.let(T.unsafe(nil), Set)
-RuboCop::AST::NodePattern::Sets::SET_PRY_REMOTE_PRY_PRY_REMOTE_CONSOLE = T.let(T.unsafe(nil), Set)
-
RuboCop::AST::NodePattern::Sets::SET_PUBLIC_CONSTANT_PRIVATE_CONSTANT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_PUBLIC_PROTECTED_PRIVATE_MODULE_FUNCTION = T.let(T.unsafe(nil), Set)
@@ -1498,8 +1498,6 @@ RuboCop::AST::NodePattern::Sets::SET_REJECT_REJECT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_REQUIRE_REQUIRE_RELATIVE = T.let(T.unsafe(nil), Set)
-RuboCop::AST::NodePattern::Sets::SET_SAVE_AND_OPEN_PAGE_SAVE_AND_OPEN_SCREENSHOT = T.let(T.unsafe(nil), Set)
-
RuboCop::AST::NodePattern::Sets::SET_SELECT_FILTER_FIND_ALL_REJECT = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT = T.let(T.unsafe(nil), Set)
@@ -1564,6 +1562,8 @@ RuboCop::AST::NodePattern::Sets::SET___7 = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET___8 = T.let(T.unsafe(nil), Set)
+RuboCop::AST::NodePattern::Sets::SET___METHOD_____CALLEE__ = T.let(T.unsafe(nil), Set)
+
RuboCop::AST::NodePattern::Sets::SET____ = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET____ETC = T.let(T.unsafe(nil), Set)
@@ -1572,10 +1572,6 @@ RuboCop::AST::NodePattern::Sets::SET____ETC_2 = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET____ETC_3 = T.let(T.unsafe(nil), Set)
-RuboCop::AST::NodePattern::Sets::SET____ETC_4 = T.let(T.unsafe(nil), Set)
-
-RuboCop::AST::NodePattern::Sets::SET____ETC_5 = T.let(T.unsafe(nil), Set)
-
RuboCop::AST::NodePattern::VAR = T.let(T.unsafe(nil), String)
module RuboCop::AST::NumericNode
@@ -1631,6 +1627,10 @@ module RuboCop::AST::PredicateOperatorNode
def semantic_operator?; end
end
+class RuboCop::AST::Procarg0Node < ::RuboCop::AST::ArgNode
+ def name; end
+end
+
class RuboCop::AST::ProcessedSource
include(::RuboCop::Ext::ProcessedSource)
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.