Skip to content
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
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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: 'master'
gemspec
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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'
Expand Down
5 changes: 3 additions & 2 deletions ext/Rakefile
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 2 additions & 2 deletions faster_path.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*']
Expand All @@ -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'
Expand Down
1 change: 0 additions & 1 deletion lib/faster_path.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'faster_path/version'
require 'pathname'
require 'thermite/config'
require 'faster_path/thermite_initialize'
require 'fiddle'
require 'fiddle/import'

Expand Down
22 changes: 0 additions & 22 deletions lib/faster_path/thermite_initialize.rb

This file was deleted.

27 changes: 16 additions & 11 deletions test/thermite_test.rb
Original file line number Diff line number Diff line change
@@ -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
Loading