spreadsheet 1.2.3 → 1.2.8

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
- SHA1:
3
- metadata.gz: c435d58771950e840768f7ba80cb02acdf98c9e2
4
- data.tar.gz: d994cab59c7ee93edff3e69b40aaf2f7d3a14f68
2
+ SHA256:
3
+ metadata.gz: eb16d4af4c562e6c5b65e459811240184635197c457385670cca8921d67e111e
4
+ data.tar.gz: c38bc6a6c1bc31706307d28f50d66ec163a371eeeeecdcbc3a06c48287668bb9
5
5
  SHA512:
6
- metadata.gz: 273c89fd7f4eb201c915072ace62ac7a32db7173c708f8f43d09506aa43d3391501c17c716741778e30857e97cfb1ab387f2cd9780ddb38cf7a13df395e99da3
7
- data.tar.gz: b09e354712317e7a17d800ab992c3385e0c466cac0c0eeb3f8ed564966ce684530feca24597f63081be0ac25e13fb5307ffdfc6ba23a30639e06f5f63fa4869b
6
+ metadata.gz: 71450fa0a12bd2ef1667aa106dcbcbc1af8fe54c4e49e0930adf433edcb70a8a38e6e5d4de3c82c912bd3c410cbb03554a1e17cc64c1a803dd0204d96d999989
7
+ data.tar.gz: a22de68097078aa164d04f80fd6bbd4cdd0f4bb8125a1cf9e250d1884fb9d2147555c183d787d98439d307f8c3fff2a7252a99559ec5d5ac986b2f40a90f5dd5
data/bin/bundle ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||=
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version
67
+ end
68
+
69
+ def bundler_requirement
70
+ return "#{Gem::Requirement.default}.a" unless bundler_version
71
+
72
+ bundler_gem_version = Gem::Version.new(bundler_version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
data/bin/bundler ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'bundler' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("bundler", "bundler")
data/bin/oletool ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'oletool' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("ruby-ole", "oletool")
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/sow ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'sow' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("hoe", "sow")
data/bin/xlsopcodes CHANGED
@@ -1,18 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require 'spreadsheet'
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'xlsopcodes' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
4
10
 
5
- source, target = ARGV
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
6
14
 
7
- if source.nil?
8
- puts "Usage: #{$0} <source> [<target>]"
9
- exit -1
10
- end
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
11
16
 
12
- target = target ? File.open(target, 'w') : STDOUT
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
13
25
 
14
- reader = Spreadsheet::Excel::Reader.new :print_opcodes => target
15
- reader.setup File.open(source)
26
+ require "rubygems"
27
+ require "bundler/setup"
16
28
 
17
- while tuple = reader.get_next_chunk
18
- end
29
+ load Gem.bin_path("spreadsheet", "xlsopcodes")
@@ -1,11 +1,5 @@
1
1
  require 'spreadsheet'
2
2
 
3
- warn <<-EOS
4
- [DEPRECATED] By requiring 'spreadsheet/excel' you are loading a Compatibility
5
- layer which provides a drop-in replacement for Spreadsheet::Excel
6
- versions <= 0.3.5.1. This code will be removed in Spreadsheet
7
- version 1.0.0
8
- EOS
9
3
  ##
10
4
  # Spreadsheet::Excel Compatibility Layer.
11
5
  # Drop-in replacement for Spreadsheet::Excel version <= 0.3.5.1
@@ -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 io.respond_to?(:string) && (str = io.string) \
1279
- && str.respond_to?(:force_encoding)
1280
- str.force_encoding 'ASCII-8BIT'
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, {}
@@ -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\[\$\-\d+\]/.to_s, 'UTF-8')),
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.
@@ -3,5 +3,5 @@
3
3
  module Spreadsheet
4
4
  ##
5
5
  # The version of Spreadsheet you are using.
6
- VERSION = '1.2.3'
6
+ VERSION = '1.2.8'
7
7
  end
@@ -76,7 +76,7 @@ module Spreadsheet
76
76
  # Returns the count of total worksheets present.
77
77
  # Takes no arguments. Just returns the length of @worksheets array.
78
78
  def sheet_count
79
- @worksheets.length
79
+ @worksheets.length
80
80
  end
81
81
  ##
82
82
  # The Font at _idx_
@@ -232,6 +232,9 @@ module Spreadsheet
232
232
  updated_from idx
233
233
  res
234
234
  end
235
+ def << cells=[]
236
+ insert_row @rows.size, cells
237
+ end
235
238
  def inspect
236
239
  names = instance_variables
237
240
  names.delete '@rows'
Binary file
Binary file
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/suite.rb CHANGED
@@ -3,6 +3,8 @@
3
3
  require 'rubygems'
4
4
  require 'bundler'
5
5
  require 'find'
6
+ require 'simplecov'
7
+ SimpleCov.start
6
8
 
7
9
  $VERBOSE = true
