fastlane-plugin-imagesgoldenrun 0.1.0 → 0.1.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd5fc30c800629a03a096327f7384232f87c7911
|
4
|
+
data.tar.gz: 5b179fe77ea1103e075bb2afa7b0d58736f63d89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f815b77262b156e4956273f1adec13fbe823eef25aca1c42d6dc3b92c64259314506ff1902b51f644d2574f22de42a7f9d8d45a2a321712cbc6ec4de19c193d7
|
7
|
+
data.tar.gz: b4674678169b8476457de0a85bb5b165440678404af2fecfa3bcef0f27682782c969d67c0dd9e3a6830cec465e808d918069962cee6012b5fa9581a7d522a5a0
|
@@ -8,7 +8,8 @@ module Fastlane
|
|
8
8
|
class ImagesgoldenrunAction < Action
|
9
9
|
def self.run(params)
|
10
10
|
|
11
|
-
|
11
|
+
differencesFolder = "imagesGoldenRunReport"
|
12
|
+
differencesPath = "#{differencesFolder}/differences"
|
12
13
|
FileUtils.mkdir_p(differencesPath)
|
13
14
|
|
14
15
|
Dir.foreach(differencesPath) do |f|
|
@@ -16,23 +17,32 @@ module Fastlane
|
|
16
17
|
File.delete(fp) if !File.directory?(fp)
|
17
18
|
end
|
18
19
|
|
20
|
+
#html report
|
19
21
|
goldenRunReport = "<html><body><htmlImages></body></html>"
|
20
22
|
htmlImages = ""
|
21
|
-
|
23
|
+
|
24
|
+
goldenRunLoc = File.expand_path(File.join(Dir.pwd, params[:goldenRunLoc]))
|
25
|
+
goldenRunImagesNames = Dir.entries(goldenRunLoc).select {|f| f.end_with? ".png"}
|
22
26
|
goldenRunImagesNames.each do |imageName|
|
23
|
-
|
24
|
-
|
27
|
+
|
28
|
+
imgFullPathG = "#{params[:goldenRunLoc]}/#{imageName}"
|
29
|
+
imgFullPathR = "#{params[:resultLoc]}/#{imageName}"
|
25
30
|
excludeArea = params[:excludeArea].gsub(/\s+/, '').split(",").map { |e| e.to_i }
|
26
|
-
res = Imatcher.compare(
|
31
|
+
res = Imatcher.compare(imgFullPathG, imgFullPathR, exclude_rect: excludeArea)
|
27
32
|
r = res.match?
|
28
33
|
unless r
|
29
|
-
|
30
|
-
|
31
|
-
|
34
|
+
#save the result image
|
35
|
+
imagesGoldenRunReportFullPath = "#{differencesPath}/#{imageName}"
|
36
|
+
res.difference_image.save(imagesGoldenRunReportFullPath)
|
37
|
+
|
38
|
+
#html report
|
39
|
+
htmlImages += "<h2>#{imageName}</h2><img src='../#{imagesGoldenRunReportFullPath}' style='height:50%;' onclick='window.open(this.src)'>"
|
32
40
|
end
|
33
41
|
end
|
42
|
+
|
43
|
+
#html report
|
34
44
|
goldenRunReport.gsub!("<htmlImages>", htmlImages)
|
35
|
-
File.open("
|
45
|
+
File.open("#{differencesFolder}/report.html", "w") { |file| file.write(goldenRunReport) }
|
36
46
|
end
|
37
47
|
|
38
48
|
def self.description
|
@@ -55,13 +65,13 @@ module Fastlane
|
|
55
65
|
def self.available_options
|
56
66
|
[
|
57
67
|
FastlaneCore::ConfigItem.new(key: :goldenRunLoc,
|
58
|
-
description:
|
68
|
+
description: "Golden run images relative path (e.g. 'images/goldenRun')",
|
59
69
|
optional: false),
|
60
70
|
FastlaneCore::ConfigItem.new(key: :resultLoc,
|
61
|
-
description:
|
71
|
+
description: "Results images relative path (e.g. 'images/results)",
|
62
72
|
optional: false),
|
63
73
|
FastlaneCore::ConfigItem.new(key: :excludeArea,
|
64
|
-
description: '
|
74
|
+
description: 'Area for the exclusion',
|
65
75
|
optional: false)
|
66
76
|
]
|
67
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-imagesgoldenrun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luís Esteves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|