Class: Fastlane::Actions::GetVersionCodeAction

Inherits:
BaseAction
  • Object
show all
Defined in:
lib/fastlane/plugin/android_version_helper/actions/get_version_code_action.rb

Constant Summary

Constants inherited from BaseAction

BaseAction::REGEX_VERSION_CODE, BaseAction::REGEX_VERSION_NAME

Class Method Summary collapse

Methods inherited from BaseAction

authors, available_options, find_in_file, is_supported?, replace_in_file

Class Method Details

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/android_version_helper/actions/get_version_code_action.rb', line 27

def self.description
  'Gets your App version code'
end

.detailsObject



31
32
33
# File 'lib/fastlane/plugin/android_version_helper/actions/get_version_code_action.rb', line 31

def self.details
  'This action returns your App current version code'
end

.other_optionsObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/android_version_helper/actions/get_version_code_action.rb', line 14

def self.other_options
  [
    FastlaneCore::ConfigItem.new(
      key: :regex,
      env_name: 'ANDROID_VERSION_HELPER_VERSION_CODE_REGEX',
      description: 'Specifies the regex to find the line where the version code is specified',
      optional: true,
      type: Regexp,
      default_value: REGEX_VERSION_CODE
    )
  ]
end

.return_valueObject



35
36
37
# File 'lib/fastlane/plugin/android_version_helper/actions/get_version_code_action.rb', line 35

def self.return_value
  'The version code of your App'
end

.run(params) ⇒ Object



7
8
9
10
11
12
# File 'lib/fastlane/plugin/android_version_helper/actions/get_version_code_action.rb', line 7

def self.run(params)
  UI.message('Getting version code!')
  value, _line_index, _content = find_in_file(params[:file_path], params[:regex])
  Actions.lane_context[SharedValues::ANDROID_VERSION_CODE] = value
  return value
end