Skip to content

Commit e2a0924

Browse files
committed
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
1 parent 40e7b29 commit e2a0924

File tree

11 files changed

+37
-95
lines changed

11 files changed

+37
-95
lines changed

.github/workflows/sqlite3-ruby.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
os: [ubuntu-latest, macos-latest, windows-latest]
28-
ruby: ["3.3", "3.2", "3.1", "3.0", "2.7"]
28+
ruby: ["3.3", "3.2", "3.1", "3.0"]
2929
lib: [system, packaged]
3030
include:
3131
- { os: ubuntu-latest, ruby: truffleruby, lib: packaged }
@@ -65,16 +65,6 @@ jobs:
6565

6666
- run: bundle exec rake test
6767

68-
old_sqlite3:
69-
runs-on: ubuntu-latest
70-
container:
71-
image: ruby:2.7.5-buster # old enough to not support SQLITE_DBCONFIG_DQS_DDL
72-
steps:
73-
- uses: actions/checkout@v4
74-
- run: bundle install
75-
- run: bundle exec rake compile -- --enable-system-libraries
76-
- run: bundle exec rake test
77-
7868
# reported at https://github.com/sparklemotion/sqlite3-ruby/issues/354
7969
# TODO remove once https://github.com/flavorjones/mini_portile/issues/118 is fixed
8070
fedora:
@@ -95,7 +85,7 @@ jobs:
9585
fail-fast: false
9686
matrix:
9787
os: [ubuntu-latest, macos-latest, windows-latest]
98-
ruby: ["3.3", "2.7"] # oldest and newest
88+
ruby: ["3.3", "3.0"] # oldest and newest
9989
include:
10090
- { os: windows-latest, ruby: mingw }
10191
- { os: windows-latest, ruby: mswin }

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test_script:
2929

3030
environment:
3131
matrix:
32+
- ruby_version: "33"
3233
- ruby_version: "32"
3334
- ruby_version: "31"
3435
- ruby_version: "30"
35-
- ruby_version: "27"

bin/test-gem-file-contents

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Minitest::Reporters.use!([Minitest::Reporters::SpecReporter.new])
6666
puts "Testing '#{gemfile}' (#{gemspec.platform})"
6767
describe File.basename(gemfile) do
6868
let(:all_supported_ruby_versions) {
69-
["2.7", "3.0", "3.1", "3.2", "3.3"]
69+
["3.0", "3.1", "3.2", "3.3"]
7070
}
7171
let(:native_supported_ruby_versions) { ["3.0", "3.1", "3.2", "3.3"] }
7272
let(:ucrt_supported_ruby_versions) { ["3.1", "3.2", "3.3"] }
@@ -119,8 +119,7 @@ describe File.basename(gemfile) do
119119
end
120120

121121
it "contains the port files" do
122-
# TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true
123-
dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"))
122+
dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"), symbolize_names: true)
124123
sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url])
125124
actual_ports = gemfile_contents.grep(%r{^ports/})
126125

dependencies.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# TODO: stop using symbols here once we no longer support Ruby 2.7 and can rely on symbolize_names
2-
:sqlite3:
1+
sqlite3:
32
# checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html:
43
# 6c427f0547e2f7babe636b748dd5d5a1f2f31601adadef7e2805e7d1f7171861
54
#
@@ -8,7 +7,7 @@
87
#
98
# $ sha256sum ports/archives/sqlite-autoconf-3440200.tar.gz
109
# 1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407 ports/archives/sqlite-autoconf-3440200.tar.gz
11-
:version: "3.44.2"
12-
:files:
13-
- :url: "https://sqlite.org/2023/sqlite-autoconf-3440200.tar.gz"
14-
:sha256: "1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407"
10+
version: "3.44.2"
11+
files:
12+
- url: "https://sqlite.org/2023/sqlite-autoconf-3440200.tar.gz"
13+
sha256: "1c6719a148bc41cf0f2bbbe3926d7ce3f5ca09d878f1246fcc20767b175bb407"

ext/sqlite3/extconf.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ def configure_packaged_libraries
9797
end
9898

9999
def configure_extension
100-
if Gem::Requirement.new("< 2.7").satisfied_by?(Gem::Version.new(RUBY_VERSION))
101-
append_cppflags("-DTAINTING_SUPPORT")
102-
end
103-
104100
append_cflags("-fvisibility=hidden") # see https://github.com/rake-compiler/rake-compiler-dock/issues/87
105101

