fastlane-plugin-polidea 1.0.0 → 2.0.0

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: bbe77e5cb4d527ba8dc582f1b13e75f343f43f49
4
- data.tar.gz: 0e6b5f1e73dbbf8c298fe0496a49ff4d6c2724f2
3
+ metadata.gz: 41e7f4035f341c048798dcd64a9c242e810fb9d0
4
+ data.tar.gz: 792f4e2c40045802eaf8260320334ce74e7a192b
5
5
  SHA512:
6
- metadata.gz: 39fe93651ac41830ea83ad2dd589e231aeeefbbb1c4713be82e46a9be0df7ea626d357615c8a7fbc2fb7ba735c6720f5743afc0e26c1a5c77dec5aeb256d9ae6
7
- data.tar.gz: 697bab3b78376bed22391234934ae70436404140d7da0d2f6c31e1836953e1b2c1fd2771103721534bb8e27bee6590e62113c205032965444fad6fbbb4a8590d
6
+ metadata.gz: 52d41e8bc47d3ca0d6839322aabd1d2b9207437a34a253524e9f10aed4c4cb2a72bffe6e0fb928299f1c474900bbcdc36926beb7064051084e2d8d5f747e3fa4
7
+ data.tar.gz: 103a5e1de80952e759192a70d7a75df6815c2704a4bc73e7895c77340d2992eceea3f33a2d6fbe25587c2db5f1c345f33e8ff3a7ed76aefd9359dce1ed11f3b5
data/README.md CHANGED
@@ -21,7 +21,6 @@ Plugin contains following actions:
21
21
  - `get_binary_size`: Measures binary size in bytes
22
22
  - `s3`: Custom version of s3 action with Polidea's installation page
23
23
  - `fota_mail`: Custom version of mailgun action with Polidea's mail template
24
- - `polidea_store`: Notifies Polidea Store about new app version
25
24
 
