Class: Fastlane::Actions::SetVersionCodeAction

Inherits:
BaseAction
  • Object
show all
Defined in:
lib/fastlane/plugin/android_version_helper/actions/set_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



34
35
36
# File 'lib/fastlane/plugin/android_version_helper/actions/set_version_code_action.rb', line 34

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

.detailsObject



38
39
40
# File 'lib/fastlane/plugin/android_version_helper/actions/set_version_code_action.rb', line 38

def self.details
  'This action sets a new version code and returns it'
end

.other_optionsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fastlane/plugin/android_version_helper/actions/set_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
    ),
    FastlaneCore::ConfigItem.new(
      key: :version_code,
      env_name: 'ANDROID_VERSION_HELPER_NEW_VERSION_CODE',
      description: 'Specifies the new version code',
      optional: false,
      type: Integer
    )
  ]
end

.return_valueObject



42
43
44
# File 'lib/fastlane/plugin/android_version_helper/actions/set_version_code_action.rb', line 42

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

.run(params) ⇒ Object



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

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