lib/karo/cache.rb in karo-1.5.0 vs lib/karo/cache.rb in karo-2.0.0
- old
+ new
@@ -11,14 +11,17 @@
desc "search", "searches for any matching cache files from the shared/cache directory"
def search(name="")
configuration = Config.load_configuration(options)
path = File.join(configuration["path"], "shared/cache")
- ssh = "ssh #{configuration["user"]}@#{configuration["host"]}"
- cmd = "find #{path} -type f -name \"*#{name}*\""
+ ssh = "ssh #{configuration["user"]}@#{configuration["host"]}"
+ cmd = "find #{path} -type f -name \"*#{name}*\""
- system "#{ssh} '#{cmd}'"
+ to_run = "#{ssh} '#{cmd}'"
+
+ say to_run, :green if options[:verbose]
+ system to_run
end
desc "remove", "removes any matching cache files from the shared/cache directory"
def remove(name="")
invoke :search
@@ -26,11 +29,14 @@
configuration = Config.load_configuration(options)
path = File.join(configuration["path"], "shared/cache")
ssh = "ssh #{configuration["user"]}@#{configuration["host"]}"
cmd = "find #{path} -type f -name \"*#{name}*\" -delete"
+ to_run = "#{ssh} '#{cmd}'"
+
if yes?("Are you sure?", :yellow)
- system "#{ssh} '#{cmd}'"
+ say to_run, :green if options[:verbose]
+ system to_run
say "Cache removed", :green
else
say "Cache not removed", :yellow
end
end