spreadsheet 1.2.4 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6e24a126670c29d4c9f3b8bcf8adb5d8d84a2acf
4
- data.tar.gz: 21a56ac71b43a87259aee264c047b298814bd8d2
2
+ SHA256:
3
+ metadata.gz: ef4b84832d5a9a7616d0948a54c34342df9205b691ef561d24725c33fcb65b27
4
+ data.tar.gz: 29dff00bcafb3b46674a1cbd2f57ee433e27d058e69f4da9a6964cac1961f323
5
5
  SHA512:
6
- metadata.gz: 83d667da3484477693bb3dc44ff85d8c7332142dc5413e0f5497bb825e690e04731751e86103cb9cb4e5cbb2b3d39a433a90448520fac72f498d405b744433d8
7
- data.tar.gz: bc6d0f1778204ad90908e0b243449581482b67bfa446298e14e429fa7478dc5fafe3054656813e54a4c69231abc7f3bf11121f7f3c49bb330ce51bb9352aa1f3
6
+ metadata.gz: c924c33e13250366696b1ea4d969559d320e270554d0b691d02874980f01442eaaccbe55fdfb2d00bfc37201e7d0be691091a1de2f72a04ad3cb83f47db0134b
7
+ data.tar.gz: b3526dc452d2f8fc983d0af1a1b531737898d22f03ddf6c9e717fd5eb715444df46f36d9942019751bebaf3c9a1ec825eba7e3bdb7b5ad4dfb83605722de03fa
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
@@ -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.4'
6
+ VERSION = '1.2.9'
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_
@@ -49,7 +49,7 @@ module Spreadsheet
49
49
  :right => 0.75,
50
50
  :bottom => 1
51
51
  }
52
- @name = opts[:name] || 'Worksheet'
52
+ @name = sanitize_invalid_characters(opts[:name] || 'Worksheet')
53
53
  @workbook = opts[:workbook]
54
54
  @rows = []
55
55
  @columns = []
@@ -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'
@@ -363,6 +366,9 @@ module Spreadsheet
363
366
  end
364
367
 
365
368
  private
369
+ def sanitize_invalid_characters(name) # :nodoc:
370
+ name.gsub(Regexp.new('[\\\/\*\?\:\[\]]'.encode(Spreadsheet.client_encoding)), '_')
371
+ end
366
372
  def index_of_first ary # :nodoc:
367
373
  return unless ary
368
374
  ary.index(ary.find do |elm| elm end)
Binary file
Binary file
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
 
data/test/worksheet.rb CHANGED
@@ -138,5 +138,10 @@ module Spreadsheet
138
138
  end
139
139
  end
140
140
 
141
+ def test_name
142
+ worksheet = Worksheet.new(name: '\a/b*c?d:e[f]')
143
+ assert_equal '_a_b_c_d_e_f_', worksheet.name
144
+ end
145
+
141
146
  end
142
147
  end
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
4
+ version: 1.2.9
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-05-24 00:00:00.000000000 Z
11
+ date: 2021-05-21 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