Skip to content

Commit

Permalink
Merge pull request #13196 from SMillerDev/feature/pr-pull/casks_checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
SMillerDev authored Apr 27, 2022
2 parents d0a0bbe + 9a25a1d commit 506337e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Library/Homebrew/dev-cmd/pr-pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def determine_bump_subject(old_contents, new_contents, subject_path, reason: nil
"#{subject_name} #{new_package.version}"
elsif !is_cask && old_package.revision != new_package.revision
"#{subject_name}: revision #{reason}".strip
elsif is_cask && old_package.sha256 != new_package.sha256
"#{subject_name}: checksum update #{reason}".strip
else
"#{subject_name}: #{reason || "rebuild"}".strip
end
Expand Down
17 changes: 17 additions & 0 deletions Library/Homebrew/test/dev-cmd/pr-pull_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ class Foo < Formula
cask "food" do
desc "Helpful description"
version "1.0"
sha256 "a"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
end
let(:cask_checksum) do
<<~EOS
cask "food" do
desc "Helpful description"
version "1.0"
sha256 "b"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
Expand All @@ -53,6 +64,7 @@ class Foo < Formula
<<~EOS
cask "food" do
version "2.0"
sha256 "a"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
Expand All @@ -61,6 +73,7 @@ class Foo < Formula
<<~EOS
cask "food" do
version "1.0"
sha256 "a"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
Expand Down Expand Up @@ -164,6 +177,10 @@ class Foo < Formula
expect(described_class.determine_bump_subject(cask, cask_version, cask_file)).to eq("food 2.0")
end

it "correctly bumps a cask checksum" do
expect(described_class.determine_bump_subject(cask, cask_checksum, cask_file)).to eq("food: checksum update")
end

it "correctly bumps a formula revision with reason" do
expect(described_class.determine_bump_subject(
formula, formula_revision, formula_file, reason: "for fun"
Expand Down

0 comments on commit 506337e

Please sign in to comment.