sra2019 0.5.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c218936c612857dcb565b574d4f1389b13a8c4ac38a53a37d85f0142b29db28
4
- data.tar.gz: b0b015c92aa5edaac4b6e192280f19fb79a19bb664be5931e60d8b0b071b2631
3
+ metadata.gz: f6d80258051ebf745f12d63277fa418945b747e4143cddfdb9ae14fd59d8a7cf
4
+ data.tar.gz: 62d9f9565ac94cff85a4c4177c3ffac2e166c7c945754aa1570382a45f221002
5
5
  SHA512:
6
- metadata.gz: '09f230999dd5325b870cc3d79176dc8bb021494d56772c0418fbfb22383ed3896ed615326b5499118227bca771c3d3d954a08760da5759729b785fc31ffdc321'
7
- data.tar.gz: 375ba62df0f925740216880a929518bcf7d3346b0789fcf3e3d58d09e9c38efb16865b82b2e85100f43f03c44ccb2bc23d69b947f38fc509d2b761d78de9e3e7
6
+ metadata.gz: 8da13a1cf115f3c94899df1372100300f17434997abeaeeecf59abda9775b96a2bb06f065c73789f4d1998dfaa143ee29a53ae3abd67853600713ab713f05a93
7
+ data.tar.gz: 568778997ef54ccbb817f56700c388d8ab491cadf6d34c88aaef017d4c0624feb166a141a87cc2a7e77ffb56687ca71447e2a532c529c50bc7b96941abec2d78
Binary file
data.tar.gz.sig CHANGED
@@ -1,3 +1 @@
1
- �+�ha�4ߧ)t*��G���<d�~�Vbx��_�ڵ� 9��~����͠�=�<��FMZ1��)u=�fVV�<��h8i<��
2
- R��S��5���Q,
3
- *_��VHn�g�hם2��H�g3I�� &\�*����K։�H��5`�C}�t� �+(5:��9F�@�M4y� *��3��ޅA�i����/x!v$B�i�`s�M�V�ǯN�^�6��7����[�ь��b:OO�+��F�d��'֥@Nk�S�/r�i�?��vU�i�*�D�K�?cA�7|c�'��^���k�
1
+ o��Q~��Qy�&��n����pH.�X�!�%d�6��>�pP&#���8��OJc���(��۾ȉ��{��,1�1�7�Y��v�ߡW�����vo�}9:L���:� ��'Bܤ���WWE�KXQ��C����^񆧑AJ'�2MQ�r\�*���D�C�|�ƈ������3��#��|��o73�l0w��~�re�^�q��"\���# x���H>��*/Yw��.$x<�� u��l.qE��6,f4
@@ -8,6 +8,7 @@
8
8
  require 'hlt'
9
9
  require 'rexle'
10
10
  require 'base64'
11
+ require 'zip/zip'
11
12
  require 'rxfhelper'
12
13
  require 'wicked_pdf'
13
14
  require 'mini_magick'
@@ -16,7 +17,6 @@ require 'rexle-builder'
16
17
 
17
18
 
18
19
 
19
-
20
20
  class StepsRecorderAnalyser
21
21
  using ColouredText
22
22
 
@@ -26,7 +26,15 @@ class StepsRecorderAnalyser
26
26
  def initialize(s, debug: false, savepath: '/tmp', title: 'Untitled')
27
27
 
28
28
  @savepath, @title, @debug = savepath, title, debug
29
- content = RXFHelper.read(s).first
29
+
30
+ raw_content, type = RXFHelper.read(s)
31
+
32
+ content = if type == :file and File.extname(s) == '.zip' then
33
+ Zip::ZipFile.new(s).instance_eval {read(to_a[0].name)}
34
+ else
35
+ raw_content
36
+ end
37
+
30
38
  puts ('content: ' + content.inspect).debug if @debug
31
39
 
32
40
  all_steps = parse_steps content
@@ -101,30 +109,28 @@ EOF
101
109
  @sliml
102
110
  end
103
111
 
104
- def to_pdf()
112
+ def to_pdf(pdf_file=File.join(@savepath, 'sra' + Time.now.to_i.to_s,
113
+ @title.gsub(/ /,'-') + '.pdf'))
105
114
 
106
- project = 'sra' + Time.now.to_i.to_s
107
- newdir = project
108
- pdf_file = File.join(@savepath, project, @title.gsub(/ /,'-') + '.pdf')
109
- html_file = File.join(@savepath, project, 'index.html')
115
+ dir = File.dirname(pdf_file)
116
+ html_file = File.join(dir, 'index.html')
110
117
 
111
- to_html(newdir)
118
+ to_html(dir)
112
119
  pdf = WickedPdf.new.pdf_from_html_file(html_file)
113
120
  File.write pdf_file, pdf
114
121
 
115
122
  end
116
123
 
117
- # not yet working properly
118
- #
124
+
119
125
  def to_zip()
120
126
 
121
127
  project = 'sra' + Time.now.to_i.to_s
122
128
  newdir = File.join(@savepath, project)
123
- zipfile = File.join(@savepath, project + '.zip')
129
+ zipfile = newdir + '.zip'
124
130
 
125
- to_html(newdir)
131
+ to_pdf(File.join(newdir, @title.gsub(/ /,'-') + '.pdf'))
126
132
 
127
- Archive::Zip.archive(zipfile, File.join(@savepath, project))
133
+ Archive::Zip.archive(zipfile, newdir)
128
134
 
129
135
  'saved to ' + zipfile
130
136
 
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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file