kpm 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92f89695b531e939275ac653417d228d51b897570504418032418797a56674bf
4
- data.tar.gz: acd577c2a29a56c50c0daeacb09a62f7fcf6068650d1ba8ed2e527d6f9db2962
3
+ metadata.gz: fb012bf11b9ab7cc9417cec007ff6ce492b73e83637c5b55a0261c8b9ef2eb7c
4
+ data.tar.gz: 88d8bad35078a098f4a71ca95bb51ec48cbafaf6923bdaf0d2a2d5853aa3b023
5
5
  SHA512:
6
- metadata.gz: c44713659fe2517572916f45722df1d6ae7b8d639cb24b227ba161386e104df0c2dcf3f38f7a735cfe0f399cbe5d791dc5802cda6a8a73ec791c5ba9853adfd7
7
- data.tar.gz: fd47e470a0df6c75785383a45857a93909ff44d4464136a57ad3f4d27e9331a2b9d31cb4a08834885ee099292a7df5ea6ee9417bfa94fa3c93801114c3af15d3
6
+ metadata.gz: 73e89976ba802f662a70235665b32a7758a5d1cb4b7a5c07344f24647d8576bafc19ffbd695c26d798ab083c3c548912bf5e9394a66c77144bed82007d9be9cf
7
+ data.tar.gz: ef42456adfdf5e953757138fa116acde1ffd8802edb098ecf87eeffcde817daebac66f34f78a00cfaad7a15d206aa84a4f36978ee5c7b1d1995af844b72e25cc
data/README.adoc CHANGED
@@ -26,10 +26,13 @@ Note that this installation method assumes `/bin/bash` to be available on your s
26
26
  === Through Rubygems
27
27
  image:https://img.shields.io/gem/v/kpm?color=blue&label=kpm[kpm]
28
28
 
29
- On Windows, you can install KPM via https://rubygems.org/gems/kpm[RubyGems.org]. For this, you need to first install Ruby. Ruby can be installed via https://rubyinstaller.org/[RubyInstaller]. Once installed, you can run the following command to install KPM:
29
+ On Windows, you can install KPM via https://rubygems.org/gems/kpm[RubyGems.org]. For this, you need to first install Ruby 2.x.x. We recommend installing Ruby 2.7.7.
30
+
31
+ Ruby can be installed via https://rubyinstaller.org/[RubyInstaller]. Once installed, you can run the following command to install KPM:
30
32
  [source,bash]
31
33
  gem install kpm
32
34
 
35
+ Note: KPM is not tested with Ruby 3.x.x or later versions.
33
36
 
34
37
 
35
38
  [[kpm-commands]]
@@ -3,7 +3,7 @@ version: '3.8'
3
3
  services:
4
4
  killbill:
5
5
  network_mode: host
6
- image: killbill/killbill:0.22.1
6
+ image: killbill/killbill:0.24.0
7
7
  environment:
8
8
  - KILLBILL_CATALOG_URI=SpyCarAdvanced.xml
9
9
  - KILLBILL_DAO_URL=jdbc:mysql://0.0.0.0:3306/killbill
@@ -16,6 +16,6 @@ services:
16
16
  - db
17
17
  db:
18
18
  network_mode: host
19
- image: killbill/mariadb:0.22
19
+ image: killbill/mariadb:0.24
20
20
  environment:
21
21
  - MYSQL_ROOT_PASSWORD=root
data/kpm.gemspec CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.rdoc_options << '--exclude' << '.'
43
43
 
44
44
  s.add_dependency 'highline', '>= 1.6.21', '< 2.1.0'
45
- s.add_dependency 'killbill-client', '~> 3.2'
45
+ s.add_dependency 'killbill-client'
46
46
  s.add_dependency 'rubyzip', '>= 1.3', '< 2.4'
47
47
  s.add_dependency 'thor', '>= 0.19.1', '< 1.3.0'
48
48
 
@@ -49,7 +49,7 @@ module KPM
49
49
 
50
50
  def nexus_defaults
51
51
  {
52
- url: 'https://oss.sonatype.org',
52
+ url: 'https://repo1.maven.org/maven2',
53
53
  repository: 'releases'
54
54
  }
55
55
  end
@@ -23,15 +23,11 @@ module KPM
23
23
  ZIP_LOG_FILE = 'logs.zip'
24
24
 
25
25
  def initialize(config_file = nil, killbill_api_credentials = nil, killbill_credentials = nil, killbill_url = nil,
26
- database_name = nil, database_credentials = nil, database_host = nil, database_port = nil, kaui_web_path = nil,
26
+ kaui_web_path = nil,
27
27
  killbill_web_path = nil, bundles_dir = nil, logger = nil)
