class BigKeeper::CacheOperator
Public Class Methods
new(path)
click to toggle source
# File lib/big_keeper/util/cache_operator.rb, line 6 def initialize(path) @path = File.expand_path(path) @cache_path = File.expand_path("#{path}/.bigkeeper") end
Public Instance Methods
clean()
click to toggle source
# File lib/big_keeper/util/cache_operator.rb, line 23 def clean if File.exist?(@cache_path) FileUtils.rm_r(@cache_path) end end
load(file)
click to toggle source
# File lib/big_keeper/util/cache_operator.rb, line 17 def load(file) if File.exist?(@cache_path) FileUtils.cp("#{@cache_path}/#{file}", "#{@path}/#{file}"); end end
save(file)
click to toggle source
# File lib/big_keeper/util/cache_operator.rb, line 11 def save(file) dest_path = File.dirname("#{@cache_path}/#{file}") FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path) FileUtils.cp("#{@path}/#{file}", "#{@cache_path}/#{file}"); end