class Inspec::Cache
sources.
conflicts between depenedencies with the same name from different
Cache entries names include a hash of their source to prevent
- unpacked profiles
- .zip profile archives
- .tar.gz profile archives
cache can contain:
Inspec::Cache manages an on-disk cache of inspec profiles. The
def archive_entry_for(key)
def archive_entry_for(key) path = base_path_for(key) if File.exist?("#{path}.tar.gz") "#{path}.tar.gz" elsif File.exist?("#{path}.zip") "#{path}.zip" end end
def base_path_for(cache_key)
-
(String)-
Parameters:
-
source_url(String) -- -
name(String) --
def base_path_for(cache_key) File.join(@path, cache_key) end
def exists?(key)
-
(Boolean)-
Parameters:
-
source_url(String) -- -
name(String) --
def exists?(key) return false if key.nil? || key.empty? path = base_path_for(key) File.directory?(path) || File.exist?("#{path}.tar.gz") || File.exist?("#{path}.zip") end
def initialize(path = nil)
def initialize(path = nil) @path = path || File.join(Dir.home, '.inspec', 'cache') FileUtils.mkdir_p(@path) unless File.directory?(@path) end
def prefered_entry_for(key)
def prefered_entry_for(key) path = base_path_for(key) if File.directory?(path) path else archive_entry_for(key) end end