diff --git a/Library/Homebrew/livecheck.rb b/Library/Homebrew/livecheck.rb index 4a3d5df4da..66abd5142f 100644 --- a/Library/Homebrew/livecheck.rb +++ b/Library/Homebrew/livecheck.rb @@ -1,9 +1,10 @@ # typed: true # frozen_string_literal: true -# The {Livecheck} class implements the DSL methods used in a formula's, cask's or resource's -# `livecheck` block and stores related instance variables. Most of these methods -# also return the related instance variable when no argument is provided. +# The {Livecheck} class implements the DSL methods used in a formula's, cask's +# or resource's `livecheck` block and stores related instance variables. Most +# 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 # behavior. Example `livecheck` blocks can be found in the @@ -11,8 +12,8 @@ class Livecheck extend Forwardable - # A very brief description of why the formula/cask/resource is skipped (e.g. `No longer - # developed or maintained`). + # A very brief description of why the formula/cask/resource is skipped (e.g. + # `No longer developed or maintained`). # @return [String, nil] attr_reader :skip_msg diff --git a/Library/Homebrew/test/resource_spec.rb b/Library/Homebrew/test/resource_spec.rb index ed34c294ed..96541c3183 100644 --- a/Library/Homebrew/test/resource_spec.rb +++ b/Library/Homebrew/test/resource_spec.rb @@ -9,12 +9,12 @@ describe Resource do let(:livecheck_resource) { described_class.new do - url "https://brew.sh/test-0.0.1.tgz" + url "https://brew.sh/foo-1.0.tar.gz" sha256 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" livecheck do - url "https://brew.sh/foo-1.0.tar.gz" - regex(/foo/) + url "https://brew.sh/test/releases" + regex(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i) end end } @@ -71,8 +71,8 @@ describe Resource do end 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.regex).to eq(/foo/) + expect(livecheck_resource.livecheck.url).to eq("https://brew.sh/test/releases") + expect(livecheck_resource.livecheck.regex).to eq(/foo[._-]v?(\d+(?:\.\d+)+)\.t/i) end end