Skip to content

Commit a8de14a

Browse files
committed
fix: native.rake and test-gem-file-contents use dependencies.yml
Closes #351
1 parent 23d2ad4 commit a8de14a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

bin/test-gem-file-contents

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ describe File.basename(gemfile) do
117117
end
118118

119119
it "contains the port files" do
120+
dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"), symbolize_names: true)
121+
sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url])
120122
actual_ports = gemfile_contents.grep(%r{^ports/})
121-
assert_equal(1, actual_ports.count { |f| File.fnmatch?("ports/archives/sqlite-autoconf-*.tar.gz", f) })
122-
assert_equal(1, actual_ports.length)
123+
124+
assert_equal(["ports/archives/#{sqlite_tarball}"], actual_ports)
123125
end
124126

125127
it "contains the patch files" do

rakelib/native.rake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require "bundler/gem_tasks"
44
require "rubygems/package_task"
55
require "rake/extensiontask"
66
require "rake_compiler_dock"
7+
require "yaml"
78

89
cross_rubies = ["3.1.0", "3.0.0", "2.7.0", "2.6.0"]
910
cross_platforms = [
@@ -41,7 +42,9 @@ def add_file_to_gem(relative_source_path)
4142
end
4243

4344
task gem_build_path do
44-
archive = Dir.glob(File.join("ports", "archives", "sqlite-autoconf-*.tar.gz")).first
45+
dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"), symbolize_names: true)
46+
sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url])
47+
archive = Dir.glob(File.join("ports", "archives", sqlite_tarball)).first
4548
add_file_to_gem(archive)
4649

4750
patches = %x(#{["git", "ls-files", "patches"].shelljoin}).split("\n").grep(/\.patch\z/)

0 commit comments

Comments
 (0)