roo 2.7.1 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +5 -5
  2. data/.github/issue_template.md +16 -0
  3. data/.github/pull_request_template.md +14 -0
  4. data/.rubocop.yml +186 -0
  5. data/.travis.yml +12 -7
  6. data/CHANGELOG.md +31 -2
  7. data/LICENSE +2 -0
  8. data/README.md +25 -12
  9. data/lib/roo.rb +4 -1
  10. data/lib/roo/base.rb +65 -56
  11. data/lib/roo/constants.rb +5 -3
  12. data/lib/roo/csv.rb +20 -12
  13. data/lib/roo/excelx.rb +42 -16
  14. data/lib/roo/excelx/cell.rb +10 -6
  15. data/lib/roo/excelx/cell/base.rb +26 -12
  16. data/lib/roo/excelx/cell/boolean.rb +9 -6
  17. data/lib/roo/excelx/cell/date.rb +7 -7
  18. data/lib/roo/excelx/cell/datetime.rb +14 -18
  19. data/lib/roo/excelx/cell/empty.rb +3 -2
  20. data/lib/roo/excelx/cell/number.rb +35 -34
  21. data/lib/roo/excelx/cell/string.rb +3 -3
  22. data/lib/roo/excelx/cell/time.rb +4 -3
  23. data/lib/roo/excelx/comments.rb +3 -3
  24. data/lib/roo/excelx/coordinate.rb +11 -4
  25. data/lib/roo/excelx/extractor.rb +21 -3
  26. data/lib/roo/excelx/format.rb +38 -31
  27. data/lib/roo/excelx/images.rb +26 -0
  28. data/lib/roo/excelx/relationships.rb +3 -3
  29. data/lib/roo/excelx/shared.rb +10 -3
  30. data/lib/roo/excelx/shared_strings.rb +9 -15
  31. data/lib/roo/excelx/sheet.rb +49 -10
  32. data/lib/roo/excelx/sheet_doc.rb +86 -48
  33. data/lib/roo/excelx/styles.rb +3 -3
  34. data/lib/roo/excelx/workbook.rb +7 -3
  35. data/lib/roo/helpers/default_attr_reader.rb +20 -0
  36. data/lib/roo/helpers/weak_instance_cache.rb +41 -0
  37. data/lib/roo/open_office.rb +8 -6
  38. data/lib/roo/spreadsheet.rb +1 -1
  39. data/lib/roo/utils.rb +48 -19
  40. data/lib/roo/version.rb +1 -1
  41. data/roo.gemspec +13 -11
  42. data/spec/lib/roo/base_spec.rb +45 -3
  43. data/spec/lib/roo/excelx_spec.rb +125 -31
  44. data/spec/lib/roo/strict_spec.rb +43 -0
  45. data/spec/lib/roo/utils_spec.rb +12 -3
  46. data/spec/lib/roo/weak_instance_cache_spec.rb +92 -0
  47. data/spec/lib/roo_spec.rb +0 -0
  48. data/test/excelx/cell/test_attr_reader_default.rb +72 -0
  49. data/test/excelx/cell/test_base.rb +5 -0
  50. data/test/excelx/cell/test_datetime.rb +6 -6
  51. data/test/excelx/cell/test_empty.rb +11 -0
  52. data/test/excelx/cell/test_number.rb +9 -0
  53. data/test/excelx/cell/test_string.rb +20 -0
  54. data/test/excelx/cell/test_time.rb +4 -4
  55. data/test/excelx/test_coordinate.rb +51 -0
  56. data/test/formatters/test_csv.rb +17 -0
  57. data/test/formatters/test_xml.rb +4 -4
  58. data/test/roo/test_base.rb +2 -2
  59. data/test/roo/test_csv.rb +28 -0
  60. data/test/test_helper.rb +13 -0
  61. data/test/test_roo.rb +7 -7
  62. metadata +21 -11
  63. data/.github/ISSUE_TEMPLATE +0 -10
  64. data/Gemfile_ruby2 +0 -30
@@ -154,3 +154,16 @@ def skip_jruby_incompatible_test
154
154
  msg = "This test uses a feature incompatible with JRuby"
155
155
  skip(msg) if defined?(JRUBY_VERSION)
156
156
  end
