Module: Gem::InstallerUninstallerUtils

Included in:
Installer, Uninstaller
Defined in:
lib/rubygems/installer_uninstaller_utils.rb

Overview

Helper methods for both Gem::Installer and Gem::Uninstaller

Instance Method Summary collapse

Instance Method Details

#regenerate_plugins_for(spec, plugins_dir) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rubygems/installer_uninstaller_utils.rb', line 8

def regenerate_plugins_for(spec, plugins_dir)
  spec.plugins.each do |plugin|
    plugin_script_path = File.join 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

#remove_plugins_for(spec, plugins_dir) ⇒ Object


20
21
22
# File 'lib/rubygems/installer_uninstaller_utils.rb', line 20

def remove_plugins_for(spec, plugins_dir)
  FileUtils.rm_f Gem::Util.glob_files_in_dir("#{spec.name}#{Gem.plugin_suffix_pattern}", plugins_dir)
end