class Fastlane::Actions::InstabugOfficialAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 78 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| unless value && !value.empty? UI.user_error!("No API token for InstabugAction given, pass using `api_token: 'token'`") end end), FastlaneCore::ConfigItem.new(key: :dsym_array_paths, type: Array, optional: true, description: 'Array of paths to *.dSYM files') ] end
build_single_file_command(command, dsym_path)
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 125 def self.build_single_file_command(command, dsym_path) file_path = if dsym_path.end_with?('.zip') dsym_path.shellescape else ZipAction.run(path: dsym_path, include: [], exclude: []).shellescape end command + "@\"#{Shellwords.shellescape(file_path)}\"" end
cleanup_instabug_directory()
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 105 def self.cleanup_instabug_directory FileUtils.rm_f "#{@instabug_dsyms_directory}.zip" FileUtils.rm_rf @instabug_dsyms_directory end
copy_dsym_paths_into_directory(dsym_paths, directory_path)
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 114 def self.copy_dsym_paths_into_directory(dsym_paths, directory_path) dsym_paths.each do |path| if File.extname(path) == '.dSYM' destination_path = "#{directory_path}/#{File.basename(path)}" FileUtils.copy_entry(path, destination_path) if File.exist?(path) else Actions.sh("unzip -n #{Shellwords.shellescape(path)} -d #{Shellwords.shellescape(directory_path)}") end end end
description()
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 53 def self.description "Upload dSYM files to Instabug" end
details()
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 57 def self.details "This action is used to upload symbolication files to Instabug. Incase you are not using bitcode, you can use this plug-in with `gym` to upload dSYMs generated from your builds. If bitcode is enabled, you can use it with `download_dsyms` to upload dSYMs from iTunes connect" end
example_code()
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 71 def self.example_code [ 'instabug_official(api_token: "<Instabug token>")', 'instabug_official(api_token: "<Instabug token>", dsym_array_paths: ["./App1.dSYM.zip", "./App2.dSYM.zip"])' ] end
generate_instabug_directory()
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 100 def self.generate_instabug_directory cleanup_instabug_directory FileUtils.mkdir_p @instabug_dsyms_directory end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 95 def self.is_supported?(platform) platform == :ios true end
remove_directory(directory_path)
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 110 def self.remove_directory(directory_path) FileUtils.rm_rf directory_path end
return_value()
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 67 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb, line 9 def self.run(params) @instabug_dsyms_directory = 'Instabug_dsym_files_fastlane' UI.verbose 'Running Instabug Action' api_token = params[:api_token] endpoint = 'https://api.instabug.com/api/sdk/v3/symbols_files' command = "curl #{endpoint} --write-out %{http_code} --silent --output /dev/null -F os=\"ios\" -F application_token=\"#{api_token}\" -F symbols_file=" dsym_paths = [] # Add paths provided by the user dsym_paths += (params[:dsym_array_paths] || []) # Add dSYMs generaed by `gym` dsym_paths += [Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH]] if Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] # Add dSYMs downloaded from iTC dsym_paths += Actions.lane_context[SharedValues::DSYM_PATHS] if Actions.lane_context[SharedValues::DSYM_PATHS] dsym_paths.uniq! UI.verbose 'dsym_paths: ' + dsym_paths.inspect if dsym_paths.empty? UI.error "Fastlane dSYMs file is not found! make sure you're using Fastlane action [download_dsyms] to download your dSYMs from App Store Connect" return end generate_instabug_directory UI.verbose 'Directory name: ' + @instabug_dsyms_directory copy_dsym_paths_into_directory(dsym_paths, @instabug_dsyms_directory) command = build_single_file_command(command, @instabug_dsyms_directory) result = Actions.sh(command) if result == '200' UI.success 'dSYM is successfully uploaded to Instabug 🤖' UI.verbose 'Removing The directory' else UI.error "Something went wrong during Instabug dSYM upload. Status code is #{result}" end # Cleanup zip file and directory cleanup_instabug_directory end