class Artifactory::Resource::Repository

def all(options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :client (Artifactory::Client) --

Parameters:
  • options (Hash) --
def all(options = {})
  client = extract_client!(options)
  client.get("/api/repositories").map do |hash|
    find(hash["key"], client: client)
  end.compact
end

def api_path

Returns:
  • (String) -
def api_path
  "/api/repositories/#{url_safe(key)}"
end

def artifacts

Returns:
  • (Collection::Artifact) -

Other tags:
    Example: Get the list of artifacts for a repository -

Other tags:
    See: Artifact.search - Search syntax examples
def artifacts
  @artifacts ||= Collection::Artifact.new(self, repos: key) do
    Resource::Artifact.search(name: ".*", repos: key)
  end
end

def content_type

Returns:
  • (String) -
def content_type
  case rclass.to_s.downcase
  when "local"
    "application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json"
  when "remote"
    "application/vnd.org.jfrog.artifactory.repositories.RemoteRepositoryConfiguration+json"
  when "virtual"
    "application/vnd.org.jfrog.artifactory.repositories.VirtualRepositoryConfiguration+json"
  else
    raise "Unknown Repository type `#{rclass}'!"
  end
end

def delete

Returns:
  • (Boolean) -
def delete
  client.delete(api_path)
  true
rescue Error::HTTPError => e
  false
end

def files



def files
  response = client.get("/api/storage/#{url_safe(key)}", {
    deep:            0,
    listFolders:     0,
    mdTimestamps:    0,
    includeRootPath: 0,
  })
  response["children"]
end

def find(name, options = {})

Returns:
  • (Resource::Repository, nil) -

Options Hash: (**options)
  • :client (Artifactory::Client) --
  • :name (String) --

Parameters:
  • options (Hash) --

Other tags:
    Example: Find a repository by named key -
def find(name, options = {})
  client = extract_client!(options)
  response = client.get("/api/repositories/#{url_safe(name)}")
  from_hash(response, client: client)
rescue Error::HTTPError => e
  raise unless e.code == 400
  nil
end

def headers

Returns:
  • (Hash) -
def headers
  @headers ||= {
    "Content-Type" => content_type,
  }
end

def save

Returns:
  • (Boolean) -
def save
  if self.class.find(key, client: client)
    client.post(api_path, to_json, headers)
  else
    client.put(api_path, to_json, headers)
  end
  true
end

def upload(local_path, remote_path, properties = {}, headers = {})

Returns:
  • (Resource::Artifact) -

Other tags:
    See: Artifact#upload - Upload syntax examples
def upload(local_path, remote_path, properties = {}, headers = {})
  artifact = Resource::Artifact.new(local_path: local_path)
  artifact.upload(key, remote_path, properties, headers)
end

def upload_from_archive(local_path, remote_path, properties = {})

Other tags:
    See: Artifact#upload_from_archive - More syntax examples
def upload_from_archive(local_path, remote_path, properties = {})
  artifact = Resource::Artifact.new(local_path: local_path)
  artifact.upload_from_archive(key, remote_path, properties)
end

def upload_with_checksum(local_path, remote_path, checksum, properties = {})

Other tags:
    See: Artifact#upload_with_checksum - More syntax examples
def upload_with_checksum(local_path, remote_path, checksum, properties = {})
  artifact = Resource::Artifact.new(local_path: local_path)
  artifact.upload_with_checksum(key, remote_path, checksum, properties)
end