aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-03-26 12:37:10 +0100
committergit <svn-admin@ruby-lang.org>2022-06-11 18:43:25 +0900
commit95f5194b3c37497ae9ed2a1b2ae5b7729ee063ff (patch)
treec4782370e8c7fdbab03349663c8d6ef0785e2a94 /lib
parent3f69774b76067932015dff40d4fd38e9fdfae9ff (diff)
downloadruby-95f5194b3c37497ae9ed2a1b2ae5b7729ee063ff.tar.gz
[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
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb8
-rw-r--r--lib/bundler/cli/cache.rb2
-rw-r--r--lib/bundler/cli/install.rb2
-rw-r--r--lib/bundler/source/rubygems.rb98
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
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
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
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
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
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