Class: FastlaneCore::TagVersion

Inherits:
Gem::Version
  • Object
show all
Defined in:
fastlane_core/lib/fastlane_core/tag_version.rb

Overview

Utility class to construct a Gem::Version from a tag. Accepts vX.Y.Z and X.Y.Z.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ TagVersion

Returns a new instance of TagVersion.



27
28
29
# File 'fastlane_core/lib/fastlane_core/tag_version.rb', line 27

def initialize(tag)
  super(self.class.version_number_from_tag(tag))
end

Class Method Details

.correct?(tag) ⇒ Boolean

Returns:



8
9
10
11
12
13
14
15
16
17
# File 'fastlane_core/lib/fastlane_core/tag_version.rb', line 8

def correct?(tag)
  result = superclass.correct?(version_number_from_tag(tag))

  # It seems like depending on the Ruby env, the result is
  # slightly different. We actually just want `true` and `false`
  # values here
  return false if result.nil?
  return true if result == 0
  return result
end

.version_number_from_tag(tag) ⇒ Object

Gem::Version.new barfs on things like “v0.1.0”, which is the style generated by the rake release task. Just strip off any initial v to generate a Gem::Version from a tag.



22
23
24
# File 'fastlane_core/lib/fastlane_core/tag_version.rb', line 22

def version_number_from_tag(tag)
  tag.sub(/^v/, "")
end