sra2019 0.3.0 → 0.4.0
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -1
- data/lib/sra2019.rb +93 -15
- metadata +6 -6
- 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: 4ca33bfd09172282c98624b31e6489a6c7205cca8085f924dacd2ff7cc01fcb1
|
4
|
+
data.tar.gz: 9898d125ea75459c0ff51972a7ad54a143acbebbc0a7681ff8d802852b2b498a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cda1d9493835d6a5f5e32ca464c43f1c865a04c41989712a18098118f62d11c76615a873cbc0686f6db1d9a29b418e5c144661b9bdf46e96fd3a030dc2a9b700
|
7
|
+
data.tar.gz: 61880dccd861672beedc105b038db731582058d0a17ee5fed8e9d73aecd1658e8b82d9f92b90a9d20c1fad2d13b3117f8f72803777e5773f6b6fbaa3f815d1d6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
��%�����F^��M��.#rP��r߉�W�Jǒ��&bq��*�ܐ��L
|
2
|
+
�gH�ѯ*ȉș��?��>��Pe2��}�(Ί�Y�ކ\c�p�9jy��{�aRo�S�k�-�=pL:eŢ4���q�0;=Q�����L`�7�+�?Yy��m��Z�R/���W�ŴX/��,�[��|eUn)H�����
|
data/lib/sra2019.rb
CHANGED
@@ -5,10 +5,12 @@
|
|
5
5
|
# description: Steps Recorder (MS Windows) Analyser 2019
|
6
6
|
|
7
7
|
|
8
|
+
require 'hlt'
|
9
|
+
require 'zip'
|
8
10
|
require 'rexle'
|
9
11
|
require 'base64'
|
10
12
|
require 'rxfhelper'
|
11
|
-
require
|
13
|
+
require 'mini_magick'
|
12
14
|
require 'rexle-builder'
|
13
15
|
|
14
16
|
|
@@ -18,13 +20,15 @@ class StepsRecorderAnalyser
|
|
18
20
|
attr_reader :steps
|
19
21
|
|
20
22
|
|
21
|
-
def initialize(s, debug: false)
|
23
|
+
def initialize(s, debug: false, savepath: '/tmp', title: 'Untitled')
|
22
24
|
|
23
|
-
@debug = debug
|
25
|
+
@savepath, @title, @debug = savepath, title, debug
|
24
26
|
content = RXFHelper.read(s).first
|
25
27
|
puts ('content: ' + content.inspect).debug if @debug
|
26
|
-
|
27
|
-
|
28
|
+
|
29
|
+
all_steps = parse_steps content
|
30
|
+
@doc = build all_steps
|
31
|
+
@steps = all_steps.select {|x| x[:user_comment]}
|
28
32
|
|
29
33
|
end
|
30
34
|
|
@@ -34,6 +38,80 @@ class StepsRecorderAnalyser
|
|
34
38
|
@doc.xml options
|
35
39
|
|
36
40
|
end
|
41
|
+
|
42
|
+
def to_html(targetdir='sra' + Time.now.to_i.to_s)
|
43
|
+
|
44
|
+
# save the image files to a file directory.
|
45
|
+
# name the sub-directory using the date and time?
|
46
|
+
|
47
|
+
filepath = File.join(@savepath, targetdir)
|
48
|
+
imgpath = File.join(filepath, 'images')
|
49
|
+
csspath = File.join(filepath, 'css')
|
50
|
+
|
51
|
+
[filepath, imgpath, csspath].each {|x| FileUtils.mkdir x}
|
52
|
+
|
53
|
+
@steps.each.with_index do |x, i|
|
54
|
+
|
55
|
+
File.open(File.join(imgpath, "screenshot#{i}.jpg" ), 'wb') \
|
56
|
+
{|f| f.write(x[:screenshot]) }
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
rows = @steps.map.with_index do |x, i|
|
62
|
+
|
63
|
+
li = "
|
64
|
+
li
|
65
|
+
markdown:
|
66
|
+
#{x[:user_comment]}
|
67
|
+
|
68
|
+

|
69
|
+
"
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
html=<<EOF
|
74
|
+
html
|
75
|
+
head
|
76
|
+
title #{@title}: #{@steps.length} Steps (with Pictures)
|
77
|
+
link rel='stylesheet' type='text/css' href='css/layout.css' media='screen, projection, tv'
|
78
|
+
link rel='stylesheet' type='text/css' href='css/style.css' media='screen, projection, tv'
|
79
|
+
link rel='stylesheet' type='text/css' href='css/print.css' media='print'
|
80
|
+
body
|
81
|
+
h1 #{@title}
|
82
|
+
|
83
|
+
ol
|
84
|
+
#{rows.join("\n").lstrip}
|
85
|
+
EOF
|
86
|
+
|
87
|
+
html = Rexle.new(Hlt.new(html).to_html)\
|
88
|
+
.root.element('html').xml pretty: true
|
89
|
+
File.write File.join(filepath, 'index.html'), html
|
90
|
+
|
91
|
+
%w(layout style print).each \
|
92
|
+
{|x| File.write File.join(csspath, "%s.css" % x), ''}
|
93
|
+
|
94
|
+
'saved'
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
# not yet working properly
|
99
|
+
#
|
100
|
+
def to_zip()
|
101
|
+
|
102
|
+
project = 'sra' + Time.now.to_i.to_s
|
103
|
+
newdir = project
|
104
|
+
zipfile = project + '.zip'
|
105
|
+
|
106
|
+
to_html(newdir)
|
107
|
+
|
108
|
+
Zip::ZipFile.open(zipfile, Zip::ZipFile::CREATE) do |x|
|
109
|
+
x.add(project, File.join(@savepath, project))
|
110
|
+
end
|
111
|
+
|
112
|
+
'saved to ' + File.join(@savepath, zipfile)
|
113
|
+
|
114
|
+
end
|
37
115
|
|
38
116
|
private
|
39
117
|
|
@@ -81,8 +159,13 @@ class StepsRecorderAnalyser
|
|
81
159
|
Rexle.new(xml.to_a)
|
82
160
|
end
|
83
161
|
|
84
|
-
def extract_image(s,
|
85
|
-
|
162
|
+
def extract_image(s, n)
|
163
|
+
|
164
|
+
report = Rexle.new s[/<Report>.*<\/Report>/m]
|
165
|
+
|
166
|
+
e = report.root.element('UserActionData/RecordSession/EachAction' +
|
167
|
+
"[@ActionNumber='#{n}']/HighlightXYWH")
|
168
|
+
|
86
169
|
y, x, w, h = e.text.split(',').map(&:to_i)
|
87
170
|
|
88
171
|
jpg_file = e.parent.element('ScreenshotFileName/text()')
|
@@ -102,7 +185,6 @@ class StepsRecorderAnalyser
|
|
102
185
|
s2 = s[/Recording Session.*(?=<)/]
|
103
186
|
puts ('s: ' + s.inspect).debug if @debug
|
104
187
|
|
105
|
-
report = Rexle.new s[/<Report>.*<\/Report>/m]
|
106
188
|
raw_steps = s2.split(/(?=Step \d+:)/)
|
107
189
|
summary = raw_steps.shift
|
108
190
|
|
@@ -117,16 +199,12 @@ class StepsRecorderAnalyser
|
|
117
199
|
n = a[0][/(?<=Step )\d+/]
|
118
200
|
puts ('n: ' + n.inspect).debug if @debug
|
119
201
|
|
120
|
-
if raw_comment then
|
121
|
-
|
122
|
-
|
123
|
-
e = report.root.element('UserActionData/RecordSession/EachAction' +
|
124
|
-
"[@ActionNumber='#{n}']/HighlightXYWH")
|
202
|
+
if raw_comment then
|
125
203
|
|
126
204
|
{
|
127
205
|
step: n,
|
128
|
-
user_comment: raw_comment.gsub(""",'
|
129
|
-
screenshot: extract_image(s,
|
206
|
+
user_comment: raw_comment.gsub(""",''),
|
207
|
+
screenshot: extract_image(s, n)
|
130
208
|
}
|
131
209
|
|
132
210
|
else
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -38,25 +38,25 @@ cert_chain:
|
|
38
38
|
date: 2019-04-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: hlt
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '0.6'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 0.6.3
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '0.6'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 0.6.3
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: mini_magick
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|