28
28
  @killbill_api_credentials = killbill_api_credentials
29
29
  @killbill_credentials = killbill_credentials
30
30
  @killbill_url = killbill_url
31
- @database_name = database_name
32
- @database_credentials = database_credentials
33
- @database_host = database_host
34
- @database_port = database_port
35
31
  @config_file = config_file
36
32
  @kaui_web_path = kaui_web_path
37
33
  @killbill_web_path = killbill_web_path
@@ -109,8 +105,8 @@ module KPM
109
105
  @logger.level = Logger::WARN
110
106
 
111
107
  account = KPM::Account.new(@config_file, @killbill_api_credentials, @killbill_credentials,
112
- @killbill_url, @database_name,
113
- @database_credentials, @database_host, @database_port, nil, @logger)
108
+ @killbill_url, nil,
109
+ nil, nil, nil, nil, @logger)
114
110
  export_file = account.export_data(account_id)
115
111
 
116
112
  final = TMP_DIR + File::Separator + ACCOUNT_FILE
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rexml/document'
4
- require 'set'
5
4
 
6
5
  module KPM
7
6
  class KauiArtifact < BaseArtifact
@@ -11,9 +10,9 @@ module KPM
11
10
 
12
11
  coordinates = KPM::Coordinates.build_coordinates(coordinate_map)
13
12
  response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
14
- versions = SortedSet.new
13
+ versions = []
15
14
  response.elements.each('searchNGResponse/data/artifact/version') { |element| versions << element.text }
16
- versions
15
+ versions.sort!.uniq
17
16
  end
18
17
  end
19
18
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rexml/document'
4
- require 'set'
5
4
 
6
5
  module KPM
7
6
  class KillbillPluginArtifact < BaseArtifact
@@ -20,8 +19,9 @@ module KPM
20
19
  response = REXML::Document.new nexus.search_for_artifacts(type_and_group_id[1])
21
20
  response.elements.each('searchNGResponse/data/artifact') do |element|
22
21
  artifact_id = element.elements['artifactId'].text
23
- plugins[type_and_group_id[0]][artifact_id] ||= SortedSet.new
22
+ plugins[type_and_group_id[0]][artifact_id] ||= []
24
23
  plugins[type_and_group_id[0]][artifact_id] << element.elements['version'].text
24
+ plugins[type_and_group_id[0]][artifact_id].sort!.uniq!
25
25
  end
26
26
  end
27
27
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rexml/document'
4
- require 'set'
5
4
 
6
5
  module KPM
7
6
  class KillbillServerArtifact < BaseArtifact
@@ -10,9 +9,9 @@ module KPM
10
9
  coordinate_map = { group_id: KPM::BaseArtifact::KILLBILL_GROUP_ID, artifact_id: artifact_id, packaging: packaging, classifier: classifier }
11
10
  coordinates = KPM::Coordinates.build_coordinates(coordinate_map)
12
11
  response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
13
- versions = SortedSet.new
12
+ versions = []
14
13
  response.elements.each('searchNGResponse/data/artifact/version') { |element| versions << element.text }
15
- versions
14
+ versions.sort!.uniq
16
15
  end
17
16
 
18
17
  def info(version = 'LATEST', sha1_file = nil, force_download = false, verify_sha1 = true, overrides = {}, ssl_verify = true)
@@ -3,6 +3,7 @@
3
3
  require_relative 'nexus_api_calls_v2'
4
4
  require_relative 'github_api_calls'
5
5
  require_relative 'cloudsmith_api_calls'
6
+ require_relative 'maven_central_api_calls'
6
7
 
7
8
  module KPM
8
9
  module NexusFacade
@@ -25,15 +26,18 @@ module KPM
25
26
 
26
27
  def initialize(overrides, ssl_verify, logger)
27
28
  overrides ||= {}
28
- overrides[:url] ||= 'https://oss.sonatype.org'
29
+ overrides[:url] ||= 'https://repo1.maven.org/maven2'
29
30
  overrides[:repository] ||= 'releases'
30
31
 
31
32
  @logger = logger
33
+ logger.level = Logger::INFO
32
34
 
33
35
  @nexus_api_call = if overrides[:url].start_with?('https://maven.pkg.github.com')
34
36
  GithubApiCalls.new(overrides, ssl_verify, logger)
35
37
  elsif overrides[:url].start_with?('https://dl.cloudsmith.io')
36
38
  CloudsmithApiCalls.new(overrides, ssl_verify, logger)
39
+ elsif overrides[:url].start_with?('https://repo1.maven.org')
40
+ MavenCentralApiCalls.new(overrides, ssl_verify, logger)
37
41
  else
