cask cookbook: update livecheck blocks
This change causes `livecheck` to return a nicer error if no match is found from the regex.
This commit is contained in:
parent
dae9a34a85
commit
e6e0ba0521
@ -748,6 +748,8 @@ If the version depends on multiple header fields, a block can be specified, e.g.
|
|||||||
strategy :header_match do |headers|
|
strategy :header_match do |headers|
|
||||||
v = headers["content-disposition"][/MyApp-(\d+(?:\.\d+)*)\.zip/i, 1]
|
v = headers["content-disposition"][/MyApp-(\d+(?:\.\d+)*)\.zip/i, 1]
|
||||||
id = headers["location"][%r{/(\d+)/download$}i, 1]
|
id = headers["location"][%r{/(\d+)/download$}i, 1]
|
||||||
|
next if v.blank? || id.blank?
|
||||||
|
|
||||||
"#{v},#{id}"
|
"#{v},#{id}"
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
@ -757,6 +759,8 @@ Similarly, the `:page_match` strategy can also be used for more complex versions
|
|||||||
```ruby
|
```ruby
|
||||||
strategy :page_match do |page|
|
strategy :page_match do |page|
|
||||||
match = page.match(%r{href=.*?/(\d+)/MyApp-(\d+(?:\.\d+)*)\.zip}i)
|
match = page.match(%r{href=.*?/(\d+)/MyApp-(\d+(?:\.\d+)*)\.zip}i)
|
||||||
|
next if match.blank?
|
||||||
|
|
||||||
"#{match[2]},#{match[1]}"
|
"#{match[2]},#{match[1]}"
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user