Class: Homebrew::Livecheck::Strategy::ElectronBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
livecheck/strategy/electron_builder.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

The ElectronBuilder strategy fetches content at a URL and parses it as an electron-builder appcast in YAML format.

This strategy is not applied automatically and it's necessary to use strategy :electron_builder in a livecheck block to apply it.

Constant Summary collapse

NICE_NAME =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"electron-builder"
PRIORITY =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

A priority of zero causes livecheck to skip the strategy. We do this for Homebrew::Livecheck::Strategy::ElectronBuilder so we can selectively apply it when appropriate.

0
URL_MATCH_REGEX =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

The Regexp used to determine if the strategy applies to the URL.

%r{^https?://.+/[^/]+\.ya?ml(?:\?[^/?]+)?$}i

Class Method Summary collapse

Class Method Details

.find_versions(url:, regex: nil, provided_content: nil, **unused, &block) ⇒ Hash{Symbol => T.untyped}

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Checks the YAML content at the URL for new versions.

Parameters:

  • url (String)

    the URL of the content to check

  • regex (Regexp, nil) (defaults to: nil)

    a regex used for matching versions

  • provided_content (String, nil) (defaults to: nil)

    content to use in place of fetching via Strategy#page_content

  • unused (T.untyped)
  • block (Proc, nil)

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'livecheck/strategy/electron_builder.rb', line 47

def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block)
  if regex.present? && block.blank?
    raise ArgumentError,
          "#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
  end

  Yaml.find_versions(
    url:,
    regex:,
    provided_content:,
    **unused,
    &block || proc { |yaml| yaml["version"] }
  )
end

.match?(url) ⇒ Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Whether the strategy can be applied to the provided URL.

Parameters:

  • url (String)

    the URL to match against

Returns:

  • (Boolean)


27
28
29
# File 'livecheck/strategy/electron_builder.rb', line 27

def self.match?(url)
  URL_MATCH_REGEX.match?(url)
end