Skip to content

Commit

Permalink
fix: ensure env doesn't get clobbered when installing package_json (#…
Browse files Browse the repository at this point in the history
…576)

It seems that something had changed in Ruby 3.3.6 that means for some
reason unless we maintain the old env, the use of `bundler/inline`
causes Bundler to error about gems not being present when we (very)
later call `run "bundle install"`.

I have no idea what has actually changed, as while I confirmed
everything is passing if we switch to Ruby 3.3.5, I couldn't get a
smaller reproducible example that showed the exact same behaviour 🤷
  • Loading branch information
G-Rath authored Nov 24, 2024
1 parent c0e3fe5 commit 6154d26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def puts_header(msg)
JEST_MAJOR_VERSION = "29".freeze

def require_package_json_gem
old_env = ENV.to_h

require "bundler/inline"

gemfile(true) do
Expand All @@ -105,6 +107,8 @@ def require_package_json_gem
end

puts "using package_json v#{PackageJson::VERSION}"

ENV.replace(old_env)
end

def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
Expand Down

0 comments on commit 6154d26

Please sign in to comment.