Class: Homebrew::BumpVersionParser Private
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.
Class handling architecture-specific version information.
Instance Attribute Summary collapse
- #arm ⇒ Version, ... readonly private
- #general ⇒ Version, ... readonly private
- #intel ⇒ Version, ... readonly private
Instance Method Summary collapse
- #blank? ⇒ Boolean private
- #initialize(general: nil, arm: nil, intel: nil) ⇒ void constructor private
- #parse_cask_version(version) ⇒ Cask::DSL::Version? private
- #parse_version(version) ⇒ Version, ... private
Constructor Details
#initialize(general: nil, arm: nil, intel: nil) ⇒ void
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.
15 16 17 18 19 20 21 22 23 24 |
# File 'bump_version_parser.rb', line 15 def initialize(general: nil, arm: nil, intel: nil) @general = T.let(parse_version(general), T.nilable(T.any(Version, Cask::DSL::Version))) if general.present? @arm = T.let(parse_version(arm), T.nilable(T.any(Version, Cask::DSL::Version))) if arm.present? @intel = T.let(parse_version(intel), T.nilable(T.any(Version, Cask::DSL::Version))) if intel.present? return if @general.present? raise UsageError, "`--version` must not be empty." if arm.blank? && intel.blank? raise UsageError, "`--version-arm` must not be empty." if arm.blank? raise UsageError, "`--version-intel` must not be empty." if intel.blank? end |
Instance Attribute Details
#arm ⇒ Version, ... (readonly)
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.
8 9 10 |
# File 'bump_version_parser.rb', line 8 def arm @arm end |
#general ⇒ Version, ... (readonly)
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.
8 9 10 |
# File 'bump_version_parser.rb', line 8 def general @general end |
#intel ⇒ Version, ... (readonly)
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.
8 9 10 |
# File 'bump_version_parser.rb', line 8 def intel @intel end |
Instance Method Details
#blank? ⇒ 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.
48 49 50 |
# File 'bump_version_parser.rb', line 48 def blank? @general.blank? && @arm.blank? && @intel.blank? end |
#parse_cask_version(version) ⇒ Cask::DSL::Version?
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.
39 40 41 42 43 44 45 |
# File 'bump_version_parser.rb', line 39 def parse_cask_version(version) if version == "latest" Cask::DSL::Version.new(:latest) else Cask::DSL::Version.new(version) end end |
#parse_version(version) ⇒ Version, ...
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.
30 31 32 33 34 35 36 |
# File 'bump_version_parser.rb', line 30 def parse_version(version) if version.is_a?(Version) version elsif version.is_a?(String) parse_cask_version(version) end end |