From 3ab1cfc325811b862cb81d0360bf83216cd6f235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= Date: Sun, 14 Jun 2020 00:26:23 +0200 Subject: Add Gem.disable_system_update_message to disable gem update --system if needed. --- lib/rubygems.rb | 6 ++++++ lib/rubygems/commands/update_command.rb | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/rubygems.rb b/lib/rubygems.rb index c018492150..d24c07d55a 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -1187,6 +1187,12 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} # other. class << self + ## + # RubyGems distributors (like operating system package managers) can + # disable RubyGems update by setting this to error message printed to + # end-users on gem update --system instead of actual update. + attr_accessor :disable_system_update_message + ## # Hash of loaded Gem::Specification keyed by name diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index ca407ee33e..052d9f9245 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -262,6 +262,11 @@ command to remove old versions. # Update RubyGems software to the latest version. def update_rubygems + if Gem.disable_system_update_message + alert_error Gem.disable_system_update_message + return + end + check_update_arguments version, requirement = rubygems_target_version -- cgit v1.2.3