fastlane-plugin-bugsnag 2.3.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require_relative '../lib/fastlane/plugin/bugsnag/actions/bugsnag_cli'
2
3
 
3
4
  Action = Fastlane::Actions::UploadSymbolsToBugsnagAction
4
5
 
@@ -15,29 +16,24 @@ describe Action do
15
16
  FileUtils.rm_rf("#{gem_name}.gem")
16
17
  end
17
18
 
18
- it 'has an executable upload script' do
19
+ it 'has bundled CLI binaries' do
19
20
  system('rake build')
20
21
  system("gem unpack #{gem_name}.gem")
21
- expect(File.exist?(File.join("#{gem_name}/bugsnag-dsym-upload"))).to be true
22
+ expect(File.exist?(File.join("#{gem_name}", "bin", "arm64-linux-bugsnag-cli"))).to be true
23
+ expect(File.exist?(File.join("#{gem_name}", "bin", "arm64-macos-bugsnag-cli"))).to be true
24
+ expect(File.exist?(File.join("#{gem_name}", "bin", "i386-linux-bugsnag-cli"))).to be true
25
+ expect(File.exist?(File.join("#{gem_name}", "bin", "i386-windows-bugsnag-cli.exe"))).to be true
26
+ expect(File.exist?(File.join("#{gem_name}", "bin", "x86_64-linux-bugsnag-cli"))).to be true
27
+ expect(File.exist?(File.join("#{gem_name}", "bin", "x86_64-macos-bugsnag-cli"))).to be true
28
+ expect(File.exist?(File.join("#{gem_name}", "bin", "x86_64-windows-bugsnag-cli.exe"))).to be true
22
29
  end
23
30
  end
24
31
 
25
32
  describe '#run' do
26
- it 'silences script output by default' do
27
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
28
- "--silent",
29
- "--project-root", Dir::pwd,
30
- FIXTURE_PATH).and_return(true)
31
- run_with({dsym_path: FIXTURE_PATH})
32
- end
33
-
34
33
  it 'UI.user_error when script fails' do
35
- expect(Fastlane::UI).to receive(:user_error!).with("Failed uploading #{FIXTURE_PATH}")
36
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
37
- "--silent",
38
- "--project-root", Dir::pwd,
39
- FIXTURE_PATH).and_return(false)
40
- run_with({dsym_path: FIXTURE_PATH})
34
+ expect(Fastlane::UI).to receive(:user_error!).with("Failed uploading #{File.join(FIXTURE_PATH, "ios_proj/Project")}")
35
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{File.join(FIXTURE_PATH, "ios_proj/Project")}\"").and_return(false)
36
+ run_with({dsym_path: File.join(FIXTURE_PATH, "ios_proj/Project")})
41
37
  end
42
38
 
43
39
  it 'requires the dSYM file path to exist' do
@@ -52,25 +48,21 @@ describe Action do
52
48
 
53
49
  it 'uploads a single .dSYM file' do
54
50
  directory = File.join(FIXTURE_PATH, 'dSYMs')
55
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
56
- "--silent", "--project-root", Dir::pwd, directory).and_return(true)
51
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{directory}\"").and_return(true)
57
52
  run_with({dsym_path: File.join(FIXTURE_PATH, 'dSYMs/app.dSYM')})
58
53
  end
59
54
 
60
55
  it 'uploads a .zip of .dSYM files' do
61
56
  path = File.join(FIXTURE_PATH, 'files.zip')
62
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
63
- "--silent", "--project-root", Dir::pwd, path).and_return(true)
57
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{path}\"").and_return(true)
64
58
  run_with({dsym_path: path})
65
59
  end
66
60
 
67
61
  it 'uploads multiple .zip files' do
68
62
  zip1 = File.join(FIXTURE_PATH, 'files.zip')
69
63
  zip2 = File.join(FIXTURE_PATH, 'more_files.zip')
