Module: LivecheckFormula Private

Extended by:
Context
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

Methods included from Context

current, current=, debug?, quiet?, verbose?, with_context

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.



14
15
16
17
18
19
20
# File 'brew/Library/Homebrew/utils/livecheck_formula.rb', line 14

def init(formula)
  ohai "Checking livecheck formula: #{formula}" if 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.



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'brew/Library/Homebrew/utils/livecheck_formula.rb', line 22

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