38
42
  NexusApiCallsV2.new(overrides, ssl_verify, logger)
39
43
  end
@@ -0,0 +1,246 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'uri'
5
+ require 'json'
6
+ require 'rexml/document'
7
+
8
+ module KPM
9
+ module NexusFacade
10
+ class MavenCentralApiCalls < NexusApiCallsV2
11
+ READ_TIMEOUT_DEFAULT = 60
12
+ OPEN_TIMEOUT_DEFAULT = 60
13
+
14
+ attr_reader :configuration
15
+ attr_accessor :logger
16
+
17
+ BASE_REPO_URL = 'https://repo1.maven.org/maven2'
18
+ SEARCH_API = 'https://search.maven.org/solrsearch/select'
19
+
20
+ def initialize(configuration, _ssl_verify, logger)
21
+ @configuration = configuration
22
+ @configuration[:url] ||= BASE_REPO_URL
23
+ @logger = logger
24
+ end
25
+
26
+ def search_for_artifacts(coordinates)
27
+ artifact = parse_coordinates(coordinates)
28
+ params = {
29
+ q: "g:\"#{artifact[:group_id]}\" AND a:\"#{artifact[:artifact_id]}\"",
30
+ rows: 200,
31
+ wt: 'json',
32
+ core: 'gav'
33
+ }
34
+ query = params.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join('&')
35
+ url = "#{SEARCH_API}?#{query}"
36
+
37
+ response = Net::HTTP.get_response(URI(url))
38
+ raise "Search failed: #{response.code}" unless response.code.to_i == 200
39
+
40
+ json = JSON.parse(response.body)
41
+ docs = json['response']['docs']
42
+ search_versions = docs.map { |doc| doc['v'] }.uniq
43
+
44
+ # Apply when the artifact provided
45
+ if artifact[:artifact_id]
46
+ # Fetch metadata versions (incase the artifact is not indexed)
47
+ metadata_url = build_metadata_url(artifact)
48
+ metadata_versions = []
49
+ begin
50
+ metadata_response = Net::HTTP.get(URI(metadata_url))
51
+ if metadata_response.nil? || metadata_response.strip.empty?
52
+ logger.debug { "Empty metadata response for #{artifact[:artifact_id]}" }
53
+ else
54
+ begin
55
+ metadata_xml = REXML::Document.new(metadata_response)
56
+ metadata_xml.elements.each('//versioning/versions/version') do |version_node|
57
+ metadata_versions << version_node.text
58
+ end
59
+ rescue REXML::ParseException => e
60
+ logger.debug { "Malformed XML in metadata for #{artifact[:artifact_id]}: #{e.message}" }
61
+ end
62
+ end
63
+ rescue StandardError => e
64
+ logger.debug { "Failed to fetch metadata for #{artifact[:artifact_id]}: #{e.message}" }
65
+ end
66
+
67
+ # Combine versions
68
+ search_versions = (search_versions + metadata_versions).uniq.sort_by do |v|
69
+ begin
70
+ Gem::Version.new(v)
71
+ rescue ArgumentError
72
+ v
73
+ end
74
+ end.reverse
75
+
76
+ artifacts_xml = '<searchNGResponse><data>'
77
+ search_versions.each do |version|
78
+ artifacts_xml += '<artifact>'
79
+ artifacts_xml += "<groupId>#{artifact[:group_id]}</groupId>"
80
+ artifacts_xml += "<artifactId>#{artifact[:artifact_id]}</artifactId>"
81
+ artifacts_xml += "<version>#{version}</version>"
82
+ artifacts_xml += '<repositoryId>central</repositoryId>'
83
+ artifacts_xml += '</artifact>'
84
+ end
85
+ else # Incase no artifact_id is provided for plugin search
86
+ artifacts_xml = '<searchNGResponse><data>'
87
+ docs.each do |doc|
88
+ artifacts_xml += '<artifact>'
89
+ artifacts_xml += "<groupId>#{doc['g']}</groupId>"
90
+ artifacts_xml += "<artifactId>#{doc['a']}</artifactId>"
91
+ artifacts_xml += "<version>#{doc['v']}</version>"
92
+ artifacts_xml += '<repositoryId>central</repositoryId>'
93
+ artifacts_xml += '</artifact>'
94
+ end
95
+ end
96
+
97
+ artifacts_xml += '</data></searchNGResponse>'
98
+ artifacts_xml
99
+ end
100
+
101
+ def get_artifact_info(coordinates)
102
+ coords = parse_coordinates(coordinates)
103
+ version = coords[:version]
104
+ if version.casecmp('latest').zero?
105
+ version = fetch_latest_version(coords)
106
+ coords = coords.merge(version: version)
107
+ end
108
+ _, versioned_artifact, coords = build_base_path_and_coords([coords[:group_id], coords[:artifact_id], coords[:extension], coords[:classifier], version].compact.join(':'))
109
+ sha1 = get_sha1([coords[:group_id], coords[:artifact_id], coords[:extension], coords[:classifier], version].compact.join(':'))
110
+ artifact_xml = '<artifact-resolution><data>'
111
+ artifact_xml += '<presentLocally>true</presentLocally>'
112
+ artifact_xml += "<groupId>#{coords[:group_id]}</groupId>"
113
+ artifact_xml += "<artifactId>#{coords[:artifact_id]}</artifactId>"
114
+ artifact_xml += "<version>#{coords[:version]}</version>"
115
+ artifact_xml += "<extension>#{coords[:extension]}</extension>"
116
+ artifact_xml += "<snapshot>#{!(coords[:version] =~ /-SNAPSHOT$/).nil?}</snapshot>"
117
+ artifact_xml += "<sha1>#{sha1}</sha1>"
118
+ artifact_xml += "<repositoryPath>/#{coords[:group_id].gsub('.', '/')}/#{versioned_artifact}</repositoryPath>"
119
+ artifact_xml += '</data></artifact-resolution>'
120
+ artifact_xml
121
+ end
122
+
123
+ def pull_artifact(coordinates, destination)
124
+ artifact = parse_coordinates(coordinates)
125
+ version = artifact[:version]
126
+ version = fetch_latest_version(artifact) if version.casecmp('latest').zero?
127
+ file_name = build_file_name(artifact[:artifact_id], version, artifact[:classifier], artifact[:extension])
128
+ download_url = build_download_url(artifact, version, file_name)
129
+
130
+ dest_path = File.join(File.expand_path(destination || '.'), file_name)
131
+
132
+ File.open(dest_path, 'wb') do |io|
133
+ io.write(Net::HTTP.get(URI(download_url)))
134
+ end
135
+
136
+ {
137
+ file_name: file_name,
138
+ file_path: File.expand_path(dest_path),
139
+ version: version,
140
+ size: File.size(File.expand_path(dest_path))
141
+ }
142
+ end
143
+
144
+ private
145
+
146
+ def parse_coordinates(coordinates)
147
+ raise 'Invalid coordinates' if coordinates.nil?
148
+
149
+ parts = coordinates.split(':')
150
+
151
+ {
152
+ group_id: parts[0],
153
+ artifact_id: parts[1],
154
+ extension: parts.size > 3 ? parts[2] : 'jar',
155
+ classifier: parts.size > 4 ? parts[3] : nil,
156
+ version: parts[-1]
157
+ }
158
+ end
159
+
160
+ def build_base_path_and_coords(coordinates)
161
+ coords = parse_coordinates(coordinates)
162
+
163
+ token_org_and_repo = URI.parse(configuration[:url]).path
164
+
165
+ [
166
+ "#{token_org_and_repo}/#{coords[:group_id].gsub('.', '/')}/#{coords[:artifact_id]}",
167
+ "#{coords[:version]}/#{coords[:artifact_id]}-#{coords[:version]}.#{coords[:extension]}",
168
+ coords
169
+ ]
170
+ end
171
+
172
+ def get_sha1(coordinates)
173
+ base_path, versioned_artifact, = build_base_path_and_coords(coordinates)
174
+ endpoint = "#{base_path}/#{versioned_artifact}.sha1"
175
+ get_response_with_retries(nil, endpoint, nil)
176
+ end
177
+
178
+ def get_response_with_retries(coordinates, endpoint, what_parameters)
179
+ logger.debug { "Fetching coordinates=#{coordinates}, endpoint=#{endpoint}, params=#{what_parameters}" }
180
+ response = get_response(coordinates, endpoint, what_parameters)
181
+ logger.debug { "Response body: #{response.body}" }
182
+ process_response_with_retries(response)
183
+ end
184
+
185
+ def process_response_with_retries(response)
186
+ case response.code
187
+ when '200'
188
+ response.body
189
+ when '301', '302', '307'
190
+ location = response['Location']
191
+ logger.debug { "Following redirect to #{location}" }
192
+
193
+ new_path = location.gsub!(configuration[:url], '')
194
+ if new_path.nil?
195
+ # Redirect to another domain (e.g. CDN)
196
+ get_raw_response_with_retries(location)
197
+ else
198
+ get_response_with_retries(nil, location, nil)
199
+ end
200
+ when '404'
201
+ raise StandardError, ERROR_MESSAGE_404
202
+ else
203
+ raise UnexpectedStatusCodeException, response.code
204
+ end
205
+ end
206
+
207
+ def get_response(coordinates, endpoint, what_parameters)
208
+ http = build_http
209
+ query_params = build_query_params(coordinates, what_parameters) unless coordinates.nil?
210
+ endpoint = endpoint_with_params(endpoint, query_params) unless coordinates.nil?
211
+ request = Net::HTTP::Get.new(endpoint)
212
+ if configuration.key?(:username) && configuration.key?(:password)
213
+ request.basic_auth(configuration[:username], configuration[:password])
214
+ elsif configuration.key?(:token)
215
+ request['Authorization'] = "token #{configuration[:token]}"
216
+ end
217
+
218
+ logger.debug do
219
+ http.set_debug_output(logger)
220
+ "HTTP path: #{endpoint}"
221
+ end
222
+
223
+ http.request(request)
224
+ end
225
+
226
+ def build_metadata_url(artifact)
227
+ group_path = artifact[:group_id].tr('.', '/')
228
+ "#{BASE_REPO_URL}/#{group_path}/#{artifact[:artifact_id]}/maven-metadata.xml"
229
+ end
230
+
231
+ def fetch_latest_version(artifact)
232
+ xml = REXML::Document.new(Net::HTTP.get(URI(build_metadata_url(artifact))))
233
+ xml.elements['//versioning/latest']&.text || xml.elements['//version']&.text
234
+ end
235
+
236
+ def build_file_name(artifact_id, version, classifier, extension)
237
+ classifier ? "#{artifact_id}-#{version}-#{classifier}.#{extension}" : "#{artifact_id}-#{version}.#{extension}"
238
+ end
239
+
240
+ def build_download_url(artifact, version, file_name)
241
+ group_path = artifact[:group_id].tr('.', '/')
242
+ "#{BASE_REPO_URL}/#{group_path}/#{artifact[:artifact_id]}/#{version}/#{file_name}"
243
+ end
244
+ end
245
+ end
246
+ end
@@ -8,18 +8,22 @@
8
8
  :versions:
9
9
  :0.18: 0.5.26
10
10
  :0.20: 0.7.0
11
+ :0.22: 0.9.0
12
+ :0.24: 0.10.0
11
13
  :analytics:
12
14
  :type: :java
13
15
  :versions:
14
16
  :0.18: 4.2.5
15
17
  :0.20: 6.0.1
16
18
  :0.22: 7.2.7
19
+ :0.24: 8.1.1
17
20
  :avatax:
18
21
  :type: :java
19
22
  :versions:
20
23
  :0.18: 0.4.1
21
24
  :0.20: 0.6.1
22
25
  :0.22: 0.8.4
26
+ :0.24: 0.9.0
23
27
  :cybersource:
24
28
  :type: :ruby
25
29
  :versions:
@@ -28,6 +32,7 @@
28
32
  :type: :java
29
33
  :versions:
30
34
  :0.22: 0.0.2
35
+ :0.24: 0.1.0
31
36
  :dwolla:
32
37
  :type: :java
33
38
  :versions:
@@ -39,6 +44,7 @@
39
44
  :0.18: 0.3.1
40
45
  :0.20: 0.5.1
41
46
  :0.22: 0.7.2
47
+ :0.24: 0.8.0
42
48
  :forte:
43
49
  :type: :java
44
50
  :versions:
@@ -73,6 +79,7 @@
73
79
  :artifact_id: payment-test-plugin
74
80
  :versions:
75
81
  :0.22: 7.0.4
82
+ :0.24: 8.0.0
76
83
  :securenet:
77
84
  :type: :ruby
78
85
  :versions:
@@ -81,3 +88,25 @@
81
88
  :type: :java
82
89
  :versions:
83
90
  :0.22: 7.3.3
91
+ :0.24: 8.0.2
92
+ :braintree:
93
+ :type: :java
94
+ :versions:
95
+ :0.24: 1.0.0
96
+ :catalog-test:
97
+ :type: :java
98
+ :versions:
99
+ :0.24: 0.5.1
100
+ :gocardless:
101
+ :type: :java
102
+ :versions:
103
+ :0.24: 1.0.1
104
+ :qualpay:
105
+ :type: :java
106
+ :versions:
107
+ :0.22: 0.0.1
108
+ :0.24: 1.0.0
109
+ :invgrp:
110
+ :type: :java
111
+ :versions:
112
+ :0.24: 1.0.7
data/lib/kpm/tasks.rb CHANGED
@@ -17,16 +17,6 @@ module KPM
17
17
  say "KPM version #{KPM::VERSION}"
18
18
  end
19
19
 
20
- class_option :overrides,
21
- type: :hash,
22
- default: nil,
23
- desc: "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
24
-
25
- class_option :ssl_verify,
26
- type: :boolean,
27
- default: true,
28
- desc: 'Set to false to disable SSL Verification.'
29
-
30
20
  method_option :force_download,
