fastlane-plugin-emerge 0.6.2 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e1447dca3b388a05160397929cd49bd402f82c97cce36e3118b5fc8a91dc0b8
4
- data.tar.gz: 94f2deab73ca67cb4520c7b2958a003106b07b16c32abd614613c0f0d1b6c13c
3
+ metadata.gz: d4d089c7870b5c71f07b01d99df92996471d9050ab6fd4b0f6c3290648dcd404
4
+ data.tar.gz: a98f1c7796d0e21d0a2d7dcbadc20e11d3e2de626e1441da4947610e8433d468
5
5
  SHA512:
6
- metadata.gz: e747d8c426f8d873e7a89dc30dce0c03e24a8dbf9e697aab6f7a3b66d0de7aeef0308518a67427e0a91ac7a8d7192385e7404449607bcbf7d77d9b58f76d5260
7
- data.tar.gz: dd5874a90ad2edfdf97a99eda6736ad9e442a75fdc9e204c7ef2e116db68801175dbe32d7bf98c00f8e401b1381012131ee2133bd3775c1703551843ef77eed4
6
+ metadata.gz: 7afe4c7adc02c46fa4193dbed344afc716877d26ca00849f6dce44bdd73e7da8458221aa875e9b9290aeec36c2e08fa2036e71d08581af4de74cb848779fdffe
7
+ data.tar.gz: 3fb17574090d31c7088b5afb3e0f9161e627ba777de779887b7d34ee45ea6094d3439bde09851087035d3c2face7be1caf173fb5228e5b81496f412b80d27aa0
@@ -13,7 +13,7 @@ module Fastlane
13
13
  api_token = params[:api_token]
14
14
  file_path = params[:file_path] || lane_context[SharedValues::XCODEBUILD_ARCHIVE]
15
15
 
16
- if file_path == nil
16
+ if file_path.nil?
17
17
  file_path = Dir.glob("#{lane_context[SharedValues::SCAN_DERIVED_DATA_PATH]}/Build/Products/Debug-iphonesimulator/*.app").first
18
18
  end
19
19
  pr_number = params[:pr_number]
@@ -22,11 +22,11 @@ module Fastlane
22
22
  base_sha = params[:base_sha] || params[:base_build_id]
23
23
  repo_name = params[:repo_name]
24
24
  gitlab_project_id = params[:gitlab_project_id]
25
- build_type = params[:build_type]
25
+ tag = params[:tag]
26
26
  order_file_version = params[:order_file_version]
27
27
  config_path = params[:config_path]
28
28
 
29
- if file_path == nil || !File.exist?(file_path)
29
+ if file_path.nil? || !File.exist?(file_path)
30
30
  UI.error("Invalid input file")
31
31
  return
32
32
  end
@@ -38,8 +38,8 @@ module Fastlane
38
38
  Dir.mktmpdir do |d|
39
39
  application_folder = "#{d}/archive.xcarchive/Products/Applications/"
40
40
  dsym_folder = "#{d}/archive.xcarchive/dSYMs/"
41
- FileUtils.mkdir_p application_folder
42
- FileUtils.mkdir_p dsym_folder
41
+ FileUtils.mkdir_p(application_folder)
42
+ FileUtils.mkdir_p(dsym_folder)
43
43
  if params[:linkmaps] && params[:linkmaps].length > 0
44
44
  linkmap_folder = "#{d}/archive.xcarchive/Linkmaps/"
45
45
  FileUtils.mkdir_p(linkmap_folder)
@@ -51,13 +51,14 @@ module Fastlane
51
51
  FileUtils.cp_r(file_path, application_folder)
52
52
  copy_dsyms("#{absolute_path.dirname}/*.dsym", dsym_folder)
53
53
  copy_dsyms("#{absolute_path.dirname}/*/*.dsym", dsym_folder)
54
- Xcodeproj::Plist.write_to_path({"NAME" => "Emerge Upload"}, "#{d}/archive.xcarchive/Info.plist")
54
+ Xcodeproj::Plist.write_to_path({ "NAME" => "Emerge Upload" }, "#{d}/archive.xcarchive/Info.plist")
55
55
  file_path = "#{absolute_path.dirname}/archive.xcarchive.zip"
