From 37c0124fbfd8ef639e6acce1363581ff545402bf Mon Sep 17 00:00:00 2001 From: Brian Shand Date: Mon, 24 Nov 2025 23:48:02 +0000 Subject: [PATCH 1/3] Update gem development dependencies for Ruby >= 2.3 --- msworddoc-extractor.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/msworddoc-extractor.gemspec b/msworddoc-extractor.gemspec index fc5a400..4504ceb 100644 --- a/msworddoc-extractor.gemspec +++ b/msworddoc-extractor.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |gem| gem.require_paths = ["lib"] gem.version = '0.2.0' - has_rake = RUBY_VERSION >= '1.9.' + has_rake = RUBY_VERSION >= '1.9.' && RUBY_VERSION < '2.3' if gem.respond_to? :specification_version then gem.specification_version = 3 @@ -39,4 +39,5 @@ Gem::Specification.new do |gem| gem.add_dependency 'ruby-ole' gem.add_dependency 'rake' unless has_rake end + gem.add_development_dependency 'test-unit' end From f3c84df191614f9238a3ab9223c201e8d4f34d59 Mon Sep 17 00:00:00 2001 From: Brian Shand Date: Mon, 24 Nov 2025 23:49:30 +0000 Subject: [PATCH 2/3] Fix Ruby 3.4 frozen string literal warnings --- lib/msworddoc/extractor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msworddoc/extractor.rb b/lib/msworddoc/extractor.rb index 967d733..3447592 100644 --- a/lib/msworddoc/extractor.rb +++ b/lib/msworddoc/extractor.rb @@ -236,7 +236,7 @@ def retrieve_substring(f, offset, length = -1) i -= 1 raise 'could not find suitable heading piece' unless i >= 0 - output = "" + output = "".dup while length > 0 || length < 0 pcd = @pcds[i] From d390c244d259512cd9810ef3335dc308f777478d Mon Sep 17 00:00:00 2001 From: Brian Shand Date: Tue, 25 Nov 2025 07:54:55 +0000 Subject: [PATCH 3/3] Add GitHub Actions tests --- .github/workflows/test.yml | 50 ++++++++++++++++++++++++++++++ .github/workflows/test_ruby193.yml | 38 +++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/test_ruby193.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f22dec1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,50 @@ +name: Test + +on: [push] + +jobs: + test: + strategy: + fail-fast: false + matrix: + ruby-version: + - '2.0' + - '2.1' + - '2.2' + - '2.3' + - '2.4' + - '2.5' + - '2.6' + - '2.7' + - '3.0' + - '3.1' + - '3.2' + - '3.3' + - '3.4' + + name: Ruby ${{ matrix.ruby-version }} + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + - name: Install dependencies + run: bundle install + - name: Run tests + run: bundle exec rake test + + # A utility job upon which Branch Protection can depend, + # thus remaining agnostic of the matrix. + test_matrix: + if: ${{ always() }} + runs-on: ubuntu-latest + name: Matrix + needs: test + steps: + - name: Check build matrix status + if: ${{ needs.test.result != 'success' }} + run: exit 1 diff --git a/.github/workflows/test_ruby193.yml b/.github/workflows/test_ruby193.yml new file mode 100644 index 0000000..742efe5 --- /dev/null +++ b/.github/workflows/test_ruby193.yml @@ -0,0 +1,38 @@ +name: Test Ruby 1.9 + +on: [push] + +jobs: + test: + strategy: + fail-fast: false + matrix: + ruby-version: + - '1.9' + + name: Ruby ${{ matrix.ruby-version }} + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + - name: Install dependencies + run: bundle install + - name: Run tests + run: bundle exec rake test + + # A utility job upon which Branch Protection can depend, + # thus remaining agnostic of the matrix. + test_matrix: + if: ${{ always() }} + runs-on: ubuntu-latest + name: Matrix + needs: test + steps: + - name: Check build matrix status + if: ${{ needs.test.result != 'success' }} + run: exit 1