Class: Version::StemParser Private

Inherits:
RegexParser show all
Defined in:
version/parser.rb

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.

Constant Summary collapse

SOURCEFORGE_DOWNLOAD_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.

%r{(?:sourceforge\.net|sf\.net)/.*/download$}
NO_FILE_EXTENSION_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.

/\.[^a-zA-Z]+$/

Class Method Summary collapse

Methods inherited from RegexParser

#initialize, #parse

Methods inherited from Parser

#parse

Constructor Details

This class inherits a constructor from Version::RegexParser

Class Method Details

.process_spec(spec) ⇒ String

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.

Parameters:

Returns:



52
53
54
55
56
57
58
59
60
# File 'version/parser.rb', line 52

def self.process_spec(spec)
  return spec.basename.to_s if spec.directory?

  spec_s = spec.to_s
  return spec.dirname.stem if spec_s.match?(SOURCEFORGE_DOWNLOAD_REGEX)
  return spec.basename.to_s if spec_s.match?(NO_FILE_EXTENSION_REGEX)

  spec.stem
end