157
+
158
+ def with_timezone(new_tz)
159
+ if new_tz
160
+ begin
161
+ prev_tz, ENV['TZ'] = ENV['TZ'], new_tz
162
+ yield
163
+ ensure
164
+ ENV['TZ'] = prev_tz
165
+ end
166
+ else
167
+ yield
168
+ end
169
+ end
@@ -339,21 +339,21 @@ class TestRoo < Minitest::Test
339
339
 
340
340
  # compare large spreadsheets
341
341
  def test_compare_large_spreadsheets
342
- # problematisch, weil Formeln in Excel nicht unterstützt werden
343
342
  skip_long_test
344
- qq = Roo::OpenOffice.new(File.join('test',"Bibelbund.ods"))
345
- with_each_spreadsheet(:name=>'Bibelbund') do |oo|
346
- # p "comparing Bibelbund.ods with #{oo.class}"
343
+ qq = Roo::OpenOffice.new(File.join('test', 'files', "Bibelbund.ods"))
344
+ with_each_spreadsheet(name: 'Bibelbund') do |oo|
347
345
  oo.sheets.each do |sh|
348
346
  oo.first_row.upto(oo.last_row) do |row|
349
347
  oo.first_column.upto(oo.last_column) do |col|
350
- c1 = qq.cell(row,col,sh)
348
+ c1 = qq.cell(row, col, sh)
351
349
  c1.force_encoding("UTF-8") if c1.class == String
352
350
  c2 = oo.cell(row,col,sh)
353
351
  c2.force_encoding("UTF-8") if c2.class == String
352
+ next if c1.nil? && c2.nil?
353
+
354
354
  assert_equal c1, c2, "diff in #{sh}/#{row}/#{col}}"
355
- assert_equal qq.celltype(row,col,sh), oo.celltype(row,col,sh)
356
- assert_equal qq.formula?(row,col,sh), oo.formula?(row,col,sh) if oo.class != Roo::Excel
355
+ assert_equal qq.celltype(row, col, sh), oo.celltype(row, col, sh)
356
+ assert_equal qq.formula?(row, col, sh), oo.formula?(row, col, sh)
357
357
  end
358
358
  end
359
359
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Preymesser
@@ -9,10 +9,11 @@ authors:
9
9
  - Ben Woosley
10
10
  - Oleksandr Simonov
11
11
  - Steven Daniels
12
+ - Anmol Chopra
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2017-01-04 00:00:00.000000000 Z
16
+ date: 2019-01-18 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: nokogiri
@@ -32,9 +33,9 @@ dependencies:
32
33
  name: rubyzip
33
34
  requirement: !ruby/object:Gem::Requirement
34
35
  requirements:
35
- - - "~>"
36
+ - - ">="
36
37
  - !ruby/object:Gem::Version
37
- version: '1.1'
38
+ version: 1.2.1
38
39
  - - "<"
39
40
  - !ruby/object:Gem::Version
40
41
  version: 2.0.0
@@ -42,9 +43,9 @@ dependencies:
42
43
  prerelease: false
43
44
  version_requirements: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - "~>"
46
+ - - ">="
46
47
  - !ruby/object:Gem::Version
47
- version: '1.1'
48
+ version: 1.2.1
48
49
  - - "<"
49
50
  - !ruby/object:Gem::Version
50
51
  version: 2.0.0
@@ -116,13 +117,14 @@ extensions: []
116
117
  extra_rdoc_files: []
117
118
  files:
118
119
  - ".codeclimate.yml"
119
- - ".github/ISSUE_TEMPLATE"
120
+ - ".github/issue_template.md"
121
+ - ".github/pull_request_template.md"
120
122
  - ".gitignore"
123
+ - ".rubocop.yml"
121
124
  - ".simplecov"
122
125
  - ".travis.yml"
123
126
  - CHANGELOG.md
124
127
  - Gemfile
125
- - Gemfile_ruby2
126
128
  - Guardfile
127
129
  - LICENSE
128
130
  - README.md
@@ -149,6 +151,7 @@ files:
149
151
  - lib/roo/excelx/coordinate.rb
150
152
  - lib/roo/excelx/extractor.rb
151
153
  - lib/roo/excelx/format.rb
154
+ - lib/roo/excelx/images.rb
152
155
  - lib/roo/excelx/relationships.rb
153
156
  - lib/roo/excelx/shared.rb
154
157
  - lib/roo/excelx/shared_strings.rb
@@ -162,6 +165,8 @@ files:
162
165
  - lib/roo/formatters/matrix.rb
