flash_flow 1.5.1 → 1.5.2
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 +4 -4
- data/lib/flash_flow/release/pdf_diff_generator.rb +32 -19
- data/lib/flash_flow/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e906c19c6979dd04796aa3a4a120c43708b8b31
|
4
|
+
data.tar.gz: a711a9219a03243b4cae5b79f5bf9fb000593995
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d93ca428a41c0af6328589732b5623eec00327e4fca74d943f247ba27089786a83006f90478ad4d49db59290af34b13bae5c6b0b28beb2a7c58fe00c8c159daf
|
7
|
+
data.tar.gz: 55777d04af267fb1dfd287285ade1f268876386838c6a0e077983eeedd92793961f5c5c67a72749fb820110ece023d62b08d30de77dbb8644a87e5ce15d2948c
|
@@ -47,15 +47,15 @@ module FlashFlow
|
|
47
47
|
pdf.text("Compliance Diffs Generated At: #{Time.now.to_s}")
|
48
48
|
end
|
49
49
|
|
50
|
-
def compute_scale_factor(column_width, page_height,
|
51
|
-
x_scale_factor = column_width /
|
52
|
-
y_scale_factor = page_height /
|
50
|
+
def compute_scale_factor(column_width, page_height, width, height)
|
51
|
+
x_scale_factor = column_width / width
|
52
|
+
y_scale_factor = page_height / height
|
53
53
|
[x_scale_factor, y_scale_factor].min
|
54
54
|
end
|
55
55
|
|
56
|
-
def compute_scale_and_orientation(
|
57
|
-
scale_portrait = compute_scale_factor(@column_portrait, [@page_width, @page_height].max,
|
58
|
-
scale_landscape = compute_scale_factor(@column_landscape, [@page_width, @page_height].min,
|
56
|
+
def compute_scale_and_orientation(width, height)
|
57
|
+
scale_portrait = compute_scale_factor(@column_portrait, [@page_width, @page_height].max, width, height)
|
58
|
+
scale_landscape = compute_scale_factor(@column_landscape, [@page_width, @page_height].min, width, height)
|
59
59
|
if scale_portrait > scale_landscape
|
60
60
|
@orientation = :portrait
|
61
61
|
@column_width = @column_portrait
|
@@ -67,14 +67,25 @@ module FlashFlow
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
def max_width(comparison)
|
71
|
+
max_by(comparison, :width)
|
72
|
+
end
|
73
|
+
|
74
|
+
def max_height(comparison)
|
75
|
+
max_by(comparison, :height)
|
76
|
+
end
|
77
|
+
|
78
|
+
def max_by(comparison, key)
|
79
|
+
[comparison['head-screenshot'][key], comparison['base-screenshot'][key], comparison['pdiff'][key]].max
|
80
|
+
end
|
81
|
+
|
70
82
|
def add_comparison_to_pdf(pdf, comparison)
|
71
|
-
scale_factor = compute_scale_and_orientation(comparison
|
83
|
+
scale_factor = compute_scale_and_orientation(max_width(comparison), max_height(comparison))
|
72
84
|
options = { vposition: :top, scale: scale_factor }
|
73
85
|
|
74
86
|
pdf.start_new_page(layout: @orientation)
|
75
|
-
|
76
|
-
place_image(pdf, comparison.dig('head-screenshot', :url), options,
|
77
|
-
place_image(pdf, comparison.dig('base-screenshot', :url), options, 2)
|
87
|
+
place_image(pdf, comparison.dig('base-screenshot', :url), options, 1)
|
88
|
+
place_image(pdf, comparison.dig('head-screenshot', :url), options, 2)
|
78
89
|
place_image(pdf, comparison.dig('base-screenshot', :url), options, 3)
|
79
90
|
place_image(pdf, comparison.dig('pdiff', :url), options, 3)
|
80
91
|
end
|
@@ -82,10 +93,15 @@ module FlashFlow
|
|
82
93
|
def place_image(pdf, url, options, column)
|
83
94
|
pdf.float do
|
84
95
|
options[:position] = (column - 1) * (@column_width + SPACE_BETWEEN)
|
85
|
-
pdf.image(
|
96
|
+
pdf.image(get_url_once(url), options)
|
86
97
|
end
|
87
98
|
end
|
88
99
|
|
100
|
+
def get_url_once(url)
|
101
|
+
@already_gotten_urls ||= {}
|
102
|
+
@already_gotten_urls[url] ||= open(url)
|
103
|
+
end
|
104
|
+
|
89
105
|
####################################
|
90
106
|
# #
|
91
107
|
# Methods to traverse Percy output #
|
@@ -93,14 +109,11 @@ module FlashFlow
|
|
93
109
|
####################################
|
94
110
|
|
95
111
|
def collect_comparison_info(compare_info, threshold=0.0)
|
96
|
-
[]
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
112
|
+
compare_info['data']
|
113
|
+
.select { |record| record['type'] == 'comparisons' }
|
114
|
+
.map { |record| get_comparison_info(record, compare_info) }
|
115
|
+
.select { |record| record&.dig('diff-ratio').to_f > threshold }
|
116
|
+
.sort { |a, b| b['diff-ratio'] <=> a['diff-ratio'] }
|
104
117
|
end
|
105
118
|
|
106
119
|
def get_comparison_info(record, data)
|
data/lib/flash_flow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flashfunders
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
298
|
version: '0'
|
299
299
|
requirements: []
|
300
300
|
rubyforge_project:
|
301
|
-
rubygems_version: 2.
|
301
|
+
rubygems_version: 2.6.9
|
302
302
|
signing_key:
|
303
303
|
specification_version: 4
|
304
304
|
summary: Implementation of the flashfunders workflow
|