8
10
 
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.3
4
+ version: 1.2.8
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: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2021-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-ole
@@ -16,78 +16,72 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdoc
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '7'
33
+ version: '0'
37
34
  type: :development
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: '4.0'
44
- - - "<"
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
45
53
  - !ruby/object:Gem::Version
46
- version: '7'
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
- name: hoe
56
+ name: simplecov
49
57
  requirement: !ruby/object:Gem::Requirement
50
58
  requirements:
51
- - - "~>"
59
+ - - ">="
52
60
  - !ruby/object:Gem::Version
53
- version: '3.17'
61
+ version: '0'
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
65
  requirements:
58
- - - "~>"
66
+ - - ">="
59
67
  - !ruby/object:Gem::Version
60
- version: '3.17'
61
- description: |-
62
- The Spreadsheet Library is designed to read and write Spreadsheet Documents.
63
- As of version 0.6.0, only Microsoft Excel compatible spreadsheets are
64
- supported. Spreadsheet is a combination/complete rewrite of the
65
- Spreadsheet::Excel Library by Daniel J. Berger and the ParseExcel Library by
66
- Hannes Wyss. Spreadsheet can read, write and modify Spreadsheet Documents.
67
- email: zdavatz@ywesee.com
68
+ version: '0'
69
+ description: As of version 0.6.0, only Microsoft Excel compatible spreadsheets are
70
+ supported
71
+ email: hannes.wyss@gmail.com, mhatakeyama@ywesee.com, zdavatz@ywesee.com
68
72
  executables:
69
73
  - xlsopcodes
70
74
  extensions: []
71
- extra_rdoc_files:
72
- - GUIDE.md
73
- - History.md
74
- - LICENSE.txt
75
- - Manifest.txt
76
- - README.md
75
+ extra_rdoc_files: []
77
76
  files:
78
- - ".gitignore"
79
- - ".travis.yml"
80
- - Excel97-2007BinaryFileFormatSpecification.pdf
81
- - GUIDE.md
82
- - Gemfile
83
- - Gemfile.lock
84
- - History.md
85
77
  - LICENSE.txt
86
78
  - Manifest.txt
87
- - README.md
88
- - Rakefile
79
+ - bin/bundle
80
+ - bin/bundler
81
+ - bin/oletool
82
+ - bin/rake
83
+ - bin/sow
89
84
  - bin/xlsopcodes
90
- - excelfileformat.pdf
91
85
  - lib/parseexcel.rb
92
86
  - lib/parseexcel/parseexcel.rb
93
87
  - lib/parseexcel/parser.rb
@@ -130,11 +124,12 @@ files:
130
124
  - lib/spreadsheet/workbook.rb
131
125
  - lib/spreadsheet/worksheet.rb
132
126
  - lib/spreadsheet/writer.rb
133
- - spreadsheet.gemspec
134
127
  - test/data/test_adding_data_to_existing_file.xls
135
128
  - test/data/test_borders.xls
136
129
  - test/data/test_changes.xls
137
130
  - test/data/test_comment.xls
131
+ - test/data/test_compact_format_date.xls
132
+ - test/data/test_compact_many_rows.xls
138
133
  - test/data/test_copy.xls
139
134
  - test/data/test_datetime.xls
140
135
  - test/data/test_empty.xls
@@ -143,8 +138,10 @@ files:
143
138
  - test/data/test_margin.xls
144
139
  - test/data/test_merged_and_protected.xls
145
140
  - test/data/test_merged_cells.xls
141
+ - test/data/test_missing_format.xls
146
142
  - test/data/test_missing_row.xls
147
143
  - test/data/test_pagesetup.xls
144
+ - test/data/test_sizes.xls
148
145
  - test/data/test_text_drawing.xls
149
146
  - test/data/test_version_excel5.xls
150
147
  - test/data/test_version_excel95.xls
@@ -163,14 +160,12 @@ files:
163
160
  - test/workbook.rb
164
161
  - test/workbook_protection.rb
165
162
  - test/worksheet.rb
166
- homepage: https://github.com/zdavatz/spreadsheet
163
+ homepage: https://github.com/zdavatz/spreadsheet/
167
164
  licenses:
168
165
  - GPL-3.0
169
166
  metadata: {}
170
167
  post_install_message:
171
- rdoc_options:
172
- - "--main"
173
- - README.md
168
+ rdoc_options: []
174
169
  require_paths:
175
170
  - lib
176
171
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -184,9 +179,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
179
  - !ruby/object:Gem::Version
185
180
  version: '0'
186
181
  requirements: []
187
- rubyforge_project:
188
- rubygems_version: 2.6.8
182
+ rubygems_version: 3.2.3
189
183
  signing_key:
190
184
  specification_version: 4
191
185
  summary: The Spreadsheet Library is designed to read and write Spreadsheet Documents
192
- test_files: []
186
+ test_files:
187
+ - test/suite.rb