kpm 0.9.0 → 0.10.3

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: 0d40f3a357b1d6291000edb471a0af5f097d60b87befd5fe81c24b7c7d06eaab
4
- data.tar.gz: c20904d06ada1b9a6ee9efaeeae4c1ec1701922a6ad862a207ee5ff76ac3274e
3
+ metadata.gz: 23329bb4cce96a95cae38e312063f509233c86fbcf5a3068f9963afab8fed54d
4
+ data.tar.gz: 270d7e52554e8b17181cd21c545e3aa9895474add6665d5d2b13921d79615c8b
5
5
  SHA512:
6
- metadata.gz: 2734efed5f46394d5109a9389f419a639d09f3967b6f52a5566bda9d1e5a21009a19576e8fc9887fe003372a33a947a8c21d03becc733f4f3409df4d174a36f6
7
- data.tar.gz: 0e30885e28fd2614aa0fb31f76927410816d576c386009f634c2716b17575ae755beb0746d53a914f7b2b2073f592e294a3fd500eb0c612f5b62ec5f483ae20c
6
+ metadata.gz: 0fd8e93c1bb2301566965c2878d4f127b5886e3e6f19949ab394f5c895b68d53d7ccd35209b3f9e758f6384f87d9ec968308c0c8947843747552fdc6a28fcad2
7
+ data.tar.gz: 3054c061d4041391c06f3f784c135f9af8367f1e6ce098b44c8f5e74e78c2b111ce720345fb7bbab8243d83c4b6b28513e4e099e45fd3871b28c0e6fcd8e66e5
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ kpm-*-osx.tar.gz
8
8
  traveling-ruby-*.tar.gz
9
9
  *.asc
10
10
  .rakeTasks
11
+ pom.xml.versionsBackup
data/README.adoc CHANGED
@@ -14,8 +14,9 @@ toc::[]
14
14
 
15
15
  [[pre-built-binaries-recommended]]
16
16
  === Pre-built binaries (recommended)
17
+ image:https://img.shields.io/maven-central/v/org.kill-bill.billing.installer/kpm?color=blue&label=kpm[kpm]
17
18
 
18
- KPM self-contained builds are available on http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.installer%22%20AND%20a%3A%22kpm%22[Maven Central] with coordinates `org.kill-bill.billing.installer:kpm`.
19
+ On Linux and MacOS, you can use the pre-built binaries. KPM self-contained builds are available on http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.installer%22%20AND%20a%3A%22kpm%22[Maven Central] with coordinates `org.kill-bill.billing.installer:kpm`.
19
20
 
20
21
  Download the `.tar.gz` package matching your architecture (Linux and MacOS only).
21
22
 
@@ -23,8 +24,13 @@ Note that this installation method assumes `/bin/bash` to be available on your s
23
24
 
24
25
  [[through-rubygems]]
25
26
  === Through Rubygems
27
+ image:https://img.shields.io/gem/v/kpm?color=blue&label=kpm[kpm]
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:
30
+ [source,bash]
31
+ gem install kpm
32
+
26
33
 
27
- KPM is also available on https://rubygems.org/gems/kpm[RubyGems.org].
28
34
 
29
35
  [[kpm-commands]]
30
36
  == KPM Commands
@@ -249,7 +255,7 @@ Notes:
249
255
  [[gh-packages]]
250
256
  ### GitHub Packages
251
257
 
252
- KPM was initially designed to work against Sonatype. Starting with version 0.9.0, experimental support for GitHub packages has been added:
258
+ Starting with version 0.9.0, experimental support for GitHub packages has been added:
253
259
 
254
260
  ....
255
261
  kpm install_java_plugin acme:plugin \
@@ -260,3 +266,17 @@ kpm install_java_plugin acme:plugin \
260
266
  ....
261
267
 
262
268
  Replace `TOKEN` with a GitHub personal access token.
