From f16ac76d83eaf72ec54918f6956d5f16a4d21133 Mon Sep 17 00:00:00 2001 From: "Daniel P. Clark" <6ftdan@gmail.com> Date: Wed, 7 Oct 2026 05:28:40 +0000 Subject: [PATCH 1/2] Use thermite 0.14's version option instead of monkeypatching thermite thermite_initialize.rb redefined two thermite methods. `Config#ruby_version` put the running Ruby's full version into the release tarball names, so a prebuilt extension was only found by that exact patch release (ruby3.4.6) although it works on every 3.4.x; thermite's own `ruby34` naming is what the download expects. `Tasks#github_download_uri` made the download use the gem's version as the release tag instead of the crate's; thermite 0.14 removed that method and added a `version` option for exactly this, which the Rakefiles now pass. `rake build_lib` cleaned the Cargo target through a method the same refactor removed, so it uses `Thermite::Cargo`. The Gemfile takes thermite from its repository until 0.14.0 is on rubygems.org; the gemspec already requires it. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01CXvfgWzuq28ewqT3AyhX4Z --- Gemfile | 3 +++ Rakefile | 7 ++++--- ext/Rakefile | 5 +++-- faster_path.gemspec | 4 ++-- lib/faster_path.rb | 1 - lib/faster_path/thermite_initialize.rb | 22 --------------------- test/thermite_test.rb | 27 +++++++++++++++----------- 7 files changed, 28 insertions(+), 41 deletions(-) delete mode 100644 lib/faster_path/thermite_initialize.rb diff --git a/Gemfile b/Gemfile index b806447..72deae5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,7 @@ source 'https://rubygems.org' # Specify your gem's dependencies in faster_path.gemspec + +# Until thermite 0.14.0 is on rubygems.org +gem 'thermite', github: 'danielpclark/thermite', branch: 'claude/determined-shannon-ybz9nf-thermite-0.14' gemspec diff --git a/Rakefile b/Rakefile index 1220540..04fa352 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ require 'bundler/gem_tasks' require 'rake/testtask' require 'thermite/tasks' -require 'faster_path/thermite_initialize' +require 'faster_path/version' desc 'System Details' task :sysinfo do @@ -22,7 +22,8 @@ task :sysinfo do puts "RAKE\n #{Rake::VERSION}" end -thermite = Thermite::Tasks.new +# The gem's version names the release tarballs, not the crate's +thermite = Thermite::Tasks.new(version: FasterPath::VERSION) desc "Generate Contriburs.md Manifest" task :contrib do @@ -33,7 +34,7 @@ end desc 'Build + clean up Rust extension' task build_lib: 'thermite:build' do - thermite.run_cargo 'clean' + Thermite::Cargo.new(thermite.config).clean end desc 'Code Quality Check' diff --git a/ext/Rakefile b/ext/Rakefile index 76936fe..4fd6dfc 100644 --- a/ext/Rakefile +++ b/ext/Rakefile @@ -1,8 +1,9 @@ require 'thermite/tasks' -require_relative '../lib/faster_path/thermite_initialize' +require_relative '../lib/faster_path/version' project_toplevel_dir = File.dirname(__dir__) Thermite::Tasks.new(cargo_project_path: project_toplevel_dir, - ruby_project_path: project_toplevel_dir) + ruby_project_path: project_toplevel_dir, + version: FasterPath::VERSION) task default: 'thermite:build' diff --git a/faster_path.gemspec b/faster_path.gemspec index 6c681b0..1fbb0d5 100644 --- a/faster_path.gemspec +++ b/faster_path.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| spec.files = [ 'Cargo.lock', 'Cargo.toml', 'Gemfile', 'MIT-LICENSE.txt', 'README.md', 'Rakefile', 'bin/console', 'bin/setup', 'ext/Rakefile', 'faster_path.gemspec', 'lib/faster_path.rb', - 'lib/faster_path/version.rb', 'lib/faster_path/thermite_initialize.rb', + 'lib/faster_path/version.rb', 'lib/faster_path/optional/monkeypatches.rb', 'lib/faster_path/optional/refinements.rb' ] spec.files += Dir['src/**/*'] @@ -29,7 +29,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'bundler', '>= 1.12' spec.add_dependency 'rake', '>= 12.3' - spec.add_dependency 'thermite', '0.13.0' + spec.add_dependency 'thermite', '~> 0.14' # thermite reads GitHub release feeds with REXML, a bundled gem since Ruby 3.0 spec.add_dependency 'rexml', '~> 3.2' spec.add_development_dependency 'read_source', '~> 0.2.6' diff --git a/lib/faster_path.rb b/lib/faster_path.rb index 6e20989..3ff060a 100644 --- a/lib/faster_path.rb +++ b/lib/faster_path.rb @@ -1,7 +1,6 @@ require 'faster_path/version' require 'pathname' require 'thermite/config' -require 'faster_path/thermite_initialize' require 'fiddle' require 'fiddle/import' diff --git a/lib/faster_path/thermite_initialize.rb b/lib/faster_path/thermite_initialize.rb deleted file mode 100644 index 4f51e5c..0000000 --- a/lib/faster_path/thermite_initialize.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'rubygems' -require 'rake/tasklib' -require_relative './version' - -# @private :nodoc: -module Thermite - # @private :nodoc: - class Config - # @private :nodoc: - def ruby_version - "ruby#{RUBY_VERSION}" - end - end - - # @private :nodoc: - class Tasks < Rake::TaskLib - # @private :nodoc: - def github_download_uri(_tag, version) - "#{github_uri}/releases/download/v#{FasterPath::VERSION}/#{config.tarball_filename(version)}" - end - end -end diff --git a/test/thermite_test.rb b/test/thermite_test.rb index 5d99fee..e6f0ae9 100644 --- a/test/thermite_test.rb +++ b/test/thermite_test.rb @@ -1,25 +1,30 @@ require 'test_helper' require 'thermite/tasks' +# What the Rakefiles rely on in thermite class ThermiteTest < Minitest::Test def setup project_toplevel_dir = File.dirname(__dir__) @thermite = Thermite::Tasks.new(cargo_project_path: project_toplevel_dir, - ruby_project_path: project_toplevel_dir) + ruby_project_path: project_toplevel_dir, + version: FasterPath::VERSION) end - def test_has_methods_needed_for_monkeypatch - assert Thermite::Config.public_method_defined?(:ruby_version), 'Thermite ruby_version not defined!' - assert Thermite::Tasks.public_method_defined?(:github_download_uri), 'Thermite github_download_uri not defined!' + def test_release_tarballs_are_named_after_the_gem_version + config = @thermite.config - assert_match(/ruby\d+\.\d+\.\d+/, Thermite::Config.new.ruby_version) + assert_equal FasterPath::VERSION, config.version + refute_equal config.crate_version, config.version - gh_uri = @thermite.github_download_uri('lol', '0.0.1') + tarball = config.tarball_filename(config.version) - assert_match(/faster_path/, gh_uri) - assert_match(/0\.0\.1/, gh_uri) - assert_match(/#{FasterPath::VERSION}/, gh_uri) - assert_match(/github/, gh_uri) - assert_match(/tar\.gz/, gh_uri) + assert_match(/\Afaster_path-#{Regexp.escape(FasterPath::VERSION)}-/, tarball) + # The Ruby's major and minor version only: the extension works on every patch release + assert_match(/-ruby\d\d-/, tarball) + assert_match(/\.tar\.gz\z/, tarball) + end + + def test_build_lib_can_clean_the_cargo_target + assert_respond_to Thermite::Cargo.new(@thermite.config), :clean end end From dee51a100b22ba9386d05f4d0a79f8d86cc39f6c Mon Sep 17 00:00:00 2001 From: "Daniel P. Clark" <6ftdan@gmail.com> Date: Wed, 7 Oct 2026 13:36:54 +0000 Subject: [PATCH 2/2] Take thermite from its master branch now that 0.14.0 is merged there Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01CXvfgWzuq28ewqT3AyhX4Z --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 72deae5..b48de51 100644 --- a/Gemfile +++ b/Gemfile @@ -3,5 +3,5 @@ source 'https://rubygems.org' # Specify your gem's dependencies in faster_path.gemspec # Until thermite 0.14.0 is on rubygems.org -gem 'thermite', github: 'danielpclark/thermite', branch: 'claude/determined-shannon-ybz9nf-thermite-0.14' +gem 'thermite', github: 'danielpclark/thermite', branch: 'master' gemspec