70
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
71
- "--silent", "--project-root", Dir::pwd, zip1).and_return(true)
72
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
73
- "--silent", "--project-root", Dir::pwd, zip2).and_return(true)
64
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{zip1}\"").and_return(true)
65
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{zip2}\"").and_return(true)
74
66
  run_with({dsym_path: [zip1, zip2]})
75
67
  end
76
68
 
@@ -80,10 +72,8 @@ describe Action do
80
72
  dsym3 = File.join(FIXTURE_PATH, 'dSYMs/app2.dSYM')
81
73
  dsym4 = File.join(FIXTURE_PATH, 'stuff/app2.dSYM')
82
74
  directories = [File.join(FIXTURE_PATH, 'dSYMs'), File.join(FIXTURE_PATH, 'stuff')]
83
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
84
- "--silent", "--project-root", Dir::pwd, directories[0]).and_return(true)
85
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
86
- "--silent", "--project-root", Dir::pwd, directories[1]).and_return(true)
75
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{directories[0]}\"").and_return(true)
76
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{directories[1]}\"").and_return(true)
87
77
  run_with({dsym_path: [dsym1, dsym2, dsym3, dsym4]})
88
78
  end
89
79
 
@@ -91,48 +81,32 @@ describe Action do
91
81
  dsym1 = File.join(FIXTURE_PATH, 'dSYMs/app.dSYM')
92
82
  dsym2 = File.join(FIXTURE_PATH, 'dSYMs/app2.dSYM')
93
83
  directory = File.join(FIXTURE_PATH, 'dSYMs')
94
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
95
- "--silent", "--project-root", Dir::pwd, directory).and_return(true)
84
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{directory}\"").and_return(true)
96
85
  run_with({dsym_path: [dsym1, dsym2]})
97
86
  end
98
87
 
99
88
  it 'accepts a project root argument' do
100
89
  root_path = "/test/test/test"
101
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
102
- "--silent",
103
- "--project-root", root_path,
104
- FIXTURE_PATH).and_return(true)
90
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --project-root #{root_path} \"#{FIXTURE_PATH}\"").and_return(true)
105
91
  run_with({dsym_path: FIXTURE_PATH, project_root: root_path})
106
92
  end
107
93
 
108
94
  it 'accepts an API key argument' do
109
95
  api_key = "123456789123456789001234567890FF"
110
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
111
- "--silent",
112
- "--api-key", api_key,
113
- "--project-root", Dir::pwd,
114
- FIXTURE_PATH).and_return(true)
96
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --api-key #{api_key} --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
115
97
  run_with({dsym_path: FIXTURE_PATH, api_key: api_key})
116
98
  end
117
99
 
118
100
  it 'accepts an API key argument with no project root' do
119
101
  api_key = "123456789012345678901234567890FF"
120
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
121
- "--silent",
122
- "--api-key", api_key,
123
- "--project-root", `pwd`.chomp,
124
- FIXTURE_PATH).and_return(true)
102
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --api-key #{api_key} --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
125
103
  run_with({dsym_path: FIXTURE_PATH, api_key: api_key, project_root: nil})
126
104
  end
127
105
 
128
106
  it 'uses default API key argument from plist' do
129
107
  root_path = "/test/test/test"
130
108
  api_key = "12345678901234567890123456789AAA" # Uses the API Key from ./spec/fixtures/ios_proj/FirstRealFolder/Info.plist
131
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
132
- "--silent",
133
- "--api-key", api_key,
134
- "--project-root", root_path,
135
- FIXTURE_PATH).and_return(true)
109
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --api-key #{api_key} --project-root #{root_path} --plist ./FirstRealFolder/Info.plist \"#{FIXTURE_PATH}\"").and_return(true)
136
110
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
137
111
  run_with({dsym_path: FIXTURE_PATH, project_root: root_path})
138
112
  end
@@ -141,11 +115,7 @@ describe Action do
141
115
  it 'uses legacy API key argument from plist' do
142
116
  root_path = "/test/test/test"
143
117
  api_key = "12345678901234567890123456789BBB" # Uses the API Key from ./spec/fixtures/ios_proj_legacy/Project/Info.plist
