2020-01-31 21:14:04 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
##
|
|
|
|
# Helper methods for both Gem::Installer and Gem::Uninstaller
|
|
|
|
|
|
|
|
module Gem::InstallerUninstallerUtils
|
|
|
|
|
2020-03-24 02:39:24 -04:00
|
|
|
def regenerate_plugins_for(spec, plugins_dir)
|
2020-01-31 21:14:04 -05:00
|
|
|
spec.plugins.each do |plugin|
|
2020-03-24 02:39:24 -04:00
|
|
|
plugin_script_path = File.join plugins_dir, "#{spec.name}_plugin#{File.extname(plugin)}"
|
2020-01-31 21:14:04 -05:00
|
|
|
|
|
|
|
File.open plugin_script_path, 'wb' do |file|
|
|
|
|
file.puts "require '#{plugin}'"
|
|
|
|
end
|
|
|
|
|
|
|
|
verbose plugin_script_path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-03-24 02:39:24 -04:00
|
|
|
def remove_plugins_for(spec, plugins_dir)
|
|
|
|
FileUtils.rm_f Gem::Util.glob_files_in_dir("#{spec.name}#{Gem.plugin_suffix_pattern}", plugins_dir)
|
2020-01-31 21:14:04 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|