packaging 0.99.56 → 0.99.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/packaging/artifactory.rb +23 -8
  3. metadata +18 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91478585428801cdfc12e3da5f0dcb54b748d0f1ca3fc21517287b8ffddc53d1
4
- data.tar.gz: ef8871c674e926d599edcee2be2d58ada0d0bad919f33a078e163f40c65d3e2a
3
+ metadata.gz: 5a26342fa551df9cbae2afbc9b8c1c03aa03bd7001ef16511598013735d1b400
4
+ data.tar.gz: d29a92aa8e936a01df40db513e02e98763c0e6a74a8a5801ad47a242f4e4b67b
5
5
  SHA512:
6
- metadata.gz: 9d529dea7fac73e55a9f634feb3cde54d082de316bcc30c886ad9471484432bff5a1e410984d916946e26124a7903f86e45833461b8b71770dc3e702c96e0096
7
- data.tar.gz: c3b9ddbd1a08552ec7488091b55429cbc5e74a2029a2839bcb427bcb7b4930e58b469641b715b68134af73dc0d96827cb999f4451c67ca5887fac3dd8698c4c5
6
+ metadata.gz: 3bfafe308304409ca317f83c3fc514607a9732fb064c040fe6a12f35eb8282620d3c9c3acf58acfa66d2c269318b8938a83126c10fecf546b8be61cc4350e540
7
+ data.tar.gz: cde4572cbe48d14bd039d7b8e94bedc2d3584a674637a47a1310049180a651661ed7e450af2977b15bae435b0bc8bb6fb44e371f36922507311ebe02941f6107
@@ -506,18 +506,33 @@ module Pkg
506
506
  end
507
507
  end
508
508
 
509
- # Download an artifact based on name, repo, and path to artifact
509
+ # Search for artifacts matching `artifact_name` in `repo` with path matching
510
+ # `path`
510
511
  # @param artifact_name [String] name of artifact to download
511
512
  # @param repo [String] repo the artifact lives
512
513
  # @param path [String] path to artifact in the repo
513
- def download_artifact(artifact_name, repo, path)
514
+ #
515
+ # @return [Array<Artifactory::Resource::Artifact>] A list of artifacts that
516
+ # match the query
517
+ def search_with_path(artifact_id, repo, path)
514
518
  check_authorization
515
- artifacts = Artifactory::Resource::Artifact.search(name: artifact_name, repos: repo)
516
- artifacts.each do |artifact|
517
- if artifact.download_uri.include? path
518
- artifact.download('.')
519
- end
520
- end
519
+ artifacts = Artifactory::Resource::Artifact.search(name: artifact_id, repos: repo)
520
+ artifacts.select { |artifact| artifact.download_uri.include? path }
521
+ end
522
+
523
+ # Download an artifact based on name, repo, and path to artifact
524
+ # @param artifact_name [String] name of artifact to download
525
+ # @param repo [String] repo the artifact lives
526
+ # @param path [String] path to artifact in the repo
527
+ # @param target [String] directory to download artifact to. Defaults to '.'
528
+ # @param filename [String] Filename to save artifact as. Defaults to artifact_name
529
+ def download_artifact(artifact_name, repo, path, target: '.', filename: nil)
530
+ filename ||= artifact_name
531
+ artifacts = search_with_path(artifact_name, repo, path)
532
+ return nil if artifacts.empty?
533
+ # Only download the first of the artifacts since we're saving them to
534
+ # the same location anyways
535
+ artifacts.first.download(target, filename: filename)
521
536
  end
522
537
 
523
538
  # Download final pe tarballs to local path based on name, repo, and path on artifactory
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.56
4
+ version: 0.99.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -245,27 +245,27 @@ specification_version: 4
245
245
  summary: Puppet Labs' packaging automation
246
246
  test_files:
247
247
  - spec/lib/packaging_spec.rb
248
- - spec/lib/packaging/deb_spec.rb
249
- - spec/lib/packaging/retrieve_spec.rb
250
- - spec/lib/packaging/gem_spec.rb
251
248
  - spec/lib/packaging/artifactory_spec.rb
252
- - spec/lib/packaging/config_spec.rb
253
249
  - spec/lib/packaging/util/gpg_spec.rb
254
- - spec/lib/packaging/util/rake_utils_spec.rb
255
- - spec/lib/packaging/util/misc_spec.rb
256
- - spec/lib/packaging/util/jenkins_spec.rb
257
- - spec/lib/packaging/util/os_spec.rb
250
+ - spec/lib/packaging/util/git_tag_spec.rb
258
251
  - spec/lib/packaging/util/git_spec.rb
259
- - spec/lib/packaging/util/ship_spec.rb
252
+ - spec/lib/packaging/util/os_spec.rb
253
+ - spec/lib/packaging/util/execution_spec.rb
260
254
  - spec/lib/packaging/util/file_spec.rb
255
+ - spec/lib/packaging/util/jenkins_spec.rb
261
256
  - spec/lib/packaging/util/version_spec.rb
262
- - spec/lib/packaging/util/git_tag_spec.rb
263
- - spec/lib/packaging/util/execution_spec.rb
257
+ - spec/lib/packaging/util/ship_spec.rb
258
+ - spec/lib/packaging/util/rake_utils_spec.rb
259
+ - spec/lib/packaging/util/misc_spec.rb
264
260
  - spec/lib/packaging/util/net_spec.rb
265
- - spec/lib/packaging/rpm/repo_spec.rb
266
- - spec/lib/packaging/paths_spec.rb
267
- - spec/lib/packaging/platforms_spec.rb
268
- - spec/lib/packaging/sign_spec.rb
269
- - spec/lib/packaging/repo_spec.rb
261
+ - spec/lib/packaging/gem_spec.rb
270
262
  - spec/lib/packaging/tar_spec.rb
263
+ - spec/lib/packaging/repo_spec.rb
264
+ - spec/lib/packaging/retrieve_spec.rb
265
+ - spec/lib/packaging/sign_spec.rb
266
+ - spec/lib/packaging/rpm/repo_spec.rb
267
+ - spec/lib/packaging/config_spec.rb
271
268
  - spec/lib/packaging/deb/repo_spec.rb
269
+ - spec/lib/packaging/deb_spec.rb
270
+ - spec/lib/packaging/platforms_spec.rb
271
+ - spec/lib/packaging/paths_spec.rb