144
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
145
- "--silent",
146
- "--api-key", api_key,
147
- "--project-root", root_path,
148
- FIXTURE_PATH).and_return(true)
118
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --api-key #{api_key} --project-root #{root_path} --plist ./Project/Info.plist \"#{FIXTURE_PATH}\"").and_return(true)
149
119
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj_legacy')) do
150
120
  run_with({dsym_path: FIXTURE_PATH, project_root: root_path})
151
121
  end
@@ -155,11 +125,7 @@ describe Action do
155
125
  # The order of precedence is 1. option input, 2. env variable, 3. default or config file input (for api key only)
156
126
  # The API key in ./spec/fixtures/ios_proj_legacy/Project/Info.plist is 12345678912345678900123456789AAA.
157
127
  api_key = "12345678912345678900123456789CCC"
158
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
159
- "--silent",
160
- "--api-key", api_key,
161
- "--project-root", File.join(FIXTURE_PATH, 'ios_proj'),
162
- FIXTURE_PATH).and_return(true)
128
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --api-key #{api_key} --project-root #{File.join(FIXTURE_PATH, 'ios_proj')} --plist Project/Info.plist \"#{FIXTURE_PATH}\"").and_return(true)
163
129
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
164
130
  run_with({dsym_path: FIXTURE_PATH, api_key: api_key, config_file: File.join('Project', 'Info.plist')})
165
131
  end
@@ -176,25 +142,47 @@ describe Action do
176
142
 
177
143
  context 'using a private server' do
178
144
  it 'uploads to the private server' do
179
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
180
- "--silent",
181
- "--upload-server", "http://myserver.example.com",
182
- "--project-root", Dir::pwd,
183
- FIXTURE_PATH).and_return(true)
145
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} upload dsym --upload-api-root-url http://myserver.example.com --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
184
146
  run_with({dsym_path: FIXTURE_PATH, upload_url: "http://myserver.example.com"})
185
147
  end
186
148
  end
187
149
 
