Class: Fastlane::Helper::RollbarHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/rollbar/helper/rollbar_helper.rb

Class Method Summary collapse

Class Method Details

.create_bundle(os) ⇒ Object

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



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fastlane/plugin/rollbar/helper/rollbar_helper.rb', line 18

def self.create_bundle(os)
  UI.message('Creating React Native bundle')
  jsbundle = os == 'ios' ? 'main.jsbundle' : 'index.android.bundle'
  assets_dest = os == 'ios' ? 'ios' : 'android/app/src/main/res/'
  Action.sh("react-native bundle \
    --platform #{os} \
    --dev false \
    --entry-file index.js \
    --bundle-output /tmp/#{jsbundle} \
    --assets-dest #{assets_dest} \
    --sourcemap-output /tmp/sourcemap.#{os}.js \
    --sourcemap-sources-root ./")
end

.report_deploy(api_key, environment, revision, local_username, rollbar_username, comment, status) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fastlane/plugin/rollbar/helper/rollbar_helper.rb', line 63

def self.report_deploy(api_key, environment, revision, local_username, rollbar_username, comment, status)
  UI.message('Report deploy to Rollbar')
  action_params = ["curl #{API_DEPLOY_URL} -F access_token=#{api_key} -F environment=#{environment} -F revision=#{revision}"]
  if local_username
    action_params.push("-F local_username=#{local_username}")
  end
  if rollbar_username
    action_params.push("-F rollbar_username=#{rollbar_username}")
  end
  if comment
    action_params.push("-F comment=#{comment}")
  end
  if status
    action_params.push("-F status=#{status}")
  end
  Action.sh(action_params.join(" "))
end

.show_messageObject



81
82
83
# File 'lib/fastlane/plugin/rollbar/helper/rollbar_helper.rb', line 81

def self.show_message
  UI.message('Hello from the rollbar plugin helper!')
end

.upload_bundle(api_key, os, code_version, environment) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fastlane/plugin/rollbar/helper/rollbar_helper.rb', line 32

def self.upload_bundle(api_key, os, code_version, environment)
  UI.message('Uploading React Native bundle to Rollbar')
  jsbundle = os == 'ios' ? 'main.jsbundle' : 'index.android.bundle'
  Action.sh("curl #{API_SOURCEMAP_URL} \
    -F access_token=#{api_key} \
    -F version=#{code_version}.#{os} \
    -F minified_url=http://reactnativehost/#{jsbundle} \
    -F environment=#{environment} \
    -F source_map=@/tmp/sourcemap.#{os}.js \
    -F [email protected]")
end

.upload_dsym(api_key, dsym_path, code_version, bundle_identifier, environment) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/fastlane/plugin/rollbar/helper/rollbar_helper.rb', line 44

def self.upload_dsym(api_key, dsym_path, code_version, bundle_identifier, environment)
  UI.message('Uploading Dsym to Rollbar')
  Action.sh("curl -X POST #{API_DSYM_URL} \
    -F access_token=#{api_key} \
    -F version=#{code_version}.ios \
    -F bundle_identifier=#{bundle_identifier} \
    -F environment=#{environment} \
    -F dsym=@#{dsym_path}")
end

.upload_proguard(api_key, proguard_path, code_version, environment) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/fastlane/plugin/rollbar/helper/rollbar_helper.rb', line 54

def self.upload_proguard(api_key, proguard_path, code_version, environment)
  UI.message('Uploading Proguard mapping to Rollbar')
  Action.sh("curl #{API_PROGUARD_URL} \
    -F access_token=#{api_key} \
    -F version=#{code_version}.android \
    -F environment=#{environment} \
    -F mapping=@#{proguard_path}")
end