26
25
  See more details [here](https://gitlab2.polidea.com/CI/fastlane-plugin-polidea/blob/master/docs/Actions.md).
27
26
  To list all available actions run:
@@ -39,7 +38,6 @@ lane :deploy do
39
38
  extract_version
40
39
  get_binary_size
41
40
  s3
42
- polidea_store
43
41
  fota_mail(
44
42
  to: "piotr.dubiel@polidea.com"
45
43
  )
@@ -321,20 +321,21 @@ module Fastlane
321
321
  end
322
322
 
323
323
  def self.get_bucket(s3_access_key, s3_secret_access_key, s3_region, s3_bucket)
324
- self.s3_client(s3_access_key, s3_secret_access_key, s3_region).buckets[s3_bucket]
324
+ self.s3_client(s3_access_key, s3_secret_access_key, s3_region).bucket(s3_bucket)
325
325
  end
326
326
 
327
327
  def self.s3_client(s3_access_key, s3_secret_access_key, s3_region)
328
- Actions.verify_gem!('aws-sdk')
329
- require 'aws-sdk'
328
+ Actions.verify_gem!('aws-sdk-s3')
329
+ require 'aws-sdk-s3'
330
+
330
331
  if s3_region
331
- s3_client = AWS::S3.new(
332
+ s3_client = Aws::S3::Resource.new(
332
333
  access_key_id: s3_access_key,
333
334
  secret_access_key: s3_secret_access_key,
334
335
  region: s3_region
335
336
  )
336
337
  else
337
- s3_client = AWS::S3.new(
338
+ s3_client = Aws::S3::Resource.new(
338
339
  access_key_id: s3_access_key,
339
340
  secret_access_key: s3_secret_access_key
340
341
  )
@@ -343,13 +344,18 @@ module Fastlane
343
344
  end
344
345
 
345
346
  def self.upload_file(bucket, file_name, file_data, acl, treat_bucket_as_domain_name)
346
- obj = bucket.objects.create(file_name, file_data, acl: acl, content_type: content_type_for_file(file_name))
347
+ obj = bucket.put_object({
348
+ key: file_name,
349
+ body: file_data,
350
+ acl: acl,
351
+ content_type: content_type_for_file(file_name)
352
+ })
347
353
 
348
354
  # When you enable versioning on a S3 bucket,
349
355
  # writing to an object will create an object version
350
356
  # instead of replacing the existing object.
351
357
  # http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/ObjectVersion.html
352
- if obj.kind_of? AWS::S3::ObjectVersion
358
+ if obj.kind_of? Aws::S3::ObjectVersion
353
359
  obj = obj.object
354
360
  end
355
361
 
@@ -367,8 +373,13 @@ module Fastlane
367
373
  files.each do |file|
368
374
  local_path = directory_path + file
369
375
  s3_path = directory_name + file
370
- obj = bucket.objects[s3_path]
371
- obj.write(file: local_path, content_type: content_type_for_file(local_path), acl: "public_read")
376
+
377
+ bucket.put_object({
378
+ key: s3_path,
379
+ body: File.open(local_path),
380
+ acl: acl,
381
+ content_type: content_type_for_file(local_path)
382
+ })
372
383
  end
373
384
  end
374
385
 
@@ -519,7 +530,7 @@ module Fastlane
519
530
  env_name: "S3_ACL",
520
531
  description: "Uploaded object permissions e.g public_read (default), private, public_read_write, authenticated_read ",
521
532
  optional: true,
522
- default_value: "public_read"),
533
+ default_value: "public-read"),
523
534
  FastlaneCore::ConfigItem.new(key: :installation_password,
524
535
  env_name: "INSTALLATION_PASSWORD",
525
536
  description: "Password for installation page",
@@ -8,10 +8,10 @@ module Fastlane
8
8
  @dark_color = dark_color
9
9
 
10
10
  @margin = 20
11
- @image = ::ChunkyPNG::Image.new(2 * @margin + @qr_code.module_count * 5, 2 * @margin + @qr_code.module_count * 5, ::ChunkyPNG::Color::WHITE)
11
+ @image = ::ChunkyPNG::Image.new(2 * @margin + @qr_code.qrcode.module_count * 5, 2 * @margin + @qr_code.qrcode.module_count * 5, ::ChunkyPNG::Color::WHITE)
12
12
 
13
13
  @logo = ::ChunkyPNG::Image.from_file("#{path_to_resources}/logo.png")
14
- @logo = @logo.resize(2 * @margin + @qr_code.module_count * 5, 2 * @margin + @qr_code.module_count * 5)
14
+ @logo = @logo.resize(2 * @margin + @qr_code.qrcode.module_count * 5, 2 * @margin + @qr_code.qrcode.module_count * 5)
15
15
  end
16
16
 
17
17
  def generate(path)
@@ -25,11 +25,11 @@ module Fastlane
25
25
  end
26
26
 
27
27
  @qr_code.modules.each_index do |row|
28
- @qr_code.modules.each_index do |column|
29
- if @qr_code.is_dark(row, column)
30
- print_symbol(dark_color, column, row, (column < 8 && row < 8) || (column < 8 && row >= @qr_code.module_count - 8) || (column >= @qr_code.module_count - 8 && row < 8))
28
+ @qr_code.modules[row].each_index do |column|
29
+ if @qr_code.modules[row][column]
30
+ print_symbol(dark_color, column, row, (column < 8 && row < 8) || (column < 8 && row >= @qr_code.qrcode.module_count - 8) || (column >= @qr_code.qrcode.module_count - 8 && row < 8))
31
31
  else
32
- print_symbol(white, column, row, (column < 8 && row < 8) || (column < 8 && row >= @qr_code.module_count - 8) || (column >= @qr_code.module_count - 8 && row < 8))
32
+ print_symbol(white, column, row, (column < 8 && row < 8) || (column < 8 && row >= @qr_code.qrcode.module_count - 8) || (column >= @qr_code.qrcode.module_count - 8 && row < 8))
33
33
  end
34
34
  end
35
35
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Polidea
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.0"
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: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Dubiel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-21 00:00:00.000000000 Z
11
+ date: 2019-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.1.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: aws-sdk
28
+ name: aws-sdk-s3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2'
33
+ version: '1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "<"
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2'
40
+ version: '1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: premailer
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 1.8.7
61
+ - !ruby/object:Gem::Dependency
62
+ name: nokogiri
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: rqrcode_png
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +156,20 @@ dependencies:
142
156
  - - ">="
143
157
  - !ruby/object:Gem::Version
144
158
  version: '0'
159
+ - !ruby/object:Gem::Dependency
160
+ name: rb-readline
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
145
173
  - !ruby/object:Gem::Dependency
146
174
  name: rubocop
147
175
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +230,6 @@ files:
202
230
  - lib/fastlane/plugin/polidea/actions/fota_s3.rb
203
231
  - lib/fastlane/plugin/polidea/actions/get_binary_size.rb
204
232
  - lib/fastlane/plugin/polidea/actions/import_provisioning.rb
205
- - lib/fastlane/plugin/polidea/actions/polidea_store.rb
206
233
  - lib/fastlane/plugin/polidea/actions/release_notes.rb
207
234
  - lib/fastlane/plugin/polidea/actions/shuttle.rb
208
235
  - lib/fastlane/plugin/polidea/helper/page_generator.rb
@@ -1,255 +0,0 @@
1
- # rubocop:disable Metrics/MethodLength
2
-
3
- require 'net/http'
4
- require 'uri'
5
- require 'json'
6
-
7
- module Fastlane
8
- module Actions
9
- class PolideaStoreAction < Action
10
- def self.run(params)
11
- platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
12
- validate(platform, params)
13
- config = get_config(platform, params)
14
- app_name, app_identifier, version = notify(platform, config)
15
-
16
- UI.success("Successfully uploaded #{app_name} (#{app_identifier})")
17
- UI.success("version: #{version}")
18
- UI.success("using icon from #{params[:icon_url]}") if params[:icon_url]
19
- UI.success("using plist from #{params[:plist_url]}") if platform == :ios
20
- UI.success("with release notes: #{params[:release_notes]}") if params[:release_notes]
21
- end
22
-
23
- #####################################################
24
- # @!group Documentation
25
- #####################################################
26
-
27
- def self.description
28
- "Polidea Store upload action"
29
- end
30
-
31
- def self.details
32
- "Notify Polidea Store about new app version"
33
- end
34
-
35
- def self.author
36
- ["Piotrek Dubiel"]
37
- end
38
-
39
- def self.available_options
40
- [
41
- FastlaneCore::ConfigItem.new(key: :api_token,
42
- env_name: "POLIDEA_STORE_API_TOKEN",
43
- description: "API Token for Polidea Store",
44
- verify_block: proc do |value|
45
- UI.user_error!("No API token for Polidea Store given, pass using `api_token: 'token'`") unless value and !value.empty?
46
- end),
47
- FastlaneCore::ConfigItem.new(key: :ipa,
48
- env_name: "",
49
- description: ".ipa file for the build ",
50
- optional: true,
51
- default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]),
52
- FastlaneCore::ConfigItem.new(key: :apk,
53
- env_name: "",
54
- description: ".apk file for the build ",
55
- optional: true,
56
- default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]),
57
- FastlaneCore::ConfigItem.new(key: :plist_url,
58
- env_name: "POLIDEA_STORE_PLIST_URL",
59
- description: "Url to uploaded plist",
60
- default_value: Actions.lane_context[SharedValues::S3_PLIST_OUTPUT_PATH],
61
- verify_block: proc do |value|
62
- UI.user_error!("No plist url given, pass using `plist_url: 'url'` or make sure s3 action succeded and exposed S3_PLIST_OUTPUT_PATH shared value") unless value and !value.empty?
63
- end),
64
- FastlaneCore::ConfigItem.new(key: :apk_url,
65
- env_name: "POLIDEA_STORE_APK_URL",
66
- description: "Url to uploaded apk",
67
- default_value: Actions.lane_context[SharedValues::S3_APK_OUTPUT_PATH],
68
- verify_block: proc do |value|
69
- UI.user_error!("No apk url given, pass using `apk_url: 'url'` or make sure s3 action succeded and exposed S3_APK_OUTPUT_PATH shared value") unless value and !value.empty?
70
- end),
71
- FastlaneCore::ConfigItem.new(key: :icon_url,
72
- env_name: "POLIDEA_STORE_ICON_URL",
73
- description: "Url to uploaded app icon",
74
- default_value: Actions.lane_context[SharedValues::S3_ICON_OUTPUT_PATH],
75
- optional: true),
76
- FastlaneCore::ConfigItem.new(key: :release_notes,
77
- env_name: "",
78
- description: "Release notes to be attached to uploaded version",
79
- is_string: true,
80
- optional: true,
81
- default_value: Actions.lane_context[SharedValues::RELEASE_NOTES]),
82
- FastlaneCore::ConfigItem.new(key: :app_name,
83
- env_name: "",
84
- description: "Application name (defaults to results of extract_app_name action)",
85
- is_string: true,
86
- optional: true),
87
- FastlaneCore::ConfigItem.new(key: :bundle_id,
88
- env_name: "",
89
- description: "Bundle id, used if platform equals :ios",
90
- is_string: true,
91
- optional: true),
92
- FastlaneCore::ConfigItem.new(key: :bundle_version,
93
- env_name: "",
94
- description: "Bundle version, used if platform equals :ios",
95
- is_string: true,
96
- optional: true),
97
- FastlaneCore::ConfigItem.new(key: :package_name,
98
- env_name: "",
99
- description: "Package name, used if platform equals :android",
100
- is_string: true,
101
- optional: true),
102
- FastlaneCore::ConfigItem.new(key: :version_name,
103
- env_name: "",
104
- description: "Version name, used if platform equals :android",
105
- is_string: true,
106
- optional: true),
107
- FastlaneCore::ConfigItem.new(key: :version_code,
108
- env_name: "",
109
- description: "Version code, used if platform equals :android",
110
- type: Integer,
111
- optional: true),
112
- FastlaneCore::ConfigItem.new(key: :binary_size,
113
- env_name: "",
114
- description: ".ipa/.apk binary size in bytes",
115
- type: Integer,
116
- optional: true)
117
- ]
118
- end
119
-
120
- def self.is_supported?(platform)
121
- [:ios, :android].include? platform
122
- end
123
-
124
- def self.category
125
- :deprecated
126
- end
127
-
128
- def self.validate(platform, params)
129
- binary_size = params[:binary_size] || Actions.lane_context[Actions::SharedValues::BINARY_SIZE]
130
- UI.user_error!("No binary size given, pass using `binary_size: bytes` or make sure get_binary_size action succeded and exposed BINARY_SIZE shared value") unless binary_size and !binary_size.nil?
131
-
132
- case platform
133
- when :android
134
- UI.user_error!("No .apk file given, pass using `apk: 'apk path'` or make sure gradle action succeded and exposed GRADLE_APK_OUTPUT_PATH shared value") unless params[:apk] and !params[:apk].empty?
135
- when :ios
136
- UI.user_error!("No .ipa file given, pass using `ipa: 'ipa path'` or make sure gym action succeded and exposed IPA_OUTPUT_PATH shared value") unless params[:ipa] and !params[:ipa].empty?
137
- end
138
- end
139
-
140
- def self.get_config(platform, params)
141
- binary_size = params[:binary_size] || Actions.lane_context[Actions::SharedValues::BINARY_SIZE]
142
- api_token = params[:api_token]
143
- icon_url = params[:icon_url]
144
- release_notes = params[:release_notes]
145
-
146
- case platform
147
- when :ios
148
- info = FastlaneCore::IpaFileAnalyser.fetch_info_plist_file(params[:ipa])
149
- app_name = params[:app_name] || info['CFBundleDisplayName'] || info['CFBundleName']
150
- app_identifier = params[:bundle_id] || info['CFBundleIdentifier']
151
- version = params[:bundle_version] || info['CFBundleShortVersionString']
152
- href = itms_href(params[:plist_url])
153
- url_scheme = get_url_scheme(info)
154
- UI.user_error!("No prefix scheme found in Info.plist. Make sure `add_prefix_schema` action succeded before build action") if url_scheme.nil?
155
- when :android
156
- manifest = Android::Apk.new(params[:apk]).manifest
157
- app_name = params[:app_name] || manifest.label
158
- app_identifier = params[:package_name] || manifest.package_name
159
- version = params[:version_name] || manifest.version_name
160
- version_code = params[:version_code] || manifest.version_code
161
- href = params[:apk_url]
162
- end
163
-
164
- config = {
165
- api_token: api_token,
166
- app_name: app_name,
167
- app_identifier: app_identifier,
168
- version: version,
169
- version_code: version_code,
170
- icon_url: icon_url,
171
- href: href,
172
- release_notes: release_notes,
173
- binary_size: binary_size,
174
- url_scheme: url_scheme
175
- }
176
-
177
- return config
178
- end
179
-
180
- def self.notify(platform, params)
181
- uri = URI.parse(url(platform, params[:app_identifier]))
182
-
183
- version = {
184
- version: params[:version],
185
- releaseNotes: params[:release_notes],
186
- href: params[:href],
187
- bytes: params[:binary_size]
188
- }
189
-
190
- version[:prefixSchema] = params[:url_scheme] if platform == :ios
191
- version[:versionCode] = params[:version_code] if platform == :android
192
-
193
- http = Net::HTTP.new(uri.host, uri.port)
194
- http.use_ssl = true
195
-
196
- req = create_request(uri, params[:api_token], {
197
- name: params[:app_name],
198
- icon: {
199
- href: params[:icon_url]
200
- },
201
- versions: [version]
202
- })
203
-
204
- response = http.request(req)
205
- unless response.code == "204"
206
- UI.user_error! "Polidea Store backend responded with [#{response.code}] #{response.body}"
207
- end
208
-
209
- return params[:app_name], params[:app_identifier], params[:version]
210
- end
211
- private_class_method :notify
212
-
213
- def self.url(platform, app_identifier)
214
- "#{base_url}/#{platform}/apps/#{app_identifier}/versions"
215
- end
216
- private_class_method :url
217
-
218
- def self.base_url
219
- "https://polideastore.herokuapp.com"
220
- # "https://polideastore-staging.herokuapp.com"
221
- end
222
- private_class_method :base_url
223
-
224
- def self.create_request(uri, upload_token, params)
225
- req = Net::HTTP::Post.new(uri.request_uri)
226
- req['Content-Type'] = 'application/json'
227
- req['Upload-Token'] = upload_token
228
- req.body = JSON.generate(params)
229
- req
230
- end
231
- private_class_method :create_request
232
-
233
- def self.itms_href(plist_url)
234
- "itms-services://?action=download-manifest&url=#{URI.encode_www_form_component(plist_url)}"
235
- end
236
- private_class_method :itms_href
237
-
238
- def self.get_url_scheme(plist)
239
- url_scheme = nil
240
- url_types = plist['CFBundleURLTypes']
241
- unless url_types.nil?
242
- url_type = url_types[0]
243
- url_schemes = url_type['CFBundleURLSchemes']
244
- unless url_schemes.nil?
245
- url_scheme = url_schemes[0]
246
- end
247
- end
248
- url_scheme
249
- end
250
- private_class_method :get_url_scheme
251
- end
252
- end
253
- end
254
-
255
- # rubocop:enable Metrics/MethodLength