Skip to content

Commit

Permalink
fix: native.rake and test-gem-file-contents use dependencies.yml
Browse files Browse the repository at this point in the history
Closes #351
  • Loading branch information
flavorjones committed Sep 30, 2022
1 parent df549ed commit d37f248
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions bin/test-gem-file-contents
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ 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"))
sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url])
actual_ports = gemfile_contents.grep(%r{^ports/})
assert_equal(1, actual_ports.count { |f| File.fnmatch?("ports/archives/sqlite-autoconf-*.tar.gz", f) })
assert_equal(1, actual_ports.length)

assert_equal(["ports/archives/#{sqlite_tarball}"], actual_ports)
end

it "contains the patch files" do
Expand Down
6 changes: 5 additions & 1 deletion rakelib/native.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ require "bundler/gem_tasks"
require "rubygems/package_task"
require "rake/extensiontask"
require "rake_compiler_dock"
require "yaml"

cross_rubies = ["3.1.0", "3.0.0", "2.7.0", "2.6.0"]
cross_platforms = [
Expand Down Expand Up @@ -41,7 +42,10 @@ def add_file_to_gem(relative_source_path)
end

task gem_build_path do
archive = Dir.glob(File.join("ports", "archives", "sqlite-autoconf-*.tar.gz")).first
# TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true
dependencies = YAML.load_file(File.join(__dir__, "..", "dependencies.yml"))
sqlite_tarball = File.basename(dependencies[:sqlite3][:files].first[:url])
archive = Dir.glob(File.join("ports", "archives", sqlite_tarball)).first
add_file_to_gem(archive)

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

0 comments on commit d37f248

Please sign in to comment.