Sha256: c28c1c67be4fca8255d55cab467243d027824572f92240995a5d8564837800da

Contents?: true

Size: 771 Bytes

Versions: 27

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

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

module Gem::InstallerUninstallerUtils
  def regenerate_plugins_for(spec, plugins_dir)
    plugins = spec.plugins
    return if plugins.empty?

    require "pathname"

    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_relative '#{Pathname.new(plugin).relative_path_from(Pathname.new(plugins_dir))}'"
      end

      verbose plugin_script_path
    end
  end

  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
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
rubygems-update-3.6.3 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.6.2 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.6.1 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.6.0 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.23 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.22 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.21 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.20 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.19 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.18 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.17 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.16 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.15 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.14 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.13 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.12 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.10 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.9 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.8 lib/rubygems/installer_uninstaller_utils.rb
rubygems-update-3.5.7 lib/rubygems/installer_uninstaller_utils.rb