fastlane-plugin-polidea 0.6.0.pre.1 → 2.2.0.pre

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.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +3 -5
  3. data/lib/fastlane/plugin/polidea.rb +7 -0
  4. data/lib/fastlane/plugin/polidea/actions/add_prefix_schema.rb +4 -1
  5. data/lib/fastlane/plugin/polidea/actions/extract_app_icon.rb +4 -0
  6. data/lib/fastlane/plugin/polidea/actions/extract_app_info.rb +12 -9
  7. data/lib/fastlane/plugin/polidea/actions/extract_app_name.rb +4 -1
  8. data/lib/fastlane/plugin/polidea/actions/extract_version.rb +4 -0
  9. data/lib/fastlane/plugin/polidea/actions/{mailgun.rb → fota_mail.rb} +25 -21
  10. data/lib/fastlane/plugin/polidea/actions/{s3.rb → fota_s3.rb} +72 -51
  11. data/lib/fastlane/plugin/polidea/actions/get_binary_size.rb +4 -0
  12. data/lib/fastlane/plugin/polidea/actions/import_provisioning.rb +5 -0
  13. data/lib/fastlane/plugin/polidea/actions/release_notes.rb +5 -0
  14. data/lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb +54 -0
  15. data/lib/fastlane/plugin/polidea/actions/shuttle.rb +6 -38
  16. data/lib/fastlane/plugin/polidea/helper/analytics.rb +43 -0
  17. data/lib/fastlane/plugin/polidea/helper/mime.rb +22 -0
  18. data/lib/fastlane/plugin/polidea/helper/page_generator.rb +41 -3
  19. data/lib/fastlane/plugin/polidea/helper/qr_generator.rb +7 -7
  20. data/lib/fastlane/plugin/polidea/helper/shuttle.rb +39 -0
  21. data/lib/fastlane/plugin/polidea/templates/download.erb +481 -0
  22. data/lib/fastlane/plugin/polidea/templates/images/cover-shuttle.jpg +0 -0
  23. data/lib/fastlane/plugin/polidea/templates/images/icon-placeholder.png +0 -0
  24. data/lib/fastlane/plugin/polidea/templates/images/polidea-logo.png +0 -0
  25. data/lib/fastlane/plugin/polidea/templates/images/social-behance.png +0 -0
  26. data/lib/fastlane/plugin/polidea/templates/images/social-dribbble.png +0 -0
  27. data/lib/fastlane/plugin/polidea/templates/images/social-facebook.png +0 -0
  28. data/lib/fastlane/plugin/polidea/templates/images/social-github.png +0 -0
  29. data/lib/fastlane/plugin/polidea/templates/images/social-instagram.png +0 -0
  30. data/lib/fastlane/plugin/polidea/templates/images/social-linkedin.png +0 -0
  31. data/lib/fastlane/plugin/polidea/templates/images/social-twitter.png +0 -0
  32. data/lib/fastlane/plugin/polidea/templates/installation-page/css/installation-page.css +2835 -1082
  33. data/lib/fastlane/plugin/polidea/templates/installation_template.erb +3 -7
  34. data/lib/fastlane/plugin/polidea/templates/mailgun_template.erb +56 -24
  35. data/lib/fastlane/plugin/polidea/templates/secure_installation_template.erb +6 -10
  36. data/lib/fastlane/plugin/polidea/version.rb +1 -1
  37. metadata +100 -23
  38. data/lib/fastlane/plugin/polidea/actions/polidea_store.rb +0 -251
  39. data/lib/fastlane/plugin/polidea/templates/images/logo.png +0 -0
  40. data/lib/fastlane/plugin/polidea/templates/images/polidea-facebook-icon.png +0 -0
  41. data/lib/fastlane/plugin/polidea/templates/images/polidea-github-icon.png +0 -0
  42. data/lib/fastlane/plugin/polidea/templates/images/polidea-twitter-icon.png +0 -0
@@ -42,15 +42,11 @@
42
42
  </div>
43
43
  </div>
44
44
 
45
- <% if release_notes && release_notes.count > 0 %>
46
- <div class="row section">
45
+ <% if !release_notes.nil? %>
46
+ <div class="row section release-notes">
47
47
  <div class="small-12 columns">
