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: 5e564b5550140fd611f86cb6a1ccd87ffde1763b
4
- data.tar.gz: 8391f7e798ae393939c5abff71480f7cf5fa9b7e
3
+ metadata.gz: bd5fc30c800629a03a096327f7384232f87c7911
4
+ data.tar.gz: 5b179fe77ea1103e075bb2afa7b0d58736f63d89
5
5
  SHA512:
6
- metadata.gz: 7fda2fbba6df59068d102518b4d3e090cd09a740017d3b39ab809295cd1c6984ff862b4b3c9d32009133ac49dbd865ad0050eca20aec40d489cde4cec6c9f027
7
- data.tar.gz: 91821fbc9b00b8c5cb334d5ef71558adb0188fe0bfa207484741e6c282a59ef3c82da7a79dceb76be54c97081e2b4ae3193907e9e22d2eb96244bb877e9f3743
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
- differencesPath = "imagesGoldenRun/differences"
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
- goldenRunImagesNames = Dir.entries(params[:goldenRunLoc]).select {|f| f.end_with? ".png"}
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
- imgG = "#{params[:goldenRunLoc]}/#{imageName}"
24
- imgR = "#{params[:resultLoc]}/#{imageName}"
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(imgG, imgR, exclude_rect: excludeArea)
31
+ res = Imatcher.compare(imgFullPathG, imgFullPathR, exclude_rect: excludeArea)
27
32
  r = res.match?
28
33
  unless r
29
- img = "#{differencesPath}/#{imageName}"
30
- res.difference_image.save(img)
31
- htmlImages += "<h2>#{imageName}</h2><img src='../#{img}' style='height:50%;' onclick='window.open(this.src)'>"
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("imagesGoldenRun/report.html", "w") { |file| file.write(goldenRunReport) }
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: 'Golden run images location',
68
+ description: "Golden run images relative path (e.g. 'images/goldenRun')",
59
69
  optional: false),
60
70
  FastlaneCore::ConfigItem.new(key: :resultLoc,
61
- description: 'Results images location',
71
+ description: "Results images relative path (e.g. 'images/results)",
62
72
  optional: false),
63
73
  FastlaneCore::ConfigItem.new(key: :excludeArea,
64
- description: 'Results images location',
74
+ description: 'Area for the exclusion',
65
75
  optional: false)
66
76
  ]
67
77
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Imagesgoldenrun
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-imagesgoldenrun
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
  - Luís Esteves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-04 00:00:00.000000000 Z
11
+ date: 2018-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry