[rubygems/rubygems] Fix issue with extensions not compiling properly using inline gemfile
https://github.com/rubygems/rubygems/commit/fa6e6ea95c
This commit is contained in:
parent
70eedef32a
commit
369ed03cd4
Notes:
git
2023-01-31 01:49:30 +00:00
@ -38,9 +38,8 @@ def gemfile(install = false, options = {}, &gemfile)
|
||||
Bundler.ui = ui
|
||||
raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
|
||||
|
||||
begin
|
||||
Bundler.with_unbundled_env do
|
||||
Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
|
||||
old_gemfile = ENV["BUNDLE_GEMFILE"]
|
||||
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
|
||||
|
||||
Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
|
||||
@ -65,11 +64,9 @@ def gemfile(install = false, options = {}, &gemfile)
|
||||
runtime = Bundler::Runtime.new(nil, definition)
|
||||
runtime.setup.require
|
||||
end
|
||||
ensure
|
||||
if old_gemfile
|
||||
ENV["BUNDLE_GEMFILE"] = old_gemfile
|
||||
else
|
||||
ENV["BUNDLE_GEMFILE"] = ""
|
||||
end
|
||||
end
|
||||
|
||||
if ENV["BUNDLE_GEMFILE"].nil?
|
||||
ENV["BUNDLE_GEMFILE"] = ""
|
||||
end
|
||||
end
|
||||
|
@ -207,6 +207,116 @@ RSpec.describe "bundler/inline#gemfile" do
|
||||
expect(err).to be_empty
|
||||
end
|
||||
|
||||
<<<<<<< HEAD:spec/bundler/runtime/inline_spec.rb
|
||||
=======
|
||||
it "doesn't reinstall already installed gems" do
|
||||
system_gems "rack-1.0.0"
|
||||
|
||||
script <<-RUBY
|
||||
require '#{entrypoint}'
|
||||
ui = Bundler::UI::Shell.new
|
||||
ui.level = "confirm"
|
||||
|
||||
gemfile(true, ui: ui) do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "activesupport"
|
||||
gem "rack"
|
||||
end
|
||||
RUBY
|
||||
|
||||
expect(out).to include("Installing activesupport")
|
||||
expect(out).not_to include("Installing rack")
|
||||
expect(err).to be_empty
|
||||
end
|
||||
|
||||
it "installs gems in later gemfile calls" do
|
||||
system_gems "rack-1.0.0"
|
||||
|
||||
script <<-RUBY
|
||||
require '#{entrypoint}'
|
||||
ui = Bundler::UI::Shell.new
|
||||
ui.level = "confirm"
|
||||
gemfile(true, ui: ui) do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack"
|
||||
end
|
||||
|
||||
gemfile(true, ui: ui) do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "activesupport"
|
||||
end
|
||||
RUBY
|
||||
|
||||
expect(out).to include("Installing activesupport")
|
||||
expect(out).not_to include("Installing rack")
|
||||
expect(err).to be_empty
|
||||
end
|
||||
|
||||
it "doesn't reinstall already installed gems in later gemfile calls" do
|
||||
system_gems "rack-1.0.0"
|
||||
|
||||
script <<-RUBY
|
||||
require '#{entrypoint}'
|
||||
ui = Bundler::UI::Shell.new
|
||||
ui.level = "confirm"
|
||||
gemfile(true, ui: ui) do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "activesupport"
|
||||
end
|
||||
|
||||
gemfile(true, ui: ui) do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack"
|
||||
end
|
||||
RUBY
|
||||
|
||||
expect(out).to include("Installing activesupport")
|
||||
expect(out).not_to include("Installing rack")
|
||||
expect(err).to be_empty
|
||||
end
|
||||
|
||||
it "installs gems with native extensions in later gemfile calls" do
|
||||
system_gems "rack-1.0.0"
|
||||
|
||||
build_git "foo" do |s|
|
||||
s.add_dependency "rake"
|
||||
s.extensions << "Rakefile"
|
||||
s.write "Rakefile", <<-RUBY
|
||||
task :default do
|
||||
path = File.expand_path("lib", __dir__)
|
||||
FileUtils.mkdir_p(path)
|
||||
File.open("\#{path}/foo.rb", "w") do |f|
|
||||
f.puts "FOO = 'YES'"
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
script <<-RUBY
|
||||
require '#{entrypoint}'
|
||||
ui = Bundler::UI::Shell.new
|
||||
ui.level = "confirm"
|
||||
gemfile(true, ui: ui) do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack"
|
||||
end
|
||||
|
||||
gemfile(true, ui: ui) do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "foo", :git => "#{lib_path("foo-1.0")}"
|
||||
end
|
||||
|
||||
require 'foo'
|
||||
puts FOO
|
||||
puts $:.grep(/ext/)
|
||||
RUBY
|
||||
|
||||
expect(out).to include("YES")
|
||||
expect(out).to include(Pathname.glob(default_bundle_path("bundler/gems/extensions/**/foo-1.0-*")).first.to_s)
|
||||
expect(err).to be_empty
|
||||
end
|
||||
|
||||
>>>>>>> fa6e6ea95c2 (Fix issue with extensions not compiling properly using inline gemfile):bundler/spec/runtime/inline_spec.rb
|
||||
it "installs inline gems when a Gemfile.lock is present" do
|
||||
gemfile <<-G
|
||||
source "https://notaserver.com"
|
||||
|
Loading…
x
Reference in New Issue
Block a user