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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cdde65c8beb37a6d21417b919fb8c113c86684bbf497e596721ef05ce8eefa7
4
- data.tar.gz: 67fe8a0ef11f76d10048ddd2b887ee7512df74b4cca5a4d226fbcb066769ed36
3
+ metadata.gz: 1a1630217c7d4ee5a473b6ece8d7f9a53c05311ea6c46c802b0ed1261adde45f
4
+ data.tar.gz: 708dbf7e48829c70f368bf8746da56b1cac998cc624cb47516abb301309c809b
5
5
  SHA512:
6
- metadata.gz: 4a44dbefc831f46bd0b6056ca5fa9b32b860eca9b1ca1669761427538f8af7dc942e61f312e0dfcb37a384e4156b1566e5ba570bf65c76e591c144d399cd8026
7
- data.tar.gz: 64611e6f9ac846085ea12f676f74cf46c7d39a08e1423eb7d43ff2575858b9871bebedbd0bdc5ccedc8af430972a705469d14cfe8dab93f12fe79ac3e18ac84b
6
+ metadata.gz: a919453361eb6cb6c6e46e2b28e135ac4d4597e51967c1c5dd3fbf6b533975aca4feb11aa918c2cc725af4a66be6da707cfc00eaecb0708395e9cf5a36b9eeaf
7
+ data.tar.gz: bb5a2ddf6a905234d29666702985a4908b4254d1844d5dc4ddb9507efca824685219a838cbc81626a974e368eefe23ff49d6f59c26d3b9a6cae9a17661d0449b
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- def parse_steps(s2)
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
- s = s2[/Recording Session.*(?=<)/]
100
+ def parse_steps(s)
101
+
102
+ s2 = s[/Recording Session.*(?=<)/]
85
103
  puts ('s: ' + s.inspect).debug if @debug
86
104
 
87
- raw_steps = s.split(/(?=Step \d+:)/)
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: a[0][/(?<=Step )\d+/],
102
- user_comment: raw_comment.gsub("&quot;",'"')
127
+ step: n,
128
+ user_comment: raw_comment.gsub("&quot;",'"'),
129
+ screenshot: extract_image(s, e)
103
130
  }
104
131
 
105
132
  else
106
133
 
107
134
  {
108
- step: a[0][/(?<=Step )\d+/],
135
+ step: n,
109
136
  desc: a[0][/(?:Step \d+: )(.*)/,1].gsub("&quot;",'"'),
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.2.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-21 00:00:00.000000000 Z
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