spreadsheet 1.2.0 → 1.2.6
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
- data/.gitignore +1 -0
- data/.travis.yml +18 -8
- data/Gemfile +2 -1
- data/Gemfile.lock +7 -7
- data/History.md +42 -0
- data/Manifest.txt +1 -0
- data/README.md +6 -5
- data/lib/spreadsheet.rb +1 -4
- data/lib/spreadsheet/excel/reader.rb +5 -5
- data/lib/spreadsheet/excel/reader/biff8.rb +1 -1
- data/lib/spreadsheet/excel/writer/workbook.rb +3 -3
- data/lib/spreadsheet/excel/writer/worksheet.rb +3 -3
- data/lib/spreadsheet/format.rb +2 -2
- data/lib/spreadsheet/version.rb +7 -0
- data/lib/spreadsheet/workbook.rb +1 -1
- data/lib/spreadsheet/worksheet.rb +3 -0
- data/spreadsheet.gemspec +1 -1
- data/test/excel/reader.rb +13 -0
- data/test/format.rb +2 -0
- data/test/integration.rb +6 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8aa45d407cf5aeadbf8af753a674fdf12dab84c
|
4
|
+
data.tar.gz: 32a18ad8a2d79f9eb5df62f435560502c05bfbb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f97bf780ece2ac6f25906106b1f62c1cb681cb91740620321875de8fcd2489dc97c592a4d143c52f1cd78c6f737e2b12a33fe3d6a0715ecd4f390461ffa713
|
7
|
+
data.tar.gz: ddb5ee3babe8492581be775a760db74dd4f392f75773386c6a204682e051f20b56d004091741653691eba09f7e8433588945b266784747d95b5cfae4f0836180
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
language: ruby
|
2
|
+
dist: trusty
|
2
3
|
sudo: false
|
3
4
|
cache: bundler
|
4
5
|
before_install:
|
5
|
-
-
|
6
|
+
- "if $(ruby -e 'exit(RUBY_VERSION >= \"2.3.0\")'); then env -u RUBYOPT gem update --system; fi"
|
7
|
+
- "if $(ruby -e 'exit(RUBY_VERSION >= \"2.3.0\")'); then env -u RUBYOPT gem install bundler --no-document; fi"
|
8
|
+
- "if $(ruby -e 'exit(RUBY_VERSION < \"2.3.0\")'); then gem install bundler -v 1.17.3 --no-document; fi"
|
6
9
|
bundler_args: --binstubs
|
7
10
|
script: "bundle exec ruby test/suite.rb"
|
8
11
|
rvm:
|
9
12
|
- ruby-head
|
10
|
-
- 2.
|
11
|
-
- 2.
|
13
|
+
- 2.6.3
|
14
|
+
- 2.5.5
|
15
|
+
- 2.4.5
|
16
|
+
- 2.3.8
|
17
|
+
- 2.2.10
|
12
18
|
- 2.1.10
|
13
19
|
- 2.0.0
|
14
20
|
- 1.9.3
|
@@ -21,6 +27,13 @@ rvm:
|
|
21
27
|
- jruby-18mode
|
22
28
|
- ree
|
23
29
|
matrix:
|
30
|
+
include:
|
31
|
+
- rvm: 2.4.5
|
32
|
+
env: RUBYOPT='--enable-frozen-string-literal --debug-frozen-string-literal' USE_LATEST_RUBY_OLE=yes
|
33
|
+
- rvm: 2.5.5
|
34
|
+
env: RUBYOPT='--enable-frozen-string-literal --debug-frozen-string-literal' USE_LATEST_RUBY_OLE=yes
|
35
|
+
- rvm: 2.6.3
|
36
|
+
env: RUBYOPT='--enable-frozen-string-literal --debug-frozen-string-literal' USE_LATEST_RUBY_OLE=yes
|
24
37
|
allow_failures:
|
25
38
|
- rvm: ruby-head
|
26
39
|
- rvm: rbx-19mode
|
@@ -29,8 +42,5 @@ matrix:
|
|
29
42
|
- rvm: jruby-19mode
|
30
43
|
- rvm: jruby-18mode
|
31
44
|
- rvm: ree
|
32
|
-
|
33
|
-
|
34
|
-
recipients:
|
35
|
-
- yasaka@ywesee.com
|
36
|
-
- zdavatz@ywesee.com
|
45
|
+
email:
|
46
|
+
false
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,11 +3,11 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
hoe (3.17.1)
|
5
5
|
rake (>= 0.8, < 13.0)
|
6
|
-
minitest (5.
|
7
|
-
power_assert (0.
|
8
|
-
rake (
|
9
|
-
ruby-ole (1.2.12.
|
10
|
-
test-unit (3.
|
6
|
+
minitest (5.10.1)
|
7
|
+
power_assert (1.0.1)
|
8
|
+
rake (12.3.0)
|
9
|
+
ruby-ole (1.2.12.2)
|
10
|
+
test-unit (3.2.3)
|
11
11
|
power_assert
|
12
12
|
|
13
13
|
PLATFORMS
|
@@ -16,8 +16,8 @@ PLATFORMS
|
|
16
16
|
DEPENDENCIES
|
17
17
|
hoe (>= 3.4)
|
18
18
|
minitest
|
19
|
-
ruby-ole
|
19
|
+
ruby-ole (>= 1.2.12.2)
|
20
20
|
test-unit
|
21
21
|
|
22
22
|
BUNDLED WITH
|
23
|
-
1.
|
23
|
+
1.14.6
|
data/History.md
CHANGED
@@ -1,3 +1,45 @@
|
|
1
|
+
### 1.2.6 22.1.2020
|
2
|
+
Author: tetsuya-ogawa <tetsuya.ogawa87@gmail.com>
|
3
|
+
Date: Wed Jan 22 15:18:00 2020 +0900
|
4
|
+
|
5
|
+
* add instance method "<<" to Spreadsheet::Worksheet
|
6
|
+
|
7
|
+
### 1.2.5 23.10.2019
|
8
|
+
Author: Jesús Manuel García Muñoz <jesus@bebanjo.com>
|
9
|
+
Date: Wed Oct 23 20:26:01 2019 +0200
|
10
|
+
|
11
|
+
* Fixes unrecognized date format
|
12
|
+
|
13
|
+
### 1.2.4 24.05.2019
|
14
|
+
Author: Cyril Champier <cyril.champier@doctolib.com>
|
15
|
+
Date: Fri May 24 12:56:52 2019 +0200
|
16
|
+
|
17
|
+
* correct ruby version check
|
18
|
+
* can read frozen string io
|
19
|
+
|
20
|
+
### 1.2.3 12.03.2019
|
21
|
+
Author: taichi <taichi730@gmail.com>
|
22
|
+
Date: Tue Mar 12 22:29:12 2019 +0900
|
23
|
+
|
24
|
+
* Remove workaround for ruby-ole gem
|
25
|
+
|
26
|
+
### 1.2.2 01.03.2019
|
27
|
+
Author: taichi <taichi730@gmail.com>
|
28
|
+
Date: Fri Mar 1 13:00:28 2019 +0900
|
29
|
+
|
30
|
+
* fixed unit test errors caused by frozen-string-literal
|
31
|
+
* removed ruby 2.3.8 with frozen-string-literal from CI regression
|
32
|
+
(It seems that standard libraries for this version does not support the
|
33
|
+
feature enough.)
|
34
|
+
* enable '--enable-frozen-string-literal' option on CI test
|
35
|
+
|
36
|
+
### 1.2.1 28.02.2019
|
37
|
+
Author: taichi <taichi730@gmail.com>
|
38
|
+
Date: Thu Feb 28 10:30:46 2019 +0900
|
39
|
+
|
40
|
+
* Merge pull request #231 from taichi-ishitani/separated_version_file
|
41
|
+
* Merge pull request #230 from taichi-ishitani/frozen_string_literal_support
|
42
|
+
|
1
43
|
### 1.2.0 17.2.2019
|
2
44
|
Author: James McLaren <jamesmclaren555@gmail.com>
|
3
45
|
* spreadsheet-1.2.0.gem released
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -29,9 +29,10 @@ Hannes Wyss. Spreadsheet can read, write and modify Spreadsheet Documents.
|
|
29
29
|
|
30
30
|
## Notes from Users
|
31
31
|
|
32
|
-
Alfred:
|
33
|
-
|
34
|
-
|
32
|
+
* [Alfred](mailto:a@boxbot.org): The library doesn't recognize cell formats in Excel
|
33
|
+
created documents, which results in Floats returned for any number.
|
34
|
+
* [Tom](https://github.com/tom-lord): This library *only* supports XLS format;
|
35
|
+
it does **not** support XLSX format.
|
35
36
|
|
36
37
|
## What's new?
|
37
38
|
|
@@ -50,7 +51,7 @@ Floats returned for any number.
|
|
50
51
|
* Write-Support: BIFF5
|
51
52
|
* Remove backward compatibility code
|
52
53
|
|
53
|
-
Note: Spreadsheet
|
54
|
+
Note: Spreadsheet is tested against all minor ruby versions through: 1.8.7 - 2.6.3
|
54
55
|
|
55
56
|
You will get a deprecated warning about iconv when using spreadsheet with Ruby
|
56
57
|
1.9.3. So replacing iconv is on the Roadmap as well ;).
|
@@ -109,5 +110,5 @@ Copyright (c) 2010 ywesee GmbH (mhatakeyama@ywesee.com, zdavatz@ywesee.com)
|
|
109
110
|
## License
|
110
111
|
|
111
112
|
This library is distributed under the GPLv3.
|
112
|
-
Please see the [LICENSE]
|
113
|
+
Please see the [LICENSE](https://github.com/zdavatz/spreadsheet/blob/master/LICENSE.txt) file.
|
113
114
|
|
data/lib/spreadsheet.rb
CHANGED
@@ -25,6 +25,7 @@
|
|
25
25
|
# 8006 Zürich
|
26
26
|
### Switzerland
|
27
27
|
|
28
|
+
require 'spreadsheet/version'
|
28
29
|
require 'spreadsheet/errors'
|
29
30
|
|
30
31
|
require 'spreadsheet/excel/workbook'
|
@@ -44,10 +45,6 @@ require 'spreadsheet/excel/rgb'
|
|
44
45
|
# sheet.each do |row| puts row[0] end
|
45
46
|
module Spreadsheet
|
46
47
|
|
47
|
-
##
|
48
|
-
# The version of Spreadsheet you are using.
|
49
|
-
VERSION = '1.2.0'
|
50
|
-
|
51
48
|
##
|
52
49
|
# Default client Encoding. Change this value if your application uses a
|
53
50
|
# different Encoding:
|
@@ -56,7 +56,7 @@ class Reader
|
|
56
56
|
## remove two bits
|
57
57
|
integer, = work.unpack 'V'
|
58
58
|
integer &= 0xfffffffc
|
59
|
-
value, = ("\0\0\0\0"
|
59
|
+
value, = ("\0\0\0\0" + [integer].pack('V')).unpack EIGHT_BYTE_DOUBLE
|
60
60
|
else
|
61
61
|
## I can't find a format for unpacking a little endian signed integer.
|
62
62
|
# 'V' works for packing, but not for unpacking. But the following works
|
@@ -1275,11 +1275,11 @@ class Reader
|
|
1275
1275
|
end
|
1276
1276
|
def setup io
|
1277
1277
|
## Reading from StringIO fails without forced encoding
|
1278
|
-
if
|
1279
|
-
|
1280
|
-
|
1278
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3.0')
|
1279
|
+
io.set_encoding('ASCII-8BIT')
|
1280
|
+
elsif io.respond_to?(:string) && (str = io.string) && str.respond_to?(:force_encoding)
|
1281
|
+
str.force_encoding('ASCII-8BIT')
|
1281
1282
|
end
|
1282
|
-
##
|
1283
1283
|
io.rewind
|
1284
1284
|
@ole = Ole::Storage.open io
|
1285
1285
|
@workbook = Workbook.new io, {}
|
@@ -209,7 +209,7 @@ class Workbook < Spreadsheet::Writer
|
|
209
209
|
oldoffset = positions.min - len
|
210
210
|
lastpos = pos + len
|
211
211
|
bytechange = 0
|
212
|
-
buffer = StringIO.new ''
|
212
|
+
buffer = StringIO.new ''.dup
|
213
213
|
if tuple = workbook.offsets[:sst]
|
214
214
|
write_sst_changes workbook, buffer, writer.pos,
|
215
215
|
sst_total, sst_strings
|
@@ -396,7 +396,7 @@ class Workbook < Spreadsheet::Writer
|
|
396
396
|
sanitize_worksheets workbook.worksheets
|
397
397
|
collect_formats workbook
|
398
398
|
sheets = worksheets workbook
|
399
|
-
buffer1 = StringIO.new ''
|
399
|
+
buffer1 = StringIO.new ''.dup
|
400
400
|
# ● BOF Type = workbook globals (➜ 6.8)
|
401
401
|
write_bof workbook, buffer1, :globals
|
402
402
|
# ○ File Protection Block ➜ 4.19
|
@@ -441,7 +441,7 @@ class Workbook < Spreadsheet::Writer
|
|
441
441
|
# ○ USESELFS ➜ 5.106
|
442
442
|
buffer1.rewind
|
443
443
|
# ●● BOUNDSHEET ➜ 5.95
|
444
|
-
buffer2 = StringIO.new ''
|
444
|
+
buffer2 = StringIO.new ''.dup
|
445
445
|
# ○ COUNTRY ➜ 5.22
|
446
446
|
# ○ Link Table ➜ 4.10.3
|
447
447
|
# ○○ NAME ➜ 6.66
|
@@ -20,7 +20,7 @@ class Worksheet
|
|
20
20
|
def initialize workbook, worksheet
|
21
21
|
@workbook = workbook
|
22
22
|
@worksheet = worksheet
|
23
|
-
@io = StringIO.new ''
|
23
|
+
@io = StringIO.new ''.dup
|
24
24
|
@biff_version = 0x0600
|
25
25
|
@bof = 0x0809
|
26
26
|
@build_id = 3515
|
@@ -642,7 +642,7 @@ and minimal code that generates this warning. Thanks!
|
|
642
642
|
##
|
643
643
|
# Write multiple consecutive cells with RK values (see #write_rk)
|
644
644
|
def write_mulrk row, idx, multiples
|
645
|
-
fmt = 'v2'
|
645
|
+
fmt = ['v2']
|
646
646
|
data = [
|
647
647
|
row.idx, # Index to row
|
648
648
|
idx, # Index to first column (fc)
|
@@ -655,7 +655,7 @@ and minimal code that generates this warning. Thanks!
|
|
655
655
|
end
|
656
656
|
# Index to last column (lc)
|
657
657
|
data.push idx + multiples.size - 1
|
658
|
-
write_op opcode(:mulrk), data.pack(fmt << 'v')
|
658
|
+
write_op opcode(:mulrk), data.pack((fmt << 'v').join)
|
659
659
|
end
|
660
660
|
def write_multiples row, idx, multiples
|
661
661
|
case multiples.last
|
data/lib/spreadsheet/format.rb
CHANGED
@@ -101,12 +101,12 @@ module Spreadsheet
|
|
101
101
|
@pattern_fg_color = :border
|
102
102
|
@pattern_bg_color = :pattern_bg
|
103
103
|
@regexes = {
|
104
|
-
:date => Regexp.new(client("[YMD]", 'UTF-8')),
|
104
|
+
:date => Regexp.new(client("[YMD]|d{2}|m{3}|y{2}", 'UTF-8')),
|
105
105
|
:date_or_time => Regexp.new(client("[hmsYMD]", 'UTF-8')),
|
106
106
|
:datetime => Regexp.new(client("([YMD].*[HS])|([HS].*[YMD])", 'UTF-8')),
|
107
107
|
:time => Regexp.new(client("[hms]", 'UTF-8')),
|
108
108
|
:number => Regexp.new(client("([\#]|0+)", 'UTF-8')),
|
109
|
-
:locale => Regexp.new(client(/\A\[\$\-\
|
109
|
+
:locale => Regexp.new(client(/\A\[\$\-\S+\]/.to_s, 'UTF-8')),
|
110
110
|
}
|
111
111
|
|
112
112
|
# Temp code to prevent merged formats in non-merged cells.
|
data/lib/spreadsheet/workbook.rb
CHANGED
data/spreadsheet.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# require File.join(File.dirname(__FILE__), 'lib', 'spreadsheet')
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'spreadsheet'
|
4
|
+
require 'spreadsheet/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "spreadsheet"
|
data/test/excel/reader.rb
CHANGED
@@ -25,6 +25,19 @@ module Spreadsheet
|
|
25
25
|
reader.setup not_empty_io
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
def test_not_frozen_stream_error_on_setup
|
30
|
+
return if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
|
31
|
+
|
32
|
+
reader = Spreadsheet::Excel::Reader.new
|
33
|
+
data = File.expand_path File.join('test', 'data')
|
34
|
+
path = File.join data, 'test_empty.xls'
|
35
|
+
content_string = File.read path
|
36
|
+
frozen_io = StringIO.new(content_string.freeze)
|
37
|
+
assert_nothing_thrown do
|
38
|
+
reader.setup(frozen_io)
|
39
|
+
end
|
40
|
+
end
|
28
41
|
end
|
29
42
|
end
|
30
43
|
end
|
data/test/format.rb
CHANGED
@@ -25,6 +25,8 @@ module Spreadsheet
|
|
25
25
|
assert_equal false, @format.date?
|
26
26
|
@format.number_format = "0.00;[RED]\\-0.00"
|
27
27
|
assert_equal false, @format.date?
|
28
|
+
@format.number_format = "[$-C0A]dd\\-mmm\\-yy"
|
29
|
+
assert_equal true, @format.date?
|
28
30
|
end
|
29
31
|
def test_date_or_time?
|
30
32
|
assert_equal false, @format.date_or_time?
|
data/test/integration.rb
CHANGED
@@ -36,7 +36,7 @@ module Spreadsheet
|
|
36
36
|
end
|
37
37
|
def teardown
|
38
38
|
Spreadsheet.client_encoding = 'UTF-8'
|
39
|
-
FileUtils.
|
39
|
+
FileUtils.rm_rf @var
|
40
40
|
end
|
41
41
|
def test_copy__identical__file_paths
|
42
42
|
path = File.join @data, 'test_copy.xls'
|
@@ -506,7 +506,7 @@ module Spreadsheet
|
|
506
506
|
assert_equal 3, sheets.size
|
507
507
|
sheet = book.worksheet 0
|
508
508
|
assert_instance_of Excel::Worksheet, sheet
|
509
|
-
str = "S\000h\000e\000e\000t\0001\000"
|
509
|
+
str = "S\000h\000e\000e\000t\0001\000".dup
|
510
510
|
if RUBY_VERSION >= '1.9'
|
511
511
|
str.force_encoding 'UTF-16LE' if str.respond_to?(:force_encoding)
|
512
512
|
end
|
@@ -730,7 +730,7 @@ module Spreadsheet
|
|
730
730
|
book = Spreadsheet::Excel::Workbook.new
|
731
731
|
sheet = book.create_worksheet :name => 'My Worksheet'
|
732
732
|
sheet[0,0] = 'my cell'
|
733
|
-
data = StringIO.new ''
|
733
|
+
data = StringIO.new ''.dup
|
734
734
|
assert_nothing_raised do
|
735
735
|
book.write data
|
736
736
|
end
|
@@ -829,7 +829,7 @@ module Spreadsheet
|
|
829
829
|
assert_equal 2, book.worksheets.size
|
830
830
|
sheet = book.worksheets.first
|
831
831
|
assert_instance_of Spreadsheet::Excel::Worksheet, sheet
|
832
|
-
name = "W\000o\000r\000k\000s\000h\000e\000e\000t\0001\000"
|
832
|
+
name = "W\000o\000r\000k\000s\000h\000e\000e\000t\0001\000".dup
|
833
833
|
name.force_encoding 'UTF-16LE' if name.respond_to?(:force_encoding)
|
834
834
|
assert_equal name, sheet.name
|
835
835
|
assert_not_nil sheet.offset
|
@@ -926,7 +926,7 @@ module Spreadsheet
|
|
926
926
|
assert_equal 40, sheet1.row(11).height
|
927
927
|
assert_instance_of Spreadsheet::Excel::Worksheet, sheet
|
928
928
|
sheet = book.worksheets.last
|
929
|
-
name = "m\000y\000 \000n\000a\000m\000e\000"
|
929
|
+
name = "m\000y\000 \000n\000a\000m\000e\000".dup
|
930
930
|
name.force_encoding 'UTF-16LE' if name.respond_to?(:force_encoding)
|
931
931
|
assert_equal name, sheet.name
|
932
932
|
assert_not_nil sheet.offset
|
@@ -1212,7 +1212,7 @@ module Spreadsheet
|
|
1212
1212
|
sheet = book.create_worksheet
|
1213
1213
|
(0..200).each { |i| sheet.row(i).push "ëçáéíóú" }
|
1214
1214
|
assert_nothing_raised do
|
1215
|
-
book.write StringIO.new("", "w+")
|
1215
|
+
book.write StringIO.new("".dup, "w+")
|
1216
1216
|
end
|
1217
1217
|
end
|
1218
1218
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannes F. Wyss, Masaomi Hatakeyama, Zeno R.R. Davatz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-ole
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/spreadsheet/note.rb
|
127
127
|
- lib/spreadsheet/noteObject.rb
|
128
128
|
- lib/spreadsheet/row.rb
|
129
|
+
- lib/spreadsheet/version.rb
|
129
130
|
- lib/spreadsheet/workbook.rb
|
130
131
|
- lib/spreadsheet/worksheet.rb
|
131
132
|
- lib/spreadsheet/writer.rb
|