Skip to content

Commit 4c97a5a

Browse files
committed
refactor running the cli commands
1 parent 389decb commit 4c97a5a

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

tools/fastlane-plugin/lib/fastlane/plugin/bugsnag/actions/bugsnag_cli.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ def self.upload_args dir, upload_url, project_root, api_key, ignore_missing_dwar
9999
args << dir
100100
args
101101
end
102+
103+
def self.upload_dsym cli_path, args
104+
bugsnag_cli_command = "#{cli_path} upload dsym #{args.join(' ')}"
105+
FastlaneCore::UI.verbose("Running command: #{bugsnag_cli_command}")
106+
Kernel.system(bugsnag_cli_command)
107+
end
108+
109+
def self.create_build cli_path, args
110+
bugsnag_cli_command = "#{cli_path} create-build #{args.join(' ')}"
111+
FastlaneCore::UI.verbose("Running command: #{bugsnag_cli_command}")
112+
Kernel.system(bugsnag_cli_command)
113+
end
102114
end
103115

104116

tools/fastlane-plugin/lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ def self.run(params)
5555
timeout,
5656
endpoint
5757
)
58-
bugsnag_cli_command = "#{bugsnag_cli_path} create-build #{args.join(' ')}"
59-
UI.verbose("Running command: #{bugsnag_cli_command}")
60-
success = Kernel.system(bugsnag_cli_command)
58+
success = BugsnagCli.create_build bugsnag_cli_path, args
6159
if success
6260
UI.success("Build successfully sent to Bugsnag")
6361
else

tools/fastlane-plugin/lib/fastlane/plugin/bugsnag/actions/upload_symbols_to_bugsnag.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def self.run(params)
1010
UI.verbose("Using bugsnag-cli from path: #{bugsnag_cli_path}")
1111

1212
# If we have not explicitly set an API key through env, or parameter
13-
# input in Fastfile, find an API key in the Info.plist in config_file param
13+
# input in Fastfile, find an API key from the Info.plist in config_file param
1414
api_key = params[:api_key]
1515
if params[:config_file] && params[:api_key] == nil
1616
UI.message("Using the API Key from #{params[:config_file]}")
@@ -46,9 +46,7 @@ def self.run(params)
4646
params[:config_file],
4747
params[:xcode_project]
4848
)
49-
bugsnag_cli_command = "#{bugsnag_cli_path} upload dsym #{args.join(' ')}"
50-
UI.verbose("Running command: #{bugsnag_cli_command}")
51-
success = Kernel.system(bugsnag_cli_command)
49+
success = BugsnagCli.upload_dsym bugsnag_cli_path, args
5250
if success
5351
UI.success("Uploaded dSYMs in #{dsym_path}")
5452
else

0 commit comments

Comments
 (0)