creeker 2.1.2 → 2.1.3

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
  SHA1:
3
- metadata.gz: af4d420c04fe635845353edf92b12ec3afe810b4
4
- data.tar.gz: d14f45bbdfc6b13eddb97d020569e63ae5f5d8dc
3
+ metadata.gz: 90abfebb786387b1b3263bd1c3f42f6008838321
4
+ data.tar.gz: b5cebc6dc4073c4106e7dd6199b2437ed21aee25
5
5
  SHA512:
6
- metadata.gz: dc80c89452bb6f35e02e3fda5b6bc97352ea8a138cc50351ecbda7f9bda8adc511c6b106d463c5b814c998976571306873c0e25b4837abf30a8bcc707cd556ff
7
- data.tar.gz: 0a9e4f3cfe8ced82516bad82534c5e7bb216d9b342526967652ea0a04745b61e6d631a50270648b9d4daaf60dcd67b35540291638db6e059089dc79be058a2bf
6
+ metadata.gz: 22b01bbc8bea7cfa6c959dcf40183eea7ac5a2b92a9386f8f19ec211394cd55c693a094aafd2a0f756ac202a9d0482e78d27cf82d42ed5a0a308d0fc55f71543
7
+ data.tar.gz: 88ec7a6283451313aebc0a033dadfade51d3d1f91bae73417ddfafb8bf552cb70f31701de6da46dede61b6800242348572b82d08f9209acd25b51b7acfb82fbd
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in creek.gemspec
4
+ gemspec
data/creeker.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'creeker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "creeker"
8
+ spec.version = Creeker::VERSION
9
+ spec.authors = ["huntcode"]
10
+ spec.email = ["vivektripathi_cse@hotmail.com"]
11
+ spec.description = %q{A Ruby gem that streams and parses large Excel(xlsx and xlsm) files fast and efficiently. Based on Creek gem, but with Multi-threading and Garbage Collection}
12
+ spec.summary = %q{A Ruby gem for parsing large Excel(xlsx and xlsm) files.}
13
+ spec.homepage = "https://github.com/vivektripathihunt/creeker"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '>= 2.0.0'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency 'rspec', '~> 3.6.0'
26
+ spec.add_development_dependency 'pry'
27
+
28
+ spec.add_dependency 'nokogiri', '>= 1.7.0'
29
+ spec.add_dependency 'rubyzip', '>= 1.0.0'
30
+ spec.add_dependency 'httparty', '~> 0.15.5'
31
+ end
data/lib/.DS_Store ADDED
Binary file
@@ -1,3 +1,3 @@
1
1
  module Creeker
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.3"
3
3
  end
