class Fastlane::Actions::InstabugAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/instabug/actions/instabug.rb, line 58
def self.authors
  ['SiarheiFedartsou']
end
available_options() click to toggle source
# 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
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/instabug/actions/instabug.rb, line 34
def self.description
  'Instabug dSYM uploading'
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/instabug/actions/instabug.rb, line 62
def self.is_supported?(platform)
  platform == :ios
end
run(params) click to toggle source
# 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