method
remove_executables
v2_6_3 -
Show latest stable
- Class:
Gem::Uninstaller
remove_executables(spec)public
Removes installed executables and batch files (windows only) for gemspec.
# File lib/rubygems/uninstaller.rb, line 175
def remove_executables(spec)
return if spec.nil? or spec.executables.empty?
executables = spec.executables.clone
# Leave any executables created by other installed versions
# of this gem installed.
list = Gem::Specification.find_all { |s|
s.name == spec.name && s.version != spec.version
}
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 Related methods
- Instance methods
- abort_on_dependent?
- ask_if_ok
- dependencies_ok?
- formatted_program_filename
- path_ok?
- remove
- remove_all
- remove_executables
- safe_delete
- uninstall
- uninstall_gem
- Class methods
- new