188
- context 'using bitcode' do
189
- it 'combines dSYM files with symbols' do
190
- path = File.join(FIXTURE_PATH, 'BCSymbolMaps')
191
- expect(Kernel).to receive(:system).with(Action::UPLOAD_SCRIPT_PATH,
192
- "--silent",
193
- "--symbol-maps", path,
194
- "--project-root", Dir::pwd,
195
- FIXTURE_PATH).and_return(true)
196
- run_with({dsym_path: FIXTURE_PATH, symbol_maps_path: path})
197
- end
150
+ it 'accepts a custom bugsnag_cli_path as an option' do
151
+ custom_cli_path = File.join(ENV['HOME'], ".local/bugsnag/bin/bugsnag-cli")
152
+ expect(Kernel).to receive(:system).with("#{custom_cli_path} upload dsym --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
153
+ run_with({dsym_path: FIXTURE_PATH, bugsnag_cli_path: custom_cli_path})
154
+ end
155
+
156
+ it 'accepts a custom bugsnag_cli_path with an API key' do
157
+ custom_cli_path = File.join(ENV['HOME'], ".local/bugsnag/bin/bugsnag-cli")
158
+ api_key = "123456789012345678901234567890FF"
159
+ expect(Kernel).to receive(:system).with("#{custom_cli_path} upload dsym --api-key #{api_key} --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
160
+ run_with({dsym_path: FIXTURE_PATH, api_key: api_key, bugsnag_cli_path: custom_cli_path})
161
+ end
162
+
163
+ it 'logs a warning when using an outdated CLI version' do
164
+ cli_path = File.join(FIXTURE_PATH, 'dummy_bugsnag_cli.sh')
165
+ bundled_bugsnag_cli_version = `#{BUGSNAG_CLI_PATH} --version`.strip
166
+ allow(Fastlane::Actions::UploadSymbolsToBugsnagAction).to receive(:version_from_cli).and_return("1.0.0")
167
+ allow(Fastlane::Actions::UploadSymbolsToBugsnagAction).to receive(:bundled_bugsnag_cli_version).and_return(bundled_bugsnag_cli_version)
168
+
169
+ expect(Fastlane::UI).to receive(:warning).with("The installed bugsnag-cli at #{cli_path} is outdated (1.0.0). The current bundled version is: #{bundled_bugsnag_cli_version}. It is recommended that you either update your installed version or use the bundled version.")
170
+ expect(Kernel).to receive(:system).with("#{cli_path} upload dsym --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
171
+
172
+ run_with({dsym_path: FIXTURE_PATH, bugsnag_cli_path: cli_path})
173
+ end
174
+
175
+ it 'logs doesnt log a warning when using an newer CLI version' do
176
+ cli_version = "9.9.9"
177
+ cli_path = File.join(FIXTURE_PATH, 'dummy_bugsnag_cli.sh')
178
+ bundled_bugsnag_cli_version = `#{BUGSNAG_CLI_PATH} --version`.strip
179
+ allow(Fastlane::Actions::UploadSymbolsToBugsnagAction).to receive(:version_from_cli).and_return(cli_version)
180
+ allow(Fastlane::Actions::UploadSymbolsToBugsnagAction).to receive(:bundled_bugsnag_cli_version).and_return(bundled_bugsnag_cli_version)
181
+
182
+ expect(Fastlane::UI).not_to receive(:warning)
183
+
184
+ ENV['BUGSNAG_CLI_VERSION'] = cli_version
185
+ run_with({dsym_path: FIXTURE_PATH, bugsnag_cli_path: cli_path})
198
186
  end
199
187
  end
200
188
  end
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+
3
+ VERSION="1.0.0"
4
+
5
+ if [[ -n "$BUGSNAG_CLI_VERSION" ]]; then
6
+ VERSION="$BUGSNAG_CLI_VERSION"
7
+ fi
8
+
9
+ if [[ "$1" == "--version" ]]; then
10
+ echo "Version: $VERSION"
11
+ else
12
+ echo "Usage: $0 [VERSION=x.y.z] --version"
13
+ fi
@@ -1,8 +1,13 @@
1
1
  require 'spec_helper'
2
2
  require 'json'
3
3
  require 'fastlane/actions/get_info_plist_value'
4
+ require_relative '../lib/fastlane/plugin/bugsnag/actions/bugsnag_cli'
5
+
4
6
 
5
7
  BuildAction = Fastlane::Actions::SendBuildToBugsnagAction
8
+ GIT_REVISION = `git rev-parse HEAD`.strip
9
+ BUILDER = `whoami`.strip
10
+ GIT_REPO_URL = `git config --get remote.origin.url`.strip
6
11
 
7
12
  describe BuildAction do
8
13
  def run_with args
@@ -11,13 +16,7 @@ describe BuildAction do
11
16
 
12
17
  context 'building an iOS project' do
13
18
  it 'detects default Info.plist file excluding test dirs' do
14
- expect(BuildAction).to receive(:send_notification) do |url, body|
15
- payload = ::JSON.load(body)
16
- expect(payload['appVersion']).to eq '2.0-other'
17
- expect(payload['appBundleVersion']).to eq '22'
18
- expect(payload['apiKey']).to eq '12345678901234567890123456789AAA'
19
- end
20
-
19
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789AAA --version-name 2.0-other --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL}").and_return(true)
21
20
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
22
21
  run_with({})
23
22
  end
@@ -26,13 +25,7 @@ describe BuildAction do
26
25
  it 'reads api key from legacy location' do
27
26
  # the API key is now in `bugsnag.apiKey`, it used to be in 'BugsnagAPIKey',
28
27
  # test this can be extracted correctly from the `ios_proj_legacy`
29
- expect(BuildAction).to receive(:send_notification) do |url, body|
30
- payload = ::JSON.load(body)
31
- expect(payload['appVersion']).to eq '4.0-project'
32
- expect(payload['appBundleVersion']).to eq '44'
33
- expect(payload['apiKey']).to eq '12345678901234567890123456789BBB'
34
- end
35
-
28
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789BBB --version-name 4.0-project --bundle-version 44 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL}").and_return(true)
36
29
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj_legacy')) do
37
30
  run_with({})
38
31
  end
@@ -41,11 +34,7 @@ describe BuildAction do
41
34
  context 'using default config_file option' do
42
35
  context 'override API key from config' do
43
36
  it 'reads API key from the api_key option' do
44
- expect(BuildAction).to receive(:send_notification) do |url, body|
45
- payload = ::JSON.load(body)
46
- expect(payload['apiKey']).to eq '12345678901234567890123456789FFF'
47
- end
48
-
37
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789FFF --version-name 2.0-other --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL}").and_return(true)
49
38
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
50
39
  run_with({
51
40
  api_key: '12345678901234567890123456789FFF'
@@ -54,12 +43,7 @@ describe BuildAction do
54
43
  end
55
44
 
56
45
  it 'uses input versions from options' do
57
- expect(BuildAction).to receive(:send_notification) do |url, body|
58
- payload = ::JSON.load(body)
59
- expect(payload['appVersion']).to eq '8.0.0'
60
- expect(payload['appBundleVersion']).to eq '800'
61
- end
62
-
46
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789AAA --version-name 8.0.0 --bundle-version 800 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL}").and_return(true)
63
47
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
64
48
  run_with({
65
49
  app_version: '8.0.0',
@@ -72,13 +56,7 @@ describe BuildAction do
72
56
 
73
57
  context 'override config_file option' do
74
58
  it 'reads API key and version info from the config file' do
75
- expect(BuildAction).to receive(:send_notification) do |url, body|
76
- payload = ::JSON.load(body)
77
- expect(payload['appVersion']).to eq '3.0-project'
78
- expect(payload['appBundleVersion']).to eq '33'
79
- expect(payload['apiKey']).to eq '12345678901234567890123456789DDD'
80
- end
81
-
59
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 3.0-project --bundle-version 33 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL}").and_return(true)
82
60
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
83
61
  run_with({
84
62
  config_file: File.join('Project', 'Info.plist')
@@ -88,13 +66,7 @@ describe BuildAction do
88
66
 
89
67
  context 'override API key, and config file' do
90
68
  it 'uses the input api_key to override a non default config' do
91
- expect(BuildAction).to receive(:send_notification) do |url, body|
92
- payload = ::JSON.load(body)
93
- expect(payload['appVersion']).to eq '3.0-project'
94
- expect(payload['appBundleVersion']).to eq '33'
95
- expect(payload['apiKey']).to eq '12345678901234567890123456789EEE'
96
- end
97
-
69
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789EEE --version-name 3.0-project --bundle-version 33 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL}").and_return(true)
98
70
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
99
71
  run_with({
100
72
  config_file: File.join('Project', 'Info.plist'),
@@ -104,13 +76,7 @@ describe BuildAction do
104
76
  end
105
77
 
106
78
  it 'uses the input versions to override a non default config' do
107
- expect(BuildAction).to receive(:send_notification) do |url, body|
108
- payload = ::JSON.load(body)
109
- expect(payload['appVersion']).to eq '9.0.0'
110
- expect(payload['appBundleVersion']).to eq '900'
111
- expect(payload['apiKey']).to eq '12345678901234567890123456789DDD'
112
- end
113
-
79
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 9.0.0 --bundle-version 900 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL}").and_return(true)
114
80
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
115
81
  run_with({
116
82
  config_file: File.join('Project', 'Info.plist'),
@@ -122,15 +88,9 @@ describe BuildAction do
122
88
  end
123
89
  end
124
90
 
125
- context 'metadata added to payload' do
91
+ context 'metadata added to args' do
126
92
  it "single key:value pair added" do
127
- expect(BuildAction).to receive(:send_notification) do |url, body|
128
- payload = ::JSON.load(body)
129
- expect(payload['appVersion']).to eq '4.0-project'
130
- expect(payload['apiKey']).to eq '12345678901234567890123456789DDD'
131
- expect(payload['metadata']).to eq '"test1": "First test"'
132
- end
133
-
93
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL} --metadata \"test1\": \"First test\"").and_return(true)
134
94
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
135
95
  run_with({
136
96
  app_version: '4.0-project',
@@ -139,21 +99,29 @@ describe BuildAction do
139
99
  })
140
100
  end
141
101
  end
142
-
102
+
143
103
  it "multiple key:value pairs added" do
144
- expect(BuildAction).to receive(:send_notification) do |url, body|
145
- payload = ::JSON.load(body)
146
- expect(payload['appVersion']).to eq '4.0-project'
147
- expect(payload['apiKey']).to eq '12345678901234567890123456789DDD'
148
- expect(payload['metadata']).to eq '"test1": "First test", "test2": "Second test", "test3": "Third test"'
104
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL} --metadata \"test1\": \"First test\", \"test2\": \"Second test\", \"test3\": \"Third test\"").and_return(true)
105
+ Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
106
+ run_with({
107
+ app_version: '4.0-project',
108
+ api_key: '12345678901234567890123456789DDD',
109
+ metadata: '"test1": "First test", "test2": "Second test", "test3": "Third test"'
110
+ })
149
111
  end
112
+ end
150
113
 
114
+ it "multiple key:value pairs added as a hash" do
115
+ expect(Kernel).to receive(:system).with("#{BUGSNAG_CLI_PATH} create-build --api-key 12345678901234567890123456789DDD --version-name 4.0-project --bundle-version 22 --builder-name #{BUILDER} --revision #{GIT_REVISION} --repository #{GIT_REPO_URL} --metadata \"custom_field_1\"=\"value1\",\"custom_field_2\"=\"value2\"").and_return(true)
151
116
  Dir.chdir(File.join(FIXTURE_PATH, 'ios_proj')) do
152
117
  run_with({
153
- app_version: '4.0-project',
154
- api_key: '12345678901234567890123456789DDD',
155
- metadata: '"test1": "First test", "test2": "Second test", "test3": "Third test"'
156
- })
118
+ app_version: '4.0-project',
119
+ api_key: '12345678901234567890123456789DDD',
120
+ metadata: {
121
+ "custom_field_1": "value1",
122
+ "custom_field_2": "value2"
123
+ }
124
+ })
157
125
  end
