1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Make --standalone play nice with --local

I'm not sure if using relative paths in the generated script is best for
this case, since it makes the script not movable, but that can be
improved later.

https://github.com/rubygems/rubygems/commit/7f5bdbb842
This commit is contained in:
David Rodríguez 2022-07-24 22:32:34 +02:00 committed by git
parent b515fdcc32
commit 030050cdfa
3 changed files with 30 additions and 2 deletions

View file

@ -148,7 +148,7 @@ module Bundler
Bundler.settings.set_command_option :path, nil if options[:system]
Bundler.settings.set_command_option_if_given :path, options[:path]
if options["standalone"] && Bundler.settings[:path].nil?
if options["standalone"] && Bundler.settings[:path].nil? && !options["local"]
Bundler.settings.temporary(:path_relative_to_cwd => false) do
Bundler.settings.set_command_option :path, "bundle"
end

View file

@ -47,7 +47,7 @@ module Bundler
end
def bundler_path
Bundler.root.join(Bundler.settings[:path], "bundler")
Bundler.root.join(Bundler.settings[:path].to_s, "bundler")
end
def gem_path(path, spec)

View file

@ -461,3 +461,31 @@ RSpec.describe "bundle install --standalone run in a subdirectory" do
include_examples("bundle install --standalone")
end
RSpec.describe "bundle install --standalone --local" do
before do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
system_gems "rack-1.0.0", :path => default_bundle_path
end
it "generates script pointing to system gems" do
bundle "install --standalone --local --verbose"
expect(out).to include("Using rack 1.0.0")
load_error_ruby <<-RUBY, "spec"
require "./bundler/setup"
require "rack"
puts RACK
require "spec"
RUBY
expect(out).to eq("1.0.0")
expect(err).to eq("ZOMG LOAD ERROR")
end
end