269
+
270
+ [[cloudsmith]]
271
+ ### Cloudsmith
272
+
273
+ Starting with version 0.10.0, experimental support for Cloudsmith has been added:
274
+
275
+ ....
276
+ kpm pull_kb_server_war 0.22.21-SNAPSHOT \
277
+ --overrides url:https://dl.cloudsmith.io/<TOKEN>/<ORG>/<REPO>/maven \
278
+ --group-id org.kill-bill.billing \
279
+ --artifact-id killbill-profiles-killbill
280
+ ....
281
+
282
+ Replace `TOKEN` with a Cloudsmith entitlement token, and specify the right `ORG` and `REPO`.
@@ -0,0 +1,21 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ killbill:
5
+ network_mode: host
6
+ image: killbill/killbill:0.22.1
7
+ environment:
8
+ - KILLBILL_CATALOG_URI=SpyCarAdvanced.xml
9
+ - KILLBILL_DAO_URL=jdbc:mysql://0.0.0.0:3306/killbill
10
+ - KILLBILL_DAO_USER=root
11
+ - KILLBILL_DAO_PASSWORD=root
12
+ - KILLBILL_SERVER_TEST_MODE=true
13
+ - KILLBILL_INVOICE_SANITY_SAFETY_BOUND_ENABLED=false
14
+ - KILLBILL_INVOICE_MAX_DAILY_NUMBER_OF_ITEMS_SAFETY_BOUND=-1
15
+ depends_on:
16
+ - db
17
+ db:
18
+ network_mode: host
19
+ image: killbill/mariadb:0.22
20
+ environment:
21
+ - MYSQL_ROOT_PASSWORD=root
data/kpm.gemspec CHANGED
@@ -46,6 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.add_dependency 'rubyzip', '~>1.2.0'
47
47
  s.add_dependency 'thor', '~> 0.19.1'
48
48
 
49
+ s.add_development_dependency 'gem-release', '~> 2.2'
49
50
  s.add_development_dependency 'rake', '~> 13.0'
50
51
  s.add_development_dependency 'rspec', '~> 3.9'
51
52
  s.add_development_dependency 'rubocop', '~> 0.88.0' if RUBY_VERSION >= '2.4'
data/lib/kpm/blob.rb CHANGED
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'fileutils'
4
+
3
5
  module KPM
4
6
  class Blob
5
7
  def initialize(value, tmp_dir)
6
8
  @tmp_dir = tmp_dir
7
9
  @blob_file = @tmp_dir + File::SEPARATOR + rand.to_s
10
+ # Make sure directory is 'rx' for others to allow LOAD_FILE to work
11
+ FileUtils.chmod('a+rx', @tmp_dir)
8
12
  store_value(value)
9
13
  end
10
14
 
data/lib/kpm/inspector.rb CHANGED
@@ -75,7 +75,14 @@ module KPM
75
75
  plugin_map = { plugin_name: plugin_name, plugin_path: plugin_path.to_s, type: type }
76
76
  entries = get_entries(plugin_path)
77
77
  set_default = entries.select { |e| e == 'SET_DEFAULT' }[0]
78
- default_version = File.basename(File.readlink(plugin_path.join(set_default))) if set_default
78
+ default_version = nil
79
+ if set_default
80
+ begin
81
+ default_version = File.basename(File.readlink(plugin_path.join(set_default)))
82
+ rescue StandardError
83
+ # On Windows, SET_DEFAULT is a directory, not a symbolic link
84
+ end
85
+ end
79
86
 
80
87
  non_default = entries.reject do |e|
81
88
  e == 'SET_DEFAULT'
@@ -41,10 +41,15 @@ module KPM
41
41
  ssl_verify)
42
42
 
43
43
  # Extract the killbill-oss-parent version
44
- pom = REXML::Document.new(File.new(kb_pom_info[:file_path]))
45
- oss_parent_version = pom.root.elements['parent/version'].text
46
- kb_version = pom.root.elements['version'].text
47
-
44
+ file = File.new(kb_pom_info[:file_path])
45
+ begin
46
+ pom = REXML::Document.new(file)
47
+ oss_parent_version = pom.root.elements['parent/version'].text
48
+ kb_version = pom.root.elements['version'].text
49
+ ensure
50
+ file.close
51
+ FileUtils.rm_f(kb_pom_info[:file_path])
52
+ end
48
53
  versions['killbill'] = kb_version
49
54
  versions['killbill-oss-parent'] = oss_parent_version
50
55
 
@@ -61,13 +66,17 @@ module KPM
61
66
  verify_sha1,
62
67
  overrides,
63
68
  ssl_verify)
64
-
65
- pom = REXML::Document.new(File.new(oss_pom_info[:file_path]))
66
- properties_element = pom.root.elements['properties']
67
- %w[killbill-api killbill-plugin-api killbill-commons killbill-platform].each do |property|
68
- versions[property] = properties_element.elements["#{property}.version"].text
69
+ file = File.new(oss_pom_info[:file_path])
70
+ begin
71
+ pom = REXML::Document.new(file)
72
+ properties_element = pom.root.elements['properties']
73
+ %w[killbill-api killbill-plugin-api killbill-commons killbill-platform].each do |property|
74
+ versions[property] = properties_element.elements["#{property}.version"].text
75
+ end
76
+ ensure
77
+ file.close
78
+ FileUtils.rm_f(oss_pom_info[:file_path])
69
79
  end
70
-
71
80
  sha1_checker.cache_killbill_info(version, versions) if sha1_checker
