From bfc6c465706856a7953f7588c67e62cc01904dc5 Mon Sep 17 00:00:00 2001 From: Miccal Matthews Date: Thu, 26 Jan 2017 09:50:32 +0800 Subject: [PATCH] Update CONTRIBUTING.md Closes https://github.com/caskroom/homebrew-cask/issues/28354. --- CONTRIBUTING.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d653b875195894..6325ad4027b8ce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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{.*?(.*?).*?dmg}m).max[1] + end + "#{base_url}/#{latest_build_filename}" + end +```