@@ -0,0 +1,52 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe 'drawing' do
4
+ let(:book) { Creeker::Book.new('spec/fixtures/sample-with-images.xlsx') }
5
+ let(:book_no_images) { Creeker::Book.new('spec/fixtures/sample.xlsx') }
6
+ let(:drawingfile) { 'xl/drawings/drawing1.xml' }
7
+ let(:drawing) { Creeker::Drawing.new(book, drawingfile) }
8
+ let(:drawing_without_images) { Creeker::Drawing.new(book_no_images, drawingfile) }
9
+
10
+ describe '#has_images?' do
11
+ it 'has' do
12
+ expect(drawing.has_images?).to eq(true)
13
+ end
14
+
15
+ it 'does not have' do
16
+ expect(drawing_without_images.has_images?).to eq(false)
17
+ end
18
+ end
19
+
20
+ describe '#images_at' do
21
+ it 'returns images pathnames at cell' do
22
+ image = drawing.images_at('A2')[0]
23
+ expect(image.class).to eq(Pathname)
24
+ expect(image.exist?).to eq(true)
25
+ expect(image.to_path).to match(/.+creeker__drawing.+\.jpeg$/)
26
+ end
27
+
28
+ context 'when no images in cell' do
29
+ it 'returns nil' do
30
+ images = drawing.images_at('B2')
31
+ expect(images).to eq(nil)
32
+ end
33
+ end
34
+
35
+ context 'when more images in one cell' do
36
+ it 'returns all images at cell' do
37
+ images = drawing.images_at('A10')
38
+ expect(images.size).to eq(2)
39
+ expect(images.all?(&:exist?)).to eq(true)
40
+ end
41
+ end
42
+
43
+ context 'when same image across multiple cells' do
44
+ it 'returns same image for each cell' do
45
+ image1 = drawing.images_at('A4')[0]
46
+ image2 = drawing.images_at('A5')[0]
47
+ expect(image1.class).to eq(Pathname)
48
+ expect(image1).to eq(image2)
49
+ end
50
+ end
51
+ end
52
+ end
File without changes
Binary file
Binary file
@@ -0,0 +1,459 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
3
+ <sheetPr filterMode="false">
4
+ <pageSetUpPr fitToPage="false" />
5
+ </sheetPr>
6
+ <dimension ref="A1:FN2755" />
7
+ <sheetViews>
8
+ <sheetView windowProtection="true" showFormulas="false" showGridLines="true" showRowColHeaders="true" showZeros="true" rightToLeft="false" tabSelected="true" showOutlineSymbols="true" defaultGridColor="true" view="normal" topLeftCell="A1" colorId="64" zoomScale="75" zoomScaleNormal="75" zoomScalePageLayoutView="100" workbookViewId="0">
9
+ <pane xSplit="0" ySplit="1" topLeftCell="L2" activePane="bottomLeft" state="frozen" />
10
+ <selection pane="topLeft" activeCell="A1" activeCellId="0" sqref="A1" />
11
+ <selection pane="bottomLeft" activeCell="A2" activeCellId="0" sqref="A2" />
12
+ </sheetView>
13
+ </sheetViews>
14
+ <sheetFormatPr defaultRowHeight="13.8"></sheetFormatPr>
15
+ <cols>
16
+ <col collapsed="false" hidden="false" max="1" min="1" style="0" width="48.5023255813954" />
17
+ <col collapsed="false" hidden="false" max="2" min="2" style="0" width="11.6651162790698" />
18
+ <col collapsed="false" hidden="false" max="3" min="3" style="0" width="15.6604651162791" />
19
+ <col collapsed="false" hidden="false" max="5" min="4" style="0" width="11.6651162790698" />
20
+ <col collapsed="false" hidden="false" max="6" min="6" style="0" width="12.5023255813953" />
21
+ <col collapsed="false" hidden="false" max="9" min="7" style="0" width="11.6651162790698" />
22
+ <col collapsed="false" hidden="false" max="10" min="10" style="0" width="15.8325581395349" />
23
+ <col collapsed="false" hidden="false" max="11" min="11" style="0" width="17.6651162790698" />
24
+ <col collapsed="false" hidden="false" max="42" min="12" style="0" width="11.3302325581395" />
25
+ <col collapsed="false" hidden="false" max="47" min="43" style="0" width="13.0046511627907" />
26
+ <col collapsed="false" hidden="false" max="49" min="48" style="0" width="5.9953488372093" />
27
+ <col collapsed="false" hidden="false" max="50" min="50" style="0" width="4.83255813953488" />
28
+ <col collapsed="false" hidden="false" max="81" min="51" style="0" width="11.3302325581395" />
29
+ <col collapsed="false" hidden="false" max="86" min="82" style="0" width="13.0046511627907" />
30
+ <col collapsed="false" hidden="false" max="1025" min="87" style="0" width="10.8279069767442" />
31
+ </cols>
32
+ <sheetData>
33
+ <row r="1" s="2" customFormat="true" ht="39.75" hidden="false" customHeight="true" outlineLevel="0" collapsed="false">
34
+ <c r="A1" s="1" t="s">
35
+ <v>0</v>
36
+ </c>
37
+ <c r="B1" s="1" t="s">
38
+ <v>1</v>
39
+ </c>
40
+ <c r="C1" s="1" t="s">
41
+ <v>2</v>
42
+ </c>
43
+ <c r="D1" s="1" t="s">
44
+ <v>1</v>
45
+ </c>
46
+ <c r="E1" s="1" t="s">
47
+ <v>2</v>
48
+ </c>
49
+ <c r="F1" s="1" t="s">
50
+ <v>1</v>
51
+ </c>
52
+ <c r="G1" s="1" t="s">
53
+ <v>2</v>
54
+ </c>
55
+ <c r="H1" s="1" t="s">
56
+ <v>1</v>
57
+ </c>
58
+ <c r="I1" s="1" t="s">
59
+ <v>2</v>
60
+ </c>
61
+ <c r="L1" s="3" t="n">
62
+ <v>41275</v>
63
+ </c>
64
+ <c r="M1" s="3" t="n">
65
+ <v>41306</v>
66
+ </c>
67
+ <c r="N1" s="3" t="n">
68
+ <v>41334</v>
69
+ </c>
70
+ <c r="O1" s="3" t="n">
71
+ <v>41365</v>
72
+ </c>
73
+ <c r="P1" s="3" t="n">
74
+ <v>41395</v>
75
+ </c>
76
+ <c r="Q1" s="3" t="n">
77
+ <v>41426</v>
78
+ </c>
79
+ <c r="R1" s="3" t="n">
80
+ <v>41456</v>
81
+ </c>
82
+ <c r="S1" s="3" t="n">
83
+ <v>41487</v>
84
+ </c>
85
+ <c r="T1" s="3" t="n">
86
+ <v>41518</v>
87
+ </c>
88
+ <c r="U1" s="3" t="n">
89
+ <v>41548</v>
90
+ </c>
91
+ <c r="V1" s="3" t="n">
92
+ <v>41579</v>
93
+ </c>
94
+ <c r="W1" s="3" t="n">
95
+ <v>41609</v>
96
+ </c>
97
+ <c r="X1" s="3" t="n">
98
+ <v>41640</v>
99
+ </c>
100
+ <c r="Y1" s="3" t="n">
101
+ <v>41671</v>
102
+ </c>
103
+ <c r="Z1" s="3" t="n">
104
+ <v>41699</v>
105
+ </c>
106
+ <c r="AA1" s="3" t="n">
107
+ <v>41730</v>
108
+ </c>
109
+ <c r="AB1" s="3" t="n">
110
+ <v>41760</v>
111
+ </c>
112
+ <c r="AC1" s="3" t="n">
113
+ <v>41791</v>
114
+ </c>
115
+ <c r="AD1" s="3" t="n">
116
+ <v>41821</v>
117
+ </c>
118
+ <c r="AE1" s="3" t="n">
119
+ <v>41852</v>
120
+ </c>
121
+ <c r="AF1" s="3" t="n">
122
+ <v>41883</v>
123
+ </c>
124
+ <c r="AG1" s="3" t="n">
125
+ <v>41913</v>
126
+ </c>
127
+ <c r="AH1" s="3" t="n">
128
+ <v>41944</v>
129
+ </c>
130
+ <c r="AI1" s="3" t="n">
131
+ <v>41974</v>
132
+ </c>
133
+ <c r="AJ1" s="3" t="n">
134
+ <v>42005</v>
135
+ </c>
136
+ <c r="AK1" s="3" t="n">
137
+ <v>42036</v>
138
+ </c>
139
+ <c r="AL1" s="3" t="n">
140
+ <v>42064</v>
141
+ </c>
142
+ <c r="AM1" s="3" t="n">
143
+ <v>42095</v>
144
+ </c>
145
+ <c r="AN1" s="3" t="n">
146
+ <v>42125</v>
147
+ </c>
148
+ <c r="AO1" s="3" t="n">
149
+ <v>42156</v>
150
+ </c>
151
+ <c r="AP1" s="3" />
152
+ <c r="AQ1" s="3" />
153
+ <c r="AR1" s="3" />
154
+ <c r="AS1" s="3" />
155
+ <c r="AT1" s="3" />
156
+ <c r="AU1" s="3" />
157
+ <c r="AY1" s="3" />
158
+ <c r="AZ1" s="3" />
159
+ <c r="BA1" s="3" />
160
+ <c r="BB1" s="3" />
161
+ <c r="BC1" s="3" />
162
+ <c r="BD1" s="3" />
163
+ <c r="BE1" s="3" />
164
+ <c r="BF1" s="3" />
165
+ <c r="BG1" s="3" />
166
+ <c r="BH1" s="3" />
167
+ <c r="BI1" s="3" />
168
+ <c r="BJ1" s="3" />
169
+ <c r="BK1" s="3" />
170
+ <c r="BL1" s="3" />
171
+ <c r="BM1" s="3" />
172
+ <c r="BN1" s="3" />
173
+ <c r="BO1" s="3" />
174
+ <c r="BP1" s="3" />
175
+ <c r="BQ1" s="3" />
176
+ <c r="BR1" s="3" />
177
+ <c r="BS1" s="3" />
178
+ <c r="BT1" s="3" />
179
+ <c r="BU1" s="3" />
180
+ <c r="BV1" s="3" />
181
+ <c r="BW1" s="3" />
182
+ <c r="BX1" s="3" />
183
+ <c r="BY1" s="3" />
184
+ <c r="BZ1" s="3" />
185
+ <c r="CA1" s="3" />
186
+ <c r="CB1" s="3" />
187
+ <c r="CC1" s="3" />
188
+ <c r="CD1" s="3" />
189
+ <c r="CE1" s="3" />
190
+ <c r="CF1" s="3" />
191
+ <c r="CG1" s="3" />
192
+ <c r="CH1" s="3" />
193
+ <c r="CI1" s="3" />
194
+ <c r="CJ1" s="3" />
195
+ <c r="CK1" s="3" />
196
+ <c r="CL1" s="3" />
197
+ <c r="CM1" s="3" />
198
+ <c r="CN1" s="3" />
199
+ <c r="CO1" s="3" />
200
+ <c r="CP1" s="3" />
201
+ <c r="CQ1" s="3" />
202
+ <c r="CR1" s="3" />
203
+ <c r="CS1" s="3" />
204
+ <c r="CT1" s="3" />
205
+ <c r="CU1" s="3" />
206
+ <c r="CV1" s="3" />
207
+ <c r="CW1" s="3" />
208
+ <c r="CX1" s="3" />
209
+ <c r="CY1" s="3" />
210
+ <c r="CZ1" s="3" />
211
+ <c r="DA1" s="3" />
212
+ <c r="DB1" s="3" />
213
+ <c r="DC1" s="3" />
214
+ <c r="DD1" s="3" />
215
+ <c r="DE1" s="3" />
216
+ <c r="DF1" s="3" />
217
+ <c r="DG1" s="3" />
218
+ <c r="DH1" s="3" />
219
+ <c r="DI1" s="3" />
220
+ <c r="DJ1" s="3" />
221
+ <c r="DK1" s="3" />
222
+ <c r="DL1" s="3" />
223
+ <c r="DM1" s="3" />
224
+ <c r="DN1" s="3" />
225
+ <c r="DO1" s="3" />
226
+ <c r="DP1" s="3" />
227
+ <c r="DQ1" s="3" />
228
+ <c r="DR1" s="3" />
229
+ <c r="DS1" s="3" />
230
+ <c r="DT1" s="3" />
231
+ <c r="DU1" s="3" />
232
+ <c r="DV1" s="3" />
233
+ <c r="DW1" s="3" />
234
+ <c r="DX1" s="3" />
235
+ <c r="DY1" s="3" />
236
+ <c r="DZ1" s="3" />
237
+ <c r="EA1" s="3" />
238
+ <c r="EB1" s="3" />
239
+ <c r="EC1" s="3" />
240
+ <c r="ED1" s="3" />
241
+ <c r="EE1" s="3" />
242
+ <c r="EF1" s="3" />
243
+ <c r="EG1" s="3" />
244
+ <c r="EH1" s="3" />
245
+ <c r="EI1" s="3" />
246
+ <c r="EJ1" s="3" />
247
+ <c r="EK1" s="3" />
248
+ <c r="EL1" s="3" />
249
+ <c r="EM1" s="3" />
250
+ <c r="EN1" s="3" />
251
+ <c r="EO1" s="3" />
252
+ <c r="EP1" s="3" />
253
+ <c r="EQ1" s="3" />
254
+ <c r="ER1" s="3" />
255
+ <c r="ES1" s="3" />
256
+ <c r="ET1" s="3" />
257
+ <c r="EU1" s="3" />
258
+ <c r="EV1" s="3" />
259
+ <c r="EW1" s="3" />
260
+ <c r="EX1" s="3" />
261
+ <c r="EY1" s="3" />
262
+ <c r="EZ1" s="3" />
263
+ <c r="FA1" s="3" />
264
+ <c r="FB1" s="3" />
265
+ <c r="FC1" s="3" />
266
+ <c r="FD1" s="3" />
267
+ <c r="FE1" s="3" />
268
+ <c r="FF1" s="3" />
269
+ <c r="FG1" s="3" />
270
+ <c r="FH1" s="3" />
271
+ <c r="FI1" s="3" />
272
+ <c r="FJ1" s="3" />
273
+ <c r="FK1" s="3" />
274
+ <c r="FL1" s="3" />
275
+ <c r="FM1" s="3" />
276
+ <c r="FN1" s="3" />
277
+ </row>
278
+ <row r="2" s="7" customFormat="true" ht="13.9" hidden="false" customHeight="false" outlineLevel="0" collapsed="false">
279
+ <c r="A2" s="4" t="s">
280
+ <v>3</v>
281
+ </c>
282
+ <c r="B2" s="5" t="s">
283
+ <v>4</v>
284
+ </c>
285
+ <c r="C2" s="5" t="s">
286
+ <v>5</v>
287
+ </c>
288
+ <c r="D2" s="5" t="s">
289
+ <v>6</v>
290
+ </c>
291
+ <c r="E2" s="5" t="s">
292
+ <v>7</v>
293
+ </c>
294
+ <c r="F2" s="5" t="s">
295
+ <v>8</v>
296
+ </c>
297
+ <c r="G2" s="5" t="s">
298
+ <v>9</v>
299
+ </c>
300
+ <c r="H2" s="5" t="s">
301
+ <v>10</v>
302
+ </c>
303
+ <c r="I2" s="5" t="s">
304
+ <v>11</v>
305
+ </c>
306
+ <c r="J2" s="0" />
307
+ <c r="K2" s="0" />
308
+ <c r="L2" s="0" t="n">
309
+ <v>31.27</v>
310
+ </c>
311
+ <c r="M2" s="0" t="n">
312
+ <v>46.05</v>
313
+ </c>
314
+ <c r="N2" s="0" t="n">
315
+ <v>29</v>
316
+ </c>
317
+ <c r="O2" s="0" t="n">
318
+ <v>26.13</v>
319
+ </c>
320
+ <c r="P2" s="0" t="n">
321
+ <v>11.64</v>
322
+ </c>
323
+ <c r="Q2" s="0" t="n">
324
+ <v>34.31</v>
325
+ </c>
326
+ <c r="R2" s="0" t="n">
327
+ <v>25.78</v>
328
+ </c>
329
+ <c r="S2" s="0" t="n">
330
+ <v>33.49</v>
331
+ </c>
332
+ <c r="T2" s="0" t="n">
333
+ <v>28.2</v>
334
+ </c>
335
+ <c r="U2" s="0" t="n">
336
+ <v>46.54</v>
337
+ </c>
338
+ <c r="V2" s="0" t="n">
339
+ <v>12.88</v>
340
+ </c>
341
+ <c r="W2" s="0" t="n">
342
+ <v>38.69</v>
343
+ </c>
344
+ <c r="X2" s="0" t="n">
345
+ <v>36.97</v>
346
+ </c>
347
+ <c r="Y2" s="0" t="n">
348
+ <v>42.26</v>
349
+ </c>
350
+ <c r="Z2" s="0" t="n">
351
+ <v>39.45</v>
352
+ </c>
353
+ <c r="AA2" s="0" t="n">
354
+ <v>29.01</v>
355
+ </c>
356
+ <c r="AB2" s="0" t="n">
357
+ <v>20.2</v>
358
+ </c>
359
+ <c r="AC2" s="0" t="n">
360
+ <v>46.42</v>
361
+ </c>
362
+ <c r="AD2" s="0" t="n">
363
+ <v>22.45</v>
364
+ </c>
365
+ <c r="AE2" s="0" t="n">
366
+ <v>14.35</v>
367
+ </c>
368
+ <c r="AF2" s="0" t="n">
369
+ <v>39.36</v>
370
+ </c>
371
+ <c r="AG2" s="0" t="n">
372
+ <v>21.28</v>
373
+ </c>
374
+ <c r="AH2" s="0" t="n">
375
+ <v>14.19</v>
376
+ </c>
377
+ <c r="AI2" s="0" t="n">
378
+ <v>34.57</v>
379
+ </c>
380
+ <c r="AJ2" s="6" t="n">
381
+ <v>11.64</v>
382
+ </c>
383
+ <c r="AK2" s="6" t="n">
384
+ <v>34.31</v>
385
+ </c>
386
+ <c r="AL2" s="6" t="n">
387
+ <v>11.64</v>
388
+ </c>
389
+ <c r="AM2" s="6" t="n">
390
+ <v>11.64</v>
391
+ </c>
392
+ <c r="AN2" s="6" t="n">
393
+ <v>34.31</v>
394
+ </c>
395
+ <c r="AO2" s="6" t="n">
396
+ <v>25.78</v>
397
+ </c>
398
+ <c r="AP2" s="6" />
399
+ <c r="AQ2" s="0" />
400
+ <c r="AR2" s="0" />
401
+ <c r="AS2" s="0" />
402
+ <c r="AT2" s="0" />
403
+ <c r="AU2" s="0" />
404
+ <c r="AV2" s="0" />
405
+ <c r="AW2" s="0" />
406
+ <c r="AX2" s="0" />
407
+ <c r="AY2" s="0" />
408
+ <c r="AZ2" s="0" />
409
+ <c r="BA2" s="0" />
410
+ <c r="BB2" s="0" />
411
+ <c r="BC2" s="0" />
412
+ <c r="BD2" s="0" />
413
+ <c r="BE2" s="0" />
414
+ <c r="BF2" s="0" />
415
+ <c r="BG2" s="0" />
416
+ <c r="BH2" s="0" />
417
+ <c r="BI2" s="0" />
418
+ <c r="BJ2" s="0" />
419
+ <c r="BK2" s="0" />
420
+ <c r="BL2" s="0" />
421
+ <c r="BM2" s="0" />
422
+ <c r="BN2" s="0" />
423
+ <c r="BO2" s="0" />
424
+ <c r="BP2" s="0" />
425
+ <c r="BQ2" s="0" />
426
+ <c r="BR2" s="0" />
427
+ <c r="BS2" s="0" />
428
+ <c r="BT2" s="0" />
429
+ <c r="BU2" s="0" />
430
+ <c r="BV2" s="0" />
431
+ <c r="BW2" s="6" />
432
+ <c r="BX2" s="6" />
433
+ <c r="BY2" s="6" />
434
+ <c r="BZ2" s="6" />
435
+ <c r="CA2" s="6" />
436
+ <c r="CB2" s="6" />
437
+ <c r="CC2" s="6" />
438
+ <c r="CD2" s="0" />
439
+ </row>
440
+ <row r="2755" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
441
+ <row r="2756" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
442
+ <row r="2757" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
443
+ <row r="2758" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
444
+ <row r="2759" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
445
+ <row r="2760" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
446
+ <row r="2761" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
447
+ <row r="2762" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
448
+ <row r="2763" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
449
+ <row r="2764" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
450
+ <row r="2765" customFormat="false" ht="13" hidden="false" customHeight="true" outlineLevel="0" collapsed="false"></row>
451
+ </sheetData>
452
+ <printOptions headings="false" gridLines="false" gridLinesSet="true" horizontalCentered="false" verticalCentered="false" />
453
+ <pageMargins left="0.7" right="0.7" top="0.7875" bottom="0.7875" header="0.511805555555555" footer="0.511805555555555" />
454
+ <pageSetup paperSize="9" scale="100" firstPageNumber="0" fitToWidth="1" fitToHeight="1" pageOrder="downThenOver" orientation="portrait" usePrinterDefaults="false" blackAndWhite="false" draft="false" cellComments="none" useFirstPageNumber="false" horizontalDpi="300" verticalDpi="300" copies="1" />
455
+ <headerFooter differentFirst="false" differentOddEven="false">
456
+ <oddHeader></oddHeader>
457
+ <oddFooter></oddFooter>
458
+ </headerFooter>
459
+ </worksheet>
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="6" uniqueCount="5">
3
+ <si>
4
+ <t>Cell A1</t>
5
+ </si>
6
+ <si>
7
+ <t>Cell B1</t>
8
+ </si>
9
+ <si>
10
+ <t>My Cell</t>
11
+ </si>
12
+ <si>
13
+ <r>
14
+ <rPr>
15
+ <sz val="11"/>
16
+ <color rgb="FFFF0000"/>
17
+ <rFont val="Calibri"/>
18
+ <family val="2"/>
19
+ <scheme val="minor"/>
20
+ </rPr>
21
+ <t>Cell</t>
22
+ </r>
23
+ <r>
24
+ <rPr>
25
+ <sz val="11"/>
26
+ <color theme="1"/>
27
+ <rFont val="Calibri"/>
28
+ <family val="2"/>
29
+ <scheme val="minor"/>
30
+ </rPr>
31
+ <t xml:space="preserve"> </t>
32
+ </r>
33
+ <r>
34
+ <rPr>
35
+ <b/>
36
+ <sz val="11"/>
37
+ <color theme="1"/>
38
+ <rFont val="Calibri"/>
39
+ <family val="2"/>
40
+ <scheme val="minor"/>
41
+ </rPr>
42
+ <t>A2</t>
43
+ </r>
44
+ </si>
45
+ <si>
46
+ <r>
47
+ <rPr>
48
+ <sz val="11"/>
49
+ <color rgb="FF00B0F0"/>
50
+ <rFont val="Calibri"/>
51
+ <family val="2"/>
52
+ <scheme val="minor"/>
53
+ </rPr>
54
+ <t>Cell</t>
55
+ </r>
56
+ <r>
57
+ <rPr>
58
+ <sz val="11"/>
59
+ <color theme="1"/>
60
+ <rFont val="Calibri"/>
61
+ <family val="2"/>
62
+ <scheme val="minor"/>
63
+ </rPr>
64
+ <t xml:space="preserve"> </t>
65
+ </r>
66
+ <r>
67
+ <rPr>
68
+ <i/>
69
+ <sz val="11"/>
70
+ <color theme="1"/>
71
+ <rFont val="Calibri"/>
72
+ <family val="2"/>
73
+ <scheme val="minor"/>
74
+ </rPr>
75
+ <t>B2</t>
76
+ </r>
77
+ </si>
78
+ </sst>
@@ -0,0 +1,208 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2
+ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
3
+ <numFmts count="2">
4
+ <numFmt numFmtId="164" formatCode="GENERAL" />
5
+ <numFmt numFmtId="165" formatCode="MM/DD/YYYY" />
6
+ </numFmts>
7
+ <fonts count="6">
8
+ <font>
9
+ <sz val="11" />
10
+ <color rgb="FF000000" />
11
+ <name val="Calibri" />
12
+ <family val="2" />
13
+ <charset val="1" />
14
+ </font>
15
+ <font>
16
+ <sz val="10" />
17
+ <name val="Arial" />
18
+ <family val="0" />
19
+ </font>
20
+ <font>
21
+ <sz val="10" />
22
+ <name val="Arial" />
23
+ <family val="0" />
24
+ </font>
25
+ <font>
26
+ <sz val="10" />
27
+ <name val="Arial" />
28
+ <family val="0" />
29
+ </font>
30
+ <font><b val="true" />
31
+ <sz val="12" />
32
+ <color rgb="FFFFFFFF" />
33
+ <name val="Calibri" />
34
+ <family val="2" />
35
+ <charset val="1" />
36
+ </font>
37
+ <font><b val="true" />
38
+ <sz val="11" />
39
+ <color rgb="FF000000" />
40
+ <name val="Calibri" />
41
+ <family val="2" />
42
+ <charset val="1" />
43
+ </font>
44
+ </fonts>
45
+ <fills count="4">
46
+ <fill>
47
+ <patternFill patternType="none" />
48
+ </fill>
49
+ <fill>
50
+ <patternFill patternType="gray125" />
51
+ </fill>
52
+ <fill>
53
+ <patternFill patternType="solid">
54
+ <fgColor rgb="FF090948" />
55
+ <bgColor rgb="FF000080" />
56
+ </patternFill>
57
+ </fill>
58
+ <fill>
59
+ <patternFill patternType="solid">
60
+ <fgColor rgb="FFDCE6F2" />
61
+ <bgColor rgb="FFCCFFFF" />
62
+ </patternFill>
63
+ </fill>
64
+ </fills>
65
+ <borders count="2">
66
+ <border diagonalUp="false" diagonalDown="false">
67
+ <left/>
68
+ <right/>
69
+ <top/>
70
+ <bottom/>
71
+ <diagonal/>
72
+ </border>
73
+ <border diagonalUp="false" diagonalDown="false">
74
+ <left style="thin" />
75
+ <right style="thin" />
76
+ <top style="thin" />
77
+ <bottom style="thin" />
78
+ <diagonal/>
79
+ </border>
80
+ </borders>
81
+ <cellStyleXfs count="20">
82
+ <xf numFmtId="164" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="true">
83
+ <alignment horizontal="general" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false" />
84
+ <protection locked="true" hidden="false" />
85
+ </xf>
86
+ <xf numFmtId="0" fontId="1" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
87
+ <xf numFmtId="0" fontId="1" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
88
+ <xf numFmtId="0" fontId="2" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
89
+ <xf numFmtId="0" fontId="2" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
90
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
91
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
92
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
93
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
94
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
95
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
96
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
97
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
98
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
99
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
100
+ <xf numFmtId="43" fontId="1" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
101
+ <xf numFmtId="41" fontId="1" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
102
+ <xf numFmtId="44" fontId="1" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
103
+ <xf numFmtId="42" fontId="1" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
104
+ <xf numFmtId="9" fontId="1" fillId="0" borderId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false"></xf>
105
+ </cellStyleXfs>
106
+ <cellXfs count="8">
107
+ <xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="false" applyBorder="false" applyAlignment="false" applyProtection="false">
108
+ <alignment horizontal="general" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false" />
109
+ <protection locked="true" hidden="false" />
110
+ </xf>
111
+ <xf numFmtId="164" fontId="4" fillId="2" borderId="1" xfId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="false">
112
+ <alignment horizontal="center" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false" />
113
+ <protection locked="true" hidden="false" />
114
+ </xf>
115
+ <xf numFmtId="164" fontId="4" fillId="2" borderId="0" xfId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="false">
116
+ <alignment horizontal="center" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false" />
117
+ <protection locked="true" hidden="false" />
118
+ </xf>
119
+ <xf numFmtId="165" fontId="4" fillId="2" borderId="0" xfId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="false">
120
+ <alignment horizontal="center" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false" />
121
+ <protection locked="true" hidden="false" />
122
+ </xf>
123
+ <xf numFmtId="164" fontId="5" fillId="3" borderId="0" xfId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="false">
124
+ <alignment horizontal="general" vertical="center" textRotation="0" wrapText="true" indent="0" shrinkToFit="false" />
125
+ <protection locked="true" hidden="false" />
126
+ </xf>
127
+ <xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="true" applyBorder="true" applyAlignment="true" applyProtection="false">
128
+ <alignment horizontal="left" vertical="center" textRotation="0" wrapText="true" indent="0" shrinkToFit="false" />
129
+ <protection locked="true" hidden="false" />
130
+ </xf>
131
+ <xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="true" applyBorder="false" applyAlignment="false" applyProtection="false">
132
+ <alignment horizontal="general" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false" />
133
+ <protection locked="true" hidden="false" />
134
+ </xf>
135
+ <xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyFont="false" applyBorder="true" applyAlignment="false" applyProtection="false">
136
+ <alignment horizontal="general" vertical="bottom" textRotation="0" wrapText="false" indent="0" shrinkToFit="false" />
137
+ <protection locked="true" hidden="false" />
138
+ </xf>
139
+ </cellXfs>
140
+ <cellStyles count="6">
141
+ <cellStyle name="Normal" xfId="0" builtinId="0" customBuiltin="false" />
142
+ <cellStyle name="Comma" xfId="15" builtinId="3" customBuiltin="false" />
143
+ <cellStyle name="Comma [0]" xfId="16" builtinId="6" customBuiltin="false" />
144
+ <cellStyle name="Currency" xfId="17" builtinId="4" customBuiltin="false" />
145
+ <cellStyle name="Currency [0]" xfId="18" builtinId="7" customBuiltin="false" />
146
+ <cellStyle name="Percent" xfId="19" builtinId="5" customBuiltin="false" />
147
+ </cellStyles>
148
+ <colors>
149
+ <indexedColors>
150
+ <rgbColor rgb="FF000000" />
151
+ <rgbColor rgb="FFFFFFFF" />
152
+ <rgbColor rgb="FFFF0000" />
153
+ <rgbColor rgb="FF00FF00" />
154
+ <rgbColor rgb="FF0000FF" />
155
+ <rgbColor rgb="FFFFFF00" />
156
+ <rgbColor rgb="FFFF00FF" />
157
+ <rgbColor rgb="FF00FFFF" />
158
+ <rgbColor rgb="FF800000" />
159
+ <rgbColor rgb="FF008000" />
160
+ <rgbColor rgb="FF090948" />
161
+ <rgbColor rgb="FF808000" />
162
+ <rgbColor rgb="FF800080" />
163
+ <rgbColor rgb="FF008080" />
164
+ <rgbColor rgb="FFC0C0C0" />
165
+ <rgbColor rgb="FF808080" />
166
+ <rgbColor rgb="FF9999FF" />
167
+ <rgbColor rgb="FF993366" />
168
+ <rgbColor rgb="FFFFFFCC" />
169
+ <rgbColor rgb="FFDCE6F2" />
170
+ <rgbColor rgb="FF660066" />
171
+ <rgbColor rgb="FFFF8080" />
172
+ <rgbColor rgb="FF0066CC" />
173
+ <rgbColor rgb="FFCCCCFF" />
174
+ <rgbColor rgb="FF000080" />
175
+ <rgbColor rgb="FFFF00FF" />
176
+ <rgbColor rgb="FFFFFF00" />
177
+ <rgbColor rgb="FF00FFFF" />
178
+ <rgbColor rgb="FF800080" />
179
+ <rgbColor rgb="FF800000" />
180
+ <rgbColor rgb="FF008080" />
181
+ <rgbColor rgb="FF0000FF" />
182
+ <rgbColor rgb="FF00CCFF" />
183
+ <rgbColor rgb="FFCCFFFF" />
184
+ <rgbColor rgb="FFCCFFCC" />
185
+ <rgbColor rgb="FFFFFF99" />
186
+ <rgbColor rgb="FF99CCFF" />
187
+ <rgbColor rgb="FFFF99CC" />
188
+ <rgbColor rgb="FFCC99FF" />
189
+ <rgbColor rgb="FFFFCC99" />
190
+ <rgbColor rgb="FF3366FF" />
191
+ <rgbColor rgb="FF33CCCC" />
192
+ <rgbColor rgb="FF99CC00" />
193
+ <rgbColor rgb="FFFFCC00" />
194
+ <rgbColor rgb="FFFF9900" />
195
+ <rgbColor rgb="FFFF6600" />
196
+ <rgbColor rgb="FF666699" />
197
+ <rgbColor rgb="FF969696" />
198
+ <rgbColor rgb="FF003366" />
199
+ <rgbColor rgb="FF339966" />
200
+ <rgbColor rgb="FF003300" />
201
+ <rgbColor rgb="FF333300" />
202
+ <rgbColor rgb="FF993300" />
203
+ <rgbColor rgb="FF993366" />
204
+ <rgbColor rgb="FF333399" />
205
+ <rgbColor rgb="FF333333" />
206
+ </indexedColors>
207
+ </colors>
208
+ </styleSheet>
@@ -0,0 +1,18 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe 'shared strings' do
4
+
5
+ it 'parses rich text strings correctly' do
6
+ shared_strings_xml_file = File.open('spec/fixtures/sst.xml')
7
+ doc = Nokogiri::XML(shared_strings_xml_file)
8
+ dictionary = Creeker::SharedStrings.parse_shared_string_from_document(doc)
9
+
10
+ expect(dictionary.keys.size).to eq(5)
11
+ expect(dictionary[0]).to eq('Cell A1')
12
+ expect(dictionary[1]).to eq('Cell B1')
13
+ expect(dictionary[2]).to eq('My Cell')
14
+ expect(dictionary[3]).to eq('Cell A2')
15
+ expect(dictionary[4]).to eq('Cell B2')
16
+ end
17
+
18
+ end
@@ -0,0 +1,85 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe 'sheet' do
4
+ let(:book_with_images) { Creeker::Book.new('spec/fixtures/sample-with-images.xlsx') }
5
+ let(:book_no_images) { Creeker::Book.new('spec/fixtures/sample.xlsx') }
6
+ let(:sheetfile) { 'worksheets/sheet1.xml' }
7
+ let(:sheet_with_images) { Creeker::Sheet.new(book_with_images, 'Sheet 1', 1, '', '', '1', sheetfile) }
8
+ let(:sheet_no_images) { Creeker::Sheet.new(book_no_images, 'Sheet 1', 1, '', '', '1', sheetfile) }
9
+
10
+ def load_cell(rows, cell_name)
11
+ cell = rows.find { |row| !row[cell_name].nil? }
12
+ cell[cell_name] if cell
13
+ end
14
+
15
+ describe '#rows' do
16
+ context 'with excel with images' do
17
+ context 'with images preloading' do
18
+ let(:rows) { sheet_with_images.with_images.rows.map { |r| r } }
19
+
20
+ it 'parses single image in a cell' do
21
+ expect(load_cell(rows, 'A2').size).to eq(1)
22
+ end
23
+
24
+ it 'returns nil for cells without images' do
25
+ expect(load_cell(rows, 'A3')).to eq(nil)
26
+ expect(load_cell(rows, 'A7')).to eq(nil)
27
+ expect(load_cell(rows, 'A9')).to eq(nil)
28
+ end
29
+
30
+ it 'returns nil for merged cell within empty row' do
31
+ expect(load_cell(rows, 'A5')).to eq(nil)
32
+ end
33
+
34
+ it 'returns nil for image in a cell with empty row' do
35
+ expect(load_cell(rows, 'A8')).to eq(nil)
36
+ end
37
+
38
+ it 'returns images for merged cells' do
39
+ expect(load_cell(rows, 'A4').size).to eq(1)
40
+ expect(load_cell(rows, 'A6').size).to eq(1)
41
+ end
42
+
43
+ it 'returns multiple images' do
44
+ expect(load_cell(rows, 'A10').size).to eq(2)
45
+ end
46
+ end
47
+
48
+ it 'ignores images' do
49
+ rows = sheet_with_images.rows.map { |r| r }
50
+ expect(load_cell(rows, 'A2')).to eq(nil)
51
+ expect(load_cell(rows, 'A3')).to eq(nil)
52
+ expect(load_cell(rows, 'A4')).to eq(nil)
53
+ end
54
+ end
55
+
56
+ context 'with excel without images' do
57
+ it 'does not break on with_images' do
58
+ rows = sheet_no_images.with_images.rows.map { |r| r }
59
+ expect(load_cell(rows, 'A10')).to eq(0.15)
60
+ end
61
+ end
62
+ end
63
+
64
+ describe '#images_at' do
65
+ it 'returns images for merged cell' do
66
+ image = sheet_with_images.with_images.images_at('A5')[0]
67
+ expect(image.class).to eq(Pathname)
68
+ end
69
+
70
+ it 'returns images for empty row' do
71
+ image = sheet_with_images.with_images.images_at('A8')[0]
72
+ expect(image.class).to eq(Pathname)
73
+ end
74
+
75
+ it 'returns nil for empty cell' do
76
+ image = sheet_with_images.with_images.images_at('B3')
77
+ expect(image).to eq(nil)
78
+ end
79
+
80
+ it 'returns nil for empty cell without preloading images' do
81
+ image = sheet_with_images.images_at('B3')
82
+ expect(image).to eq(nil)
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,3 @@
1
+ require 'creeker'
2
+ require 'pry'
3
+
@@ -0,0 +1,16 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe Creeker::Styles::Converter do
4
+
5
+ describe :call do
6
+ def convert(value, type, style)
7
+ Creeker::Styles::Converter.call(value, type, style)
8
+ end
9
+
10
+ describe :date_time do
11
+ it "works" do
12
+ expect(convert('41275', 'n', :date_time)).to eq(Date.new(2013,01,01))
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe Creeker::Styles::StyleTypes do
4
+
5
+ describe :call do
6
+ it "return array of styletypes with mapping to ruby types" do
7
+ xml_file = File.open('spec/fixtures/styles/first.xml')
8
+ doc = Nokogiri::XML(xml_file)
9
+ res = Creeker::Styles::StyleTypes.new(doc).call
10
+ expect(res.size).to eq(8)
11
+ expect(res[3]).to eq(:date_time)
12
+ expect(res).to eq([:unsupported, :unsupported, :unsupported, :date_time, :unsupported, :unsupported, :unsupported, :unsupported])
13
+ end
14
+ end
15
+ end
data/spec/test_spec.rb ADDED
@@ -0,0 +1,87 @@
1
+ require './spec/spec_helper'
2
+
3
+ describe 'Creeker trying to parsing an invalid file.' do
4
+ it 'Fail to open a legacy xls file.' do
5
+ expect { Creeker::Book.new 'spec/fixtures/invalid.xls' }
6
+ .to raise_error 'Not a valid file format.'
7
+ end
8
+
9
+ it 'Ignore file extensions on request.' do
10
+ path = 'spec/fixtures/sample-as-zip.zip'
11
+ expect { Creeker::Book.new path, check_file_extension: false }
12
+ .not_to raise_error
13
+ end
14
+
15
+ it 'Check file extension when requested.' do
16
+ expect { Creeker::Book.new 'spec/fixtures/invalid.xls', check_file_extension: true }
17
+ .to raise_error 'Not a valid file format.'
18
+ end
19
+
20
+ it 'Check file extension of original_filename if passed.' do
21
+ path = 'spec/fixtures/temp_string_io_file_path_with_no_extension'
22
+ expect { Creeker::Book.new path, :original_filename => 'invalid.xls' }
23
+ .to raise_error 'Not a valid file format.'
24
+ expect { Creeker::Book.new path, :original_filename => 'valid.xlsx' }
25
+ .not_to raise_error
26
+ end
27
+ end
28
+
29
+ describe 'Creeker parsing a sample XLSX file' do
30
+ before(:all) do
31
+ @creeker = Creeker::Book.new 'spec/fixtures/sample.xlsx'
32
+ @expected_rows = [{'A1'=>'Content 1', 'B1'=>nil, 'C1'=>'Content 2', 'D1'=>nil, 'E1'=>'Content 3'},
33
+ {'A2'=>nil, 'B2'=>'Content 4', 'C2'=>nil, 'D2'=>'Content 5', 'E2'=>nil, 'F2'=>'Content 6'},
34
+ {},
35
+ {'A4'=>'Content 7', 'B4'=>'Content 8', 'C4'=>'Content 9', 'D4'=>'Content 10', 'E4'=>'Content 11', 'F4'=>'Content 12'},
36
+ {'A5'=>nil, 'B5'=>nil, 'C5'=>nil, 'D5'=>nil, 'E5'=>nil, 'F5'=>nil, 'G5'=>nil, 'H5'=>nil, 'I5'=>nil, 'J5'=>nil, 'K5'=>nil, 'L5'=>nil, 'M5'=>nil, 'N5'=>nil, 'O5'=>nil, 'P5'=>nil, 'Q5'=>nil, 'R5'=>nil, 'S5'=>nil, 'T5'=>nil, 'U5'=>nil, 'V5'=>nil, 'W5'=>nil, 'X5'=>nil, 'Y5'=>nil, 'Z5'=>'Z Content', 'AA5'=>nil, 'AB5'=>nil, 'AC5'=>nil, 'AD5'=>nil, 'AE5'=>nil, 'AF5'=>nil, 'AG5'=>nil, 'AH5'=>nil, 'AI5'=>nil, 'AJ5'=>nil, 'AK5'=>nil, 'AL5'=>nil, 'AM5'=>nil, 'AN5'=>nil, 'AO5'=>nil, 'AP5'=>nil, 'AQ5'=>nil, 'AR5'=>nil, 'AS5'=>nil, 'AT5'=>nil, 'AU5'=>nil, 'AV5'=>nil, 'AW5'=>nil, 'AX5'=>nil, 'AY5'=>nil, 'AZ5'=>'Content 13'},
37
+ {'A6'=>'1', 'B6'=>'2', 'C6'=>'3'}, {'A7'=>'Content 15', 'B7'=>'Content 16', 'C7'=>'Content 18', 'D7'=>'Content 19'},
38
+ {'A8'=>nil, 'B8'=>'Content 20', 'C8'=>nil, 'D8'=>nil, 'E8'=>nil, 'F8'=>'Content 21'},
39
+ {'A10' => 0.15, 'B10' => 0.15}]
40
+ end
41
+
42
+ after(:all) do
43
+ @creeker.close
44
+ end
45
+
46
+ it 'open an XLSX file successfully.' do
47
+ expect(@creeker).not_to be_nil
48
+ end
49
+
50
+ it 'find sheets successfully.' do
51
+ expect(@creeker.sheets.count).to eq(1)
52
+ sheet = @creeker.sheets.first
53
+ expect(sheet.state).to eql nil
54
+ expect(sheet.name).to eql 'Sheet1'
55
+ expect(sheet.rid).to eql 'rId1'
56
+ end
57
+
58
+ it 'Parse rows with empty cells successfully.' do
59
+ rows = Array.new
60
+ row_count = 0
61
+ @creeker.sheets[0].rows.each do |row|
62
+ rows << row
63
+ row_count += 1
64
+ end
65
+
66
+ expect(rows[0]).to eq(@expected_rows[0])
67
+ expect(rows[1]).to eq(@expected_rows[1])
68
+ expect(rows[2]).to eq(@expected_rows[2])
69
+ expect(rows[3]).to eq(@expected_rows[3])
70
+ expect(rows[4]).to eq(@expected_rows[4])
71
+ expect(rows[5]).to eq(@expected_rows[5])
72
+ expect(rows[6]).to eq(@expected_rows[6])
73
+ expect(rows[7]).to eq(@expected_rows[7])
74
+ expect(rows[8]).to eq(@expected_rows[8])
75
+ expect(row_count).to eq(9)
76
+ end
77
+
78
+ it 'Parse rows with empty cells and meta data successfully.' do
79
+ rows = Array.new
80
+ row_count = 0
81
+ @creeker.sheets[0].rows_with_meta_data.each do |row|
82
+ rows << row
83
+ row_count += 1
84
+ end
85
+ expect(rows.map{|r| r['cells']}).to eq(@expected_rows)
86
+ end
87
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creeker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - huntcode
@@ -116,9 +116,14 @@ executables: []
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
+ - ".DS_Store"
120
+ - ".gitignore"
121
+ - Gemfile
119
122
  - LICENSE.txt
