class Fastlane::Actions::BuildnumberAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb, line 27 def self.available_options [ FastlaneCore::ConfigItem.new( key: :git, env_name: "FL_BUILDNUMBER_GIT", description: "Git branch, tag, or commit to pull timestamp from for epoch portion of build number", optional: true, default_value: "master", type: String ) ] end
description()
click to toggle source
# File lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb, line 7 def self.description "Generates unique build numbers for iOS projects" end
details()
click to toggle source
# File lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb, line 19 def self.details "This plugin generates unique build numbers for projects combined a custom epoch to ensure always increasing build number and a decimal version of the githash, which can be reversed to find the commit the build comes from." end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb, line 15 def self.is_supported?(platform) [:ios, :mac].include?(platform) end
return_value()
click to toggle source
# File lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb, line 23 def self.return_value "Returns the generated build number" end
run(params)
click to toggle source
# File lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb, line 40 def self.run(params) current_commit = `git rev-parse --short HEAD` current_commit_decimalized = Integer("0x1#{current_commit}") git_commit_date = `git show -s --format=%ci #{params[:git]}` time_since_git = DateTime.now - DateTime.parse(git_commit_date) # minutes since specified git commit/tag/branch time_since_git_minutes = (time_since_git * 24 * 60).to_i return "#{time_since_git_minutes}.#{current_commit_decimalized}" end