artifactory-gem_import 0.2.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d9422a855958aa038e1c5340c3b247257e7e99ef0f55e7b19a3be59a756fa41
4
- data.tar.gz: f3ee7a9613f07d850fe5f6d3f97b6c9ac823cf97676be84e88a0713110e8337f
3
+ metadata.gz: 57ab4217838b44abf3dde9b5f6e1bd6e6209af40e3cd84dfa9b758c68946cb86
4
+ data.tar.gz: 3d0b72405f995269769ebeebb9aaacab60b28dcf14dbd00426a7d3b97278b8f7
5
5
  SHA512:
6
- metadata.gz: 72aacbc2f1176149a6e55f0f08a4000a4bc90eb01e66e123b4fef8557d39236445616ef2249a174d5120a712f64ce1d01b6eaa52727b4bddf9f4b53f4490827e
7
- data.tar.gz: 325b64f6d681e3a258ccbc6cff36f28246b53cf6e28c08c5379a572cf93c3b4fc5852c89da69a0dadae46331dcd3803d8e7c7831a741dd71754d5bd13b447ba9
6
+ metadata.gz: 67c0448e9161b7ac268569b064aadcabd7d79c29ff2e266e9a706807f9a9cfbe77a467aa61b666c7a9a70dfe32705fc62d2862521ceccd74b83047539a949797
7
+ data.tar.gz: 0b7f11815cb9ac286ea1e3997f7ec44f00b47a5f5f4b7cd986c7b1014af45c81a637f8a21f5067dcd0436b9ca6e4aa1bb4915d316b0014ae552198007ad05d91
data/README.md CHANGED
@@ -26,18 +26,18 @@ gem 'artifactory-gem_import'
26
26
 
27
27
  Show gems not already present in the Artifactory.
28
28
  ```shell
29
- $ artifactory-gem-import show-missing --source-repo https://your-repo.local/private --target-repo https://your-artifactory.local/gems-local --target-repo-api-key <api-key> [--only "+."]
29
+ $ artifactory-gem-import show-missing --source-repo https://your-repo.local/private --target-repo https://your-artifactory.local/gems-local --target-repo-access-token <access-token> [--only "+."]
30
30
  ```
31
31
 
32
32
  Import gems into the Artifactory.
33
33
  ```shell
34
- $ artifactory-gem-import import --source-repo https://your-repo.local/private --target-repo https://your-artifactory.local/gems-local --target-repo-api-key <api-key> [--only "+."] [--force]
34
+ $ artifactory-gem-import import --source-repo https://your-repo.local/private --target-repo https://your-artifactory.local/gems-local --target-repo-access-token <access-token> [--only "+."] [--force]
35
35
  ```
36
36
  Using `--force` uploads gems even if already present in the target repo instead of skipping them.
37
37
 
38
38
  Delete gems from the Artifactory. It will NOT remove the `rubygems-update` gem as it seems to be needed to keep the gem repository working.
39
39
  ```shell
40
- $ artifactory-gem-import delete --target-repo https://your-artifactory.local/gems-local --target-repo-api-key <api-key> [--only "+."]
40
+ $ artifactory-gem-import delete --target-repo https://your-artifactory.local/gems-local --target-repo-access-token <access-token> [--only "+."]
41
41
  ```
42
42
 
43
43
  Keep in mind that Artifactory needs some time to apply your changes.
@@ -13,7 +13,7 @@ module Artifactory
13
13
 
14
14
  option :target_repo, required: true, type: :string
15
15
 
16
- option :target_repo_api_key, required: true, type: :string
16
+ option :target_repo_access_token, required: true, type: :string
17
17
 
18
18
  option :only, type: :string, default: ".+"
19
19
 
@@ -30,7 +30,7 @@ module Artifactory
30
30
 
31
31
  option :target_repo, required: true, type: :string
32
32
 
33
- option :target_repo_api_key, required: true, type: :string
33
+ option :target_repo_access_token, required: true, type: :string
34
34
 
35
35
  option :only, type: :string, default: ".+"
36
36
 
@@ -45,7 +45,7 @@ module Artifactory
45
45
 
46
46
  option :target_repo, required: true, type: :string
47
47
 
