class ChefCLI::Policyfile::StorageConfig

@attr_reader [String] policyfile_lock_filename Filename of compiled Policyfile.
@attr_reader [String] policyfile_filename Uncompiled Policyfile filename.
@attr_accessor [String] cache_path Local cache directory for
@attr_accessor [String] relative_paths_root Root path relative to the named Policyfile
@since 0.11.0
@author Dan DeLeo
Policyfile artifacts.
are specified relative to the Policyfile and local caching of compiled
Provides handling of relative paths, such as on disk cookbooks which

def handle_options(options)

def handle_options(options)
  @cache_path = options[:cache_path] if options[:cache_path]
  @relative_paths_root = options[:relative_paths_root] if options.key?(:relative_paths_root)
end

def initialize(options = {})

def initialize(options = {})
  @relative_paths_root = Dir.pwd
  @cache_path = CookbookOmnifetch.storage_path
  @policyfile_filename = "<< Policyfile filename not specified >>"
  @policyfile_lock_filename = "<< Policyfile lock filename not specified >>"
  handle_options(options)
end

def policyfile_expanded_path

def policyfile_expanded_path
  File.expand_path(policyfile_filename, relative_paths_root)
end

def policyfile_lock_expanded_path

def policyfile_lock_expanded_path
  File.expand_path(policyfile_lock_filename, relative_paths_root)
end

def use_policyfile(policyfile_filename)

def use_policyfile(policyfile_filename)
  if policyfile_filename.end_with?(".lock.json")
    return use_policyfile_lock(policyfile_filename)
  end
  unless policyfile_filename.end_with?(".rb")
    raise InvalidPolicyfileFilename, "Policyfile filenames must end with `.rb' extension (you gave: `#{policyfile_filename}')"
  end
  @policyfile_filename = policyfile_filename
  @policyfile_lock_filename = policyfile_filename.sub(/\.rb\Z/, ".lock.json")
  @relative_paths_root = File.dirname(policyfile_filename)
  self
end

def use_policyfile_lock(policyfile_lock_filename)

def use_policyfile_lock(policyfile_lock_filename)
  @policyfile_lock_filename = policyfile_lock_filename
  @policyfile_filename = policyfile_lock_filename.sub(/\.lock\.json\Z/, ".rb")
  @relative_paths_root = File.dirname(policyfile_lock_filename)
  self
end