31
21
  type: :boolean,
32
22
  default: false,
@@ -104,6 +94,14 @@ module KPM
104
94
  type: :boolean,
105
95
  default: true,
106
96
  desc: 'Validate sha1 sum'
97
+ method_option :overrides,
98
+ type: :hash,
99
+ default: nil,
100
+ desc: "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
101
+ method_option :ssl_verify,
102
+ type: :boolean,
103
+ default: true,
104
+ desc: 'Set to false to disable SSL Verification.'
107
105
  desc 'pull_kb_server_war <version>', 'Pulls Kill Bill server war and places it on your machine. If version was not specified it uses the latest released version.'
108
106
  def pull_kb_server_war(version = 'LATEST')
109
107
  installer = BaseInstaller.new(logger,
@@ -121,6 +119,14 @@ module KPM
121
119
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
122
120
  end
123
121
 
122
+ method_option :overrides,
123
+ type: :hash,
124
+ default: nil,
125
+ desc: "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
126
+ method_option :ssl_verify,
127
+ type: :boolean,
128
+ default: true,
129
+ desc: 'Set to false to disable SSL Verification.'
124
130
  desc 'search_for_kb_server', 'Searches for all versions of Kill Bill server and prints them to the screen.'
125
131
  def search_for_kb_server
126
132
  say "Available versions: #{KillbillServerArtifact.versions(KillbillServerArtifact::KILLBILL_ARTIFACT_ID,
@@ -207,6 +213,14 @@ module KPM
207
213
  type: :boolean,
208
214
  default: true,
209
215
  desc: 'Validates sha1 sum'
216
+ method_option :overrides,
217
+ type: :hash,
218
+ default: nil,
219
+ desc: "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
220
+ method_option :ssl_verify,
221
+ type: :boolean,
222
+ default: true,
223
+ desc: 'Set to false to disable SSL Verification.'
210
224
  desc 'pull_defaultbundles <kb-version>', 'Pulls the default OSGI bundles and places it on your machine. If the kb-version has been specified, it is used to download the matching platform artifact; if not, it uses the latest released version.'
211
225
  def pull_defaultbundles(kb_version = 'LATEST')
212
226
  response = BaseInstaller.new(logger,
@@ -219,12 +233,19 @@ module KPM
219
233
  options[:verify_sha1])
220
234
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
221
235
  end
222
-
236
+ method_option :overrides,
237
+ type: :hash,
238
+ default: nil,
239
+ desc: "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
240
+ method_option :ssl_verify,
241
+ type: :boolean,
242
+ default: true,
243
+ desc: 'Set to false to disable SSL Verification.'
223
244
  desc 'search_for_plugins', 'Searches for all available plugins and prints them to the screen.'
224
245
  def search_for_plugins
225
246
  all_plugins = KillbillPluginArtifact.versions(options[:overrides], options[:ssl_verify])
226
247
 
227
- result = ''
248
+ result = String.new
228
249
  all_plugins.each do |type, plugins|
229
250
  result << "Available #{type} plugins:\n"
230
251
  Hash[plugins.sort].each do |name, versions|
@@ -251,6 +272,14 @@ module KPM
251
272
  type: :boolean,
252
273
  default: true,
253
274
  desc: 'Validates sha1 sum'
275
+ method_option :overrides,
276
+ type: :hash,
277
+ default: nil,
278
+ desc: "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
279
+ method_option :ssl_verify,
280
+ type: :boolean,
281
+ default: true,
282
+ desc: 'Set to false to disable SSL Verification.'
254
283
  desc 'pull_kaui_war <version>', 'Pulls Kaui war and places it on your machine. If version was not specified it uses the latest released version.'
255
284
  def pull_kaui_war(version = 'LATEST')
256
285
  response = KauiArtifact.pull(logger,
@@ -293,6 +322,14 @@ module KPM
293
322
  type: :boolean,
294
323
  default: false,
295
324
  desc: 'Set the output format as JSON when true'
325
+ method_option :overrides,
326
+ type: :hash,
327
+ default: nil,
328
+ desc: "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
329
+ method_option :ssl_verify,
330
+ type: :boolean,
331
+ default: true,
332
+ desc: 'Set to false to disable SSL Verification.'
296
333
  desc 'info', 'Describe information about a Kill Bill version'
297
334
  def info
298
335
  versions_info = KillbillServerArtifact.info(options[:version],
@@ -525,22 +562,6 @@ module KPM
525
562
  type: :string,
526
563
  default: nil,
527
564
  desc: 'Killbill URL ex. http://127.0.0.1:8080'
528
- method_option :database_name,
529
- type: :string,
530
- default: nil,
531
- desc: 'DB name to connect'
532
- method_option :database_credentials,
533
- type: :array,
534
- default: nil,
535
- desc: 'DB credentials <user> <password>'
536
- method_option :database_host,
537
- type: :string,
538
- default: nil,
539
- desc: 'Database Host name'
540
- method_option :database_port,
541
- type: :string,
542
- default: nil,
543
- desc: 'Database port'
544
565
  method_option :kaui_web_path,
545
566
  type: :string,
546
567
  default: nil,
@@ -563,17 +584,12 @@ module KPM
563
584
 
564
585
  raise Interrupt, '--killbill_credentials, required format -> <user> <password>' if options[:killbill_credentials] && options[:killbill_credentials].size != 2
565
586
 
566
- raise Interrupt, '--database_credentials, required format -> <user> <password>' if options[:database_credentials] && options[:database_credentials].size != 2
567
-
568
- raise Interrupt, '--database_credentials, please provide a valid database name' if options[:database_name] && options[:database_name] == :database_name.to_s
569
-
570
587
  raise Interrupt, '--kaui_web_path, please provide a valid kaui web path ' if options[:kaui_web_path] && options[:kaui_web_path] == :kaui_web_path.to_s
571
588
 
572
589
  raise Interrupt, '--killbill_web_path, please provide a valid killbill web path' if options[:killbill_web_path] && options[:killbill_web_path] == :killbill_web_path.to_s
573
590
 
574
591
  diagnostic = KPM::DiagnosticFile.new(options[:config_file], options[:killbill_api_credentials], options[:killbill_credentials],
575
- options[:killbill_url], options[:database_name], options[:database_credentials],
576
- options[:database_host], options[:database_port], options[:kaui_web_path], options[:killbill_web_path], options[:bundles_dir], logger)
592
+ options[:killbill_url], options[:kaui_web_path], options[:killbill_web_path], options[:bundles_dir], logger)
577
593
  diagnostic.export_data(options[:account_export], options[:log_dir])
578
594
  rescue StandardError => e
579
595
  logger.error "\e[91;1m#{e.message}\e[0m"
data/lib/kpm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KPM
4
- VERSION = '0.11.1'
4
+ VERSION = '0.12.0'
5
5
  end
data/pom.xml CHANGED
@@ -22,7 +22,7 @@
22
22
  <modelVersion>4.0.0</modelVersion>
23
23
  <groupId>org.kill-bill.billing.installer</groupId>
24
24
  <artifactId>kpm</artifactId>
25
- <version>0.11.1</version>
25
+ <version>0.12.0</version>
26
26
  <packaging>pom</packaging>
27
27
  <name>KPM</name>
28
28
  <description>KPM: the Kill Bill Package Manager</description>
@@ -34,9 +34,6 @@ describe KPM::KillbillPluginArtifact do
34
34
  expect(versions[:java]['analytics-plugin']).not_to be_nil
35
35
  logging_plugin_versions = versions[:java]['analytics-plugin'].to_a
36
36
  expect(logging_plugin_versions.size).to be >= 3
37
- expect(logging_plugin_versions[0]).to eq '0.6.0'
38
- expect(logging_plugin_versions[1]).to eq '0.7.0'
39
- expect(logging_plugin_versions[2]).to eq '0.7.1'
40
37
  end
41
38
 
42
39
  private
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'rexml/document'
5
+
6
+ describe KPM::NexusFacade do
7
+ let(:logger) do
8
+ logger = ::Logger.new(STDOUT)
9
+ logger.level = Logger::DEBUG
10
+ logger
11
+ end
12
+ let(:test_version) { '0.24.15' }
13
+ let(:coordinates_map) do
14
+ { version: test_version,
15
+ group_id: 'org.kill-bill.billing',
16
+ artifact_id: 'killbill',
17
+ packaging: 'pom',
18
+ classifier: nil }
19
+ end
20
+ let(:coordinates) { KPM::Coordinates.build_coordinates(coordinates_map) }
21
+ let(:nexus_remote) { described_class::MavenCentralApiCalls.new({}, nil, logger) }
22
+
23
+ context 'when pulling release artifact' do
24
+ it {
25
+ response = nil
26
+ expect { response = nexus_remote.get_artifact_info(coordinates) }.not_to raise_exception
27
+ parsed_doc = REXML::Document.new(response)
28
+ expect(parsed_doc.elements['//version'].text).to eq(test_version)
29
+ expect(parsed_doc.elements['//repositoryPath'].text).to eq("/org/kill-bill/billing/#{test_version}/killbill-#{test_version}.pom")
30
+ expect(parsed_doc.elements['//snapshot'].text).to eq('false')
31
+ }
32
+
33
+ it {
34
+ response = nil
35
+ destination = Dir.mktmpdir('artifact')
36
+ expect { response = nexus_remote.pull_artifact(coordinates, destination) }.not_to raise_exception
37
+ destination = File.join(File.expand_path(destination), response[:file_name])
38
+ parsed_pom = REXML::Document.new(File.read(destination))
39
+ expect(parsed_pom.elements['//groupId'].text).to eq('org.kill-bill.billing')
40
+ expect(parsed_pom.elements['//artifactId'].text).to eq('killbill-oss-parent')
41
+ expect(parsed_pom.elements['//version'].text).to eq('0.146.63')
42
+ }
43
+ end
44
+
45
+ context 'when getting artifact info' do
46
+ it 'returns artifact info in XML format' do
47
+ response = nil
48
+ expect { response = nexus_remote.get_artifact_info(coordinates) }.not_to raise_exception
49
+ parsed_doc = REXML::Document.new(response)
50
+ expect(parsed_doc.elements['//groupId'].text).to eq('org.kill-bill.billing')
51
+ expect(parsed_doc.elements['//artifactId'].text).to eq('killbill')
52
+ expect(parsed_doc.elements['//version'].text).to eq(test_version)
53
+ end
54
+ end
55
+
56
+ context 'when searching for release artifact' do
57
+ it 'searches for artifacts and returns XML format' do
58
+ response = nil
59
+ expect do
60
+ response = nexus_remote.search_for_artifacts(coordinates)
61
+ end.not_to raise_exception
62
+
63
+ parsed_doc = REXML::Document.new(response)
64
+ expect(parsed_doc.elements['//groupId'].text).to eq('org.kill-bill.billing')
65
+ expect(parsed_doc.elements['//artifactId'].text).to eq('killbill')
66
+ expect(parsed_doc.elements['//version'].text).to eq(test_version)
67
+ end
68
+ end
69
+ end
data/tasks/package.rake CHANGED
@@ -10,9 +10,9 @@ require './lib/kpm/version'
10
10
  VERSION = KPM::VERSION
11
11
 
12
12
  # See https://www.jruby.org/download
13
- JRUBY_VERSION = '9.3.4.0'
13
+ JRUBY_VERSION = '9.4.5.0'
14
14
  # See https://github.com/Homebrew/homebrew-portable-ruby/releases
15
- HOMEBREW_PORTABLE_RUBY_VERSION = '2.6.8_1'
15
+ HOMEBREW_PORTABLE_RUBY_VERSION = '3.1.4'
16
16
 
17
17
  # Remove unused files to reduce package size
18
18
  GEMS_PATH = 'packaging/vendor/ruby/*/gems/*/'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2025-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -34,16 +34,16 @@ dependencies:
34
34
  name: killbill-client
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '3.2'
39
+ version: '0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '3.2'
46
+ version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rubyzip
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -176,6 +176,7 @@ files:
176
176
  - lib/kpm/nexus_helper/actions.rb
177
177
  - lib/kpm/nexus_helper/cloudsmith_api_calls.rb
178
178
  - lib/kpm/nexus_helper/github_api_calls.rb
179
+ - lib/kpm/nexus_helper/maven_central_api_calls.rb
179
180
  - lib/kpm/nexus_helper/nexus_api_calls_v2.rb
180
181
  - lib/kpm/nexus_helper/nexus_facade.rb
181
182
  - lib/kpm/plugins_directory.rb
@@ -207,6 +208,7 @@ files:
207
208
  - spec/kpm/remote/kaui_artifact_spec.rb
208
209
  - spec/kpm/remote/killbill_plugin_artifact_spec.rb
209
210
  - spec/kpm/remote/killbill_server_artifact_spec.rb
211
+ - spec/kpm/remote/maven_central_api_calls_spec.rb
210
212
  - spec/kpm/remote/migrations_spec.rb
211
213
  - spec/kpm/remote/nexus_facade_spec.rb
212
214
  - spec/kpm/remote/tenant_config_spec.rb
@@ -252,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
254
  - !ruby/object:Gem::Version
253
255
  version: '0'
254
256
  requirements: []
255
- rubygems_version: 3.0.3.1
257
+ rubygems_version: 3.3.26
256
258
  signing_key:
257
259
  specification_version: 4
258
260
  summary: Kill Bill package manager.