158
126
  end
159
127
  end
data/spec/spec_helper.rb CHANGED
@@ -8,3 +8,11 @@ require 'fastlane' # to import the Action super class
8
8
  require 'fastlane/plugin/bugsnag' # import the actual plugin
9
9
 
10
10
  FIXTURE_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
11
+ BUGSNAG_CLI_PATH = BugsnagCli.get_bundled_path
12
+
13
+ # expands the `got` and `expected` output in the RSpec output
14
+ RSpec.configure do |config|
15
+ config.expect_with :rspec do |expectations|
16
+ expectations.max_formatted_output_length = nil # unlimited
17
+ end
18
+ end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delisa Mason
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: xml-simple
13
+ name: git
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
@@ -25,7 +24,7 @@ dependencies:
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
26
  - !ruby/object:Gem::Dependency
28
- name: git
27
+ name: abbrev
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
@@ -136,15 +135,21 @@ dependencies:
136
135
  - - ">="
137
136
  - !ruby/object:Gem::Version
138
137
  version: 2.28.5
139
- description:
140
138
  email: iskanamagus@gmail.com
141
139
  executables: []
142
140
  extensions: []
143
141
  extra_rdoc_files: []
144
142
  files:
145
143
  - LICENSE.txt
146
- - bugsnag-dsym-upload
144
+ - bin/arm64-linux-bugsnag-cli
145
+ - bin/arm64-macos-bugsnag-cli
146
+ - bin/i386-linux-bugsnag-cli
147
+ - bin/i386-windows-bugsnag-cli.exe
148
+ - bin/x86_64-linux-bugsnag-cli
149
+ - bin/x86_64-macos-bugsnag-cli
150
+ - bin/x86_64-windows-bugsnag-cli.exe
147
151
  - lib/fastlane/plugin/bugsnag.rb