163
166
  - lib/roo/formatters/xml.rb
164
167
  - lib/roo/formatters/yaml.rb
168
+ - lib/roo/helpers/default_attr_reader.rb
169
+ - lib/roo/helpers/weak_instance_cache.rb
165
170
  - lib/roo/libre_office.rb
166
171
  - lib/roo/link.rb
167
172
  - lib/roo/open_office.rb
@@ -181,9 +186,13 @@ files:
181
186
  - spec/lib/roo/libreoffice_spec.rb
182
187
  - spec/lib/roo/openoffice_spec.rb
183
188
  - spec/lib/roo/spreadsheet_spec.rb
189
+ - spec/lib/roo/strict_spec.rb
184
190
  - spec/lib/roo/utils_spec.rb
191
+ - spec/lib/roo/weak_instance_cache_spec.rb
192
+ - spec/lib/roo_spec.rb
185
193
  - spec/spec_helper.rb
186
194
  - test/all_ss.rb
195
+ - test/excelx/cell/test_attr_reader_default.rb
187
196
  - test/excelx/cell/test_base.rb
188
197
  - test/excelx/cell/test_boolean.rb
189
198
  - test/excelx/cell/test_date.rb
@@ -192,6 +201,7 @@ files:
192
201
  - test/excelx/cell/test_number.rb
193
202
  - test/excelx/cell/test_string.rb
194
203
  - test/excelx/cell/test_time.rb
204
+ - test/excelx/test_coordinate.rb
195
205
  - test/formatters/test_csv.rb
196
206
  - test/formatters/test_matrix.rb
197
207
  - test/formatters/test_xml.rb
@@ -209,7 +219,7 @@ files:
209
219
  - test/roo/test_open_office.rb
210
220
  - test/test_helper.rb
211
221
  - test/test_roo.rb
212
- homepage: http://github.com/roo-rb/roo
222
+ homepage: https://github.com/roo-rb/roo
213
223
  licenses:
214
224
  - MIT
215
225
  metadata: {}
@@ -221,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
221
231
  requirements:
222
232
  - - ">="
223
233
  - !ruby/object:Gem::Version
224
- version: '0'
234
+ version: 2.3.0
225
235
  required_rubygems_version: !ruby/object:Gem::Requirement
226
236
  requirements:
227
237
  - - ">="
@@ -229,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
239
  version: '0'
230
240
  requirements: []
231
241
  rubyforge_project:
232
- rubygems_version: 2.5.1
242
+ rubygems_version: 2.7.7
233
243
  signing_key:
234
244
  specification_version: 4
235
245
  summary: Roo can access the contents of various spreadsheet files.
@@ -1,10 +0,0 @@
1
- Thanks for filing an issue. Following these instructions will help us solve your problem sooner.
2
-
3
- 1. Describe the issue.
4
- 2. Create a gist for this issue (Sample gist: https://gist.github.com/stevendaniels/98a05849036e99bb8b3c)?
5
-
6
- Here are some instructions for creating such a gist.
7
-
8
- 1. Create a gist (https://gist.github.com) with code that creates the error.
9
- 2. Clone the gist repo locally, add a stripped down version of the offending spreadsheet to the gist repo, and push the gist's changes master.
10
- 3. Paste the gist url here.
@@ -1,30 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- gem 'nokogiri', "< 1.7.0"
6
-
7
- group :test do
8
- # additional testing libs
9
- gem 'shoulda'
10
- gem 'rspec', '>= 3.0.0'
11
- gem 'simplecov', '>= 0.9.0', require: false
12
- gem 'coveralls', require: false
13
- gem "activesupport", "~> 4.2.0"
14
- gem "tins", '~> 1.6.0'
15
- gem "term-ansicolor", "~> 1.3.2"
16
- gem "minitest-reporters"
17
- end
18
-
19
- group :local_development do
20
- gem "listen", "~> 3.0.6"
21
- gem 'terminal-notifier-guard', require: false if RUBY_PLATFORM.downcase.include?('darwin')
22
- gem 'guard-rspec', '>= 4.3.1', require: false
23
- gem 'guard-minitest', require: false
24
- gem 'guard-bundler', require: false
25
- gem 'guard-preek', require: false
26
- gem 'guard-rubocop', require: false
27
- gem 'guard-reek', github: 'pericles/guard-reek', require: false
28
- gem 'rb-readline'
29
- gem 'pry'
30
- end