diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 963b782..275b203 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,16 +18,24 @@ jobs: - '3.0' - '3.1' - '3.2' + - '3.3' gemfile: - gemfiles/Gemfile.rails61 - gemfiles/Gemfile.rails70 - # Rails 7.1.2 conflicts with latest ndr_support 5.10.0 default to_s handling. - #- gemfiles/Gemfile.rails71 + - gemfiles/Gemfile.rails71 + - gemfiles/Gemfile.rails72 + - gemfiles/Gemfile.rails80 exclude: - # rails 7.0 requires ruby >= 2.7 + # rails 7.2 requires ruby >= 3.1 # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html - - ruby-version: '2.6' - gemfile: 'gemfiles/Gemfile.rails70' + - ruby-version: '3.0' + gemfile: 'gemfiles/Gemfile.rails72' + # rails 8.0 requires ruby >= 3.2 + # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html + - ruby-version: '3.0' + gemfile: 'gemfiles/Gemfile.rails80' + - ruby-version: '3.1' + gemfile: 'gemfiles/Gemfile.rails80' name: Ruby ${{ matrix.ruby-version }} / Bundle ${{ matrix.gemfile }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e09537..cadf522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## [Unreleased] -======= -* no unreleased changes * +### Fixed +* Support Ruby 3.2 and 3.3, Rails 7.1, 7.2 and 8.0 ## 11.2.0 / 2024-04-10 ### Added diff --git a/gemfiles/Gemfile.rails72 b/gemfiles/Gemfile.rails72 new file mode 100644 index 0000000..12775ee --- /dev/null +++ b/gemfiles/Gemfile.rails72 @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gemspec path: '..' + +gem 'activesupport', '~> 7.2.0' diff --git a/gemfiles/Gemfile.rails80 b/gemfiles/Gemfile.rails80 new file mode 100644 index 0000000..92f240d --- /dev/null +++ b/gemfiles/Gemfile.rails80 @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gemspec path: '..' + +gem 'activesupport', '~> 8.0.0' diff --git a/lib/ndr_import/csv_library.rb b/lib/ndr_import/csv_library.rb index c9d31cd..7f31597 100644 --- a/lib/ndr_import/csv_library.rb +++ b/lib/ndr_import/csv_library.rb @@ -49,8 +49,12 @@ def read_csv_from_file(filepath) private + def deprecator + @deprecator ||= ActiveSupport::Deprecation.new(NdrImport::VERSION, 'NdrImport') + end + def deprecate(additional_message = nil) - ActiveSupport::Deprecation.warn(<<~MESSAGE) + deprecator.warn(<<~MESSAGE) CSVLibrary is deprecated, and will be removed in a future version of ndr_import. Please use standard functionality provided by Ruby's CSV library (#{additional_message}). MESSAGE diff --git a/ndr_import.gemspec b/ndr_import.gemspec index 6e7a64d..0fcebfe 100644 --- a/ndr_import.gemspec +++ b/ndr_import.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_dependency 'activemodel' - spec.add_dependency 'activesupport', '>= 6.1', '< 7.1' + spec.add_dependency 'activesupport', '>= 6.1', '< 8.1' spec.add_dependency 'ndr_support', '>= 5.3.2', '< 6' spec.add_dependency 'rubyzip', '~> 2.0' @@ -29,6 +29,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'avro', '~> 1.11.0' spec.add_dependency 'bio-vcf', '~> 0.9.5' + spec.add_dependency 'csv' spec.add_dependency 'docx', '~> 0.3' spec.add_dependency 'msworddoc-extractor', '0.2.0' spec.add_dependency 'nokogiri', '~> 1.8', '>= 1.8.5' diff --git a/test/csv_library_test.rb b/test/csv_library_test.rb index c235775..e2ba3fc 100644 --- a/test/csv_library_test.rb +++ b/test/csv_library_test.rb @@ -11,13 +11,15 @@ class CSVLibraryTest < ActiveSupport::TestCase end test 'raises deprecation warnings' do - assert_deprecated(/will be removed in a future version of ndr_import/) do + deprecator = CSVLibrary.send(:deprecator) + assert_deprecated(/will be removed in a future version of ndr_import/, deprecator) do assert CSVLibrary.fastercsv?, '::CSV unexpectedly was the _old_ standard library' end end test 'defines functional legacy methods' do - assert_deprecated(/write_csv_to_string -> generate/) do + deprecator = CSVLibrary.send(:deprecator) + assert_deprecated(/write_csv_to_string -> generate/, deprecator) do assert_equal "1,2,3\n", CSVLibrary.write_csv_to_string([%w[1 2 3]]) end end diff --git a/test/helpers/file/zip_test.rb b/test/helpers/file/zip_test.rb index 4bf083c..44a4e6d 100644 --- a/test/helpers/file/zip_test.rb +++ b/test/helpers/file/zip_test.rb @@ -44,7 +44,7 @@ def setup File.open(fname, 'w') { |f| f.write "test #{fname}" } end - ::Zip::File.open(zip_name, Zip::File::CREATE) do |zipfile| + ::Zip::File.open(zip_name, create: true) do |zipfile| files.each do |fname| zipfile.add(File.basename(fname.to_s), fname.to_s) end diff --git a/test/standard_mappings_test.rb b/test/standard_mappings_test.rb index 53ef27e..6feb1dc 100644 --- a/test/standard_mappings_test.rb +++ b/test/standard_mappings_test.rb @@ -1,11 +1,12 @@ -# encoding: UTF-8 require 'test_helper' # This tests the StandardMappings configuration class class StandardMappingsTest < ActiveSupport::TestCase test 'should not raise exception on reconfiguring NdrImport::StandardMappings' do - NdrImport::StandardMappings.mappings = - YAML.load_file(SafePath.new('permanent_test_files').join('standard_mappings.yml')) + assert_nothing_raised do + NdrImport::StandardMappings.mappings = + YAML.load_file(SafePath.new('permanent_test_files').join('standard_mappings.yml')) + end end test 'should raise exception on setting non-hash standard mappings' do diff --git a/test/xml/table_test.rb b/test/xml/table_test.rb index 671260c..77dd709 100644 --- a/test/xml/table_test.rb +++ b/test/xml/table_test.rb @@ -71,7 +71,9 @@ def setup end test 'test should not raise exception on forced slurp' do - NdrImport::Xml::Table.new(klass: 'SomeTestKlass', slurp: true, columns: xml_column_mapping) + assert_nothing_raised do + NdrImport::Xml::Table.new(klass: 'SomeTestKlass', slurp: true, columns: xml_column_mapping) + end end test 'test should augment columns for repeating sections' do