diff --git a/Casks/wezterm-nightly.rb b/Casks/wezterm-nightly.rb index 576b83a..4d92cd5 100644 --- a/Casks/wezterm-nightly.rb +++ b/Casks/wezterm-nightly.rb @@ -11,6 +11,27 @@ # Unclear what the minimal OS version is # depends_on macos: ">= :sierra" + + livecheck do + url "https://github.com/wez/wezterm/releases/download/nightly/WezTerm-macos-nightly.zip" + strategy :header_match do |headers| + # matches last-modified header syntax + regex = /(\w{3}, )?(\d{1,2}) (\w{3}) (\d{4}) (\d{2}):(\d{2}):(\d{2}) GMT/ + match = headers["last-modified"].match(regex) + if match.nil? + match = headers["x-ms-creation-time"].match(regex) + end + + year = match[4] + month_idx = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"].index {|month| month == match[3].downcase} + month = (month_idx ? month_idx + 1 : 0).to_s.rjust(2,"0") + day = match[2].rjust(2, '0') + hour = match[5].rjust(2, '0') + minute = match[6].rjust(2, '0') + second = match[7].rjust(2, '0') + "#{year}#{month}#{day}#{hour}#{minute}#{second}" + end + end app "WezTerm.app" [ @@ -42,12 +63,6 @@ def caveats; <<~EOS /opt/homebrew/bin/ for M1 Mac. Removal of them is ensured by 'brew uninstall --cask #{token}'. - - Since there's no version info included in the download URL of the nightly - build, NO update will be notified for 'wezterm-nightly' by Homebrew. (Not a - problem for non-nightly, regular released 'wezterm'.) To get the nightly - update, just run - 'brew upgrade --cask wezterm-nightly --no-quarantine --greedy-latest'. EOS end end