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. -
#calculate_yum_metadata ⇒ Object
Return this object’s
calculate_yum_metadata
. -
#calculate_yum_metadata=(value) ⇒ Object
Set this object’s
calculate_yum_metadata
. -
#calculate_yum_metadata? ⇒ Boolean
Determines if the
calculate_yum_metadata
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. -
#package_type ⇒ Object
Return this object’s
package_type
. -
#package_type=(value) ⇒ Object
Set this object’s
package_type
. -
#package_type? ⇒ Boolean
Determines if the
package_type
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.
-
#url ⇒ Object
Return this object’s
url
. -
#url=(value) ⇒ Object
Set this object’s
url
. -
#url? ⇒ Boolean
Determines if the
url
value exists and is truthy. -
#yum_root_depth ⇒ Object
Return this object’s
yum_root_depth
. -
#yum_root_depth=(value) ⇒ Object
Set this object’s
yum_root_depth
. -
#yum_root_depth? ⇒ Boolean
Determines if the
yum_root_depth
value exists and is truthy.
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_query_string_parameters, #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.
155 156 157 158 159 |
# File 'lib/artifactory/resources/repository.rb', line 155 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 |
#calculate_yum_metadata ⇒ Object
Return this object’s calculate_yum_metadata
86 |
# File 'lib/artifactory/resources/repository.rb', line 86 attribute :calculate_yum_metadata, false |
#calculate_yum_metadata=(value) ⇒ Object
Set this object’s calculate_yum_metadata
86 |
# File 'lib/artifactory/resources/repository.rb', line 86 attribute :calculate_yum_metadata, false |
#calculate_yum_metadata? ⇒ Boolean
Determines if the calculate_yum_metadata
value exists and is truthy
86 |
# File 'lib/artifactory/resources/repository.rb', line 86 attribute :calculate_yum_metadata, 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.
182 183 184 185 186 187 |
# File 'lib/artifactory/resources/repository.rb', line 182 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
164 165 166 167 168 169 170 171 172 173 |
# File 'lib/artifactory/resources/repository.rb', line 164 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 |
#package_type ⇒ Object
Return this object’s package_type
78 |
# File 'lib/artifactory/resources/repository.rb', line 78 attribute :package_type, "generic" |
#package_type=(value) ⇒ Object
Set this object’s package_type
78 |
# File 'lib/artifactory/resources/repository.rb', line 78 attribute :package_type, "generic" |
#package_type? ⇒ Boolean
Determines if the package_type
value exists and is truthy
78 |
# File 'lib/artifactory/resources/repository.rb', line 78 attribute :package_type, "generic" |
#property_sets ⇒ Object
Return this object’s property_sets
79 |
# File 'lib/artifactory/resources/repository.rb', line 79 attribute :property_sets, [] |
#property_sets=(value) ⇒ Object
Set this object’s property_sets
79 |
# File 'lib/artifactory/resources/repository.rb', line 79 attribute :property_sets, [] |
#property_sets? ⇒ Boolean
Determines if the property_sets
value exists and is truthy
79 |
# File 'lib/artifactory/resources/repository.rb', line 79 attribute :property_sets, [] |
#rclass ⇒ Object
Return this object’s rclass
81 |
# File 'lib/artifactory/resources/repository.rb', line 81 attribute :rclass, "local" |
#rclass=(value) ⇒ Object
Set this object’s rclass
81 |
# File 'lib/artifactory/resources/repository.rb', line 81 attribute :rclass, "local" |
#rclass? ⇒ Boolean
Determines if the rclass
value exists and is truthy
81 |
# File 'lib/artifactory/resources/repository.rb', line 81 attribute :rclass, "local" |
#repo_layout_ref ⇒ Object
Return this object’s repo_layout_ref
80 |
# File 'lib/artifactory/resources/repository.rb', line 80 attribute :repo_layout_ref, "simple-default" |
#repo_layout_ref=(value) ⇒ Object
Set this object’s repo_layout_ref
80 |
# File 'lib/artifactory/resources/repository.rb', line 80 attribute :repo_layout_ref, "simple-default" |
#repo_layout_ref? ⇒ Boolean
Determines if the repo_layout_ref
value exists and is truthy
80 |
# File 'lib/artifactory/resources/repository.rb', line 80 attribute :repo_layout_ref, "simple-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!
98 99 100 101 102 103 104 105 |
# File 'lib/artifactory/resources/repository.rb', line 98 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
82 |
# File 'lib/artifactory/resources/repository.rb', line 82 attribute :snapshot_version_behavior, "non-unique" |
#snapshot_version_behavior=(value) ⇒ Object
Set this object’s snapshot_version_behavior
82 |
# File 'lib/artifactory/resources/repository.rb', line 82 attribute :snapshot_version_behavior, "non-unique" |
#snapshot_version_behavior? ⇒ Boolean
Determines if the snapshot_version_behavior
value exists and is truthy
82 |
# File 'lib/artifactory/resources/repository.rb', line 82 attribute :snapshot_version_behavior, "non-unique" |
#suppress_pom_consistency_checks ⇒ Object
Return this object’s suppress_pom_consistency_checks
83 |
# File 'lib/artifactory/resources/repository.rb', line 83 attribute :suppress_pom_consistency_checks, false |
#suppress_pom_consistency_checks=(value) ⇒ Object
Set this object’s suppress_pom_consistency_checks
83 |
# File 'lib/artifactory/resources/repository.rb', line 83 attribute :suppress_pom_consistency_checks, false |
#suppress_pom_consistency_checks? ⇒ Boolean
Determines if the suppress_pom_consistency_checks
value exists and is truthy
83 |
# File 'lib/artifactory/resources/repository.rb', line 83 attribute :suppress_pom_consistency_checks, false |
#upload(local_path, remote_path, properties = {}, headers = {}) ⇒ Resource::Artifact
Upload to a given repository
114 115 116 117 |
# File 'lib/artifactory/resources/repository.rb', line 114 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.
137 138 139 140 |
# File 'lib/artifactory/resources/repository.rb', line 137 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.
126 127 128 129 |
# File 'lib/artifactory/resources/repository.rb', line 126 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 |
#url ⇒ Object
Return this object’s url
84 |
# File 'lib/artifactory/resources/repository.rb', line 84 attribute :url, "" |
#url=(value) ⇒ Object
Set this object’s url
84 |
# File 'lib/artifactory/resources/repository.rb', line 84 attribute :url, "" |
#url? ⇒ Boolean
Determines if the url
value exists and is truthy
84 |
# File 'lib/artifactory/resources/repository.rb', line 84 attribute :url, "" |
#yum_root_depth ⇒ Object
Return this object’s yum_root_depth
85 |
# File 'lib/artifactory/resources/repository.rb', line 85 attribute :yum_root_depth, 0 |
#yum_root_depth=(value) ⇒ Object
Set this object’s yum_root_depth
85 |
# File 'lib/artifactory/resources/repository.rb', line 85 attribute :yum_root_depth, 0 |
#yum_root_depth? ⇒ Boolean
Determines if the yum_root_depth
value exists and is truthy
85 |
# File 'lib/artifactory/resources/repository.rb', line 85 attribute :yum_root_depth, 0 |