class KPM::BaseArtifact

def artifact_info(coordinates, destination_path, overrides={}, ssl_verify=true)

def artifact_info(coordinates, destination_path, overrides={}, ssl_verify=true)
  info = {}
  nexus_info = nexus_remote(overrides, ssl_verify).get_artifact_info(coordinates)
  xml = REXML::Document.new(nexus_info)
  repository_path = xml.elements['//repositoryPath'].text unless xml.elements['//repositoryPath'].nil?
  sha1 = xml.elements['//sha1'].text unless xml.elements['//sha1'].nil?
  version = xml.elements['//version'].text unless xml.elements['//version'].nil?
  info[:sha1] = sha1
  info[:version] = version
  info[:is_tgz] = repository_path.end_with?('.tar.gz') || repository_path.end_with?('.tgz')
  if File.directory?(destination_path) && !info[:is_tgz]
    destination = File.join(File.expand_path(destination_path), File.basename(repository_path))
    info[:file_name] = File.basename(repository_path)
  else
    # The destination was a fully specified path or this is an archive and we keep the directory
    destination = destination_path
    info[:file_name] = File.basename(destination_path) if !info[:is_tgz]
  end
  info[:file_path] = File.expand_path(destination)
  info[:skipped] = false
  info
end