diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-02-01 11:14:04 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-02-01 11:14:57 +0900 |
commit | 600a715c9bde99fe2e9a669465d78833445273e8 (patch) | |
tree | 8244622e8cc02b40dd0dad29d30fc60a11342396 /lib/rubygems/installer_uninstaller_utils.rb | |
parent | adc303131187654d8ce83f3db17eefa3d5bae26c (diff) |
Merge the current master branch of rubygems/rubygems.
Just started to develop RubyGems 3.2.0.
Diffstat (limited to 'lib/rubygems/installer_uninstaller_utils.rb')
-rw-r--r-- | lib/rubygems/installer_uninstaller_utils.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/rubygems/installer_uninstaller_utils.rb b/lib/rubygems/installer_uninstaller_utils.rb new file mode 100644 index 0000000000..b8436f4f0a --- /dev/null +++ b/lib/rubygems/installer_uninstaller_utils.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +## +# Helper methods for both Gem::Installer and Gem::Uninstaller + +module Gem::InstallerUninstallerUtils + + def regenerate_plugins_for(spec) + spec.plugins.each do |plugin| + plugin_script_path = File.join Gem.plugins_dir, "#{spec.name}_plugin#{File.extname(plugin)}" + + File.open plugin_script_path, 'wb' do |file| + file.puts "require '#{plugin}'" + end + + verbose plugin_script_path + end + end + + def remove_plugins_for(spec) + FileUtils.rm_f Gem::Util.glob_files_in_dir("#{spec.name}#{Gem.plugin_suffix_pattern}", Gem.plugins_dir) + end + +end |