72
81
  end
73
82
  versions
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'nexus_api_calls_v2'
4
4
  require_relative 'github_api_calls'
5
+ require_relative 'cloudsmith_api_calls'
5
6
 
6
7
  module KPM
7
8
  module NexusFacade
@@ -29,7 +30,13 @@ module KPM
29
30
 
30
31
  @logger = logger
31
32
 
32
- @nexus_api_call = overrides[:url].start_with?('https://maven.pkg.github.com') ? GithubApiCalls.new(overrides, ssl_verify, logger) : NexusApiCallsV2.new(overrides, ssl_verify, logger)
33
+ @nexus_api_call = if overrides[:url].start_with?('https://maven.pkg.github.com')
34
+ GithubApiCalls.new(overrides, ssl_verify, logger)
35
+ elsif overrides[:url].start_with?('https://dl.cloudsmith.io')
36
+ CloudsmithApiCalls.new(overrides, ssl_verify, logger)
37
+ else
38
+ NexusApiCallsV2.new(overrides, ssl_verify, logger)
39
+ end
33
40
  end
34
41
 
35
42
  def pull_artifact(coordinates, destination = nil)
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'uri'
5
+ require 'rexml/document'
6
+ require 'openssl'
7
+
8
+ module KPM
9
+ module NexusFacade
10
+ class CloudsmithApiCalls < NexusApiCallsV2
11
+ def pull_artifact_endpoint(coordinates)
12
+ version_artifact_details = begin
13
+ parent_get_artifact_info(coordinates)
14
+ rescue StandardError
15
+ ''
16
+ end
17
+
18
+ # For SNAPSHOTs, we need to figure out the version used as part of the filename
19
+ filename_version = begin
20
+ REXML::Document.new(version_artifact_details).elements['//versioning/snapshotVersions/snapshotVersion[1]/value'].text
21
+ rescue StandardError
22
+ nil
23
+ end
24
+ coords = parse_coordinates(coordinates)
25
+ coords[:version] = filename_version unless filename_version.nil?
26
+ new_coordinates = coords.values.compact.join(':')
27
+
28
+ base_path, versioned_artifact, = build_base_path_and_coords(new_coordinates)
29
+ "#{base_path}/#{versioned_artifact}"
30
+ end
31
+
32
+ alias parent_get_artifact_info get_artifact_info
33
+ def get_artifact_info(coordinates)
34
+ _, versioned_artifact, coords = build_base_path_and_coords(coordinates)
35
+ sha1 = get_sha1(coordinates)
36
+ "<artifact-resolution>
37
+ <data>
38
+ <presentLocally>true</presentLocally>
39
+ <groupId>#{coords[:group_id]}</groupId>
40
+ <artifactId>#{coords[:artifact_id]}</artifactId>
41
+ <version>#{coords[:version]}</version>
42
+ <extension>#{coords[:packaging]}</extension>
43
+ <snapshot>#{!(coords[:version] =~ /-SNAPSHOT$/).nil?}</snapshot>
44
+ <sha1>#{sha1}</sha1>
45
+ <repositoryPath>/#{coords[:group_id].gsub('.', '/')}/#{versioned_artifact}</repositoryPath>
46
+ </data>
47
+ </artifact-resolution>"
48
+ end
49
+
50
+ def get_artifact_info_endpoint(coordinates)
51
+ base_path, _, coords = build_base_path_and_coords(coordinates)
52
+ # Note: we must retrieve the XML for the version, to support SNAPSHOTs
53
+ "#{base_path}/#{coords[:version]}/maven-metadata.xml"
54
+ end
55
+
56
+ def search_for_artifact_endpoint(_coordinates)
57
+ raise NoMethodError, 'Cloudsmith has no search support'
58
+ end
59
+
60
+ def build_query_params(_coordinates, _what_parameters = nil)
61
+ ''
62
+ end
63
+
64
+ private
65
+
66
+ def get_sha1(coordinates)
67
+ base_path, versioned_artifact, = build_base_path_and_coords(coordinates)
68
+ endpoint = "#{base_path}/#{versioned_artifact}.sha1"
69
+ get_response_with_retries(coordinates, endpoint, nil)
70
+ end
71
+
72
+ def build_base_path_and_coords(coordinates)
73
+ coords = parse_coordinates(coordinates)
74
+
75
+ token_org_and_repo = URI.parse(configuration[:url]).path
76
+
77
+ [
78
+ "#{token_org_and_repo}/#{coords[:group_id].gsub('.', '/')}/#{coords[:artifact_id]}",
79
+ "#{coords[:version]}/#{coords[:artifact_id]}-#{coords[:version]}.#{coords[:extension]}",
80
+ coords
81
+ ]
82
+ end
83
+ end
84
+ end
85
+ end
@@ -13,17 +13,21 @@
13
13
  :versions:
