Sha256: 46d8398fe499abaf9a58c8303459103ab70bc1aa7ce6818300d48fd6072cc085

Contents?: true

Size: 1.15 KB

Versions: 18

Compression:

Stored size: 1.15 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}*\""

      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

      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)
        say to_run, :green if options[:verbose]
        system to_run
        say "Cache removed", :green
      else
        say "Cache not removed", :yellow
      end
	  end

	end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
karo-2.5.2 lib/karo/cache.rb
karo-2.5.1 lib/karo/cache.rb
karo-2.5.0 lib/karo/cache.rb
karo-2.4.0 lib/karo/cache.rb
karo-2.3.9 lib/karo/cache.rb
karo-2.3.8 lib/karo/cache.rb
karo-2.3.7 lib/karo/cache.rb
karo-2.3.6 lib/karo/cache.rb
karo-2.3.5 lib/karo/cache.rb
karo-2.3.4 lib/karo/cache.rb
karo-2.3.3 lib/karo/cache.rb
karo-2.3.2 lib/karo/cache.rb
karo-2.3.1 lib/karo/cache.rb
karo-2.3.0 lib/karo/cache.rb
karo-2.2.1 lib/karo/cache.rb
karo-2.2.0 lib/karo/cache.rb
karo-2.1.3 lib/karo/cache.rb
karo-2.1.2 lib/karo/cache.rb