Skip to content

Instantly share code, notes, and snippets.

@simi
Created June 8, 2020 08:43
Show Gist options
  • Save simi/579628f24072e4e239824240b7fed19f to your computer and use it in GitHub Desktop.
Save simi/579628f24072e4e239824240b7fed19f to your computer and use it in GitHub Desktop.
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index ca8032645..4e0d3971c 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1188,6 +1188,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# other.
class << self
+ attr_accessor :disable_system_update
+
##
# 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 494b3eef6..cfb9e4e22 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
+ alert_error Gem.disable_system_update
+ return
+ end
+
check_update_arguments
version, requirement = rubygems_target_version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment