Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove VersionProxy, clean up version branching, and drop Ruby 2.7 support #453

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/workflows/sqlite3-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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:
Expand All @@ -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 }
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test_script:

environment:
matrix:
- ruby_version: "33"
- ruby_version: "32"
- ruby_version: "31"
- ruby_version: "30"
- ruby_version: "27"
5 changes: 2 additions & 3 deletions bin/test-gem-file-contents
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down Expand Up @@ -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/})

Expand Down
11 changes: 5 additions & 6 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -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
#
Expand All @@ -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"
7 changes: 1 addition & 6 deletions ext/sqlite3/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 0 additions & 20 deletions lib/sqlite3/version.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions rakelib/native.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sqlite3.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
8 changes: 2 additions & 6 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 22 additions & 24 deletions test/test_collation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 1 addition & 6 deletions test/test_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 0 additions & 33 deletions test/test_integration_pending.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions test/test_sqlite3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down