106102
if find_header("sqlite3.h")
@@ -158,8 +154,7 @@ def sqlite3_config
158154
end
159155

160156
def mini_portile_config
161-
# TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true
162-
YAML.load_file(File.join(package_root_dir, "dependencies.yml"))
157+
YAML.load_file(File.join(package_root_dir, "dependencies.yml"), symbolize_names: true)
163158
end
164159

165160
def abort_could_not_find(missing)

rakelib/native.rake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def add_file_to_gem(relative_source_path)
4242
end
4343

4444
task gem_build_path do
45-
# TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true
46-
dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"))
45+
dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"), symbolize_names: true)
4746
sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url])
4847
archive = Dir.glob(File.join("ports", "archives", sqlite_tarball)).first
4948
add_file_to_gem(archive)

sqlite3.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
2020

2121
s.licenses = ["BSD-3-Clause"]
2222

23-
s.required_ruby_version = Gem::Requirement.new(">= 2.7")
23+
s.required_ruby_version = Gem::Requirement.new(">= 3.0")
2424

2525
s.homepage = "https://github.com/sparklemotion/sqlite3-ruby"
2626
s.metadata = {

test/test_collation.rb

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,34 @@ def test_remove_collation
4747
end
4848
end
4949

50-
if RUBY_VERSION >= '1.9.1'
51-
def test_encoding
52-
comparator = Comparator.new
53-
@db.collation 'foo', comparator
54-
@db.execute('select data from ex order by 1 collate foo')
50+
def test_encoding
51+
comparator = Comparator.new
52+
@db.collation 'foo', comparator
53+
@db.execute('select data from ex order by 1 collate foo')
5554

56-
a, b = *comparator.calls.first
55+
a, b = *comparator.calls.first
5756

58-
assert_equal Encoding.find('UTF-8'), a.encoding
59-
assert_equal Encoding.find('UTF-8'), b.encoding
60-
end
57+
assert_equal Encoding.find('UTF-8'), a.encoding
58+
assert_equal Encoding.find('UTF-8'), b.encoding
59+
end
6160

62-
def test_encoding_default_internal
63-
warn_before = $-w
64-
$-w = false
65-
before_enc = Encoding.default_internal
61+
def test_encoding_default_internal
62+
warn_before = $-w
63+
$-w = false
64+
before_enc = Encoding.default_internal
6665

67-
Encoding.default_internal = 'EUC-JP'
68-
comparator = Comparator.new
69-
@db.collation 'foo', comparator
70-
@db.execute('select data from ex order by 1 collate foo')
66+
Encoding.default_internal = 'EUC-JP'
67+
comparator = Comparator.new
68+
@db.collation 'foo', comparator
69+
@db.execute('select data from ex order by 1 collate foo')
7170

72-
a, b = *comparator.calls.first
71+
a, b = *comparator.calls.first
7372

74-
assert_equal Encoding.find('EUC-JP'), a.encoding
75-
assert_equal Encoding.find('EUC-JP'), b.encoding
76-
ensure
77-
Encoding.default_internal = before_enc
78-
$-w = warn_before
79-
end
73+
assert_equal Encoding.find('EUC-JP'), a.encoding
74+
assert_equal Encoding.find('EUC-JP'), b.encoding
75+
ensure
76+
Encoding.default_internal = before_enc
77+
$-w = warn_before
8078
end
8179
end
8280
end

test/test_database.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,7 @@ def test_new_with_options
237237
# determine if Ruby is running on Big Endian platform
238238
utf16 = ([1].pack("I") == [1].pack("N")) ? "UTF-16BE" : "UTF-16LE"
239239

240-
if RUBY_VERSION >= "1.9"
241-
db = SQLite3::Database.new(':memory:'.encode(utf16), :utf16 => true)
242-
else
243-
db = SQLite3::Database.new(Iconv.conv(utf16, 'UTF-8', ':memory:'),
244-
:utf16 => true)
245-
end
240+
db = SQLite3::Database.new(':memory:'.encode(utf16), :utf16 => true)
246241
assert_instance_of(SQLite3::Database, db)
247242
ensure
248243
db.close if db

test/test_encoding.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,5 @@ def test_euc_jp
161161
assert_equal str.encode('UTF-8'), row.first.first
162162
end
163163

164-
end if RUBY_VERSION >= '1.9.1'
164+
end
165165
end

0 commit comments

Comments
 (0)