Class: Fastlane::Helper::GitBuildTag

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(str, tag_prefix) ⇒ GitBuildTag

Returns a new instance of GitBuildTag.



13
14
15
16
17
# File 'lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb', line 13

def initialize(str, tag_prefix)
  # Instance variables
  @tag_prefix = tag_prefix
  @str = str
end

Instance Method Details

#build_numberObject



23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb', line 23

def build_number
  full_name = @str.split('refs/tags/').last
  m = full_name.match(/^#{@tag_prefix}(\d+)$/)
  if m && m[1]
    number_or_nil(m[1])
  end
end

#hashObject



19
20
21
# File 'lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb', line 19

def hash
  (@str.split('refs/tags/').first || '').strip
end

#is_build_number?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb', line 31

def is_build_number?
  build_number != nil
end

#to_sObject



35
36
37
# File 'lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb', line 35

def to_s
  "GitBuildTag<#{self.hash}, #{self.build_number}>"
end