Class: Fastlane::Actions::ApteligentAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/apteligent.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, details, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



84
85
86
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 84

def self.authors
  ["Mo7amedFouad"]
end

.available_optionsObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 65

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :dsym,
                                 env_name: "FL_APTELIGENT_FILE",
                                 description: "dSYM.zip file to upload to Apteligent",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :app_id,
                                 env_name: "FL_APTELIGENT_APP_ID",
                                 description: "Apteligent App ID key e.g. 569f5c87cb99e10e00c7xxxx",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :api_key,
                                 env_name: "FL_APTELIGENT_API_KEY",
                                 sensitive: true,
                                 code_gen_sensitive: true,
                                 description: "Apteligent App API key e.g. IXPQIi8yCbHaLliqzRoo065tH0lxxxxx",
                                 optional: false)
  ]
end

.categoryObject



101
102
103
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 101

def self.category
  :beta
end

.descriptionObject



61
62
63
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 61

def self.description
  "Upload dSYM file to [Apteligent (Crittercism)](http://www.apteligent.com/)"
end

.dsym_path(params) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 31

def self.dsym_path(params)
  file_path = params[:dsym]
  file_path ||= Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] || ENV[SharedValues::DSYM_OUTPUT_PATH.to_s]
  file_path ||= Actions.lane_context[SharedValues::DSYM_ZIP_PATH] || ENV[SharedValues::DSYM_ZIP_PATH.to_s]

  if file_path
    expanded_file_path = File.expand_path(file_path)
    UI.user_error!("Couldn't find file at path '#{expanded_file_path}'") unless File.exist?(expanded_file_path)
    return expanded_file_path
  else
    UI.user_error!("Couldn't find dSYM file")
  end
end

.example_codeObject



92
93
94
95
96
97
98
99
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 92

def self.example_code
  [
    'apteligent(
      app_id: "...",
      api_key: "..."
    )'
  ]
end

.fail_on_error(result) ⇒ Object



19
20
21
22
23
24
25
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 19

def self.fail_on_error(result)
  if result != "200"
    UI.crash!("Server error, failed to upload the dSYM file.")
  else
    UI.success('dSYM successfully uploaded to Apteligent!')
  end
end

.is_supported?(platform) ⇒ Boolean

Returns:



88
89
90
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 88

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
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 4

def self.run(params)
  command = []
  command << "curl"
  command += upload_options(params)
  command << upload_url(params[:app_id].shellescape)

  # Fastlane::Actions.sh has buffering issues, no progress bar is shown in real time
  # will reanable it when it is fixed
  # result = Fastlane::Actions.sh(command.join(' '), log: false)
  shell_command = command.join(' ')
  return shell_command if Helper.test?
  result = Actions.sh(shell_command)
  fail_on_error(result)
end

.upload_options(params) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 45

def self.upload_options(params)
  file_path = dsym_path(params).shellescape

  # rubocop: disable Style/FormatStringToken
  options = []
  options << "--write-out %{http_code} --silent --output /dev/null"
  options << "-F dsym=@#{file_path}"
  options << "-F key=#{params[:api_key].shellescape}"
  options
  # rubocop: enable Style/FormatStringToken
end

.upload_url(app_id) ⇒ Object



27
28
29
# File 'fastlane/lib/fastlane/actions/apteligent.rb', line 27

def self.upload_url(app_id)
  "https://api.crittercism.com/api_beta/dsym/#{app_id}"
end