From 40e7b290079ca9f0b31917ee4afc5d9f0ed16642 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 3 Jan 2024 13:45:44 -0500 Subject: [PATCH 1/3] remove: SQLite3::VersionProxy deprecated in v1.3.2 (circa 2010) --- CONTRIBUTING.md | 2 +- lib/sqlite3/version.rb | 20 -------------------- test/helper.rb | 8 ++------ test/test_sqlite3.rb | 5 ----- 4 files changed, 3 insertions(+), 32 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 862d1fc6..d574d65e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,7 @@ Update `/dependencies.yml` to reflect: A quick checklist: - [ ] make sure CI is green! -- [ ] update `CHANGELOG.md` and `lib/sqlite3/version.rb` including `VersionProxy::{MINOR,TINY}` +- [ ] update `CHANGELOG.md` and `lib/sqlite3/version.rb` - [ ] run `bin/build-gems` and make sure it completes and all the tests pass - [ ] create a git tag using a format that matches the pattern `v\d+\.\d+\.\d+`, e.g. `v1.3.13` - [ ] `git push && git push --tags` diff --git a/lib/sqlite3/version.rb b/lib/sqlite3/version.rb index 00e64a68..d582902b 100644 --- a/lib/sqlite3/version.rb +++ b/lib/sqlite3/version.rb @@ -1,23 +1,3 @@ module SQLite3 - VERSION = "2.0.0.dev" - - module VersionProxy - MAJOR = 2 - MINOR = 0 - TINY = 0 - BUILD = "dev" - - STRING = [ MAJOR, MINOR, TINY, BUILD ].compact.join( "." ) - - VERSION = ::SQLite3::VERSION - end - - def self.const_missing(name) - return super unless name == :Version - warn(<<-eowarn) if $VERBOSE -#{caller[0]}: `SQLite::Version` will be removed in sqlite3-ruby version 2.0.0 - eowarn - VersionProxy - end end diff --git a/test/helper.rb b/test/helper.rb index 8f7d1b35..a5be6a44 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -5,15 +5,11 @@ $VERBOSE = nil end -puts "info: sqlite3-ruby version: #{SQLite3::VERSION}/#{SQLite3::VersionProxy::STRING}" -puts "info: sqlite3 version: #{SQLite3::SQLITE_VERSION}/#{SQLite3::SQLITE_LOADED_VERSION}" +puts "info: gem version: #{SQLite3::VERSION}" +puts "info: sqlite version: #{SQLite3::SQLITE_VERSION}/#{SQLite3::SQLITE_LOADED_VERSION}" puts "info: sqlcipher?: #{SQLite3.sqlcipher?}" puts "info: threadsafe?: #{SQLite3.threadsafe?}" -unless RUBY_VERSION >= "1.9" - require 'iconv' -end - module SQLite3 class TestCase < Minitest::Test alias :assert_not_equal :refute_equal diff --git a/test/test_sqlite3.rb b/test/test_sqlite3.rb index 4bd1c5df..f455c23f 100644 --- a/test/test_sqlite3.rb +++ b/test/test_sqlite3.rb @@ -18,11 +18,6 @@ def test_threadsafe? end end - def test_version_strings - skip if SQLite3::VERSION.include?("test") # see set-version-to-timestamp rake task - assert_equal(SQLite3::VERSION, SQLite3::VersionProxy::STRING) - end - def test_compiled_version_and_loaded_version assert_equal(SQLite3::SQLITE_VERSION, SQLite3::SQLITE_LOADED_VERSION) end From e2a09240815c3019f84936c9819ff3c76b689b20 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 3 Jan 2024 13:47:49 -0500 Subject: [PATCH 2/3] ruby: drop support for Ruby 2.7 - delete code and tests that branched on RUBY_VERSION - update dependencies.yml for use with yaml symbolize_names --- .github/workflows/sqlite3-ruby.yml | 14 ++------- appveyor.yml | 2 +- bin/test-gem-file-contents | 5 ++-- dependencies.yml | 11 ++++--- ext/sqlite3/extconf.rb | 7 +---- rakelib/native.rake | 3 +- sqlite3.gemspec | 2 +- test/test_collation.rb | 46 ++++++++++++++---------------- test/test_database.rb | 7 +---- test/test_encoding.rb | 2 +- test/test_integration_pending.rb | 33 --------------------- 11 files changed, 37 insertions(+), 95 deletions(-) diff --git a/.github/workflows/sqlite3-ruby.yml b/.github/workflows/sqlite3-ruby.yml index c47b0aa8..6cedede9 100644 --- a/.github/workflows/sqlite3-ruby.yml +++ b/.github/workflows/sqlite3-ruby.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - ruby: ["3.3", "3.2", "3.1", "3.0", "2.7"] + ruby: ["3.3", "3.2", "3.1", "3.0"] lib: [system, packaged] include: - { os: ubuntu-latest, ruby: truffleruby, lib: packaged } @@ -65,16 +65,6 @@ jobs: - run: bundle exec rake test - old_sqlite3: - runs-on: ubuntu-latest - container: - image: ruby:2.7.5-buster # old enough to not support SQLITE_DBCONFIG_DQS_DDL - steps: - - uses: actions/checkout@v4 - - run: bundle install - - run: bundle exec rake compile -- --enable-system-libraries - - run: bundle exec rake test - # reported at https://github.com/sparklemotion/sqlite3-ruby/issues/354 # TODO remove once https://github.com/flavorjones/mini_portile/issues/118 is fixed fedora: @@ -95,7 +85,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - ruby: ["3.3", "2.7"] # oldest and newest + ruby: ["3.3", "3.0"] # oldest and newest include: - { os: windows-latest, ruby: mingw } - { os: windows-latest, ruby: mswin } diff --git a/appveyor.yml b/appveyor.yml index 856e88c1..bb7cca58 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,7 +29,7 @@ test_script: environment: matrix: + - ruby_version: "33" - ruby_version: "32" - ruby_version: "31" - ruby_version: "30" - - ruby_version: "27" diff --git a/bin/test-gem-file-contents b/bin/test-gem-file-contents index 3ee29828..6a19d805 100755 --- a/bin/test-gem-file-contents +++ b/bin/test-gem-file-contents @@ -66,7 +66,7 @@ Minitest::Reporters.use!([Minitest::Reporters::SpecReporter.new]) puts "Testing '#{gemfile}' (#{gemspec.platform})" describe File.basename(gemfile) do let(:all_supported_ruby_versions) { - ["2.7", "3.0", "3.1", "3.2", "3.3"] + ["3.0", "3.1", "3.2", "3.3"] } let(:native_supported_ruby_versions) { ["3.0", "3.1", "3.2", "3.3"] } let(:ucrt_supported_ruby_versions) { ["3.1", "3.2", "3.3"] } @@ -119,8 +119,7 @@ describe File.basename(gemfile) do end it "contains the port files" do - # TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true - dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml")) + dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"), symbolize_names: true) sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url]) actual_ports = gemfile_contents.grep(%r{^ports/}) diff --git a/dependencies.yml b/dependencies.yml index 87ef2d61..2a027be9 100644 --- a/dependencies.yml +++ b/dependencies.yml @@ -1,5 +1,4 @@ -# TODO: stop using symbols here once we no longer support Ruby 2.7 and can rely on symbolize_names -:sqlite3: +sqlite3: # checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html: # 6c427f0547e2f7babe636b748dd5d5a1f2f31601adadef7e2805e7d1f7171861 # @@ -8,7 +7,7 @@ # # $ sha256sum ports/archives/sqlite-autoconf-3440200.tar.gz # 1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407 ports/archives/sqlite-autoconf-3440200.tar.gz - :version: "3.44.2" - :files: - - :url: "https://sqlite.org/2023/sqlite-autoconf-3440200.tar.gz" - :sha256: "1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407" + version: "3.44.2" + files: + - url: "https://sqlite.org/2023/sqlite-autoconf-3440200.tar.gz" + sha256: "1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407" diff --git a/ext/sqlite3/extconf.rb b/ext/sqlite3/extconf.rb index c8dbdad4..d48e84a2 100644 --- a/ext/sqlite3/extconf.rb +++ b/ext/sqlite3/extconf.rb @@ -97,10 +97,6 @@ def configure_packaged_libraries end def configure_extension - if Gem::Requirement.new("< 2.7").satisfied_by?(Gem::Version.new(RUBY_VERSION)) - append_cppflags("-DTAINTING_SUPPORT") - end - append_cflags("-fvisibility=hidden") # see https://github.com/rake-compiler/rake-compiler-dock/issues/87 if find_header("sqlite3.h") @@ -158,8 +154,7 @@ def sqlite3_config end def mini_portile_config - # TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true - YAML.load_file(File.join(package_root_dir, "dependencies.yml")) + YAML.load_file(File.join(package_root_dir, "dependencies.yml"), symbolize_names: true) end def abort_could_not_find(missing) diff --git a/rakelib/native.rake b/rakelib/native.rake index ba46fa91..5fea1d60 100644 --- a/rakelib/native.rake +++ b/rakelib/native.rake @@ -42,8 +42,7 @@ def add_file_to_gem(relative_source_path) end task gem_build_path do - # TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true - dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml")) + dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"), symbolize_names: true) sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url]) archive = Dir.glob(File.join("ports", "archives", sqlite_tarball)).first add_file_to_gem(archive) diff --git a/sqlite3.gemspec b/sqlite3.gemspec index 748e4d59..b44d42e8 100644 --- a/sqlite3.gemspec +++ b/sqlite3.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.licenses = ["BSD-3-Clause"] - s.required_ruby_version = Gem::Requirement.new(">= 2.7") + s.required_ruby_version = Gem::Requirement.new(">= 3.0") s.homepage = "https://github.com/sparklemotion/sqlite3-ruby" s.metadata = { diff --git a/test/test_collation.rb b/test/test_collation.rb index 360335e7..42fafbbf 100644 --- a/test/test_collation.rb +++ b/test/test_collation.rb @@ -47,36 +47,34 @@ def test_remove_collation end end - if RUBY_VERSION >= '1.9.1' - def test_encoding - comparator = Comparator.new - @db.collation 'foo', comparator - @db.execute('select data from ex order by 1 collate foo') + def test_encoding + comparator = Comparator.new + @db.collation 'foo', comparator + @db.execute('select data from ex order by 1 collate foo') - a, b = *comparator.calls.first + a, b = *comparator.calls.first - assert_equal Encoding.find('UTF-8'), a.encoding - assert_equal Encoding.find('UTF-8'), b.encoding - end + assert_equal Encoding.find('UTF-8'), a.encoding + assert_equal Encoding.find('UTF-8'), b.encoding + end - def test_encoding_default_internal - warn_before = $-w - $-w = false - before_enc = Encoding.default_internal + def test_encoding_default_internal + warn_before = $-w + $-w = false + before_enc = Encoding.default_internal - Encoding.default_internal = 'EUC-JP' - comparator = Comparator.new - @db.collation 'foo', comparator - @db.execute('select data from ex order by 1 collate foo') + Encoding.default_internal = 'EUC-JP' + comparator = Comparator.new + @db.collation 'foo', comparator + @db.execute('select data from ex order by 1 collate foo') - a, b = *comparator.calls.first + a, b = *comparator.calls.first - assert_equal Encoding.find('EUC-JP'), a.encoding - assert_equal Encoding.find('EUC-JP'), b.encoding - ensure - Encoding.default_internal = before_enc - $-w = warn_before - end + assert_equal Encoding.find('EUC-JP'), a.encoding + assert_equal Encoding.find('EUC-JP'), b.encoding + ensure + Encoding.default_internal = before_enc + $-w = warn_before end end end diff --git a/test/test_database.rb b/test/test_database.rb index c6581b8c..da8088cc 100644 --- a/test/test_database.rb +++ b/test/test_database.rb @@ -237,12 +237,7 @@ def test_new_with_options # determine if Ruby is running on Big Endian platform utf16 = ([1].pack("I") == [1].pack("N")) ? "UTF-16BE" : "UTF-16LE" - if RUBY_VERSION >= "1.9" - db = SQLite3::Database.new(':memory:'.encode(utf16), :utf16 => true) - else - db = SQLite3::Database.new(Iconv.conv(utf16, 'UTF-8', ':memory:'), - :utf16 => true) - end + db = SQLite3::Database.new(':memory:'.encode(utf16), :utf16 => true) assert_instance_of(SQLite3::Database, db) ensure db.close if db diff --git a/test/test_encoding.rb b/test/test_encoding.rb index ea1bfb47..a294a390 100644 --- a/test/test_encoding.rb +++ b/test/test_encoding.rb @@ -161,5 +161,5 @@ def test_euc_jp assert_equal str.encode('UTF-8'), row.first.first end - end if RUBY_VERSION >= '1.9.1' + end end diff --git a/test/test_integration_pending.rb b/test/test_integration_pending.rb index d5fd7cd3..3f7685c4 100644 --- a/test/test_integration_pending.rb +++ b/test/test_integration_pending.rb @@ -19,39 +19,6 @@ def teardown File.delete( "test.db" ) end - def test_busy_handler_outwait - skip("not working in 1.9") if RUBY_VERSION >= '1.9' - - busy = Mutex.new - busy.lock - handler_call_count = 0 - - t = Thread.new(busy) do |locker| - begin - db2 = SQLite3::Database.open( "test.db" ) - db2.transaction( :exclusive ) do - locker.lock - end - ensure - db2.close if db2 - end - end - - @db.busy_handler do |data,count| - handler_call_count += 1 - busy.unlock - true - end - - assert_nothing_raised do - @db.execute "insert into foo (b) values ( 'from 2' )" - end - - t.join - - assert_equal 1, handler_call_count - end - def test_busy_handler_impatient busy = Mutex.new busy.lock From c2e7e4cdc565841202edc20575fbaeed580d46c0 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 3 Jan 2024 13:50:12 -0500 Subject: [PATCH 3/3] doc: update CHANGELOG for next release --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3974af4e..14f44beb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # sqlite3-ruby Changelog +## next / unreleased + +(will be 2.0.0) + +### Ruby + +This release drops support for Ruby 2.7. + + +### Removed + +- Remove `SQLite3::VersionProxy` which has been deprecated since v1.3.2. + + ## 1.7.0 / 2023-12-27 ### Ruby