fastlane-plugin-polidea 2.1.1.pre → 2.1.1.pre.1

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
  SHA256:
3
- metadata.gz: 9389415ea79485df9f60db8fb7d36dc00f3722a0c659132f35e4744e89ab8c09
4
- data.tar.gz: 455e97b59e28db63b05988617ab20453d49d281f8f18a987e58e12157168affe
3
+ metadata.gz: 66de788d11a57914464a2cc03070b31fd1440612177d90c170f7a855182a542e
4
+ data.tar.gz: b120d6021ec61cfaa6d812f0e53301ff357702873f3cbcd5c8dd60558ba1c724
5
5
  SHA512:
6
- metadata.gz: 6f8900858b70301309e2a41b474200a95fe0af1214a969e0a0fab853859e36fbb4e2717cd9d24240c5ea0e080f35abe7d6be5dfc8a55a2ec2198f593746c946d
7
- data.tar.gz: edcb2e87e4381fbb62797dc9e7c5cde32db6578a315254c45c1ee0c85996024c6827d9c8a2453c184a9d57f53ea71c28b897272f65355182fe4f0948e6aefcb3
6
+ metadata.gz: 05b363ecac70721218e61d37c184612e23d863d5d39e6325f6732a955e989cd08456297e68bf2cd4d1f21caef3435dd84d7141a862598f2663d3d60a07b87547
7
+ data.tar.gz: 03e217698b3819fe1dd5ed3f5aecdca121448a6d1a9cdfbfa276e0736292760da20bbd2d67bea7a0826af1b0a22b179d07991a7902e795acbed1c6731ec09ed9
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # fastlane-plugin-polidea
2
2
 
