Class: Artifactory::Resource::Repository
- Defined in:
- lib/artifactory/resources/repository.rb
Class Method Summary collapse
-
.all(options = {}) ⇒ Array<Resource::Repository>
Get a list of all repositories in the system.
-
.find(name, options = {}) ⇒ Resource::Repository?
Find (fetch) a repository by name.
Instance Method Summary collapse
-
#artifacts ⇒ Collection::Artifact
The list of artifacts in this repository on the remote artifactory server.
-
#blacked_out ⇒ Object
Return this object’s
blacked_out
. -
#blacked_out=(value) ⇒ Object
Set this object’s
blacked_out
. -
#blacked_out? ⇒ Boolean
Determines if the
blacked_out
value exists and is truthy. -
#checksum_policy_type ⇒ Object
Return this object’s
checksum_policy_type
. -
#checksum_policy_type=(value) ⇒ Object
Set this object’s
checksum_policy_type
. -
#checksum_policy_type? ⇒ Boolean
Determines if the
checksum_policy_type
value exists and is truthy. -
#delete ⇒ Boolean
Delete this repository from artifactory, suppressing any
ResourceNotFound
exceptions might occur. -
#description ⇒ Object
Return this object’s
description
. -
#description=(value) ⇒ Object
Set this object’s
description
. -
#description? ⇒ Boolean
Determines if the
description
value exists and is truthy. -
#excludes_pattern ⇒ Object
Return this object’s
excludes_pattern
. -
#excludes_pattern=(value) ⇒ Object
Set this object’s
excludes_pattern
. -
#excludes_pattern? ⇒ Boolean
Determines if the
excludes_pattern
value exists and is truthy. - #files ⇒ Object
-
#handle_releases ⇒ Object
Return this object’s
handle_releases
. -
#handle_releases=(value) ⇒ Object
Set this object’s
handle_releases
. -
#handle_releases? ⇒ Boolean
Determines if the
handle_releases
value exists and is truthy. -
#handle_snapshots ⇒ Object
Return this object’s
handle_snapshots
. -
#handle_snapshots=(value) ⇒ Object
Set this object’s
handle_snapshots
. -
#handle_snapshots? ⇒ Boolean
Determines if the
handle_snapshots
value exists and is truthy. -
#includes_pattern ⇒ Object
Return this object’s
includes_pattern
. -
#includes_pattern=(value) ⇒ Object
Set this object’s
includes_pattern
. -
#includes_pattern? ⇒ Boolean
Determines if the
includes_pattern
value exists and is truthy. -
#key ⇒ Object
Return this object’s
key
. -
#key=(value) ⇒ Object
Set this object’s
key
. -
#key? ⇒ Boolean
Determines if the
key
value exists and is truthy. -
#max_unique_snapshots ⇒ Object
Return this object’s
max_unique_snapshots
. -
#max_unique_snapshots=(value) ⇒ Object
Set this object’s
max_unique_snapshots
. -
#max_unique_snapshots? ⇒ Boolean
Determines if the
max_unique_snapshots
value exists and is truthy. -
#notes ⇒ Object
Return this object’s
notes
. -
#notes=(value) ⇒ Object
Set this object’s
notes
. -
#notes? ⇒ Boolean
Determines if the
notes
value exists and is truthy. -
#property_sets ⇒ Object
Return this object’s
property_sets
. -
#property_sets=(value) ⇒ Object
Set this object’s
property_sets
. -
#property_sets? ⇒ Boolean
Determines if the
property_sets
value exists and is truthy. -
#rclass ⇒ Object
Return this object’s
rclass
. -
#rclass=(value) ⇒ Object
Set this object’s
rclass
. -
#rclass? ⇒ Boolean
Determines if the
rclass
value exists and is truthy. -
#repo_layout_ref ⇒ Object
Return this object’s
repo_layout_ref
. -
#repo_layout_ref=(value) ⇒ Object
Set this object’s
repo_layout_ref
. -
#repo_layout_ref? ⇒ Boolean
Determines if the
repo_layout_ref
value exists and is truthy. -
#save ⇒ Boolean
Creates or updates a repository configuration depending on if the repository configuration previously existed.
-
#snapshot_version_behavior ⇒ Object
Return this object’s
snapshot_version_behavior
. -
#snapshot_version_behavior=(value) ⇒ Object
Set this object’s
snapshot_version_behavior
. -
#snapshot_version_behavior? ⇒ Boolean
Determines if the
snapshot_version_behavior
value exists and is truthy. -
#suppress_pom_consistency_checks ⇒ Object
Return this object’s
suppress_pom_consistency_checks
. -
#suppress_pom_consistency_checks=(value) ⇒ Object
Set this object’s
suppress_pom_consistency_checks
. -
#suppress_pom_consistency_checks? ⇒ Boolean
Determines if the
suppress_pom_consistency_checks
value exists and is truthy. -
#upload(local_path, remote_path, properties = {}, headers = {}) ⇒ Resource::Artifact
Upload to a given repository.
-
#upload_from_archive(local_path, remote_path, properties = {}) ⇒ Object
Upload an artifact with the given archive.
-
#upload_with_checksum(local_path, remote_path, checksum, properties = {}) ⇒ Object
Upload an artifact with the given SHA checksum.
Methods inherited from Base
attribute, attributes, #attributes, #client, #client=, #client?, #extract_client!, extract_client!, find_from_config, #format_repos!, format_repos!, from_hash, from_url, has_attribute?, #initialize, #inspect, list_from_config, #set, #to_hash, #to_json, #to_matrix_properties, #to_s, url_safe, #url_safe
Constructor Details
This class inherits a constructor from Artifactory::Resource::Base
Class Method Details
.all(options = {}) ⇒ Array<Resource::Repository>
Get a list of all repositories in the system.
32 33 34 35 36 37 |
# File 'lib/artifactory/resources/repository.rb', line 32 def all( = {}) client = extract_client!() client.get('/api/repositories').map do |hash| find(hash['key'], client: client) end.compact end |
.find(name, options = {}) ⇒ Resource::Repository?
Find (fetch) a repository by name.
57 58 59 60 61 62 63 64 65 |
# File 'lib/artifactory/resources/repository.rb', line 57 def find(name, = {}) client = extract_client!() response = client.get("/api/repositories/#{url_safe(name)}") from_hash(response, client: client) rescue Error::HTTPError => e raise unless e.code == 400 nil end |
Instance Method Details
#artifacts ⇒ Collection::Artifact
The list of artifacts in this repository on the remote artifactory server.
151 152 153 154 155 |
# File 'lib/artifactory/resources/repository.rb', line 151 def artifacts @artifacts ||= Collection::Artifact.new(self, repos: key) do Resource::Artifact.search(name: '.*', repos: key) end end |
#blacked_out ⇒ Object
Return this object’s blacked_out
68 |
# File 'lib/artifactory/resources/repository.rb', line 68 attribute :blacked_out, false |
#blacked_out=(value) ⇒ Object
Set this object’s blacked_out
68 |
# File 'lib/artifactory/resources/repository.rb', line 68 attribute :blacked_out, false |
#blacked_out? ⇒ Boolean
Determines if the blacked_out
value exists and is truthy
68 |
# File 'lib/artifactory/resources/repository.rb', line 68 attribute :blacked_out, false |
#checksum_policy_type ⇒ Object
Return this object’s checksum_policy_type
70 |
# File 'lib/artifactory/resources/repository.rb', line 70 attribute :checksum_policy_type, 'client-checksums' |
#checksum_policy_type=(value) ⇒ Object
Set this object’s checksum_policy_type
70 |
# File 'lib/artifactory/resources/repository.rb', line 70 attribute :checksum_policy_type, 'client-checksums' |
#checksum_policy_type? ⇒ Boolean
Determines if the checksum_policy_type
value exists and is truthy
70 |
# File 'lib/artifactory/resources/repository.rb', line 70 attribute :checksum_policy_type, 'client-checksums' |
#delete ⇒ Boolean
Delete this repository from artifactory, suppressing any ResourceNotFound
exceptions might occur.
178 179 180 181 182 183 |
# File 'lib/artifactory/resources/repository.rb', line 178 def delete client.delete(api_path) true rescue Error::HTTPError => e false end |
#description ⇒ Object
Return this object’s description
69 |
# File 'lib/artifactory/resources/repository.rb', line 69 attribute :description |
#description=(value) ⇒ Object
Set this object’s description
69 |
# File 'lib/artifactory/resources/repository.rb', line 69 attribute :description |
#description? ⇒ Boolean
Determines if the description
value exists and is truthy
69 |
# File 'lib/artifactory/resources/repository.rb', line 69 attribute :description |
#excludes_pattern ⇒ Object
Return this object’s excludes_pattern
71 |
# File 'lib/artifactory/resources/repository.rb', line 71 attribute :excludes_pattern, '' |
#excludes_pattern=(value) ⇒ Object
Set this object’s excludes_pattern
71 |
# File 'lib/artifactory/resources/repository.rb', line 71 attribute :excludes_pattern, '' |
#excludes_pattern? ⇒ Boolean
Determines if the excludes_pattern
value exists and is truthy
71 |
# File 'lib/artifactory/resources/repository.rb', line 71 attribute :excludes_pattern, '' |
#files ⇒ Object
160 161 162 163 164 165 166 167 168 169 |
# File 'lib/artifactory/resources/repository.rb', line 160 def files response = client.get("/api/storage/#{url_safe(key)}", { deep: 0, listFolders: 0, mdTimestamps: 0, includeRootPath: 0, }) response['children'] end |
#handle_releases ⇒ Object
Return this object’s handle_releases
72 |
# File 'lib/artifactory/resources/repository.rb', line 72 attribute :handle_releases, true |
#handle_releases=(value) ⇒ Object
Set this object’s handle_releases
72 |
# File 'lib/artifactory/resources/repository.rb', line 72 attribute :handle_releases, true |
#handle_releases? ⇒ Boolean
Determines if the handle_releases
value exists and is truthy
72 |
# File 'lib/artifactory/resources/repository.rb', line 72 attribute :handle_releases, true |
#handle_snapshots ⇒ Object
Return this object’s handle_snapshots
73 |
# File 'lib/artifactory/resources/repository.rb', line 73 attribute :handle_snapshots, true |
#handle_snapshots=(value) ⇒ Object
Set this object’s handle_snapshots
73 |
# File 'lib/artifactory/resources/repository.rb', line 73 attribute :handle_snapshots, true |
#handle_snapshots? ⇒ Boolean
Determines if the handle_snapshots
value exists and is truthy
73 |
# File 'lib/artifactory/resources/repository.rb', line 73 attribute :handle_snapshots, true |
#includes_pattern ⇒ Object
Return this object’s includes_pattern
74 |
# File 'lib/artifactory/resources/repository.rb', line 74 attribute :includes_pattern, '**/*' |
#includes_pattern=(value) ⇒ Object
Set this object’s includes_pattern
74 |
# File 'lib/artifactory/resources/repository.rb', line 74 attribute :includes_pattern, '**/*' |
#includes_pattern? ⇒ Boolean
Determines if the includes_pattern
value exists and is truthy
74 |
# File 'lib/artifactory/resources/repository.rb', line 74 attribute :includes_pattern, '**/*' |
#key ⇒ Object
Return this object’s key
75 |
# File 'lib/artifactory/resources/repository.rb', line 75 attribute :key, ->{ raise 'Key is missing!' } |
#key=(value) ⇒ Object
Set this object’s key
75 |
# File 'lib/artifactory/resources/repository.rb', line 75 attribute :key, ->{ raise 'Key is missing!' } |
#key? ⇒ Boolean
Determines if the key
value exists and is truthy
75 |
# File 'lib/artifactory/resources/repository.rb', line 75 attribute :key, ->{ raise 'Key is missing!' } |
#max_unique_snapshots ⇒ Object
Return this object’s max_unique_snapshots
76 |
# File 'lib/artifactory/resources/repository.rb', line 76 attribute :max_unique_snapshots, 0 |
#max_unique_snapshots=(value) ⇒ Object
Set this object’s max_unique_snapshots
76 |
# File 'lib/artifactory/resources/repository.rb', line 76 attribute :max_unique_snapshots, 0 |
#max_unique_snapshots? ⇒ Boolean
Determines if the max_unique_snapshots
value exists and is truthy
76 |
# File 'lib/artifactory/resources/repository.rb', line 76 attribute :max_unique_snapshots, 0 |
#notes ⇒ Object
Return this object’s notes
77 |
# File 'lib/artifactory/resources/repository.rb', line 77 attribute :notes |
#notes=(value) ⇒ Object
Set this object’s notes
77 |
# File 'lib/artifactory/resources/repository.rb', line 77 attribute :notes |
#notes? ⇒ Boolean
Determines if the notes
value exists and is truthy
77 |
# File 'lib/artifactory/resources/repository.rb', line 77 attribute :notes |
#property_sets ⇒ Object
Return this object’s property_sets
78 |
# File 'lib/artifactory/resources/repository.rb', line 78 attribute :property_sets, [] |
#property_sets=(value) ⇒ Object
Set this object’s property_sets
78 |
# File 'lib/artifactory/resources/repository.rb', line 78 attribute :property_sets, [] |
#property_sets? ⇒ Boolean
Determines if the property_sets
value exists and is truthy
78 |
# File 'lib/artifactory/resources/repository.rb', line 78 attribute :property_sets, [] |
#rclass ⇒ Object
Return this object’s rclass
80 |
# File 'lib/artifactory/resources/repository.rb', line 80 attribute :rclass, 'local' |
#rclass=(value) ⇒ Object
Set this object’s rclass
80 |
# File 'lib/artifactory/resources/repository.rb', line 80 attribute :rclass, 'local' |
#rclass? ⇒ Boolean
Determines if the rclass
value exists and is truthy
80 |
# File 'lib/artifactory/resources/repository.rb', line 80 attribute :rclass, 'local' |
#repo_layout_ref ⇒ Object
Return this object’s repo_layout_ref
79 |
# File 'lib/artifactory/resources/repository.rb', line 79 attribute :repo_layout_ref, 'maven-2-default' |
#repo_layout_ref=(value) ⇒ Object
Set this object’s repo_layout_ref
79 |
# File 'lib/artifactory/resources/repository.rb', line 79 attribute :repo_layout_ref, 'maven-2-default' |
#repo_layout_ref? ⇒ Boolean
Determines if the repo_layout_ref
value exists and is truthy
79 |
# File 'lib/artifactory/resources/repository.rb', line 79 attribute :repo_layout_ref, 'maven-2-default' |
#save ⇒ Boolean
Creates or updates a repository configuration depending on if the repository configuration previously existed. This method also works around Artifactory’s dangerous default behavior:
> An existing repository with the same key are removed from the
> configuration and its content is removed!
94 95 96 97 98 99 100 101 |
# File 'lib/artifactory/resources/repository.rb', line 94 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 |
#snapshot_version_behavior ⇒ Object
Return this object’s snapshot_version_behavior
81 |
# File 'lib/artifactory/resources/repository.rb', line 81 attribute :snapshot_version_behavior, 'non-unique' |
#snapshot_version_behavior=(value) ⇒ Object
Set this object’s snapshot_version_behavior
81 |
# File 'lib/artifactory/resources/repository.rb', line 81 attribute :snapshot_version_behavior, 'non-unique' |
#snapshot_version_behavior? ⇒ Boolean
Determines if the snapshot_version_behavior
value exists and is truthy
81 |
# File 'lib/artifactory/resources/repository.rb', line 81 attribute :snapshot_version_behavior, 'non-unique' |
#suppress_pom_consistency_checks ⇒ Object
Return this object’s suppress_pom_consistency_checks
82 |
# File 'lib/artifactory/resources/repository.rb', line 82 attribute :suppress_pom_consistency_checks, false |
#suppress_pom_consistency_checks=(value) ⇒ Object
Set this object’s suppress_pom_consistency_checks
82 |
# File 'lib/artifactory/resources/repository.rb', line 82 attribute :suppress_pom_consistency_checks, false |
#suppress_pom_consistency_checks? ⇒ Boolean
Determines if the suppress_pom_consistency_checks
value exists and is truthy
82 |
# File 'lib/artifactory/resources/repository.rb', line 82 attribute :suppress_pom_consistency_checks, false |
#upload(local_path, remote_path, properties = {}, headers = {}) ⇒ Resource::Artifact
Upload to a given repository
110 111 112 113 |
# File 'lib/artifactory/resources/repository.rb', line 110 def upload(local_path, remote_path, properties = {}, headers = {}) artifact = Resource::Artifact.new(local_path: local_path) artifact.upload(key, remote_path, properties, headers) end |
#upload_from_archive(local_path, remote_path, properties = {}) ⇒ Object
Upload an artifact with the given archive. Consult the artifactory documentation for the format of the archive to upload.
133 134 135 136 |
# File 'lib/artifactory/resources/repository.rb', line 133 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 |
#upload_with_checksum(local_path, remote_path, checksum, properties = {}) ⇒ Object
Upload an artifact with the given SHA checksum. Consult the artifactory documentation for the possible responses when the checksums fail to match.
122 123 124 125 |
# File 'lib/artifactory/resources/repository.rb', line 122 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 |