56
56
  ZipAction.run(
57
57
  path: "#{d}/archive.xcarchive",
58
58
  output_path: file_path,
59
59
  exclude: [],
60
- include: [])
60
+ include: []
61
+ )
61
62
  UI.message("Archive generated at #{file_path}")
62
63
  end
63
64
  elsif File.extname(file_path) == '.xcarchive'
@@ -74,11 +75,12 @@ module Fastlane
74
75
  path: file_path,
75
76
  output_path: zip_path,
76
77
  exclude: [],
77
- include: [])
78
+ include: []
79
+ )
78
80
  file_path = zip_path
79
81
  elsif File.extname(file_path) == '.zip' && params[:linkmaps] && params[:linkmaps].length > 0
80
82
  UI.error("Provided zipped archive and linkmaps, linkmaps will not be added to zip.")
81
- elsif !File.extname(file_path) == '.zip'
83
+ elsif File.extname(file_path) != '.zip'
82
84
  UI.error("Invalid input file")
83
85
  return
84
86
  end
@@ -86,7 +88,7 @@ module Fastlane
86
88
  filename = File.basename(file_path)
87
89
  url = 'https://api.emergetools.com/upload'
88
90
  params = {
89
- filename: filename,
91
+ filename: filename
90
92
  }
91
93
  if pr_number
92
94
  params[:prNumber] = pr_number
@@ -109,24 +111,33 @@ module Fastlane
109
111
  if order_file_version
110
112
  params[:orderFileVersion] = order_file_version
111
113
  end
112
- params[:buildType] = build_type || "development"
114
+ params[:tag] = tag || "default"
113
115
  FastlaneCore::PrintTable.print_values(
114
116
  config: params,
115
117
  hide_keys: [],
116
- title: "Summary for Emerge #{Fastlane::Emerge::VERSION}")
117
- resp = Faraday.post(url, params.to_json, {'Content-Type' => 'application/json', 'X-API-Token' => api_token})
118
+ title: "Summary for Emerge #{Fastlane::Emerge::VERSION}"
119
+ )
120
+ resp = Faraday.post(
121
+ url,
122
+ params.to_json,
123
+ 'Content-Type' => 'application/json', 'X-API-Token' => api_token, 'User-Agent' => "fastlane-plugin-emerge/#{Fastlane::Emerge::VERSION}"
124
+ )
118
125
  case resp.status
119
126
  when 200
120
127
  json = JSON.parse(resp.body)
121
128
  upload_id = json["upload_id"]
122
129
  upload_url = json["uploadURL"]
123
- Helper::EmergeHelper.perform_upload(upload_url, upload_id, file_path)
130
+ warning = json["warning"]
131
+ if warning
132
+ UI.important(warning)
133
+ end
134
+ return Helper::EmergeHelper.perform_upload(upload_url, upload_id, file_path)
124
135
  when 403
125
136
  UI.error("Invalid API token")
126
137
  when 400
127
138
  UI.error("Invalid parameters")
128
139
  json = JSON.parse(resp.body)
129
- UI.error("Error: #{json["errorMessage"]}")
140
+ UI.error("Error: #{json['errorMessage']}")
130
141
  else
131
142
  UI.error("Upload failed")
132
143
  end
@@ -140,10 +151,10 @@ module Fastlane
140
151
  end
141
152
 
142
153
  def self.copy_config(config_path, tmp_dir)
143
- return unless config_path != nil
154
+ return if config_path.nil?
144
155
 
145
156
  expanded_path = File.expand_path(config_path)
146
- if not File.exist?(expanded_path)
157
+ unless File.exist?(expanded_path)
147
158
  UI.error("No config file found at path '#{expanded_path}'.\nUploading without config file")
148
159
  return
149
160
  end
@@ -172,65 +183,65 @@ module Fastlane
172
183
  def self.available_options