152
+ - lib/fastlane/plugin/bugsnag/actions/bugsnag_cli.rb
148
153
  - lib/fastlane/plugin/bugsnag/actions/find_info_plist_path.rb
149
154
  - lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb
150
155
  - lib/fastlane/plugin/bugsnag/actions/upload_symbols_to_bugsnag.rb
@@ -153,6 +158,7 @@ files:
153
158
  - spec/fixtures/BCSymbolMaps/real.bcsymbolmap
154
159
  - spec/fixtures/dSYMs/app.dSYM/Contents/Resources/DWARF/app
155
160
  - spec/fixtures/dSYMs/app2.dSYM/Contents/Resources/DWARF/app2
161
+ - spec/fixtures/dummy_bugsnag_cli.sh
156
162
  - spec/fixtures/files.zip
157
163
  - spec/fixtures/invalid_file
158
164
  - spec/fixtures/ios_proj/FirstRealFolder/Info.plist
@@ -164,11 +170,10 @@ files:
164
170
  - spec/fixtures/stuff/app2.dSYM/Contents/Resources/DWARF/app2
165
171
  - spec/send_build_to_bugsnag_spec.rb
166
172
  - spec/spec_helper.rb
167
- homepage: https://github.com/bugsnag/bugsnag-dsym-upload
173
+ homepage: https://github.com/bugsnag/fastlane-plugin-bugsnag
168
174
  licenses:
169
175
  - MIT
170
176
  metadata: {}
171
- post_install_message:
172
177
  rdoc_options: []
173
178
  require_paths:
174
179
  - lib
@@ -183,23 +188,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
188
  - !ruby/object:Gem::Version
184
189
  version: '0'
185
190
  requirements: []
186
- rubygems_version: 3.4.18
187
- signing_key:
191
+ rubygems_version: 3.6.9
188
192
  specification_version: 4
189
193
  summary: Uploads dSYM files to Bugsnag
190
194
  test_files:
191
- - spec/spec_helper.rb
192
195
  - spec/bugsnag_upload_dsym_action_spec.rb
193
- - spec/send_build_to_bugsnag_spec.rb
194
- - spec/fixtures/ios_proj_legacy/Project/Info.plist
195
- - spec/fixtures/more_files.zip
196
196
  - spec/fixtures/BCSymbolMaps/real.bcsymbolmap
197
+ - spec/fixtures/dSYMs/app.dSYM/Contents/Resources/DWARF/app
198
+ - spec/fixtures/dSYMs/app2.dSYM/Contents/Resources/DWARF/app2
199
+ - spec/fixtures/dummy_bugsnag_cli.sh
200
+ - spec/fixtures/files.zip
201
+ - spec/fixtures/invalid_file
197
202
  - spec/fixtures/ios_proj/FirstRealFolder/Info.plist
198
- - spec/fixtures/ios_proj/aaTests/Info.plist
199
203
  - spec/fixtures/ios_proj/Project/Info.plist
200
- - spec/fixtures/stuff/app2.dSYM/Contents/Resources/DWARF/app2
204
+ - spec/fixtures/ios_proj/aaTests/Info.plist
205
+ - spec/fixtures/ios_proj_legacy/Project/Info.plist
206
+ - spec/fixtures/more_files.zip
201
207
  - spec/fixtures/stuff/app.dSYM/Contents/Resources/DWARF/app
202
- - spec/fixtures/invalid_file
203
- - spec/fixtures/files.zip
204
- - spec/fixtures/dSYMs/app2.dSYM/Contents/Resources/DWARF/app2
205
- - spec/fixtures/dSYMs/app.dSYM/Contents/Resources/DWARF/app
208
+ - spec/fixtures/stuff/app2.dSYM/Contents/Resources/DWARF/app2
209
+ - spec/send_build_to_bugsnag_spec.rb
210
+ - spec/spec_helper.rb