48
- option :target_repo_api_key, required: true, type: :string
48
+ option :target_repo_access_token, required: true, type: :string
49
49
 
50
50
  option :only, type: :string, default: ".+"
51
51
 
@@ -63,7 +63,7 @@ module Artifactory
63
63
 
64
64
  # option :target_repo, required: true, type: :string
65
65
  #
66
- # option :target_repo_api_key, required: true, type: :string
66
+ # option :target_repo_access_token, required: true, type: :string
67
67
  #
68
68
  # desc "reindex", "Trigger reindexing of the target repo (Artifactory only)."
69
69
  # def reindex
@@ -84,7 +84,7 @@ module Artifactory
84
84
 
85
85
  def target_repo
86
86
  GemImport.target_repo url: options[:target_repo],
87
- api_key: options[:target_repo_api_key]
87
+ access_token: options[:target_repo_access_token]
88
88
  end
89
89
  end
90
90
  end
@@ -15,13 +15,19 @@ module Artifactory
15
15
  end
16
16
 
17
17
  def get(repo:, only: /.+/)
18
- specs = Specs
19
- .new(url: repo.specs_url, headers: repo.headers)
20
- .specs
21
- rescue Net::HTTPClientException, Net::HTTPFatalError, Net::OpenTimeout, SocketError => err
22
- raise ClientError, "Could not fetch specs. URL: #{repo.specs_url}, Reason: #{err.message}"
23
- else
24
- Specs.filter(specs, only: only).sort
18
+ %i[prerelease_specs_url specs_url]
19
+ .flat_map { |getter| fetch repo.public_send(getter), repo.headers }
20
+ .sort
21
+ .then { |specs| Specs.filter specs, only: only }
22
+ end
23
+
24
+ private_class_method
25
+
26
+ def fetch(url, headers)
27
+ Specs.new(url: url, headers: headers)
28
+ .specs
29
+ rescue Zlib::GzipFile::Error, Net::HTTPClientException, Net::HTTPFatalError, Net::OpenTimeout, SocketError => err
30
+ raise ClientError, "Could not fetch specs. URL: #{url}, Reason: #{err.message}"
25
31
  end
26
32
  end
27
33
  end
@@ -4,7 +4,7 @@ module Artifactory
4
4
  attr_reader :url, :headers
5
5
 
6
6
  def initialize(url:, headers:)
7
- @url = url
7
+ @url = url
8
8
  @headers = headers
9
9
  end
10
10
 
@@ -12,9 +12,17 @@ module Artifactory
12
12
  File.join url, "gems", "/"
13
13
  end
14
14
 
15
+ def prerelease_specs_url
16
+ File.join url, "prerelease_specs.4.8.gz"
17
+ end
18
+
15
19
  def specs_url
16
20
  File.join url, "specs.4.8.gz"
17
21
  end
22
+
23
+ def latest_specs_url
24
+ File.join url, "latest_specs.4.8.gz"
25
+ end
18
26
  end
19
27
  end
20
28
  end
@@ -1,5 +1,5 @@
1
1
  module Artifactory
2
2
  module GemImport
3
- VERSION = "0.2.2"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ require_relative "gem_import/worker"
8
8
 
9
9
  module Artifactory
10
10
  module GemImport
11
- Error = Class.new StandardError
11
+ Error = Class.new StandardError
12
12
  ClientError = Class.new Error
13
13
 
14
14
  module_function
@@ -32,13 +32,13 @@ module Artifactory
32
32
  end
33
33
 
34
34
  def source_repo(url:)
35
- Repo.new url: url,
35
+ Repo.new url: url,
36
36
  headers: {}
37
37
  end
38
38
 
39
- def target_repo(url:, api_key:)
40
- Repo.new url: url,
41
- headers: { "X-JFrog-Art-Api" => api_key }
39
+ def target_repo(url:, access_token:)
40
+ Repo.new url: url,
41
+ headers: { "Authorization" => "Bearer #{access_token}" }
42
42
  end
43
43
  end
44
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artifactory-gem_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Scholz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-25 00:00:00.000000000 Z
11
+ date: 2025-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubygems_version: 3.5.14
107
+ rubygems_version: 3.5.22
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Artifactory Gem Import.