173
184
  [
174
185
  FastlaneCore::ConfigItem.new(key: :api_token,
175
- env_name: "EMERGE_API_TOKEN",
176
- description: "An API token for Emerge",
177
- optional: false,
178
- type: String),
186
+ env_name: "EMERGE_API_TOKEN",
187
+ description: "An API token for Emerge",
188
+ optional: false,
189
+ type: String),
179
190
  FastlaneCore::ConfigItem.new(key: :file_path,
180
- env_name: "EMERGE_FILE_PATH",
181
- description: "Path to the zipped xcarchive or app to upload",
182
- optional: true,
183
- type: String),
191
+ env_name: "EMERGE_FILE_PATH",
192
+ description: "Path to the zipped xcarchive or app to upload",
193
+ optional: true,
194
+ type: String),
184
195
  FastlaneCore::ConfigItem.new(key: :linkmaps,
185
- description: "List of paths to linkmaps",
186
- optional: true,
187
- type: Array),
196
+ description: "List of paths to linkmaps",
197
+ optional: true,
198
+ type: Array),
188
199
  FastlaneCore::ConfigItem.new(key: :pr_number,
189
- description: "The PR number that triggered this upload",
190
- optional: true,
191
- type: String),
200
+ description: "The PR number that triggered this upload",
201
+ optional: true,
202
+ type: String),
192
203
  FastlaneCore::ConfigItem.new(key: :branch,
193
- description: "The current git branch",
194
- optional: true,
195
- type: String),
204
+ description: "The current git branch",
205
+ optional: true,
206
+ type: String),
196
207
  FastlaneCore::ConfigItem.new(key: :sha,
197
- description: "The git SHA that triggered this build",
198
- optional: true,
199
- type: String),
208
+ description: "The git SHA that triggered this build",
209
+ optional: true,
210
+ type: String),
200
211
  FastlaneCore::ConfigItem.new(key: :base_sha,
201
- description: "The git SHA of the base build",
202
- optional: true,
203
- type: String),
212
+ description: "The git SHA of the base build",
213
+ optional: true,
214
+ type: String),
204
215
  FastlaneCore::ConfigItem.new(key: :build_id,
205
- description: "A string to identify this build",
206
- deprecated: "Replaced by `sha`",
207
- optional: true,
208
- type: String),
216
+ description: "A string to identify this build",
217
+ deprecated: "Replaced by `sha`",
218
+ optional: true,
219
+ type: String),
209
220
  FastlaneCore::ConfigItem.new(key: :base_build_id,
210
- description: "Id of the build to compare with this upload",
211
- deprecated: "Replaced by `base_sha`",
212
- optional: true,
213
- type: String),
221
+ description: "Id of the build to compare with this upload",
222
+ deprecated: "Replaced by `base_sha`",
223
+ optional: true,
224
+ type: String),
214
225
  FastlaneCore::ConfigItem.new(key: :repo_name,
215
- description: "Full name of the respository this upload was triggered from. For example: EmergeTools/Emerge",
216
- optional: true,
217
- type: String),
226
+ description: "Full name of the respository this upload was triggered from. For example: EmergeTools/Emerge",
227
+ optional: true,
228
+ type: String),
218
229
  FastlaneCore::ConfigItem.new(key: :gitlab_project_id,
219
- description: "Id of the gitlab project this upload was triggered from",
220
- optional: true,
221
- type: Integer),
222
- FastlaneCore::ConfigItem.new(key: :build_type,
223
- description: "String to identify the type of build such as release/development. Used to filter size graphs. Defaults to development",
224
- optional: true,
225
- type: String),
230
+ description: "Id of the gitlab project this upload was triggered from",
231
+ optional: true,
232
+ type: Integer),
233
+ FastlaneCore::ConfigItem.new(key: :tag,
234
+ description: "String to label the build. Useful for grouping builds together in our dashboard, like development, default, or pull-request",
235
+ optional: true,
236
+ type: String),
226
237
  FastlaneCore::ConfigItem.new(key: :order_file_version,
227
- description: "Version of the order file to download",
228
- optional: true,
229
- type: String),
238
+ description: "Version of the order file to download",
239
+ optional: true,
240
+ type: String),
230
241
  FastlaneCore::ConfigItem.new(key: :config_path,
231
- description: "Path to Emerge config path",
232
- optional: true,
233
- type: String),
242
+ description: "Path to Emerge config path",
243
+ optional: true,
244
+ type: String)
234
245
  ]
235
246
  end
236
247
 
@@ -12,23 +12,23 @@ module Fastlane
12
12
  project_id = params[:gitlab_project_id]
13
13
  pr_number = params[:pr_number]
14
14
  gitlab_access_token = params[:gitlab_access_token]
