Merge branch 'mohammad' of https://github.com/mohammadzainabbas/brew into mohammad

This commit is contained in:
Mohammad Zain Abbas 2022-07-05 14:08:30 +02:00
commit 2223a231cc
2 changed files with 11 additions and 10 deletions

View File

@ -1,9 +1,10 @@
# typed: true # typed: true
# frozen_string_literal: true # frozen_string_literal: true
# The {Livecheck} class implements the DSL methods used in a formula's, cask's or resource's # The {Livecheck} class implements the DSL methods used in a formula's, cask's
# `livecheck` block and stores related instance variables. Most of these methods # or resource's `livecheck` block and stores related instance variables. Most
# also return the related instance variable when no argument is provided. # of these methods also return the related instance variable when no argument
# is provided.
# #
# This information is used by the `brew livecheck` command to control its # This information is used by the `brew livecheck` command to control its
# behavior. Example `livecheck` blocks can be found in the # behavior. Example `livecheck` blocks can be found in the
@ -11,8 +12,8 @@
class Livecheck class Livecheck
extend Forwardable extend Forwardable
# A very brief description of why the formula/cask/resource is skipped (e.g. `No longer # A very brief description of why the formula/cask/resource is skipped (e.g.
# developed or maintained`). # `No longer developed or maintained`).
# @return [String, nil] # @return [String, nil]
attr_reader :skip_msg attr_reader :skip_msg

View File

@ -9,12 +9,12 @@ describe Resource do
let(:livecheck_resource) { let(:livecheck_resource) {
described_class.new do described_class.new do
url "https://brew.sh/test-0.0.1.tgz" url "https://brew.sh/foo-1.0.tar.gz"
sha256 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" sha256 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
livecheck do livecheck do
url "https://brew.sh/foo-1.0.tar.gz" url "https://brew.sh/test/releases"
regex(/foo/) regex(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i)
end end
end end
} }
@ -71,8 +71,8 @@ describe Resource do
end end
specify "when livecheck block is set" do specify "when livecheck block is set" do
expect(livecheck_resource.livecheck.url).to eq("https://brew.sh/foo-1.0.tar.gz") expect(livecheck_resource.livecheck.url).to eq("https://brew.sh/test/releases")
expect(livecheck_resource.livecheck.regex).to eq(/foo/) expect(livecheck_resource.livecheck.regex).to eq(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i)
end end
end end