Class: Karo::Cache

Inherits:
Thor
  • Object
show all
Defined in:
lib/karo/cache.rb

Instance Method Summary collapse

Instance Method Details

#remove(name = "") ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/karo/cache.rb', line 23

def remove(name="")
   invoke :search

   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"

   if yes?("Are you sure?", :yellow)
     system "#{ssh} '#{cmd}'"
     say "Cache removed", :green
   else
     say "Cache not removed", :yellow
   end
end

#search(name = "") ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/karo/cache.rb', line 13

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}*\""

   system "#{ssh} '#{cmd}'"
end