14
14
  :0.18: 4.2.5
15
15
  :0.20: 6.0.1
16
- :0.22: 7.0.8
16
+ :0.22: 7.2.3
17
17
  :avatax:
18
18
  :type: :java
19
19
  :versions:
20
20
  :0.18: 0.4.1
21
21
  :0.20: 0.6.1
22
- :0.22: 0.7.0
22
+ :0.22: 0.8.3
23
23
  :cybersource:
24
24
  :type: :ruby
25
25
  :versions:
26
26
  :0.18: 5.2.7
27
+ :deposit:
28
+ :type: :java
29
+ :versions:
30
+ :0.22: 0.0.2
27
31
  :dwolla:
28
32
  :type: :java
29
33
  :versions:
@@ -34,7 +38,7 @@
34
38
  :versions:
35
39
  :0.18: 0.3.1
36
40
  :0.20: 0.5.1
37
- :0.22: 0.6.1
41
+ :0.22: 0.7.2
38
42
  :forte:
39
43
  :type: :java
40
44
  :versions:
@@ -76,4 +80,4 @@
76
80
  :stripe:
77
81
  :type: :java
78
82
  :versions:
79
- :0.22: 7.0.4
83
+ :0.22: 7.3.0
@@ -10,6 +10,15 @@ module KPM
10
10
  @logger = logger
11
11
  end
12
12
 
13
+ def create_symbolic_link(path, link)
14
+ FileUtils.rm_f(link)
15
+ FileUtils.ln_s(path, link, force: true)
16
+ rescue Errno::EACCES
17
+ @logger.warn('Unable to create symbolic link LATEST, will copy the directory')
18
+ FileUtils.rm_rf(link)
19
+ FileUtils.cp_r(path, link)
20
+ end
21
+
13
22
  def set_active(plugin_name_or_path, plugin_version = nil)
14
23
  if plugin_name_or_path.nil?
15
24
  @logger.warn('Unable to mark a plugin as active: no name or path specified')
@@ -19,8 +28,7 @@ module KPM
19
28
  if plugin_version.nil?
20
29
  # Full path specified, with version
21
30
  link = Pathname.new(plugin_name_or_path).join('../SET_DEFAULT')
22
- FileUtils.rm_f(link)
23
- FileUtils.ln_s(plugin_name_or_path, link, force: true)
31
+ create_symbolic_link(plugin_name_or_path, link)
24
32
  else
25
33
  # Plugin name (fs directory) specified
26
34
  plugin_dir_glob = @plugins_dir.join('*').join(plugin_name_or_path)
@@ -28,8 +36,7 @@ module KPM
28
36
  Dir.glob(plugin_dir_glob).each do |plugin_dir_path|
29
37
  plugin_dir = Pathname.new(plugin_dir_path)
30
38
  link = plugin_dir.join('SET_DEFAULT')
31
- FileUtils.rm_f(link)
32
- FileUtils.ln_s(plugin_dir.join(plugin_version), link, force: true)
39
+ create_symbolic_link(plugin_dir.join(plugin_version), link)
33
40
  end
34
41
  end
35
42
 
@@ -179,7 +186,7 @@ module KPM
179
186
  end
180
187
  end
181
188
 
182
- # Note: the plugin name here is the directory name on the filesystem
189
+ # NOTE: the plugin name here is the directory name on the filesystem
183
190
  def update_fs(plugin_name_or_path, plugin_version = nil)
184
191
  if plugin_name_or_path.nil?
185
192
  @logger.warn('Unable to update the filesystem: no name or path specified')
data/lib/kpm/tasks.rb CHANGED
@@ -72,6 +72,22 @@ module KPM
72
72
  Uninstaller.new(options[:destination]).uninstall_non_default_plugins(options[:dry_run])
73
73
  end
74
74
 
75
+ method_option :group_id,
76
+ type: :string,
77
+ default: KillbillServerArtifact::KILLBILL_GROUP_ID,
78
+ desc: 'The Kill Bill war artifact group-id'
79
+ method_option :artifact_id,
80
+ type: :string,
81
+ default: KillbillServerArtifact::KILLBILL_ARTIFACT_ID,
82
+ desc: 'The Kill Bill war artifact id'
83
+ method_option :packaging,
84
+ type: :string,
85
+ default: KillbillServerArtifact::KILLBILL_PACKAGING,
86
+ desc: 'The Kill Bill war packaging'
87
+ method_option :classifier,
88
+ type: :string,
89
+ default: KillbillServerArtifact::KILLBILL_CLASSIFIER,
90
+ desc: 'The Kill Bill war classifier'
75
91
  method_option :destination,
