fastlane-plugin-screenshot_notifier 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: ffa76f65c4d14cfeec1c37d5add43cd0983532f942cb53acd5b8cc319367f2fa
4
- data.tar.gz: 3da1f83f3206b4fe18d014c83a8c5505c34b95b8817fc322cd19afd5f9b76eae
3
+ metadata.gz: 0fbde9cfedf4a778509f8b7ea23d92dc972251297b6ee4981cc56933ee92fcd8
4
+ data.tar.gz: 2da75461850c503933f0079a8318046fb0360d75c2970a36547d9331d719efd4
5
5
  SHA512:
6
- metadata.gz: 31b9bbcf59b34fce031c196fd44dc156557586351f2ecf425d00a478390ab1c63456374dc2ae7d558841db6936df4844056e544b8d07374d2591b96a3c4417e5
7
- data.tar.gz: d36ded2a517f76f34afed9d66ab8438e4c692ab456a77079c2e5c4373eb51b17ea3d5d315966c8de218f1fb059de8867d2aeed399ca7c1e4a4ec39356bb22271
6
+ metadata.gz: 1019e99a90cddf10a12c0400699619e5d979b17f5c46c15913dd2cdfb1c972b7579972f21c4c34b1b2ba3ce1ebdb1008be9128d6fac7c0f6eb27741f3fd4aeb4
7
+ data.tar.gz: 24ccddf8baf9cca131900f8f391318e0ab15bcdd2d89df609985b8e132b7f8b047d59b7d1933cebe64dbccc737a4c51fa546f8bab408150888148136e4ca0f98
@@ -23,14 +23,16 @@ module Fastlane
23
23
  UI.message "Post screenshots as PR comments"
24
24
  screenshot_dir = params[:screenshot_dir]
25
25
  devices = Dir.chdir("#{screenshot_dir}") do
26
- Dir.glob("*").select {|path| FileTest.directory? path}.sort
26
+ Dir.glob("*").select { |path| FileTest.directory? path }.sort
27
27
  end
28
- header = "<tr><td>Screen Name</td>\n#{devices.map {|device| "<td>#{device}</td>\n"}.inject(&:+)}</tr>"
28
+ header = "<tr><td>Screen Name</td>\n#{devices.map { |device| "<td>#{device}</td>\n" }.inject(&:+)}</tr>"
29
29
  rows = Dir.glob("#{screenshot_dir}/#{devices[0]}/*.jpg")
30
- .map {|path| File.basename(path)}
31
- .map {|file_name|
32
- cells = devices.map {|device|
33
- ratio = Helper.calc_aspect_ratio("#{screenshot_dir}/#{device}/#{file_name}")
30
+ .map { |path| File.basename(path) }
31
+ .map { |file_name|
32
+ cells = devices.map { |device|
33
+ file_path = "#{screenshot_dir}/#{device}/#{file_name}"
34
+ next if !File.exist?(file_path)
35
+ ratio = Helper.calc_aspect_ratio(file_path)
34
36
  is_portrait = ratio >= 1.0
35
37
  size_attr = if params[:image_length] != nil
36
38
  if is_portrait
@@ -8,8 +8,8 @@ module Fastlane
8
8
  def self.fold_comments(github_owner, github_repository, github_pr_number, comment_prefix, summary, github_api_token)
9
9
  res = get_comments(github_owner, github_repository, github_pr_number, github_api_token)
10
10
  JSON.parse(res.body)
11
- .select {|comment| comment["body"] != nil && comment["body"].start_with?(comment_prefix)}
12
- .each {|comment|
11
+ .select { |comment| comment["body"] != nil && comment["body"].start_with?(comment_prefix) }
12
+ .each { |comment|
13
13
  body = "<details><summary>#{summary}</summary>\n#{comment["body"]}\n\n</details>\n"
14
14
  patch_comment(github_owner, github_repository, comment["id"], body, github_api_token)
15
15
  }
@@ -18,8 +18,8 @@ module Fastlane
18
18
  def self.delete_comments(github_owner, github_repository, github_pr_number, comment_prefix, github_api_token)
19
19
  res = get_comments(github_owner, github_repository, github_pr_number, github_api_token)
20
20
  JSON.parse(res.body)
21
- .select {|comment| comment["body"] != nil && comment["body"].start_with?(comment_prefix)}
22
- .each {|comment| delete_comment(github_owner, github_repository, comment["id"], github_api_token)}
21
+ .select { |comment| comment["body"] != nil && comment["body"].start_with?(comment_prefix) }
22
+ .each { |comment| delete_comment(github_owner, github_repository, comment["id"], github_api_token) }
23
23
  end
24
24
 
25
25
  def self.get_comments(github_owner, github_repository, github_pr_number, github_api_token)
@@ -31,7 +31,7 @@ module Fastlane
31
31
  req["Content-Type"] = "application/json"
32
32
  req["Authorization"] = "token #{github_api_token}"
33
33
 
34
- res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) {|http| http.request(req)}
34
+ res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) { |http| http.request(req) }
35
35
  UI.message "#{res.code}\n#{res.body}"
36
36
 
37
37
  res
@@ -47,7 +47,7 @@ module Fastlane
47
47
  req["Authorization"] = "token #{github_api_token}"
48
48
  req.body = {:body => body}.to_json
49
49
 
50
- res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) {|http| http.request(req)}
50
+ res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) { |http| http.request(req) }
51
51
  UI.message "#{res.code}\n#{res.body}"
52
52
 
53
53
  res
@@ -63,7 +63,7 @@ module Fastlane
63
63
  req["Authorization"] = "token #{github_api_token}"
64
64
  req.body = {:body => body}.to_json
65
65
 
66
- res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) {|http| http.request(req)}
66
+ res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) { |http| http.request(req) }
67
67
  UI.message "#{res.code}\n#{res.body}"
68
68
 
69
69
  res
@@ -78,7 +78,7 @@ module Fastlane
78
78
  req["Content-Type"] = "application/json"
79
79
  req["Authorization"] = "token #{github_api_token}"
80
80
 
81
- res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) {|http| http.request(req)}
81
+ res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) { |http| http.request(req) }
82
82
  UI.message "#{res.code}\n#{res.body}"
83
83
 
84
84
  res
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module ScreenshotNotifier
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-screenshot_notifier
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
  - Moyuru Aizawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-09 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.0.3
171
+ rubygems_version: 3.0.6
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Post screenshots to a pull request