Merge pull request #16132 from apainintheneck/replace-url-before-downloading-to-check-checksum

dev-cmd/bump-cask-pr: replace url before downloading files
This commit is contained in:
Mike McQuaid 2023-10-24 12:19:21 +01:00 committed by GitHub
commit 64d309c4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,22 +116,6 @@ module Homebrew
branch_name = "bump-#{cask.token}"
commit_message = nil
if new_version.present?
# For simplicity, our naming defers to the arm version if we multiple architectures are specified
branch_version = new_version.arm || new_version.general
if branch_version.is_a?(Cask::DSL::Version)
commit_version = if branch_version.before_comma == cask.version.before_comma
branch_version
else
branch_version.before_comma
end
branch_name = "bump-#{cask.token}-#{branch_version.tr(",:", "-")}"
commit_message ||= "#{cask.token} #{commit_version}"
end
replacement_pairs = replace_version_and_checksum(cask, new_hash, new_version, replacement_pairs)
end
# Now that we have all replacement pairs, we will replace them further down
old_contents = File.read(cask.sourcefile_path)
if new_base_url
@ -148,6 +132,22 @@ module Homebrew
]
end
if new_version.present?
# For simplicity, our naming defers to the arm version if we multiple architectures are specified
branch_version = new_version.arm || new_version.general
if branch_version.is_a?(Cask::DSL::Version)
commit_version = if branch_version.before_comma == cask.version.before_comma
branch_version
else
branch_version.before_comma
end
branch_name = "bump-#{cask.token}-#{branch_version.tr(",:", "-")}"
commit_message ||= "#{cask.token} #{commit_version}"
end
replacement_pairs = replace_version_and_checksum(cask, new_hash, new_version, replacement_pairs)
end
# Now that we have all replacement pairs, we will replace them further down
commit_message ||= "#{cask.token}: update checksum" if new_hash
# Remove nested arrays where elements are identical