roo 3.0.0 → 4.0.0

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
  SHA256:
3
- metadata.gz: e760df54834eed96fbedb5e0aeffa97108962130bd861568ed1d68340487001f
4
- data.tar.gz: af4b682bef65d6cc7b843aa99123fe0bc28bac335ebd5af64029584e843000dc
3
+ metadata.gz: 0654bc954849a46d96a91404cbf8133f46a188c86cbc7019802f957f21fc910c
4
+ data.tar.gz: cfd2c14c02116a9db0e68020ff1238d1fc02475366401af64448d073bb220f64
5
5
  SHA512:
6
- metadata.gz: cdf6d407e8e10090720f46a60ded37a6c1ad1aa9d3e764547917fe3bb71d4fcd89b9f97d6cffd581472ce2e7df2f581c26c4d75366e342ec848a45e1fc6bd3d8
7
- data.tar.gz: d91a0596f2cafd202af7e75faf2adabc8e9b3e44ff8067f0d7feacceb1f2a66d8d3d1b0e34713b489ae618c73023de472647f65f861c7c0d997ead504bdd359d
6
+ metadata.gz: c58925cb5695b9a9932a6fb50d8229b821e7f7ea47c20c43c616c8f7a7a7dce4b1e516b49b1336976d1d36374bd2d842eedb54dd11a3a6b1e472eb114b54e84c
7
+ data.tar.gz: 81bafd9e8cdb155c7df1e849a2856e521ee00a851be43e60f059c7b1ecb0e4c83236e01e8bbac40429c5ebbee83f4dd2e12fa4cb00d6be8891aec526775b3309
@@ -0,0 +1,9 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ commit-message:
8
+ prefix: chore
9
+ include: scope
@@ -16,7 +16,7 @@ jobs:
16
16
  release_created: ${{ steps.release.outputs.release_created }}
17
17
  tag_name: ${{ steps.release.outputs.tag_name }}
18
18
  steps:
19
- - uses: googleapis/release-please-action@v4
19
+ - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
20
20
  id: release
21
21
  with:
22
22
  config-file: release-please-config.json
@@ -32,19 +32,19 @@ jobs:
32
32
  id-token: write
33
33
  steps:
34
34
  - name: Checkout repository
35
- uses: actions/checkout@v4
35
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36
36
  with:
37
37
  ref: ${{ needs.release-please.outputs.tag_name }}
38
38
  fetch-tags: true
39
39
 
40
40
  - name: Set up Ruby
41
- uses: ruby/setup-ruby@v1
41
+ uses: ruby/setup-ruby@e1bd6146574da5e0795075b5319b300edb30c5b0 # v1.333.0
42
42
  with:
43
43
  ruby-version: '3.4'
44
44
  bundler-cache: true
45
45
 
46
46
  - name: Publish to RubyGems
47
- uses: rubygems/release-gem@v1
47
+ uses: rubygems/release-gem@7f9650160c1a4e7989fdc9855807bdbd421d8b6b # v1.4.1
48
48
 
49
49
  - name: Upload Gem to GitHub Release
50
50
  env:
@@ -18,20 +18,18 @@ jobs:
18
18
  fail-fast: false
19
19
  matrix:
20
20
  ruby:
21
- - '3.1'
22
- - '3.2'
23
21
  - '3.3'
24
22
  - '3.4'
25
- - '3.5'
23
+ - '4.0'
26
24
  - ruby-head
27
- - jruby-9.4.10.0
25
+ - jruby-10
28
26
  include:
29
27
  - ruby: ruby-head
30
28
  env:
31
29
  RUBYOPT: '--jit'
32
30
  steps:
33
- - uses: actions/checkout@v4
34
- - uses: ruby/setup-ruby@v1
31
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32
+ - uses: ruby/setup-ruby@e1bd6146574da5e0795075b5319b300edb30c5b0 # v1.333.0
35
33
  with:
36
34
  ruby-version: ${{ matrix.ruby }}
37
35
  bundler-cache: true
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "3.0.0"
2
+ ".": "4.0.0"
3
3
  }
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  require: rubocop-performance
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 3.1
4
+ TargetRubyVersion: 3.3
5
5
  # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
6
6
  # to ignore them, so only the ones explicitly set in this file are enabled.
7
7
  DisabledByDefault: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## Unreleased
2
2
 
