End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::Uninstaller#remove_executables
remove_executables(spec)
lib/rubygems/uninstaller.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems/uninstaller.rb, line 180
def remove_executables(spec)
return if spec.executables.empty?
executables = spec.executables.clone
# Leave any executables created by other installed versions
# of this gem installed.
list = Gem::Specification.find_all do |s|
s.name == spec.name && s.version != spec.version
end
list.each do |s|
s.executables.each do |exe_name|
executables.delete exe_name
end
end
return if executables.empty?
executables = executables.map {|exec| formatted_program_filename exec }
remove = if @force_executables.nil?
ask_yes_no("Remove executables:\n" +
"\t#{executables.join ', '}\n\n" +
"in addition to the gem?",
true)
else
@force_executables
end
if remove
bin_dir = @bin_dir || Gem.bindir(spec.base_dir)
raise Gem::FilePermissionError, bin_dir unless File.writable? bin_dir
executables.each do |exe_name|
say "Removing #{exe_name}"
exe_file = File.join bin_dir, exe_name
safe_delete { FileUtils.rm exe_file }
safe_delete { FileUtils.rm "#{exe_file}.bat" }
end
else
say "Executables and scripts will remain installed."
end
end
Removes installed executables and batch files (windows only) for spec.