sra2019 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sra2019.rb +34 -7
- metadata +22 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a1630217c7d4ee5a473b6ece8d7f9a53c05311ea6c46c802b0ed1261adde45f
|
4
|
+
data.tar.gz: 708dbf7e48829c70f368bf8746da56b1cac998cc624cb47516abb301309c809b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a919453361eb6cb6c6e46e2b28e135ac4d4597e51967c1c5dd3fbf6b533975aca4feb11aa918c2cc725af4a66be6da707cfc00eaecb0708395e9cf5a36b9eeaf
|
7
|
+
data.tar.gz: bb5a2ddf6a905234d29666702985a4908b4254d1844d5dc4ddb9507efca824685219a838cbc81626a974e368eefe23ff49d6f59c26d3b9a6cae9a17661d0449b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/sra2019.rb
CHANGED
@@ -6,15 +6,17 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
require 'rexle'
|
9
|
+
require 'base64'
|
9
10
|
require 'rxfhelper'
|
11
|
+
require "mini_magick"
|
10
12
|
require 'rexle-builder'
|
11
13
|
|
12
14
|
|
13
|
-
|
14
15
|
class StepsRecorderAnalyser
|
15
16
|
using ColouredText
|
16
17
|
|
17
18
|
attr_reader :steps
|
19
|
+
|
18
20
|
|
19
21
|
def initialize(s, debug: false)
|
20
22
|
|
@@ -78,13 +80,30 @@ class StepsRecorderAnalyser
|
|
78
80
|
|
79
81
|
Rexle.new(xml.to_a)
|
80
82
|
end
|
83
|
+
|
84
|
+
def extract_image(s, e)
|
85
|
+
|
86
|
+
y, x, w, h = e.text.split(',').map(&:to_i)
|
81
87
|
|
82
|
-
|
88
|
+
jpg_file = e.parent.element('ScreenshotFileName/text()')
|
89
|
+
img_data = s[/(?<=Content-Location: #{jpg_file}\r\n\r\n)[^--]+/m]
|
90
|
+
puts ('img_data: ' + img_data.inspect).debug if @debug
|
91
|
+
|
92
|
+
image = MiniMagick::Image.read Base64.decode64(img_data.rstrip)
|
93
|
+
|
94
|
+
# crop along the red boundary and remove the red boundary
|
95
|
+
image.crop "%sx%s+%s+%s" % [w - 5, h - 5, x + 3, y + 3]
|
96
|
+
image.to_blob
|
97
|
+
|
98
|
+
end
|
83
99
|
|
84
|
-
|
100
|
+
def parse_steps(s)
|
101
|
+
|
102
|
+
s2 = s[/Recording Session.*(?=<)/]
|
85
103
|
puts ('s: ' + s.inspect).debug if @debug
|
86
104
|
|
87
|
-
|
105
|
+
report = Rexle.new s[/<Report>.*<\/Report>/m]
|
106
|
+
raw_steps = s2.split(/(?=Step \d+:)/)
|
88
107
|
summary = raw_steps.shift
|
89
108
|
|
90
109
|
raw_steps.map do |entry|
|
@@ -94,18 +113,26 @@ class StepsRecorderAnalyser
|
|
94
113
|
keys = raw_keys ? raw_keys.gsub('...','').split : []
|
95
114
|
|
96
115
|
raw_comment = a[0][/User Comment: (.*)/,1]
|
116
|
+
|
117
|
+
n = a[0][/(?<=Step )\d+/]
|
118
|
+
puts ('n: ' + n.inspect).debug if @debug
|
97
119
|
|
98
120
|
if raw_comment then
|
121
|
+
|
99
122
|
|
123
|
+
e = report.root.element('UserActionData/RecordSession/EachAction' +
|
124
|
+
"[@ActionNumber='#{n}']/HighlightXYWH")
|
125
|
+
|
100
126
|
{
|
101
|
-
step:
|
102
|
-
user_comment: raw_comment.gsub(""",'"')
|
127
|
+
step: n,
|
128
|
+
user_comment: raw_comment.gsub(""",'"'),
|
129
|
+
screenshot: extract_image(s, e)
|
103
130
|
}
|
104
131
|
|
105
132
|
else
|
106
133
|
|
107
134
|
{
|
108
|
-
step:
|
135
|
+
step: n,
|
109
136
|
desc: a[0][/(?:Step \d+: )(.*)/,1].gsub(""",'"'),
|
110
137
|
keys: keys ,
|
111
138
|
program: a[1][/(?<=Program: ).*/],
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sra2019
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
YgXo0DU1HUhuKAAuA0aZdb6DV5BqgZx9e27CLIKqRk5P7TikW49mFaelQfSRi675
|
36
36
|
ugi0V/wkIOHFlKLS87IPnc09
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2019-04-
|
38
|
+
date: 2019-04-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rexle
|
@@ -57,6 +57,26 @@ dependencies:
|
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 1.5.1
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: mini_magick
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '4.9'
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 4.9.3
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '4.9'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 4.9.3
|
60
80
|
description:
|
61
81
|
email: james@jamesrobertson.eu
|
62
82
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|