120
123
  - README.md
121
124
  - Rakefile
125
+ - creeker.gemspec
126
+ - lib/.DS_Store
122
127
  - lib/creeker.rb
123
128
  - lib/creeker/book.rb
124
129
  - lib/creeker/drawing.rb
@@ -130,7 +135,22 @@ files:
130
135
  - lib/creeker/styles/style_types.rb
131
136
  - lib/creeker/utils.rb
132
137
  - lib/creeker/version.rb
133
- homepage: https://github.com/huntcode/creeker
138
+ - spec/drawing_spec.rb
139
+ - spec/fixtures/invalid.xls
140
+ - spec/fixtures/sample-as-zip.zip
141
+ - spec/fixtures/sample-with-images.xlsx
142
+ - spec/fixtures/sample.xlsx
143
+ - spec/fixtures/sheets/sheet1.xml
144
+ - spec/fixtures/sst.xml
145
+ - spec/fixtures/styles/first.xml
146
+ - spec/fixtures/temp_string_io_file_path_with_no_extension
147
+ - spec/shared_string_spec.rb
148
+ - spec/sheet_spec.rb
149
+ - spec/spec_helper.rb
150
+ - spec/styles/converter_spec.rb
151
+ - spec/styles/style_types_spec.rb
152
+ - spec/test_spec.rb
153
+ homepage: https://github.com/vivektripathihunt/creeker
134
154
  licenses:
135
155
  - MIT
136
156
  metadata: {}
@@ -154,4 +174,19 @@ rubygems_version: 2.6.14
154
174
  signing_key:
155
175
  specification_version: 4
156
176
  summary: A Ruby gem for parsing large Excel(xlsx and xlsm) files.
157
- test_files: []
177
+ test_files:
178
+ - spec/drawing_spec.rb
179
+ - spec/fixtures/invalid.xls
180
+ - spec/fixtures/sample-as-zip.zip
181
+ - spec/fixtures/sample-with-images.xlsx
182
+ - spec/fixtures/sample.xlsx
183
+ - spec/fixtures/sheets/sheet1.xml
184
+ - spec/fixtures/sst.xml
185
+ - spec/fixtures/styles/first.xml
186
+ - spec/fixtures/temp_string_io_file_path_with_no_extension
187
+ - spec/shared_string_spec.rb
188
+ - spec/sheet_spec.rb
189
+ - spec/spec_helper.rb
190
+ - spec/styles/converter_spec.rb
191
+ - spec/styles/style_types_spec.rb
192
+ - spec/test_spec.rb