fastlane-plugin-polidea 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c08636fe218a99dbaf41712ad4748f3b32c53fcf
4
- data.tar.gz: 680e245635cf09c7f65b3f955170f11afac175b8
3
+ metadata.gz: ffdc81791469287fd4a7bc81cc21970d4ed2051b
4
+ data.tar.gz: cf2fceccb5f85159c1cdd2c717ed8f5cc0061379
5
5
  SHA512:
6
- metadata.gz: 74400d922eef81993300ea6bff2bb0cabada514ec58facd7b911500ff26cd88e4ba860ab7006058778d8effdeb7254a175a4915937fbf4449cbaaf120bc34111
7
- data.tar.gz: ed42408a0b81ff58a3a8f9f0c3dd3137b5983f4de439c79027019bbaef178c67abcae6f92a445115f7246a595ba65ac07a27c8f2f78983f727ddde58975d241c
6
+ metadata.gz: 7b41c73781e3583aaee9827f84c6b1d40ea3b952512f87bdb5e37f8e8a69a2e770450ceacfa04b53792e45ebc2b8ab2aad7290ee123cb07dfaedf54f85c214cd
7
+ data.tar.gz: 3f9684c12e1c1c5db099b08b4dcdbd9f0ae9807ece05e7b2b98ca42d9f7b0f9df62a96cff2bd88fd7d928960944195df4f98a960288ad264efb10a97d127ca84
@@ -52,6 +52,7 @@ module Fastlane
52
52
  params[:acl] = config[:acl]
53
53
  params[:installation_password] = config[:installation_password]
54
54
  params[:release_notes] = config[:release_notes]
55
+ params[:treat_bucket_as_domain_name] = config[:treat_bucket_as_domain_name]
55
56
 
56
57
  case platform
57
58
  when :ios
@@ -76,10 +77,13 @@ module Fastlane
76
77
  acl = params[:acl]
77
78
  installation_password = params[:installation_password]
78
79
  release_notes = params[:release_notes]
80
+ treat_bucket_as_domain_name = params[:treat_bucket_as_domain_name]
79
81
 
80
82
  validate(params)
81
83
  UI.user_error!("No IPA file path given, pass using `ipa: 'ipa path'`") unless ipa_file.to_s.length > 0
82
84
 
85
+ UI.message("Will transform S3 urls from https://s3.amazonaws.com/#{s3_bucket} to https://#{s3_bucket}") if treat_bucket_as_domain_name
86
+
83
87
  bucket = get_bucket(s3_access_key, s3_secret_access_key, s3_region, s3_bucket)
84
88
 
85
89
  # Gets info used for the plist
@@ -101,7 +105,7 @@ module Fastlane
101
105
  ipa_file_name = "#{url_part}#{ipa_file_basename}"
102
106
  ipa_file_data = File.open(ipa_file, 'rb')
103
107
 
104
- ipa_url = self.upload_file(bucket, ipa_file_name, ipa_file_data, acl)
108
+ ipa_url = self.upload_file(bucket, ipa_file_name, ipa_file_data, acl, treat_bucket_as_domain_name)
105
109
 
106
110
  # Setting action and environment variables
107
111
  Actions.lane_context[SharedValues::S3_IPA_OUTPUT_PATH] = ipa_url
@@ -112,7 +116,7 @@ module Fastlane
112
116
  dsym_file_name = "#{url_part}#{dsym_file_basename}"
113
117
  dsym_file_data = File.open(dsym_file, 'rb')
114
118
 
115
- dsym_url = self.upload_file(bucket, dsym_file_name, dsym_file_data, acl)
119
+ dsym_url = self.upload_file(bucket, dsym_file_name, dsym_file_data, acl, treat_bucket_as_domain_name)
116
120
 
117
121
  # Setting action and environment variables
118
122
  Actions.lane_context[SharedValues::S3_DSYM_OUTPUT_PATH] = dsym_url
@@ -157,7 +161,7 @@ module Fastlane
157
161
  })
158
162
 
159
163
  # Gets icon from ipa and uploads it
160
- icon_url = self.upload_icon(icon_file, url_part, bucket, acl)
164
+ icon_url = self.upload_icon(icon_file, url_part, bucket, acl, treat_bucket_as_domain_name)
161
165
 
162
166
  # Creates html from template
