Class: Fastlane::Actions::InstabugAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



58
59
60
# File 'lib/fastlane/plugin/instabug/actions/instabug.rb', line 58

def self.authors
  ['SiarheiFedartsou']
end

.available_optionsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fastlane/plugin/instabug/actions/instabug.rb', line 38

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: 'FL_INSTABUG_API_TOKEN', # The name of the environment variable
                                 description: 'API Token for Instabug', # a short description of this parameter
                                 verify_block: proc do |value|
                                   UI.user_error!("No API token for InstabugAction given, pass using `api_token: 'token'`") unless value && !value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :dsym_path,
                                 env_name: 'FL_INSTABUG_DSYM_PATH',
                                 description: 'Path to *.dSYM file',
                                 default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH],
                                 is_string: true,
                                 optional: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("dSYM file doesn't exists") unless File.exist?(value)
                                 end)
  ]
end

.descriptionObject



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

def self.description
  'Instabug dSYM uploading'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/fastlane/plugin/instabug/actions/instabug.rb', line 62

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/instabug/actions/instabug.rb', line 4

def self.run(params)
  api_token = params[:api_token]

  if params[:dsym_path].end_with?('.zip')
    dsym_zip_path = params[:dsym_path].shellescape
  else
    dsym_path = params[:dsym_path]
    dsym_zip_path = ZipAction.run(path: dsym_path).shellescape
  end

  endpoint = 'https://api.instabug.com/api/ios/v1/dsym'

  command =  "curl #{endpoint} --write-out %{http_code} --silent --output /dev/null -F dsym=@\"#{dsym_zip_path}\" -F token=\"#{api_token}\""

  UI.verbose command

  return command if Helper.test?

  result = Actions.sh(command)
  if result == "200"
    UI.success 'dSYM is successfully uploaded to Instabug 🤖'
  else
    UI.error "Something went wrong during Instabug dSYM upload. Status code is #{result}"
  end
end