3
+ ## [4.0.0](https://github.com/roo-rb/roo/compare/v3.0.0...v4.0.0) (2026-10-22)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **ci:** remove unsupported ruby versions
9
+
10
+ ### Bug Fixes
11
+
12
+ * **ci:** remove unsupported ruby versions ([3425358](https://github.com/roo-rb/roo/commit/34253583250a3c6d43e632ac376dd2715c519557))
13
+ * compare the worksheet target from workbook.xml.rels as text, not as a regexp ([#645](https://github.com/roo-rb/roo/issues/645)) ([3bfff46](https://github.com/roo-rb/roo/commit/3bfff46c21888f8969b41d9a6d69b4609e906969))
14
+
3
15
  ## [3.0.0](https://github.com/roo-rb/roo/compare/v2.10.1...v3.0.0) (2025-10-01)
4
16
 
5
17
  ### Miscellaneous Chores
@@ -18,6 +18,8 @@ module Roo
18
18
 
19
19
  def create_numeric(number)
20
20
  return number if Excelx::ERROR_VALUES.include?(number)
21
+ return nil if (number.nil? || number == "")
22
+
21
23
  case @format
22
24
  when /%/
23
25
  Float(number)
@@ -30,6 +32,7 @@ module Roo
30
32
 
31
33
  def formatted_value
32
34
  return @cell_value if Excelx::ERROR_VALUES.include?(@cell_value)
35
+ return '' if (@cell_value.nil? || @cell_value == "")
33
36
 
34
37
  formatter = generate_formatter(@format)
35
38
  if formatter.is_a? Proc
data/lib/roo/excelx.rb CHANGED
@@ -374,7 +374,7 @@ module Roo
374
374
  def extract_sheets_in_order(entries, sheet_ids, sheets, tmpdir)
375
375
  (sheet_ids & sheets.keys).each_with_index do |id, i|
376
376
  name = sheets[id]
377
- entry = entries.find { |e| "/#{e.name}" =~ /#{name}$/ }
377
+ entry = name && entries.find { |e| "/#{e.name}".end_with?(name) }
378
378
  path = "#{tmpdir}/roo_sheet#{i + 1}"
379
379
  sheet_files << path
380
380
  @sheet_files << path
data/lib/roo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Roo
2
- VERSION = "3.0.0"
2
+ VERSION = "4.0.0"
3
3
  end
data/roo.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.files.reject! { |fn| fn.include?('test/files') }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.required_ruby_version = ">= 3.1.0"
20
+ spec.required_ruby_version = ">= 3.3.0"
21
21
 
22
22
  if RUBY_VERSION >= '3.4.0'
23
23
  spec.add_dependency 'base64', '~> 0.2'
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Roo::Excelx::Cell::Number do
4
+
5
+ describe '#initialize' do
6
+ let(:formula) { nil }
7
+ let(:excelx_type) { [:numeric_or_formula, format] }
8
+ let(:format) { "#,##0.00" }
9
+ let(:style) { 1 }
10
+ let(:link) { nil }
11
+ let(:coordinate) { [1,1] }
12
+
13
+ let(:number) { Roo::Excelx::Cell::Number.new(value, formula, excelx_type, style, link, coordinate)}
14
+
15
+ context 'with an actual value' do
16
+ let(:value) { 0.1 }
17
+ it 'creates the object and parses the value' do
18
+ expect(number.value).to eq 0.1
19
+ end
20
+ end
21
+
22
+ context 'with an empty value' do
23
+ let(:value) { "" }
24
+ it 'creates the object with a nil value' do
25
+ expect(number.value).to eq nil
26
+ end
27
+ end
28
+ end
29
+
30
+ describe '#formatted_value' do
31
+ let(:formula) { nil }
32
+ let(:excelx_type) { [:numeric_or_formula, format] }
33
+ let(:format) { "#,##0.00" }
34
+ let(:style) { 1 }
35
+ let(:link) { nil }
36
+ let(:coordinate) { [1,1] }
37
+
38
+ let(:number) { Roo::Excelx::Cell::Number.new(value, formula, excelx_type, style, link, coordinate)}
39
+
40
+ context 'with an actual value' do
41
+ let(:value) { 0.1 }
42
+ it 'creates the object and parses the value' do
43
+ expect(number.formatted_value).to eq '0.10'
44
+ end
45
+ end
46
+
47
+ context 'with an empty value' do
48
+ let(:value) { "" }
49
+ it 'creates the object with a nil value' do
50
+ expect(number.formatted_value).to eq ''
51
+ end
52
+ end
53
+
54
+ end
55
+ end
@@ -56,6 +56,26 @@ describe Roo::Excelx do
56
56
  expect(subject).to be_a(Roo::Excelx)
57
57
  end
58
58
  end
59
+
60
+ context 'given a worksheet target with characters that are special in a regexp' do
61
+ let(:path) do
62
+ tmpdir = Dir.mktmpdir
63
+ path = File.join(tmpdir, 'special_target.xlsx')
64
+ FileUtils.cp('test/files/only_one_sheet.xlsx', path)
65
+ Zip::File.open(path) do |zip|
66
+ zip.rename('xl/worksheets/sheet1.xml', 'xl/worksheets/sheet(1).xml')
67
+ rels = zip.read('xl/_rels/workbook.xml.rels')
68
+ zip.get_output_stream('xl/_rels/workbook.xml.rels') do |stream|
69
+ stream.write(rels.sub('Target="worksheets/sheet1.xml"', 'Target="worksheets/sheet(1).xml"'))
70
+ end
71
+ end
72
+ path
73
+ end
74
+
75
+ it 'finds the worksheet by its target as text, not as a pattern' do
76
+ expect(subject.sheets).to eq(['Sheet1'])
77
+ end
78
+ end
59
79
  end
60
80
 
61
81
  describe '#cell' do
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: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Preymesser
@@ -185,6 +185,7 @@ executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
+ - ".github/dependabot.yml"
188
189
  - ".github/issue_template.md"
189
190
  - ".github/pull_request_template.md"
190
191
  - ".github/workflows/release-please.yml"
@@ -253,6 +254,7 @@ files:
253
254
  - spec/helpers.rb
254
255
  - spec/lib/roo/base_spec.rb
255
256
  - spec/lib/roo/csv_spec.rb
257
+ - spec/lib/roo/excelx/cell/number_spec.rb
256
258
  - spec/lib/roo/excelx/cell/time_spec.rb
257
259
  - spec/lib/roo/excelx/format_spec.rb
258
260
  - spec/lib/roo/excelx/relationships_spec.rb
@@ -306,7 +308,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
308
  requirements:
307
309
  - - ">="
308
310
  - !ruby/object:Gem::Version
309
- version: 3.1.0
311
+ version: 3.3.0
310
312
  required_rubygems_version: !ruby/object:Gem::Requirement
311
313
  requirements:
312
314
  - - ">="