163
167
  html_render = PageGenerator.generate({
@@ -192,10 +196,10 @@ module Fastlane
192
196
  #
193
197
  #####################################
194
198
 
195
- plist_url = self.upload_file(bucket, plist_file_name, plist_render, acl)
196
- html_url = self.upload_file(bucket, html_file_name, html_render, acl)
199
+ plist_url = self.upload_file(bucket, plist_file_name, plist_render, acl, treat_bucket_as_domain_name)
200
+ html_url = self.upload_file(bucket, html_file_name, html_render, acl, treat_bucket_as_domain_name)
197
201
  self.upload_directory(bucket, html_resources_name, "#{__dir__}/../templates/installation-page", acl)
198
- version_url = self.upload_file(bucket, version_file_name, version_render, acl)
202
+ version_url = self.upload_file(bucket, version_file_name, version_render, acl, treat_bucket_as_domain_name)
199
203
 
200
204
  # Setting action and environment variables
201
205
  Actions.lane_context[SharedValues::S3_PLIST_OUTPUT_PATH] = plist_url
@@ -230,10 +234,13 @@ module Fastlane
230
234
  acl = params[:acl]
231
235
  installation_password = params[:installation_password]
232
236
  release_notes = params[:release_notes]
237
+ treat_bucket_as_domain_name = params[:treat_bucket_as_domain_name]
233
238
 
234
239
  validate(params)
235
240
  UI.user_error!("No APK file path given, pass using `apk: 'apk path'`") unless apk_file.to_s.length > 0
236
241
 
242
+ UI.message("Will transform S3 urls from https://s3.amazonaws.com/#{s3_bucket} to https://#{s3_bucket}") if treat_bucket_as_domain_name
243
+
237
244
  bucket = get_bucket(s3_access_key, s3_secret_access_key, s3_region, s3_bucket)
238
245
 
239
246
  # Gets info used from the apk manifest
@@ -250,7 +257,7 @@ module Fastlane
250
257
  apk_file_name = "#{url_part}#{apk_file_basename}"
251
258
  apk_file_data = File.open(apk_file, 'rb')
252
259
 
253
- apk_url = self.upload_file(bucket, apk_file_name, apk_file_data, acl)
260
+ apk_url = self.upload_file(bucket, apk_file_name, apk_file_data, acl, treat_bucket_as_domain_name)
254
261
 
255
262
  # Setting action and environment variables
256
263
  Actions.lane_context[SharedValues::S3_APK_OUTPUT_PATH] = apk_url
@@ -268,7 +275,7 @@ module Fastlane
268
275
  html_resources_name = "#{url_part}installation-page"
269
276
 
270
277
  # Gets icon from ipa and uploads it
271
- icon_url = self.upload_icon(icon_file, url_part, bucket, acl)
278
+ icon_url = self.upload_icon(icon_file, url_part, bucket, acl, treat_bucket_as_domain_name)
272
279
 
273
280
  # Creates html from template
274
281
  html_render = PageGenerator.generate({
@@ -282,7 +289,7 @@ module Fastlane
282
289
  release_notes: release_notes
283
290
  })
284
291
 
285
- html_url = self.upload_file(bucket, html_file_name, html_render, acl)
292
+ html_url = self.upload_file(bucket, html_file_name, html_render, acl, treat_bucket_as_domain_name)
286
293
  self.upload_directory(bucket, html_resources_name, "#{__dir__}/../templates/installation-page", acl)
287
294
 
288
295
  Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH] = html_url
@@ -335,8 +342,7 @@ module Fastlane
335
342
  s3_client
336
343
  end
337
344
 
338
- def self.upload_file(bucket, file_name, file_data, acl)
339
- puts file_name, content_type_for_file(file_name)
345
+ def self.upload_file(bucket, file_name, file_data, acl, treat_bucket_as_domain_name)
340
346
  obj = bucket.objects.create(file_name, file_data, acl: acl, content_type: content_type_for_file(file_name))
341
347
 
342
348
  # When you enable versioning on a S3 bucket,
@@ -347,8 +353,12 @@ module Fastlane
347
353
  obj = obj.object
348
354
  end
349
355
 
350
- # Return public url
351
- shorten_url(obj.public_url.to_s)
356
+ if treat_bucket_as_domain_name
357
+ # Return public url
358
+ shorten_url(obj.public_url.to_s)
359
+ else
360
+ obj.public_url.to_s
361
+ end
352
362
  end
353
363
 
354
364
  def self.upload_directory(bucket, directory_name, directory_path, acl)
@@ -420,12 +430,12 @@ module Fastlane
420
430
  return path
421
431
  end
422
432
 
423
- def self.upload_icon(icon_path, url_part, bucket, acl)
433
+ def self.upload_icon(icon_path, url_part, bucket, acl, treat_bucket_as_domain_name)
424
434
  return unless icon_path
425
435
  icon_file_basename = File.basename(icon_path)
426
436
  icon_file = File.open(icon_path)
427
437
  icon_file_name = "#{url_part}#{icon_file_basename}"
428
- self.upload_file(bucket, icon_file_name, icon_file, acl)
438
+ self.upload_file(bucket, icon_file_name, icon_file, acl, treat_bucket_as_domain_name)
429
439
  end
430
440
 
431
441
  def self.shorten_url(url)
@@ -520,7 +530,12 @@ module Fastlane
520
530
  description: "Release notes",
521
531
  type: Array,
522
532
  optional: true,
523
- default_value: Actions.lane_context[SharedValues::RELEASE_NOTES] ? Actions.lane_context[SharedValues::RELEASE_NOTES].split("\n") : nil)
533
+ default_value: Actions.lane_context[SharedValues::RELEASE_NOTES] ? Actions.lane_context[SharedValues::RELEASE_NOTES].split("\n") : nil),
534
+ FastlaneCore::ConfigItem.new(key: :treat_bucket_as_domain_name,
535
+ description: "If it's true, it transforms all urls from https://s3.amazonaws.com/BUCKET_NAME to https://BUCKET_NAME",
536
+ is_string: false,
537
+ optional: true,
538
+ default_value: true)
524
539
  ]
525
540
  end
526
541
 
@@ -222,7 +222,7 @@ module Fastlane
222
222
  when Net::HTTPSuccess then response
223
223
  when Net::HTTPRedirection then make_request(URI.parse(response['location']), request, limit - 1)
224
224
  else
225
- UI.user_error! JSON.parse(response.body)['message']
225
+ UI.user_error! "#{response.code} #{response.body}"
226
226
  end
227
227
  end
228
228
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Polidea
3
- VERSION = "0.6.3"
3
+ VERSION = "0.6.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-polidea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Dubiel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-27 00:00:00.000000000 Z
11
+ date: 2018-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist