method
remove_executables
v1_9_3_125 -
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 127
def remove_executables(spec)
return if spec.nil? or spec.executables.empty?
list = Gem::Specification.find_all { |s|
s.name == spec.name && s.version != spec.version
}
executables = spec.executables.clone
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? then
ask_yes_no("Remove executables:\n" "\t#{executables.join ', '}\n\n" "in addition to the gem?",
true)
else
@force_executables
end
unless remove then
say "Executables and scripts will remain installed."
else
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
FileUtils.rm_f exe_file
FileUtils.rm_f "#{exe_file}.bat"
end
end
end Related methods
- Instance methods
- ask_if_ok
- dependencies_ok?
- formatted_program_filename
- path_ok?
- remove
- remove_all
- remove_executables
- uninstall
- uninstall_gem
- Class methods
- new