Class: Fastlane::Actions::FetchVersionCodeAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



25
26
27
# File 'lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb', line 25

def self.authors
  ['AdrieanKhisbe', 'VincentCATILLON']
end

.available_optionsObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb', line 33

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :endpoint, description: 'Version Api endpoint', is_string: true, default_value: ''),
    FastlaneCore::ConfigItem.new(key: :host, description: 'The host hosting the version API', default_value: ''),
    FastlaneCore::ConfigItem.new(key: :path, description: 'The path of the version API', default_value: ''),
    FastlaneCore::ConfigItem.new(key: :method, description: 'The method of the endpoint', is_string: false, default_value: :get),
    FastlaneCore::ConfigItem.new(key: :secret_header, default_value: ''),
    FastlaneCore::ConfigItem.new(key: :secret_value, default_value: '')
  ]
end

.descriptionObject



21
22
23
# File 'lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb', line 21

def self.description
  'Fetch (and increment) version code for given platform'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb', line 44

def self.is_supported?(platform)
  [:ios, :android].include?(platform)
end

.return_valueObject



29
30
31
# File 'lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb', line 29

def self.return_value
  'Version code of given platform'
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb', line 9

def self.run(params)
  unless params[:host] && params[:path] || params[:endpoint]
    UI.user_error!('Need either :host and :path or :endpoint arguments')
  end
  UI.message("About to fetch a version code")

  version_code = Helper::FetchVersionCodeHelper.fetch_version_code(params)
  UI.success("Got 'version code': #{version_code}")

  return version_code
end