fastlane-plugin-codemagic 0.1.0 → 0.1.1

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: d9b819c659bcf16f152f9c90d0b71ddbac1e120202e72c78e67dcd3e9044ea6c
4
- data.tar.gz: d660c712ffb099c5e7fc84a2338e914836803b96ecd06c0f9f690344166d801c
3
+ metadata.gz: 41bf6b2f4a394b0416d71f1000001b97d1edb9a8516315edf1f2352b8adf00de
4
+ data.tar.gz: 45ab5013021f80a0a9e37a76a3243499911cb985a66d7c1694b5eedf6e9ad1bf
5
5
  SHA512:
6
- metadata.gz: 60d68646a122d16a90b7d059624f8fb3a6385c9d70108511ca11cc8039e0b2ae502272a11853117237614d6acf833f59c5ef9b6f9a5e505c15fd6c0ef2b3f442
7
- data.tar.gz: 94a4ef6e78c9df6286b24aff137c120472cc691d0d591ffb7ce82bac595269f814d85ba2200c211f8ef04516c2f09f925ce80c056741733d6aa1fd2e8b179234
6
+ metadata.gz: 612c5778ba9c3b3b5f8c68bc240c8ab8b9212a5290b73609c9eee4375442d488d0f324f605f6af7a9bdf1ee630c021394d03a990d19937afefcd3ed0410be3e4
7
+ data.tar.gz: '00856876a693bb53a9862c9d3c7b988715ba7d4318aa0d5c362cf604b6f6562a0bddd67d33331bf4b88de94cae5ff86de66936bbe5fc8c8ca168cbc8e18b95bc'
@@ -25,8 +25,7 @@ module Fastlane
25
25
  last_build_id = get_last_build_id(params[:auth_token], params[:app_id])
26
26
 
27
27
  build = check_building_status(params[:auth_token], last_build_id)
28
-
29
- if build_path != nil
28
+ unless build_path.nil?
30
29
  download_artefacts(download_artefacts, build, build_path)
31
30
  end
32
31
  end
@@ -77,7 +76,6 @@ module Fastlane
77
76
  hide_keys: [],
78
77
  title: "Codemagic API response")
79
78
  end
80
-
81
79
  end
82
80
 
83
81
  def self.get_last_build_id(auth_token, app_id)
@@ -103,32 +101,33 @@ module Fastlane
103
101
  hide_keys: [],
104
102
  title: "Codemagic API response")
105
103
  end
106
-
107
104
  end
108
105
 
109
106
  def self.check_building_status(auth_token, build_id)
110
- while true do
107
+ prev_build_status = ''
108
+ loop do
111
109
  build = get_build(auth_token, build_id)
112
110
  build_status = build["status"]
113
111
 
114
112
  case build_status
115
113
  when "failed"
116
114
  UI.abort_with_message!(build["message"])
117
- when "success"
118
- when "finished"
115
+ when "success", "finished"
119
116
  UI.success("Success")
117
+ return build
120
118
  else
121
- UI.message(build_status)
122
- sleep 10
119
+ if prev_build_status != build_status
120
+ UI.message("Status: #{build_status}")
121
+ end
122
+ prev_build_status = build_status
123
+ sleep(10)
123
124
  next
124
125
  end
125
- build
126
126
  break
127
127
  end
128
128
  end
129
129
 
130
130
  def self.get_build(auth_token, build_id)
131
- UI.message("Requesting codemagic.io API...")
132
131
  uri = URI.parse("https://api.codemagic.io/builds/#{build_id}")
133
132
  https = Net::HTTP.new(uri.host, uri.port)
134
133
  https.use_ssl = true
@@ -142,11 +141,6 @@ module Fastlane
142
141
  json_response = JSON.parse(response.body)
143
142
 
144
143
  if response.code == "200"
145
-
146
- UI.success("Build triggered successfully on Codemagic.io 🚀")
147
- FastlaneCore::PrintTable.print_values(config: json_response["build"],
148
- hide_keys: [],
149
- title: "Build")
150
144
  json_response["build"]
151
145
  else
152
146
  UI.user_error!("Couln't trigger the build on Codemagic.io.")
@@ -158,27 +152,22 @@ module Fastlane
158
152
 
159
153
  def self.download_artefacts(download_artefacts, build, build_path)
160
154
  UI.message("Download artefacts codemagic.io API...")
161
- artefacts = build["artefacts"]
162
155
 
163
- Dir.chdir("#{Dir.pwd}/fastlane")
156
+ artefacts = build["artefacts"]
164
157
 
165
- real_build_dir = File.expand_path("#{build_path}")
158
+ real_build_dir = File.expand_path(build_path)
166
159
 
167
160
  if Dir.exist?(real_build_dir)
168
161
 
169
162
  artefacts.map do |artefact|
163
+ next unless download_artefacts.include?(artefact["type"]) || download_artefacts == 'all'
170
164
 
171
- if download_artefacts.include?(artefact["type"])
165
+ UI.message("Download #{artefact['type']} [#{artefact['size']}]: #{artefact['url']}")
172
166
 
