ruby-changes:72746
From: David <ko1@a...>
Date: Sat, 30 Jul 2022 04:24:40 +0900 (JST)
Subject: [ruby-changes:72746] 030050cdfa (master): [rubygems/rubygems] Make `--standalone` play nice with `--local`
https://git.ruby-lang.org/ruby.git/commit/?id=030050cdfa From 030050cdfa9ae65cbbcd0f708aa2459e0ef17c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Sun, 24 Jul 2022 22:32:34 +0200 Subject: [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 --- lib/bundler/cli/install.rb | 2 +- lib/bundler/installer/standalone.rb | 2 +- spec/bundler/install/gems/standalone_spec.rb | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 1601fc6a98..851ae9b840 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -148,7 +148,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/install.rb#L148 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 diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb index 248b677233..2756626f8a 100644 --- a/lib/bundler/installer/standalone.rb +++ b/lib/bundler/installer/standalone.rb @@ -47,7 +47,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/installer/standalone.rb#L47 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) diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb index a5302877c1..238006c02b 100644 --- a/spec/bundler/install/gems/standalone_spec.rb +++ b/spec/bundler/install/gems/standalone_spec.rb @@ -461,3 +461,31 @@ RSpec.describe "bundle install --standalone run in a subdirectory" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gems/standalone_spec.rb#L461 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/