class Fastlane::Helper::GitBuildVersioningHelper
Public Class Methods
current_build_number(tag_prefix)
click to toggle source
# File lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb, line 82 def self.current_build_number(tag_prefix) head = self.head tags = self.build_tags(tag_prefix) tags.select { |t| t.hash == head } .map(&:build_number) .last end
head()
click to toggle source
# File lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb, line 91 def self.head if self.is_git? head = Actions.sh("git rev-parse HEAD", log: false) (head || "").strip else UI.user_error!("No git repository detected") end end
is_git?()
click to toggle source
# File lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb, line 41 def self.is_git? Actions.sh('git rev-parse HEAD', log: false) return true rescue return false end
last_build_number(tag_prefix)
click to toggle source
# File lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb, line 76 def self.last_build_number(tag_prefix) self.build_tags(tag_prefix) .map(&:build_number) .last end
reserve_build_number(tag_prefix)
click to toggle source
class methods that you define here become available in your action as `Helper::GitBuildVersioningHelper.your_method`
# File lib/fastlane/plugin/git_build_versioning/helper/git_build_versioning_helper.rb, line 51 def self.reserve_build_number(tag_prefix) head = self.head tags = self.build_tags(tag_prefix) current = tags .select { |t| t.hash == head } .map(&:build_number) .last if current.nil? latest = tags .map(&:build_number) .last current = (latest || 0) + 1 tag_name = "#{tag_prefix}#{current}" Actions.sh("git tag #{tag_name} && git push --quiet origin #{tag_name}", log: false) UI.success("Tagging #{tag_name}") else UI.success("Current commit already tagged as build #{tag_name}") end current end