Class: Fastlane::Helper::AppliveryHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/applivery/helper/applivery_helper.rb

Class Method Summary collapse

Class Method Details

.add_git_remoteObject



58
59
60
61
62
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 58

def self.add_git_remote
  return `git config --get remote.origin.url`
rescue
  return ""
end

.get_integration_numberObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 20

def self.get_integration_number
  xcodeIntegrationNumber = ENV["XCS_INTEGRATION_NUMBER"] # XCode Server
  jenkinsIntegrationNumber = ENV["BUILD_NUMBER"] # Jenkins
  travisIntegrationNumber = ENV["TRAVIS_BUILD_NUMBER"] # Travis
  integrationNumber = ""
  
  if !xcodeIntegrationNumber.nil?
    integrationNumber += xcodeIntegrationNumber
  elsif !jenkinsIntegrationNumber.nil?
    integrationNumber += jenkinsIntegrationNumber
  elsif !travisIntegrationNumber.nil?
    integrationNumber += travisIntegrationNumber
  end

  return integrationNumber
end

.git_branchObject

GIT Methods ###



40
41
42
43
44
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 40

def self.git_branch
  return Actions.git_branch
rescue
  return ""
end

.git_commitObject



46
47
48
49
50
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 46

def self.git_commit
  return `git rev-parse --short HEAD`
rescue
  return ""
end

.git_messageObject



52
53
54
55
56
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 52

def self.git_message
  return Actions.last_git_commit_message
rescue
  return ""
end

.git_tagObject



64
65
66
67
68
69
70
71
72
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 64

def self.git_tag
  gitTag = `git describe --abbrev=0 --tags`
  gitTagCommit = `git rev-list -n 1 --abbrev-commit #{gitTag}`
  gitCommit = `git rev-parse --short HEAD`
  return gitTag if gitTagCommit == gitCommit
  return ""
rescue
  return ""
end

.parse_error(error) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 74

def self.parse_error(error)
  if error
    case error["code"]
    when 5006
      UI.user_error! "Upload fail. The build path seems to be wrong or file is invalid"
    when 4004
      UI.user_error! "The app_token is not valid. Please, go to your app settings and doble-check the integration tokens"
    when 4002
      UI.user_error! "The app_token is empty. Please, go to your app Settings->Integrations to generate a token"
    else
      UI.user_error! "Upload fail. [#{error["code"]}]: #{error["message"]}"
    end
  else
    UI.crash! "Upload fails unexpectedly. [#{response.status}]"
  end
end

.platformObject



11
12
13
14
15
16
17
18
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 11

def self.platform
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
  if platform == :ios or platform.nil?
    return "ios"
  elsif platform == :android
    return "android"
  end
end

.show_messageObject

class methods that you define here become available in your action as ‘Helper::AppliveryHelper.your_method`



7
8
9
# File 'lib/fastlane/plugin/applivery/helper/applivery_helper.rb', line 7

def self.show_message
  UI.message("Hello from the applivery plugin helper!")
end