3
- [![build status](https://gitlab2.polidea.com/CI/fastlane-plugin-polidea/badges/master/build.svg)](https://gitlab2.polidea.com/CI/fastlane-plugin-polidea)
3
+ [![build status](https://gitlab.polidea.com/CICD/fastlane-plugin-polidea/badges/master/pipeline.svg)](https://gitlab.polidea.com/CICD/fastlane-plugin-polidea/pipelines)
4
4
  [![Gem](https://img.shields.io/gem/v/fastlane-plugin-polidea.svg?style=flat)](http://rubygems.org/gems/fastlane-plugin-polidea)
5
5
 
6
6
 
@@ -1,4 +1,5 @@
1
1
  require 'fastlane/plugin/polidea/version'
2
+ require 'fastlane/plugin/polidea/helper/analytics'
2
3
 
3
4
  module Fastlane
4
5
  module Polidea
@@ -6,6 +7,12 @@ module Fastlane
6
7
  def self.all_classes
7
8
  Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
9
  end
10
+
11
+ def self.session
12
+ require 'securerandom'
13
+ @session_id ||= SecureRandom.uuid
14
+ @session ||= Analytics.new(@session_id)
15
+ end
9
16
  end
10
17
  end
11
18
 
@@ -8,6 +8,8 @@ module Fastlane
8
8
 
9
9
  class AddPrefixSchemaAction < Action
10
10
  def self.run(config)
11
+ Fastlane::Polidea.session.action_launched("add_prefix_schema", config)
12
+
11
13
  prefix_schema = generate_url_scheme
12
14
 
13
15
  info_plists = Dir.glob(File.join(config[:path], "**/*.plist"))
@@ -18,6 +20,7 @@ module Fastlane
18
20
 
19
21
  Actions.lane_context[SharedValues::PREFIX_SCHEMA] = prefix_schema
20
22
 
23
+ Fastlane::Polidea.session.action_completed("add_prefix_schema")
21
24
  prefix_schema
22
25
  end
23
26
 
@@ -10,6 +10,8 @@ module Fastlane
10
10
 
11
11
  class ExtractAppIconAction < Action
12
12
  def self.run(config)
13
+ Fastlane::Polidea.session.action_launched("extract_app_icon", config)
14
+
13
15
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
14
16
  icon_output_path = config[:icon_output_path]
15
17
 
@@ -24,6 +26,8 @@ module Fastlane
24
26
  else
25
27
  UI.important("No icon found.")
26
28
  end
29
+
30
+ Fastlane::Polidea.session.action_completed("extract_app_icon")
27
31
  end
28
32
 
29
33
  def self.extract_icon(platform, config)
@@ -15,6 +15,8 @@ module Fastlane
15
15
 
16
16
  class ExtractAppInfoAction < Action
17
17
  def self.run(config)
18
+ Fastlane::Polidea.session.action_launched("extract_app_info", config)
19
+
18
20
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
19
21
 
20
22
  icon_output_path = config[:icon_output_path]
@@ -34,6 +36,8 @@ module Fastlane
34
36
  SharedValues::APP_VERSION => app_version,
35
37
  SharedValues::BUILD_NUMBER => build_number
36
38
  )
39
+
40
+ Fastlane::Polidea.session.action_completed("extract_app_info")
37
41
  end
38
42
 
39
43
  def self.validate(platform, config)
@@ -10,6 +10,8 @@ module Fastlane
10
10
 
11
11
  class ExtractAppNameAction < Action
12
12
  def self.run(config)
13
+ Fastlane::Polidea.session.action_launched("extract_app_name", config)
14
+
13
15
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
14
16
 
15
17
  # Gets name from ipa/apk
@@ -20,6 +22,7 @@ module Fastlane
20
22
 
21
23
  UI.success("Successfully extracted app name: '#{Actions.lane_context[SharedValues::APP_NAME]}'")
22
24
 
25
+ Fastlane::Polidea.session.action_completed("extract_app_name")
23
26
  app_name
24
27
  end
25
28
 
@@ -11,6 +11,8 @@ module Fastlane
11
11
 
12
12
  class ExtractVersionAction < Action
13
13
  def self.run(config)
14
+ Fastlane::Polidea.session.action_launched("extract_version", config)
15
+
14
16
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
15
17
 
16
18
  # Gets version from ipa/apk
@@ -24,6 +26,8 @@ module Fastlane
24
26
 
25
27
  UI.success("Successfully extracted app version: '#{Actions.lane_context[SharedValues::APP_VERSION]}', build number: #{Actions.lane_context[SharedValues::BUILD_NUMBER]}")
26
28
 
29
+ Fastlane::Polidea.session.action_completed("extract_version")
30
+
27
31
  return app_version, build_number
28
32
  end
29
33
 
@@ -10,10 +10,14 @@ module Fastlane
10
10
  end
11
11
 
12
12
  def self.run(options)
13
+ Fastlane::Polidea.session.action_launched("fota_mail", options)
14
+
13
15
  Actions.verify_gem!('premailer')
14
16
  require 'premailer'
15
17
  inline_images(options)
16
18
  mailgunit(options)
19
+
20
+ Fastlane::Polidea.session.action_completed("fota_mail")
17
21
  UI.success "Mail sent!"
18
22
  end
19
23
 
@@ -30,6 +30,8 @@ module Fastlane
30
30
 
31
31
  class FotaS3Action < Action
32
32
  def self.run(config)
33
+ Fastlane::Polidea.session.action_launched("fota_s3", config)
34
+
33
35
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
34
36
 
35
37
  # Calling fetch on config so that default values will be used
@@ -61,6 +63,7 @@ module Fastlane
61
63
  upload_android(params)
62
64
  end
63
65
 
66
+ Fastlane::Polidea.session.action_completed("fota_s3")
64
67
  return true
65
68
  end
66
69
 
@@ -6,6 +6,8 @@ module Fastlane
6
6
 
7
7
  class GetBinarySizeAction < Action
8
8
  def self.run(config)
9
+ Fastlane::Polidea.session.action_launched("get_binary_size", config)
10
+
9
11
  binary_file = config[:binary]
10
12
 
11
13
  UI.user_error!("No IPA or APK file path given, pass using `binary: 'ipa or apk path'`") unless binary_file.to_s.length > 0
@@ -18,6 +20,8 @@ module Fastlane
18
20
 
19
21
  UI.success("Size of #{binary_file} is #{binary_size_in_mb} MB (#{binary_size} bytes)")
20
22
 
23
+ Fastlane::Polidea.session.action_completed("get_binary_size")
24
+
21
25
  binary_size
22
26
  end
23
27
 
@@ -2,6 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class ImportProvisioningAction < Action
4
4
  def self.run(config)
5
+ Fastlane::Polidea.session.action_launched("import_provisioning", config)
6
+
5
7
  path = config[:path]
6
8
  profiles = Dir.glob File.join(path, "*.mobileprovision")
7
9
 
@@ -10,6 +12,9 @@ module Fastlane
10
12
  FastlaneCore::ProvisioningProfile.install(profile)
11
13
  end
12
14
  UI.success "Successfully imported:\n#{profiles.join("\n")}"
15
+
16
+ Fastlane::Polidea.session.action_completed("import_provisioning")
17
+
13
18
  true
14
19
  end
15
20
 
@@ -6,12 +6,17 @@ module Fastlane
6
6
 
7
7
  class ReleaseNotesAction < Action
8
8
  def self.run(config)
9
+ Fastlane::Polidea.session.action_launched("release_notes", config)
10
+
9
11
  current_tag = sh "git describe --exact-match --tags HEAD"
10
12
  tag_info = sh "git cat-file -p #{current_tag}"
11
13
  release_notes = tag_info.split("\n").drop(5).join("\n")
12
14
  UI.success "Extracted release notes:\n#{release_notes}"
13
15
  Actions.lane_context[SharedValues::RELEASE_NOTES] = release_notes
14
16
  ENV[SharedValues::RELEASE_NOTES.to_s] = release_notes
17
+
18
+ Fastlane::Polidea.session.action_completed("release_notes")
19
+
15
20
  release_notes
16
21
  end
17
22
 
@@ -6,6 +6,7 @@ module Fastlane
6
6
  module Actions
7
7
  class ShuttleAction < Action
8
8
  def self.run(params)
9
+ Fastlane::Polidea.session.action_launched("shuttle", params)
9
10
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
10
11
  options = {
11
12
  api_token: params[:api_token],
@@ -25,6 +26,8 @@ module Fastlane
25
26
  notify(platform, config)
26
27
 
27
28
  UI.success("Successfully uploaded to #{params[:app_identifier]} #{params[:app_version]}.#{params[:build_number]} to Shuttle")
29
+
30
+ Fastlane::Polidea.session.action_completed("shuttle")
28
31
  end
29
32
 
30
33
  #####################################################
@@ -154,8 +157,6 @@ module Fastlane
154
157
  end
155
158
 
156
159
  def self.notify(platform, params)
157
- uri = URI.parse(url(params[:environment], platform, params[:app_identifier]))
158
-
159
160
  build = {
160
161
  href: params[:href],
161
162
  version: params[:app_version],
@@ -167,17 +168,11 @@ module Fastlane
167
168
  build[:prefixSchema] = params[:prefix_schema] if platform == :ios
168
169
  build[:versionCode] = params[:build_number] if platform == :android
169
170
 
170
- UI.verbose("POST #{uri}\n#{JSON.pretty_generate({ build: build })}")
171
- make_request(uri, create_request(uri, params[:api_token], {
172
- build: build
173
- }))
174
- end
175
- private_class_method :notify
171
+ client = Shuttle::Client.new(base_url(params[:environment]), params[:api_token])
176
172
 
177
- def self.url(environment, platform, app_identifier)
178
- "#{base_url(environment)}/cd/apps/#{platform}/#{app_identifier}/builds"
173
+ client.create_build(platform, params[:app_identifier], build)
179
174
  end
180
- private_class_method :url
175
+ private_class_method :notify
181
176
 
182
177
  def self.base_url(environment)
183
178
  case environment
@@ -189,14 +184,6 @@ module Fastlane
189
184
  end
190
185
  private_class_method :base_url
191
186
 
192
- def self.create_request(uri, access_token, params)
193
- req = Net::HTTP::Post.new(uri.request_uri)
194
- req['Content-Type'] = 'application/json'
195
- req['Access-Token'] = access_token
196
- req.body = JSON.generate(params)
197
- req
198
- end
199
-
200
187
  def self.itms_href(plist_url)
201
188
  "itms-services://?action=download-manifest&url=#{URI.encode_www_form_component(plist_url)}"
202
189
  end
@@ -206,25 +193,6 @@ module Fastlane
206
193
  sh("git --no-pager show -s --format='%ae'", print_command: false, print_command_output: false).strip
207
194
  end
208
195
  private_class_method :commit_author
209
-
210
- def self.make_request(uri, request, limit = 10)
211
- raise ArgumentError, 'HTTP redirect too deep' if limit.zero?
212
-
213
- http = Net::HTTP.new(uri.host, uri.port)
214
-
215
- if uri.instance_of?(URI::HTTPS)
216
- http.use_ssl = true
217
- end
218
-
219
- response = http.request(request)
220
- UI.verbose(response.body)
221
- case response
222
- when Net::HTTPSuccess then response
223
- when Net::HTTPRedirection then make_request(URI.parse(response['location']), request, limit - 1)
224
- else
225
- UI.user_error! "#{response.code} #{response.body}"
226
- end
227
- end
228
196
  end
229
197
  end
230
198
  end
@@ -0,0 +1,43 @@
1
+ module Fastlane
2
+ module Polidea
3
+ class Analytics
4
+ GA_TRACKING = "UA-165836496-1"
5
+ private_constant :GA_TRACKING
6
+
7
+ attr_accessor :session_id
8
+ attr_accessor :client
9
+
10
+ def initialize(session_id)
11
+ @session_id = session_id
12
+ @client = FastlaneCore::AnalyticsIngesterClient.new(GA_TRACKING)
13
+ @client_id = "fastlane-plugin-polidea@#{Fastlane::Polidea::VERSION}"
14
+ end
15
+
16
+ def action_launched(action_name, config)
17
+ client.post_request({
18
+ client_id: @session_id,
19
+ category: @client_id,
20
+ action: action_name,
21
+ label: "launched"
22
+ })
23
+ config.values.filter { |k, v| !v.nil? }.keys.each do |param|
24
+ client.post_request({
25
+ client_id: @session_id,
26
+ category: @client_id,
27
+ action: "#{action_name}::#{param}",
28
+ label: "param"
29
+ })
30
+ end
31
+ end
32
+
33
+ def action_completed(action_name)
34
+ client.post_request({
35
+ client_id: @session_id,
36
+ category: @client_id,
37
+ action: action_name,
38
+ label: "completed"
39
+ })
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,37 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ module Fastlane
5
+ module Shuttle
6
+ class Client
7
+ def initialize(base_url, access_token)
8
+ retry_options = {
9
+ max: 2,
10
+ interval: 0.05,
11
+ interval_randomness: 0.5,
12
+ backoff_factor: 2
13
+ }
14
+
15
+ @conn = Faraday.new(
16
+ url: base_url,
17
+ headers: {
18
+ 'Content-Type' => 'application/json',
19
+ 'Access-Token' => access_token
20
+ }
21
+ ) do |conn|
22
+ conn.request :retry, retry_options
23
+ conn.request :multipart
24
+
25
+ conn.adapter :net_http
26
+ end
27
+ end
28
+
29
+ def create_build(platform, app_identifier, build)
30
+ @conn.post(
31
+ "cd/apps/#{platform}/#{app_identifier}/builds",
32
+ build.to_json
33
+ )
34
+ end
35
+ end
36
+ end
37
+ end
@@ -309,7 +309,7 @@
309
309
  </tr>
310
310
  <tr>
311
311
  <td align="left" style="font-size:0px;padding:0;word-break:break-word;">
312
- <div style="font-family:'Acumin', 'Helvetica', Arial;font-size:14px;line-height:20px;text-align:left;color:black;">Version: <%= app_version %> ( <%= build_number %>)</div>
312
+ <div style="font-family:'Acumin', 'Helvetica', Arial;font-size:14px;line-height:20px;text-align:left;color:black;">Version: <%= app_version %> (<%= build_number %>)</div>
313
313
  </td>
314
314
  </tr>
315
315
  <tr>
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Polidea
3
- VERSION = "2.1.1.pre"
3
+ VERSION = "2.1.1.pre.1"
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: 2.1.1.pre
4
+ version: 2.1.1.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Dubiel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-05 00:00:00.000000000 Z
11
+ date: 2020-05-08 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
@@ -260,9 +274,11 @@ files:
260
274
  - lib/fastlane/plugin/polidea/actions/import_provisioning.rb
261
275
  - lib/fastlane/plugin/polidea/actions/release_notes.rb
262
276
  - lib/fastlane/plugin/polidea/actions/shuttle.rb
277
+ - lib/fastlane/plugin/polidea/helper/analytics.rb
263
278
  - lib/fastlane/plugin/polidea/helper/mime.rb
264
279
  - lib/fastlane/plugin/polidea/helper/page_generator.rb
265
280
  - lib/fastlane/plugin/polidea/helper/qr_generator.rb
281
+ - lib/fastlane/plugin/polidea/helper/shuttle.rb
266
282
  - lib/fastlane/plugin/polidea/templates/download.erb
267
283
  - lib/fastlane/plugin/polidea/templates/images/cover-shuttle.jpg
268
284
  - lib/fastlane/plugin/polidea/templates/images/icon-placeholder.png