173
- FastlaneCore::PrintTable.print_values(config: artefact,
174
- hide_keys: [])
175
-
176
- real_build_path = File.expand_path("#{build_path}#{artefact["name"]}")
177
-
178
- open(real_build_path, 'wb') do |file|
179
- file << open(artefact["url"]).read
180
- end
167
+ real_build_path = File.expand_path("#{build_path}#{artefact['name']}")
181
168
 
169
+ open(real_build_path, 'wb') do |file|
170
+ file << open(artefact["url"]).read
182
171
  end
183
172
  end
184
173
  else
@@ -205,55 +194,54 @@ module Fastlane
205
194
 
206
195
  def self.available_options
207
196
  [
208
- FastlaneCore::ConfigItem.new(key: :app_id,
209
- env_name: "CODEMAGIC_APP_ID",
210
- description: "Codemagic application identifier",
211
- optional: false,
212
- type: String,
213
- verify_block: proc do |value|
214
- UI.user_error!("No Codemagic application ID given, pass it using `app_id` parameter to the Codemagic plugin.") unless value && !value.empty?
215
- end),
216
-
217
- FastlaneCore::ConfigItem.new(key: :workflow_id,
218
- env_name: "CODEMAGIC_WORKFLOW_ID",
219
- description: "Codemagic workflow identifier as specified in YAML file",
220
- optional: false,
221
- type: String,
222
- verify_block: proc do |value|
223
- UI.user_error!("No Codemagic workflow ID given, pass it using `workflow_id` parameter to the Codemagic plugin.") unless value && !value.empty?
224
- end),
225
-
226
- FastlaneCore::ConfigItem.new(key: :auth_token,
227
- env_name: "CODEMAGIC_AUTH_TOKEN",
228
- description: "Codemagic Auth Token",
229
- optional: false,
230
- type: String,
231
- verify_block: proc do |value|
232
- UI.user_error!("No Codemagic auth token given, pass it using `auth_token` parameter to the Codemagic plugin.") unless value && !value.empty?
233
- end),
234
-
235
- FastlaneCore::ConfigItem.new(key: :branch,
236
- env_name: "CODEMAGIC_BRANCH",
237
- description: "Codemagic branch name",
238
- optional: false,
239
- type: String,
240
- verify_block: proc do |value|
241
- UI.user_error!("No Codemagic branch given, pass it using `branch` parameter to the Codemagic plugin.") unless value && !value.empty?
242
- end),
243
-
244
- FastlaneCore::ConfigItem.new(key: :download,
245
- description: "Download Codemagic artefacts",
246
- optional: true,
247
- type: Object),
248
-
249
- FastlaneCore::ConfigItem.new(key: :environment,
250
- description: "Codemagic Specify environment variables and software versions to override values defined in workflow settings",
251
- optional: true,
252
- type: Object)
197
+ FastlaneCore::ConfigItem.new(key: :app_id,
198
+ env_name: "CODEMAGIC_APP_ID",
199
+ description: "Codemagic application identifier",
200
+ optional: false,
201
+ type: String,
202
+ verify_block: proc do |value|
203
+ UI.user_error!("No Codemagic application ID given, pass it using `app_id` parameter to the Codemagic plugin.") unless value && !value.empty?
204
+ end),
205
+
206
+ FastlaneCore::ConfigItem.new(key: :workflow_id,
207
+ env_name: "CODEMAGIC_WORKFLOW_ID",
208
+ description: "Codemagic workflow identifier as specified in YAML file",
209
+ optional: false,
210
+ type: String,
211
+ verify_block: proc do |value|
212
+ UI.user_error!("No Codemagic workflow ID given, pass it using `workflow_id` parameter to the Codemagic plugin.") unless value && !value.empty?
213
+ end),
214
+
215
+ FastlaneCore::ConfigItem.new(key: :auth_token,
216
+ env_name: "CODEMAGIC_AUTH_TOKEN",
217
+ description: "Codemagic Auth Token",
218
+ optional: false,
219
+ type: String,
220
+ verify_block: proc do |value|
221
+ UI.user_error!("No Codemagic auth token given, pass it using `auth_token` parameter to the Codemagic plugin.") unless value && !value.empty?
222
+ end),
223
+
224
+ FastlaneCore::ConfigItem.new(key: :branch,
225
+ env_name: "CODEMAGIC_BRANCH",
226
+ description: "Codemagic branch name",
227
+ optional: false,
228
+ type: String,
229
+ verify_block: proc do |value|
230
+ UI.user_error!("No Codemagic branch given, pass it using `branch` parameter to the Codemagic plugin.") unless value && !value.empty?
231
+ end),
232
+
233
+ FastlaneCore::ConfigItem.new(key: :download,
234
+ description: "Download Codemagic artefacts",
235
+ optional: true,
236
+ type: Object),
237
+
238
+ FastlaneCore::ConfigItem.new(key: :environment,
239
+ description: "Codemagic Specify environment variables and software versions to override values defined in workflow settings",
240
+ optional: true,
241
+ type: Object)
253
242
  ]
254
243
  end
255
244
 
256
-
257
245
  def self.is_supported?(platform)
258
246
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
259
247
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Codemagic
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-codemagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Matsera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-17 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry