uninstall operation should list removed entities in verbose mode - close #102

This commit is contained in:
josh committed 2019-04-27 21:28:56 -04:00
1 parent fd054a07c4
commit 49e1bca1f7
3 files changed
+63

No files matched your search

+6
View File
@@ -167,15 +167,21 @@ module Rscons
def uninstall
cache = Cache.instance
cache.targets(true).each do |target|
cache.remove_target(target)
next unless File.exists?(target)
puts "Removing #{target}" if verbose
FileUtils.rm_f(target)
end
# remove all created directories if they are empty
cache.directories(true).sort {|a, b| b.size <=> a.size}.each do |directory|
cache.remove_directory(directory)
next unless File.directory?(directory)
if (Dir.entries(directory) - ['.', '..']).empty?
puts "Removing #{directory}" if verbose
Dir.rmdir(directory) rescue nil
end
end
cache.write
0
end
+14
View File
@@ -320,6 +320,20 @@ module Rscons
end.map(&:first)
end
# Remove a target from the cache.
#
# @return [void]
def remove_target(target)
@cache["targets"].delete(target)
end
# Remove a directory from the cache.
#
# @return [void]
def remove_directory(directory)
@cache["directories"].delete(directory)
end
private
# Return a String key based on the target name to use in the on-disk cache.