Module: LivecheckFormula Private

Defined in:
brew/Library/Homebrew/utils/livecheck_formula.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper module for parsing output of brew livecheck.

Class Method Summary collapse

Class Method Details

.init(formula) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
12
13
14
15
# File 'brew/Library/Homebrew/utils/livecheck_formula.rb', line 9

def init(formula)
  ohai "Checking livecheck formula: #{formula}" if Homebrew.args.verbose?

  response = Utils.popen_read(HOMEBREW_BREW_FILE, "livecheck", formula, "--quiet").chomp

  parse_livecheck_response(response)
end

.parse_livecheck_response(response) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'brew/Library/Homebrew/utils/livecheck_formula.rb', line 17

def parse_livecheck_response(response)
  # e.g response => aacgain : 7834 ==> 1.8
  output = response.delete(" ").split(/:|==>/)

  # e.g. ["openclonk", "7.0", "8.1"]
  package_name, brew_version, latest_version = output

  {
    name:              package_name,
    formula_version:   brew_version,
    livecheck_version: latest_version,
  }
end