ruby-changes:72135
From: David <ko1@a...>
Date: Sat, 11 Jun 2022 18:43:52 +0900 (JST)
Subject: [ruby-changes:72135] 95f5194b3c (master): [rubygems/rubygems] Move `no_install` setting check to a more sensible place
https://git.ruby-lang.org/ruby.git/commit/?id=95f5194b3c From 95f5194b3c37497ae9ed2a1b2ae5b7729ee063ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Sat, 26 Mar 2022 12:37:10 +0100 Subject: [rubygems/rubygems] Move `no_install` setting check to a more sensible place It's only related to the `bundle cache` command, so it should be checked there. https://github.com/rubygems/rubygems/commit/cf749f8ffa --- lib/bundler/cli.rb | 8 +--- lib/bundler/cli/cache.rb | 2 +- lib/bundler/cli/install.rb | 2 - lib/bundler/source/rubygems.rb | 98 +++++++++++++++++++++--------------------- 4 files changed, 51 insertions(+), 59 deletions(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index e1c284130b..3d93ce5e6f 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -251,9 +251,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L251 remembered_negative_flag_deprecation("no-deployment") require_relative "cli/install" - Bundler.settings.temporary(:no_install => false) do - Install.new(options.dup).run - end + Install.new(options.dup).run end map aliases_for("install") @@ -299,9 +297,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L297 def update(*gems) SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") require_relative "cli/update" - Bundler.settings.temporary(:no_install => false) do - Update.new(options, gems).run - end + Update.new(options, gems).run end desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem" diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb index c8698ed7e3..eb5dd23092 100644 --- a/lib/bundler/cli/cache.rb +++ b/lib/bundler/cli/cache.rb @@ -14,7 +14,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/cache.rb#L14 Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"] setup_cache_all - install + install unless Bundler.settings[:no_install] # TODO: move cache contents here now that all bundles are locked custom_path = Bundler.settings[:path] if options[:path] diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index e9b85f7f6f..acf92f28ad 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -161,8 +161,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/install.rb#L161 Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"] - Bundler.settings.set_command_option_if_given :no_install, options["no-install"] - Bundler.settings.set_command_option_if_given :clean, options["clean"] normalize_groups if options[:without] || options[:with] diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 01feeb75e9..d166410a9d 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -173,62 +173,60 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L173 raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path end - unless Bundler.settings[:no_install] - message = "Installing #{version_message(spec, options[:previous_spec])}" - message += " with native extensions" if spec.extensions.any? - Bundler.ui.confirm message - - if requires_sudo? - install_path = Bundler.tmp(spec.full_name) - bin_path = install_path.join("bin") - else - install_path = rubygems_dir - bin_path = Bundler.system_bindir - end + message = "Installing #{version_message(spec, options[:previous_spec])}" + message += " with native extensions" if spec.extensions.any? + Bundler.ui.confirm message + + if requires_sudo? + install_path = Bundler.tmp(spec.full_name) + bin_path = install_path.join("bin") + else + install_path = rubygems_dir + bin_path = Bundler.system_bindir + end - Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5") - - require_relative "../rubygems_gem_installer" - - installed_spec = Bundler::RubyGemsGemInstaller.at( - path, - :install_dir => install_path.to_s, - :bin_dir => bin_path.to_s, - :ignore_dependencies => true, - :wrappers => true, - :env_shebang => true, - :build_args => options[:build_args], - :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum, - :bundler_extension_cache_path => extension_cache_path(spec) - ).install - spec.full_gem_path = installed_spec.full_gem_path - - # SUDO HAX - if requires_sudo? - Bundler.rubygems.repository_subdirectories.each do |name| - src = File.join(install_path, name, "*") - dst = File.join(rubygems_dir, name) - if name == "extensions" && Dir.glob(src).any? - src = File.join(src, "*/*") - ext_src = Dir.glob(src).first - ext_src.gsub!(src[0..-6], "") - dst = File.dirname(File.join(dst, ext_src)) - end - SharedHelpers.filesystem_access(dst) do |p| - Bundler.mkdir_p(p) - end - Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any? + Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5") + + require_relative "../rubygems_gem_installer" + + installed_spec = Bundler::RubyGemsGemInstaller.at( + path, + :install_dir => install_path.to_s, + :bin_dir => bin_path.to_s, + :ignore_dependencies => true, + :wrappers => true, + :env_shebang => true, + :build_args => options[:build_args], + :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum, + :bundler_extension_cache_path => extension_cache_path(spec) + ).install + spec.full_gem_path = installed_spec.full_gem_path + + # SUDO HAX + if requires_sudo? + Bundler.rubygems.repository_subdirectories.each do |name| + src = File.join(install_path, name, "*") + dst = File.join(rubygems_dir, name) + if name == "extensions" && Dir.glob(src).any? + src = File.join(src, "*/*") + ext_src = Dir.glob(src).first + ext_src.gsub!(src[0..-6], "") + dst = File.dirname(File.join(dst, ext_src)) + end + SharedHelpers.filesystem_access(dst) do |p| + Bundler.mkdir_p(p) end + Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any? + end - spec.executables.each do |exe| - SharedHelpers.filesystem_access(Bundler.system_bindir) do |p| - Bundler.mkdir_p(p) - end - Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/" + spec.executables.each do |exe| + SharedHelpers.filesystem_access(Bundler.system_bindir) do |p| + Bundler.mkdir_p(p) end + Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/" end - installed_spec.loaded_from = loaded_from(spec) end + installed_spec.loaded_from = loaded_from(spec) spec.loaded_from = loaded_from(spec) spec.post_install_message -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/