This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes Homebrew/homebrew-cask#28354.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# How to Contribute | ||
|
||
All of the [instructions for contributing from the main repository](https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md) apply, and won't be repeated here. You simply need to change references to `caskroom/homebrew-cask` (that repository) to `caskroom/homebrew-versions` (this repository). | ||
|
||
# Nightly Builds (Nightlies) | ||
|
||
For Casks that use nightlies, which are generally builds that are done once a day, the `version`, `sha256` and `url` will change frequently and hence the Cask will be constantly outdated. To alleviate having to regularly update a Cask for a nightly build, the use of a [`url do` block](https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#using-a-block-to-defer-code-execution) in conjunction with `version :latest` and `sha256 :no_check` can help ensure that the latest version is always used. | ||
|
||
See [this pull request for exist-db-nightly](https://github.com/caskroom/homebrew-versions/pull/3067) for an example of the procedure. | ||
|
||
Example ([exist-db-nightly.rb](https://github.com/caskroom/homebrew-versions/blob/16b3bab91ab5b9a69ef7c456441b0e0fced56516/Casks/exist-db-nightly.rb#L6#L14)): | ||
```ruby | ||
url do | ||
require 'open-uri' | ||
base_url = 'http://static.adamretter.org.uk/exist-nightly' | ||
builds_url = "#{base_url}/table.html" | ||
latest_build_filename = open(builds_url) do |io| | ||
io.read.scan(%r{<tr>.*?<td>(.*?)</td>.*?<a href="([^\"]+)">dmg}m).max[1] | ||
end | ||
"#{base_url}/#{latest_build_filename}" | ||
end | ||
``` |