mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
25 lines
605 B
Ruby
25 lines
605 B
Ruby
![]() |
# 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
|