76
92
  type: :string,
77
93
  default: nil,
@@ -93,10 +109,10 @@ module KPM
93
109
  installer = BaseInstaller.new(logger,
94
110
  options[:overrides],
95
111
  options[:ssl_verify])
96
- response = installer.install_killbill_server(KillbillServerArtifact::KILLBILL_GROUP_ID,
97
- KillbillServerArtifact::KILLBILL_ARTIFACT_ID,
98
- KillbillServerArtifact::KILLBILL_PACKAGING,
99
- KillbillServerArtifact::KILLBILL_CLASSIFIER,
112
+ response = installer.install_killbill_server(options[:group_id],
113
+ options[:artifact_id],
114
+ options[:packaging],
115
+ options[:classifier],
100
116
  version,
101
117
  options[:destination],
102
118
  options[:bundles_dir],
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.9.0'
4
+ VERSION = '0.10.3'
5
5
  end
data/pom.xml CHANGED
@@ -1,45 +1,216 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
- ~ Copyright 2014-2017 The Billing Project, LLC
4
- ~
5
- ~ The Billing Project licenses this file to you under the Apache License, version 2.0
6
- ~ (the "License"); you may not use this file except in compliance with the
7
- ~ License. You may obtain a copy of the License at:
8
- ~
9
- ~ http://www.apache.org/licenses/LICENSE-2.0
10
- ~
11
- ~ Unless required by applicable law or agreed to in writing, software
12
- ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
- ~ License for the specific language governing permissions and limitations
15
- ~ under the License.
16
- -->
17
-
3
+ ~ Copyright 2010-2014 Ning, Inc.
4
+ ~ Copyright 2014-2020 Groupon, Inc
5
+ ~ Copyright 2020-2020 Equinix, Inc
6
+ ~ Copyright 2014-2020 The Billing Project, LLC
7
+ ~
8
+ ~ The Billing Project licenses this file to you under the Apache License, version 2.0
9
+ ~ (the "License"); you may not use this file except in compliance with the
10
+ ~ License. You may obtain a copy of the License at:
11
+ ~
12
+ ~ http://www.apache.org/licenses/LICENSE-2.0
13
+ ~
14
+ ~ Unless required by applicable law or agreed to in writing, software
15
+ ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16
+ ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17
+ ~ License for the specific language governing permissions and limitations
18
+ ~ under the License.
19
+ -->
18
20
  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19
21
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20
- <parent>
21
- <groupId>org.sonatype.oss</groupId>
22
- <artifactId>oss-parent</artifactId>
23
- <version>5</version>
24
- </parent>
25
- <modelVersion>4.0.0</modelVersion>
26
- <groupId>org.kill-bill.billing.installer</groupId>
27
- <artifactId>kpm</artifactId>
28
- <packaging>pom</packaging>
29
- <version>0.9.0</version>
30
- <name>KPM</name>
31
- <url>http://github.com/killbill/killbill-cloud</url>
32
- <description>KPM: the Kill Bill Package Manager</description>
33
- <licenses>
34
- <license>
35
- <name>Apache License 2.0</name>
36
- <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
37
- <distribution>repo</distribution>
38
- </license>
39
- </licenses>
40
- <scm>
41
- <connection>scm:git:git://github.com/killbill/killbill-cloud.git</connection>
42
- <url>https://github.com/killbill/killbill-cloud/</url>
43
- <developerConnection>scm:git:git@github.com:killbill/killbill-cloud.git</developerConnection>
44
- </scm>
22
+ <modelVersion>4.0.0</modelVersion>
23
+ <groupId>org.kill-bill.billing.installer</groupId>
24
+ <artifactId>kpm</artifactId>
25
+ <version>0.10.3</version>
26
+ <packaging>pom</packaging>
27
+ <name>KPM</name>
28
+ <description>KPM: the Kill Bill Package Manager</description>
29
+ <url>http://github.com/killbill/killbill-cloud</url>
30
+ <inceptionYear>2010</inceptionYear>
31
+ <licenses>
32
+ <license>
33
+ <name>Apache License 2.0</name>
34
+ <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
35
+ <distribution>repo</distribution>
36
+ </license>
37
+ </licenses>
38
+ <developers>
39
+ <developer>
40
+ <id>pierre</id>
41
+ <name>Pierre-Alexandre Meyer</name>
42
+ <email>pierre@mouraf.org</email>
43
+ </developer>
44
+ <developer>
45
+ <id>stephane</id>
46
+ <name>Stephane Brossier</name>
47
+ </developer>
48
+ </developers>
49
+ <mailingLists>
50
+ <mailingList>
51
+ <name>Kill Bill users</name>
52
+ <subscribe>killbilling-users+subscribe@googlegroups.com</subscribe>
53
+ <unsubscribe>killbilling-users+unsubscribe@googlegroups.com</unsubscribe>
54
+ <post>killbilling-users@googlegroups.com</post>
55
+ <archive>http://groups.google.com/group/killbilling-users</archive>
56
+ </mailingList>
57
+ </mailingLists>
58
+ <scm>
59
+ <connection>scm:git:git://github.com/killbill/killbill-cloud.git</connection>
60
+ <url>https://github.com/killbill/killbill-cloud/</url>
61
+ <developerConnection>scm:git:git@github.com:killbill/killbill-cloud.git</developerConnection>
62
+ </scm>
63
+ <issueManagement>
64
+ <system>Github</system>
65
+ <url>https://github.com/killbill/killbill-cloud/issues</url>
66
+ </issueManagement>
67
+ <distributionManagement>
68
+ <repository>
69
+ <id>${repository.release.id}</id>
70
+ <name>${repository.release.name}</name>
71
+ <url>${repository.release.url}</url>
72
+ </repository>
73
+ <snapshotRepository>
74
+ <id>${repository.snapshot.id}</id>
75
+ <name>${repository.snapshot.name}</name>
76
+ <url>${repository.snapshot.url}</url>
77
+ </snapshotRepository>
78
+ </distributionManagement>
79
+ <properties>
80
+ <repository.release.id>sonatype-nexus-staging</repository.release.id>
81
+ <repository.release.name>Nexus Release Repository</repository.release.name>
82
+ <repository.release.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</repository.release.url>
83
+ <repository.snapshot.id>sonatype-nexus-snapshots</repository.snapshot.id>
84
+ <repository.snapshot.name>Sonatype Nexus Snapshots</repository.snapshot.name>
85
+ <repository.snapshot.url>https://oss.sonatype.org/content/repositories/snapshots/</repository.snapshot.url>
86
+ </properties>
87
+ <build>
88
+ <pluginManagement>
89
+ <plugins>
90
+ <plugin>
91
+ <artifactId>maven-compiler-plugin</artifactId>
92
+ <executions>
93
+ <execution>
94
+ <id>default-compile</id>
95
+ <phase>none</phase>
96
+ </execution>
97
+ <execution>
98
+ <id>default-testCompile</id>
99
+ <phase>none</phase>
100
+ </execution>
101
+ </executions>
102
+ </plugin>
103
+ <plugin>
104
+ <artifactId>maven-install-plugin</artifactId>
105
+ <executions>
106
+ <execution>
107
+ <id>default-install</id>
108
+ <phase>none</phase>
109
+ </execution>
110
+ </executions>
111
+ </plugin>
112
+ <plugin>
113
+ <artifactId>maven-resources-plugin</artifactId>
114
+ <executions>
115
+ <execution>
116
+ <id>default-resources</id>
117
+ <phase>none</phase>
118
+ </execution>
119
+ <execution>
120
+ <id>default-testResources</id>
121
+ <phase>none</phase>
122
+ </execution>
123
+ </executions>
124
+ </plugin>
125
+ <plugin>
126
+ <artifactId>maven-surefire-plugin</artifactId>
127
+ <executions>
128
+ <execution>
129
+ <id>default-test</id>
130
+ <phase>none</phase>
131
+ </execution>
132
+ </executions>
133
+ </plugin>
134
+ </plugins>
135
+ </pluginManagement>
136
+ <plugins>
137
+ <plugin>
138
+ <groupId>org.codehaus.mojo</groupId>
139
+ <artifactId>build-helper-maven-plugin</artifactId>
140
+ <version>3.2.0</version>
141
+ <executions>
142
+ <execution>
143
+ <id>attach-artifacts</id>
144
+ <phase>package</phase>
145
+ <goals>
146
+ <goal>attach-artifact</goal>
147
+ </goals>
148
+ <configuration>
149
+ <artifacts>
150
+ <artifact>
151
+ <file>kpm-${project.version}-linux-x86.tar.gz</file>
152
+ <type>tar.gz</type>
153
+ <classifier>linux-x86</classifier>
154
+ </artifact>
155
+ <artifact>
156
+ <file>kpm-${project.version}-linux-x86_64.tar.gz</file>
157
+ <type>tar.gz</type>
158
+ <classifier>linux-x86_64</classifier>
159
+ </artifact>
160
+ <artifact>
161
+ <file>kpm-${project.version}-osx.tar.gz</file>
162
+ <type>tar.gz</type>
163
+ <classifier>osx</classifier>
164
+ </artifact>
165
+ </artifacts>
166
+ </configuration>
167
+ </execution>
168
+ </executions>
169
+ </plugin>
170
+ </plugins>
171
+ </build>
172
+ <profiles>
173
+ <profile>
174
+ <id>sonatype-oss-release</id>
175
+ <build>
176
+ <plugins>
177
+ <plugin>
178
+ <groupId>org.apache.maven.plugins</groupId>
179
+ <artifactId>maven-gpg-plugin</artifactId>
180
+ <version>1.6</version>
181
+ <executions>
182
+ <execution>
183
+ <id>sign-artifacts</id>
184
+ <phase>verify</phase>
185
+ <goals>
186
+ <goal>sign</goal>
187
+ </goals>
188
+ <configuration>
189
+ <!-- Prevent `gpg` from using pinentry programs -->
190
+ <gpgArguments>
191
+ <arg>--pinentry-mode</arg>
192
+ <arg>loopback</arg>
193
+ </gpgArguments>
194
+ </configuration>
195
+ </execution>
196
+ </executions>
197
+ </plugin>
198
+ <plugin>
199
+ <groupId>org.sonatype.plugins</groupId>
200
+ <artifactId>nexus-staging-maven-plugin</artifactId>
201
+ <version>1.6.8</version>
202
+ <extensions>true</extensions>
203
+ <configuration>
204
+ <serverId>ossrh-releases</serverId>
205
+ <nexusUrl>https://oss.sonatype.org/</nexusUrl>
206
+ <keepStagingRepositoryOnFailure>true</keepStagingRepositoryOnFailure>
207
+ <keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
208
+ <autoReleaseAfterClose>true</autoReleaseAfterClose>
209
+ <stagingProgressTimeoutMinutes>10</stagingProgressTimeoutMinutes>
210
+ </configuration>
211
+ </plugin>
212
+ </plugins>
213
+ </build>
214
+ </profile>
215
+ </profiles>
45
216
  </project>
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'rexml/document'
5
+
6
+ describe KPM::NexusFacade, skip_me_if_nil: ENV['CLOUDSMITH_TOKEN'].nil? do
7
+ let(:logger) do
8
+ logger = ::Logger.new(STDOUT)
9
+ logger.level = Logger::INFO
10
+ logger
11
+ end
12
+ let(:coordinates_map) do
13
+ { version: '0.22.21-20210319.010242-1',
14
+ group_id: 'org.kill-bill.billing',
15
+ artifact_id: 'killbill',
16
+ packaging: 'pom',
17
+ classifier: nil }
18
+ end
19
+ let(:coordinates) { KPM::Coordinates.build_coordinates(coordinates_map) }
20
+ let(:nexus_remote) { described_class::CloudsmithApiCalls.new({ :url => "https://dl.cloudsmith.io/#{ENV['CLOUDSMITH_TOKEN']}/#{ENV['CLOUDSMITH_ORG']}/#{ENV['CLOUDSMITH_REPO']}/maven" }, true, logger) }
21
+
22
+ it {
23
+ # Not implemented
24
+ expect { nexus_remote.search_for_artifacts(coordinates) }.to raise_exception(NoMethodError, 'Cloudsmith has no search support')
25
+ }
26
+
27
+ # Upload as: cloudsmith push maven -v --group-id com.mycompany.app --artifact-id my-app --packaging pom --version 1.2.3 org/repo my-app-1.2.3.pom
28
+ # <project>
29
+ # <modelVersion>4.0.0</modelVersion>
30
+ # <groupId>com.mycompany.app</groupId>
31
+ # <artifactId>my-app</artifactId>
32
+ # <version>1.2.3</version>
33
+ # <packaging>pom</packaging>
34
+ # </project>
35
+ context 'when pulling release artifact' do
36
+ let(:coordinates_map) do
37
+ { version: '1.2.3',
38
+ group_id: 'com.mycompany.app',
39
+ artifact_id: 'my-app',
40
+ packaging: 'pom',
41
+ classifier: nil }
42
+ end
43
+ let(:coordinates) { KPM::Coordinates.build_coordinates(coordinates_map) }
44
+
45
+ it {
46
+ response = nil
47
+ expect { response = nexus_remote.get_artifact_info(coordinates) }.not_to raise_exception
48
+ parsed_doc = REXML::Document.new(response)
49
+ expect(parsed_doc.elements['//version'].text).to eq('1.2.3')
50
+ expect(parsed_doc.elements['//repositoryPath'].text).to eq('/com/mycompany/app/1.2.3/my-app-1.2.3.pom')
51
+ expect(parsed_doc.elements['//snapshot'].text).to eq('false')
52
+ }
53
+
54
+ it {
55
+ response = nil
56
+ destination = Dir.mktmpdir('artifact')
57
+ expect { response = nexus_remote.pull_artifact(coordinates, destination) }.not_to raise_exception
58
+ destination = File.join(File.expand_path(destination), response[:file_name])
59
+ parsed_pom = REXML::Document.new(File.read(destination))
60
+ expect(parsed_pom.elements['//groupId'].text).to eq('com.mycompany.app')
61
+ expect(parsed_pom.elements['//artifactId'].text).to eq('my-app')
62
+ expect(parsed_pom.elements['//version'].text).to eq('1.2.3')
63
+ }
64
+ end
65
+
66
+ # File uploaded twice (the first doesn't have any <properties>)
67
+ # <project>
68
+ # <modelVersion>4.0.0</modelVersion>
69
+ # <groupId>com.mycompany.app</groupId>
70
+ # <artifactId>my-app</artifactId>
71
+ # <version>1.2.4-SNAPSHOT</version>
72
+ # <packaging>pom</packaging>
73
+ # <properties>
74
+ # <for-kpm>true</for-kpm>
75
+ # </properties>
76
+ # </project>
77
+ context 'when pulling SNAPSHOT artifact' do
78
+ let(:coordinates_map) do
79
+ { version: '1.2.4-SNAPSHOT',
80
+ group_id: 'com.mycompany.app',
81
+ artifact_id: 'my-app',
82
+ packaging: 'pom',
83
+ classifier: nil }
84
+ end
85
+ let(:coordinates) { KPM::Coordinates.build_coordinates(coordinates_map) }
86
+
87
+ it {
88
+ response = nil
89
+ expect { response = nexus_remote.get_artifact_info(coordinates) }.not_to raise_exception
90
+ parsed_doc = REXML::Document.new(response)
91
+ expect(parsed_doc.elements['//version'].text).to eq('1.2.4-SNAPSHOT')
92
+ expect(parsed_doc.elements['//repositoryPath'].text).to eq('/com/mycompany/app/1.2.4-SNAPSHOT/my-app-1.2.4-SNAPSHOT.pom')
93
+ expect(parsed_doc.elements['//snapshot'].text).to eq('true')
94
+ }
95
+
96
+ it {
97
+ response = nil
98
+ destination = Dir.mktmpdir('artifact')
99
+ expect { response = nexus_remote.pull_artifact(coordinates, destination) }.not_to raise_exception
100
+ destination = File.join(File.expand_path(destination), response[:file_name])
101
+ parsed_pom = REXML::Document.new(File.read(destination))
102
+ expect(parsed_pom.elements['//groupId'].text).to eq('com.mycompany.app')
103
+ expect(parsed_pom.elements['//artifactId'].text).to eq('my-app')
104
+ expect(parsed_pom.elements['//version'].text).to eq('1.2.4-SNAPSHOT')
105
+ # Verify that if multiple SNAPSHOTs are uploaded, the last one is downloaded (the first one doesn't have <properties>)
106
+ expect(parsed_pom.elements['//properties/for-kpm'].text).to eq('true')
107
+ }
108
+ end
109
+ end
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.9.0
4
+ version: 0.10.3
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: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.19.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: gem-release
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.2'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rake
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,7 @@ files:
108
122
  - README.adoc
109
123
  - Rakefile
110
124
  - bin/kpm
125
+ - docker/docker-compose.ci.mysql.yml
111
126
  - install_example.yml
112
127
  - kpm.gemspec
113
128
  - lib/kpm.rb
@@ -127,6 +142,7 @@ files:
127
142
  - lib/kpm/killbill_server_artifact.rb
128
143
  - lib/kpm/migrations.rb
129
144
  - lib/kpm/nexus_helper/actions.rb
145
+ - lib/kpm/nexus_helper/cloudsmith_api_calls.rb
130
146
  - lib/kpm/nexus_helper/github_api_calls.rb
131
147
  - lib/kpm/nexus_helper/nexus_api_calls_v2.rb
132
148
  - lib/kpm/nexus_helper/nexus_facade.rb
@@ -155,6 +171,7 @@ files:
155
171
  - release.sh
156
172
  - spec/kpm/remote/base_artifact_spec.rb
157
173
  - spec/kpm/remote/base_installer_spec.rb
174
+ - spec/kpm/remote/cloudsmith_api_calls_spec.rb
158
175
  - spec/kpm/remote/github_api_calls_spec.rb
159
176
  - spec/kpm/remote/installer_spec.rb
160
177
  - spec/kpm/remote/kaui_artifact_spec.rb