module Uricp::Strategy::CacheCommon
Public Instance Methods
cache_exists?()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 30 def cache_exists? cache_root && %w[temp cache].all? do |d| File.directory?(File.join(cache_root, d)) end end
cache_file()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 44 def cache_file @cache_file ||= File.join(cache_root, 'cache', cache_name) end
cache_name()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 26 def cache_name options['cache_name'] end
cache_root()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 22 def cache_root options['cache'] end
in_cache?()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 18 def in_cache? File.readable? cache_file end
temp_cache_file()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 36 def temp_cache_file @temp_cache_file ||= File.join(cache_root, 'temp', cache_name) end
temp_cache_uri()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 40 def temp_cache_uri URI.join('file:///', temp_cache_file) end
validate_cache!()
click to toggle source
# File lib/uricp/strategy/cache_common.rb, line 5 def validate_cache! return if dry_run? unless cache_exists? raise Uricp::MissingCache, "no cache found at #{cache_root}. Expected a 'cache' and 'temp' directory" end return if cache_name raise Uricp::MissingCache, 'no cache name found' end