Skip to content
Merged
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
17 changes: 17 additions & 0 deletions benchmarks/shipit/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,25 @@
ENV['SHIPIT_DISABLE_AUTH'] = '1' # Saves us lots of trouble

Dir.chdir __dir__

use_gemfile

# sassc uses FFI with hardcoded paths to find its compiled libsass shared object.
# RubyGems 4.x (Ruby 4.1+) no longer copies extensions into the gem's lib/ tree,
# so sassc can't find it. Copy it into place.
if RUBY_VERSION >= "4.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should ideally check the rubygems version instead. It's possible to update rubygems for an older Ruby.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if RUBY_VERSION >= "4.1"
unless Gem.install_extension_in_lib

We may use Gem.install_extension_in_lib instead of version condition.

spec = Gem::Specification.find_by_name("sassc") rescue nil
if spec
dl_ext = RbConfig::MAKEFILE_CONFIG['DLEXT']
target = File.join(spec.gem_dir, "ext", "libsass.#{dl_ext}")
source = File.join(spec.extension_dir, "sassc", "libsass.#{dl_ext}")
if !File.exist?(target) && File.exist?(source)
require 'fileutils'
FileUtils.cp(source, target)
end
end
end

require 'securerandom'
ENV['SECRET_KEY_BASE'] = SecureRandom.hex(128)

Expand Down
Loading