48
48
  <span class="whats-new">What's new:</span>
49
- <ul>
50
- <% for @item in @notes %>
51
- <li><%= @item %></li>
52
- <% end %>
53
- </ul>
49
+ <%= release_notes %>
54
50
  </div>
55
51
  </div>
56
52
  <% end %>
@@ -586,11 +586,6 @@ table.radius td {
586
586
  border-radius: 3px;
587
587
  }
588
588
 
589
- table.round td {
590
- -webkit-border-radius: 500px;
591
- -moz-border-radius: 500px;
592
- border-radius: 500px;
593
- }
594
589
 
595
590
  /* Outlook First */
596
591
 
@@ -832,12 +827,6 @@ body.outlook p {
832
827
  max-height: 50px;
833
828
  }
834
829
 
835
- .logo-decoration {
836
- border-radius: 5px;
837
- -moz-border-radius: 5px;
838
- -webkit-border-radius: 5px;
839
- }
840
-
841
830
  .container-margin {
842
831
  margin-top: 10px !important;
843
832
  margin-bottom: 10px !important;
@@ -918,12 +907,61 @@ td.whats-new-wrapper {
918
907
  color: #666666;
919
908
  }
920
909
 
921
- li.release-note {
922
- color: #666666;
910
+ .release-notes {
911
+ color: #666666;
912
+ }
913
+
914
+ .release-notes ul {
915
+ padding-left: 14px !important;
916
+ }
917
+
918
+ .release-notes li {
923
919
  padding: 0;
924
920
  margin: 0;
925
921
  }
926
922
 
923
+ .release-notes h1,
924
+ .release-notes h2,
925
+ .release-notes h3,
926
+ .release-notes h4,
927
+ .release-notes h5,
928
+ .release-notes h6 {
929
+ margin-top: 24px;
930
+ margin-bottom: 16px;
931
+ font-weight: 600;
932
+ line-height: 1.25;
933
+ }
934
+
935
+ .release-notes h1 {
936
+ color: #666666;
937
+ font-size: 1.625em;
938
+ }
939
+
940
+ .release-notes h2 {
941
+ color: #666666;
942
+ font-size: 1.5em;
943
+ }
944
+
945
+ .release-notes h3 {
946
+ color: #666666;
947
+ font-size: 1.25em;
948
+ }
949
+
950
+ .release-notes h4 {
951
+ color: #666666;
952
+ font-size: 1em;
953
+ }
954
+
955
+ .release-notes h5 {
956
+ color: #666666;
957
+ font-size: 0.875em;
958
+ }
959
+
960
+ .release-notes h6 {
961
+ color: #666666;
962
+ font-size: 0.85em;
963
+ }
964
+
927
965
  li.detailed-info {
928
966
  list-style: none;
929
967
  color: #666666;
@@ -1021,7 +1059,7 @@ img.polidea-logo {
1021
1059
  <% if app_icon %>
1022
1060
  <img src="cid:<%= app_icon %>" class="app-icon"/>
1023
1061
  <% else %>
1024
- <img src="cid:icon-placeholder.png" class="app-icon logo-decoration"/>
1062
+ <img src="cid:icon-placeholder.png" class="app-icon"/>
1025
1063
  <% end %>
1026
1064
  </td>
1027
1065
  <td class="expander"></td>
@@ -1072,21 +1110,15 @@ img.polidea-logo {
1072
1110
  </tr>
1073
1111
  </table>
1074
1112
 
1075
- <% if !release_notes.nil? && release_notes.count > 0 %>
1076
- <table class="row section">
1113
+ <% if !release_notes.nil? %>
1114
+ <table class="row section release-notes">
1077
1115
  <tr>
1078
1116
  <td class="wrapper last whats-new-wrapper">
1079
1117
  <table class="twelve columns">
1080
1118
  <tr>
1081
1119
  <td>
1082
-
1083
- <span class="whats-new">What's new:</span>
1084
- <ul class="list">
1085
- <% for @item in release_notes %>
1086
- <li class="release-note"><%= @item %></li>
1087
- <% end %>
1088
- </ul>
1089
-
1120
+ <span class="whats-new">What's new:</span>
1121
+ <%= release_notes %>
1090
1122
  </td>
1091
1123
  </tr>
1092
1124
  </table>
@@ -57,17 +57,13 @@
57
57
  </div>
58
58
  </div>
59
59
 
60
- <% if release_notes && release_notes.count > 0 %>
61
- <div class="row section">
62
- <div class="small-12 columns">
63
- <span class="whats-new">What's new:</span>
64
- <ul>
65
- <% for @item in @notes %>
66
- <li><%= @item %></li>
67
- <% end %>
68
- </ul>
60
+ <% if !release_notes.nil? %>
61
+ <div class="row section release-notes">
62
+ <div class="small-12 columns">
63
+ <span class="whats-new">What's new:</span>
64
+ <%= release_notes %>
65
+ </div>
69
66
  </div>
70
- </div>
71
67
  <% end %>
72
68
 
73
69
  <script src="installation-page/js/vendor/pbkdf2.js"></script>
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Polidea
3
- VERSION = "0.6.0.pre.1"
3
+ VERSION = "2.2.0.pre"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-polidea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.pre.1
4
+ version: 2.2.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Dubiel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-02 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.17.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.17.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: plist
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -25,19 +39,19 @@ dependencies:
25
39
  - !ruby/object:Gem::Version
26
40
  version: 3.1.0
27
41
  - !ruby/object:Gem::Dependency
28
- name: aws-sdk
42
+ name: aws-sdk-s3
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - "<"
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '2'
47
+ version: '1.61'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - "<"
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '2'
54
+ version: '1.61'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: premailer
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -58,6 +72,34 @@ dependencies:
58
72
  - - ">="
59
73
  - !ruby/object:Gem::Version
60
74
  version: 1.8.7
75
+ - !ruby/object:Gem::Dependency
76
+ name: json
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 1.8.0
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 1.8.0
89
+ - !ruby/object:Gem::Dependency
90
+ name: nokogiri
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.10'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1.10'
61
103
  - !ruby/object:Gem::Dependency
62
104
  name: rqrcode_png
63
105
  requirement: !ruby/object:Gem::Requirement
@@ -87,19 +129,33 @@ dependencies:
87
129
  - !ruby/object:Gem::Version
88
130
  version: '0.7'
89
131
  - !ruby/object:Gem::Dependency
90
- name: bundler
132
+ name: redcarpet
91
133
  requirement: !ruby/object:Gem::Requirement
92
134
  requirements:
93
135
  - - ">="
94
136
  - !ruby/object:Gem::Version
95
137
  version: '0'
96
- type: :development
138
+ type: :runtime
97
139
  prerelease: false
98
140
  version_requirements: !ruby/object:Gem::Requirement
99
141
  requirements:
100
142
  - - ">="
101
143
  - !ruby/object:Gem::Version
102
144
  version: '0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: bundler
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '2.0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '2.0'
103
159
  - !ruby/object:Gem::Dependency
104
160
  name: rspec
105
161
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +199,7 @@ dependencies:
143
199
  - !ruby/object:Gem::Version
144
200
  version: '0'
145
201
  - !ruby/object:Gem::Dependency
146
- name: rubocop
202
+ name: rb-readline
147
203
  requirement: !ruby/object:Gem::Requirement
148
204
  requirements:
149
205
  - - ">="
@@ -156,6 +212,20 @@ dependencies:
156
212
  - - ">="
157
213
  - !ruby/object:Gem::Version
158
214
  version: '0'
215
+ - !ruby/object:Gem::Dependency
216
+ name: rubocop
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: 0.46.0
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: 0.46.0
159
229
  - !ruby/object:Gem::Dependency
160
230
  name: simplecov
161
231
  requirement: !ruby/object:Gem::Requirement
@@ -174,16 +244,16 @@ dependencies:
174
244
  name: fastlane
175
245
  requirement: !ruby/object:Gem::Requirement
176
246
  requirements:
177
- - - ">="
247
+ - - "~>"
178
248
  - !ruby/object:Gem::Version
179
- version: 1.100.0
249
+ version: '2.0'
180
250
  type: :development
181
251
  prerelease: false
182
252
  version_requirements: !ruby/object:Gem::Requirement
183
253
  requirements:
184
- - - ">="
254
+ - - "~>"
185
255
  - !ruby/object:Gem::Version
186
- version: 1.100.0
256
+ version: '2.0'
187
257
  description:
188
258
  email: piotr.dubiel@polidea.com
189
259
  executables: []
@@ -198,21 +268,29 @@ files:
198
268
  - lib/fastlane/plugin/polidea/actions/extract_app_info.rb
199
269
  - lib/fastlane/plugin/polidea/actions/extract_app_name.rb
200
270
  - lib/fastlane/plugin/polidea/actions/extract_version.rb
271
+ - lib/fastlane/plugin/polidea/actions/fota_mail.rb
272
+ - lib/fastlane/plugin/polidea/actions/fota_s3.rb
201
273
  - lib/fastlane/plugin/polidea/actions/get_binary_size.rb
202
274
  - lib/fastlane/plugin/polidea/actions/import_provisioning.rb
203
- - lib/fastlane/plugin/polidea/actions/mailgun.rb
204
- - lib/fastlane/plugin/polidea/actions/polidea_store.rb
205
275
  - lib/fastlane/plugin/polidea/actions/release_notes.rb
206
- - lib/fastlane/plugin/polidea/actions/s3.rb
276
+ - lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb
207
277
  - lib/fastlane/plugin/polidea/actions/shuttle.rb
278
+ - lib/fastlane/plugin/polidea/helper/analytics.rb
279
+ - lib/fastlane/plugin/polidea/helper/mime.rb
208
280
  - lib/fastlane/plugin/polidea/helper/page_generator.rb
209
281
  - lib/fastlane/plugin/polidea/helper/qr_generator.rb
282
+ - lib/fastlane/plugin/polidea/helper/shuttle.rb
283
+ - lib/fastlane/plugin/polidea/templates/download.erb
284
+ - lib/fastlane/plugin/polidea/templates/images/cover-shuttle.jpg
210
285
  - lib/fastlane/plugin/polidea/templates/images/icon-placeholder.png
211
- - lib/fastlane/plugin/polidea/templates/images/logo.png
212
- - lib/fastlane/plugin/polidea/templates/images/polidea-facebook-icon.png
213
- - lib/fastlane/plugin/polidea/templates/images/polidea-github-icon.png
214
286
  - lib/fastlane/plugin/polidea/templates/images/polidea-logo.png
215
- - lib/fastlane/plugin/polidea/templates/images/polidea-twitter-icon.png
287
+ - lib/fastlane/plugin/polidea/templates/images/social-behance.png
288
+ - lib/fastlane/plugin/polidea/templates/images/social-dribbble.png
289
+ - lib/fastlane/plugin/polidea/templates/images/social-facebook.png
290
+ - lib/fastlane/plugin/polidea/templates/images/social-github.png
291
+ - lib/fastlane/plugin/polidea/templates/images/social-instagram.png
292
+ - lib/fastlane/plugin/polidea/templates/images/social-linkedin.png
293
+ - lib/fastlane/plugin/polidea/templates/images/social-twitter.png
216
294
  - lib/fastlane/plugin/polidea/templates/installation-page/css/installation-page.css
217
295
  - lib/fastlane/plugin/polidea/templates/installation-page/css/installation-page.css.map
218
296
  - lib/fastlane/plugin/polidea/templates/installation-page/img/bg.png
@@ -321,8 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
399
  - !ruby/object:Gem::Version
322
400
  version: 1.3.1
323
401
  requirements: []
324
- rubyforge_project:
325
- rubygems_version: 2.6.8
402
+ rubygems_version: 3.0.1
326
403
  signing_key:
327
404
  specification_version: 4
328
405
  summary: Polidea's fastlane action
@@ -1,251 +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.validate(platform, params)
125
- binary_size = params[:binary_size] || Actions.lane_context[Actions::SharedValues::BINARY_SIZE]
126
- 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?
127
-
128
- case platform
129
- when :android
130
- 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?
131
- when :ios
132
- 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?
133
- end
134
- end
135
-
136
- def self.get_config(platform, params)
137
- binary_size = params[:binary_size] || Actions.lane_context[Actions::SharedValues::BINARY_SIZE]
138
- api_token = params[:api_token]
139
- icon_url = params[:icon_url]
140
- release_notes = params[:release_notes]
141
-
142
- case platform
143
- when :ios
144
- info = FastlaneCore::IpaFileAnalyser.fetch_info_plist_file(params[:ipa])
145
- app_name = params[:app_name] || info['CFBundleName']
146
- app_identifier = params[:bundle_id] || info['CFBundleIdentifier']
147
- version = params[:bundle_version] || info['CFBundleShortVersionString']
148
- href = itms_href(params[:plist_url])
149
- url_scheme = get_url_scheme(info)
150
- UI.user_error!("No prefix scheme found in Info.plist. Make sure `add_prefix_schema` action succeded before build action") if url_scheme.nil?
151
- when :android
152
- manifest = Android::Apk.new(params[:apk]).manifest
153
- app_name = params[:app_name] || manifest.label
154
- app_identifier = params[:package_name] || manifest.package_name
155
- version = params[:version_name] || manifest.version_name
156
- version_code = params[:version_code] || manifest.version_code
157
- href = params[:apk_url]
158
- end
159
-
160
- config = {
161
- api_token: api_token,
162
- app_name: app_name,
163
- app_identifier: app_identifier,
164
- version: version,
165
- version_code: version_code,
166
- icon_url: icon_url,
167
- href: href,
168
- release_notes: release_notes,
169
- binary_size: binary_size,
170
- url_scheme: url_scheme
171
- }
172
-
173
- return config
174
- end
175
-
176
- def self.notify(platform, params)
177
- uri = URI.parse(url(platform, params[:app_identifier]))
178
-
179
- version = {
180
- version: params[:version],
181
- releaseNotes: params[:release_notes],
182
- href: params[:href],
183
- bytes: params[:binary_size]
184
- }
185
-
186
- version[:prefixSchema] = params[:url_scheme] if platform == :ios
187
- version[:versionCode] = params[:version_code] if platform == :android
188
-
189
- http = Net::HTTP.new(uri.host, uri.port)
190
- http.use_ssl = true
191
-
192
- req = create_request(uri, params[:api_token], {
193
- name: params[:app_name],
194
- icon: {
195
- href: params[:icon_url]
196
- },
197
- versions: [version]
198
- })
199
-
200
- response = http.request(req)
201
- unless response.code == "204"
202
- UI.user_error! "Polidea Store backend responded with [#{response.code}] #{response.body}"
203
- end
204
-
205
- return params[:app_name], params[:app_identifier], params[:version]
206
- end
207
- private_class_method :notify
208
-
209
- def self.url(platform, app_identifier)
210
- "#{base_url}/#{platform}/apps/#{app_identifier}/versions"
211
- end
212
- private_class_method :url
213
-
214
- def self.base_url
215
- "https://polideastore.herokuapp.com"
216
- # "https://polideastore-staging.herokuapp.com"
217
- end
218
- private_class_method :base_url
219
-
220
- def self.create_request(uri, upload_token, params)
221
- req = Net::HTTP::Post.new(uri.request_uri)
222
- req['Content-Type'] = 'application/json'
223
- req['Upload-Token'] = upload_token
224
- req.body = JSON.generate(params)
225
- req
226
- end
227
- private_class_method :create_request
228
-
229
- def self.itms_href(plist_url)
230
- "itms-services://?action=download-manifest&url=#{URI.encode_www_form_component(plist_url)}"
231
- end
232
- private_class_method :itms_href
233
-
234
- def self.get_url_scheme(plist)
235
- url_scheme = nil
236
- url_types = plist['CFBundleURLTypes']
237
- unless url_types.nil?
238
- url_type = url_types[0]
239
- url_schemes = url_type['CFBundleURLSchemes']
240
- unless url_schemes.nil?
241
- url_scheme = url_schemes[0]
242
- end
243
- end
244
- url_scheme
245
- end
246
- private_class_method :get_url_scheme
247
- end
248
- end
249
- end
250
-
251
- # rubocop:enable Metrics/MethodLength