15
-
16
- requestParams = {
15
+
16
+ request_params = {
17
17
  buildId: params[:build_id],
18
18
  baseBuildId: params[:base_build_id]
19
19
  }
20
- resp = Faraday.get(url, requestParams, {'x-api-token' => api_token})
20
+ resp = Faraday.get(url, request_params, 'x-api-token' => api_token)
21
21
  case resp.status
22
22
  when 200
23
23
  UI.message("Received comment from Emerge")
24
24
  baseURL = gitlab_url ? gitlab_url : "https://gitlab.com"
25
25
  url = "#{baseURL}/api/v4/projects/#{project_id}/merge_requests/#{pr_number}/notes"
26
- gitlabResponse = Faraday.post(url, {"body" => resp.body}, {'Authorization' => "Bearer #{gitlab_access_token}"})
27
- case gitlabResponse.status
26
+ gitlab_response = Faraday.post(url, { "body" => resp.body }, 'Authorization' => "Bearer #{gitlab_access_token}")
27
+ case gitlab_response.status
28
28
  when 200...299
29
29
  UI.message("Successfully posted comment")
30
30
  else
31
- UI.error("Received error #{gitlabResponse.status} from Gitlab")
31
+ UI.error("Received error #{gitlab_response.status} from Gitlab")
32
32
  end
33
33
  else
34
34
  UI.error("Received error #{resp.status} from Emerge")
@@ -46,35 +46,35 @@ module Fastlane
46
46
  def self.available_options
47
47
  [
48
48
  FastlaneCore::ConfigItem.new(key: :api_token,
49
- env_name: "EMERGE_API_TOKEN",
50
- description: "An API token for Emerge",
51
- optional: false,
52
- type: String),
49
+ env_name: "EMERGE_API_TOKEN",
50
+ description: "An API token for Emerge",
51
+ optional: false,
52
+ type: String),
53
53
  FastlaneCore::ConfigItem.new(key: :gitlab_acces_token,
54
- env_name: "GITLAB_ACCESS_TOKEN",
55
- description: "An access token for Gitlab",
56
- optional: false,
57
- type: String),
54
+ env_name: "GITLAB_ACCESS_TOKEN",
55
+ description: "An access token for Gitlab",
56
+ optional: false,
57
+ type: String),
58
58
  FastlaneCore::ConfigItem.new(key: :pr_number,
59
- description: "The PR number that triggered this upload",
60
- optional: false,
61
- type: String),
59
+ description: "The PR number that triggered this upload",
60
+ optional: false,
61
+ type: String),
62
62
  FastlaneCore::ConfigItem.new(key: :build_id,
63
- description: "A string to identify this build",
64
- optional: false,
65
- type: String),
63
+ description: "A string to identify this build",
64
+ optional: false,
65
+ type: String),
66
66
  FastlaneCore::ConfigItem.new(key: :base_build_id,
67
- description: "Id of the build to compare with this upload",
68
- optional: false,
69
- type: String),
67
+ description: "Id of the build to compare with this upload",
68
+ optional: false,
69
+ type: String),
70
70
  FastlaneCore::ConfigItem.new(key: :gitlab_url,
71
- description: "URL of the self hosted gitlab instance",
72
- optional: true,
73
- type: String),
71
+ description: "URL of the self hosted gitlab instance",
72
+ optional: true,
73
+ type: String),
74
74
  FastlaneCore::ConfigItem.new(key: :gitlab_project_id,
75
- description: "Id of the gitlab project this upload was triggered from",
76
- optional: false,
77
- type: Integer)
75
+ description: "Id of the gitlab project this upload was triggered from",
76
+ optional: false,
77
+ type: Integer)
78
78
  ]
79
79
  end
80
80
 
@@ -83,4 +83,4 @@ module Fastlane
83
83
  end
84
84
  end
85
85
  end
86
- end
86
+ end
@@ -16,9 +16,11 @@ module Fastlane
16
16
  case response.status
17
17
  when 200
18
18
  UI.success("Your app is processing, you can find the results at https://emergetools.com/build/#{upload_id}")
19
+ return upload_id
19
20
  else
20
21
  UI.error("Upload failed")
21
22
  end
23
+ return nil
22
24
  end
23
25
  end
24
26
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Emerge
3
- VERSION = "0.6.2"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-emerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emerge Tools, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-30 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday