Sha256: 7b12e049822bece481ad21e184790b677662ec45ff9f08bb7f26513dabfd41c9

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'karo/config'
require 'thor'

module Karo

	class Cache < Thor

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

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

	  desc "remove", "removes any matching cache files from the shared/cache directory"
	  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

	end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
karo-1.1.0 lib/karo/cache.rb
karo-1.0.0 lib/karo/cache.rb