Class: Fastlane::Actions::BuildnumberAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::BuildnumberAction
- Defined in:
- lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
11 12 13 |
# File 'lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb', line 11 def self. ["Nick Griffith"] end |
.available_options ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb', line 27 def self. [ 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 ⇒ Object
7 8 9 |
# File 'lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb', line 7 def self.description "Generates unique build numbers for iOS projects" end |
.details ⇒ Object
19 20 21 |
# 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) ⇒ Boolean
15 16 17 |
# File 'lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb', line 15 def self.is_supported?(platform) [:ios, :mac].include?(platform) end |
.return_value ⇒ Object
23 24 25 |
# File 'lib/fastlane/plugin/buildnumber/actions/buildnumber_action.rb', line 23 def self.return_value "Returns the generated build number" end |
.run(params) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# 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 |