kpm 0.10.6 → 0.11.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 +4 -4
- data/.gitignore +2 -4
- data/install_example.yml +0 -5
- data/lib/kpm/base_artifact.rb +0 -4
- data/lib/kpm/base_installer.rb +3 -45
- data/lib/kpm/installer.rb +1 -15
- data/lib/kpm/killbill_plugin_artifact.rb +3 -12
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +1 -1
- data/lib/kpm/plugins_directory.rb +3 -4
- data/lib/kpm/plugins_directory.yml +1 -1
- data/lib/kpm/tasks.rb +2 -70
- data/lib/kpm/version.rb +1 -1
- data/packaging/Gemfile +4 -1
- data/packaging/kpm.sh +1 -1
- data/pom.xml +6 -11
- data/release.sh +60 -0
- data/spec/kpm/remote/installer_spec.rb +4 -25
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +0 -48
- data/tasks/package.rake +28 -67
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8511e401669df3cf28d9ff916b158764238109c34e818a8221ee598c11d78750
|
4
|
+
data.tar.gz: cc284e39cf1c3d5b2cf7ece8fc7cbc38d2853016c666378ff1127a6761d5a04d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f6e3965bfb2e4c32707d845add23ff06fe7eb7d3bd4550d94863f2ffa207049c578ba90dff1cac3d1609427a3a6ae010582e7fa8cec309a151e7fd1e595f18e
|
7
|
+
data.tar.gz: 031a2b0f7da148e24b7a13ff90e6c023d3d381040d7de8161389ca9ac523487b64540ab6174c2d1aab2d110bcf19d6af4291b28eade76c4f2d6317303ae7c662
|
data/.gitignore
CHANGED
@@ -2,12 +2,10 @@ Gemfile.lock
|
|
2
2
|
pkg
|
3
3
|
packaging/tmp
|
4
4
|
packaging/vendor
|
5
|
+
kpm-*-linux-x86.tar.gz
|
5
6
|
kpm-*-linux-x86_64.tar.gz
|
6
|
-
kpm-*-osx-arm64.tar.gz
|
7
7
|
kpm-*-osx.tar.gz
|
8
|
-
|
9
|
-
portable-ruby-*.tar.gz
|
10
|
-
jruby-dist-*-bin.tar.gz
|
8
|
+
traveling-ruby-*.tar.gz
|
11
9
|
*.asc
|
12
10
|
.rakeTasks
|
13
11
|
pom.xml.versionsBackup
|
data/install_example.yml
CHANGED
data/lib/kpm/base_artifact.rb
CHANGED
@@ -25,10 +25,6 @@ module KPM
|
|
25
25
|
KILLBILL_JAVA_PLUGIN_PACKAGING = 'jar'
|
26
26
|
KILLBILL_JAVA_PLUGIN_CLASSIFIER = nil
|
27
27
|
|
28
|
-
KILLBILL_RUBY_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.ruby'
|
29
|
-
KILLBILL_RUBY_PLUGIN_PACKAGING = 'tar.gz'
|
30
|
-
KILLBILL_RUBY_PLUGIN_CLASSIFIER = nil
|
31
|
-
|
32
28
|
KAUI_GROUP_ID = 'org.kill-bill.billing.kaui'
|
33
29
|
KAUI_ARTIFACT_ID = 'kaui-standalone'
|
34
30
|
KAUI_PACKAGING = 'war'
|
data/lib/kpm/base_installer.rb
CHANGED
@@ -79,7 +79,7 @@ module KPM
|
|
79
79
|
:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier))
|
80
80
|
end
|
81
81
|
|
82
|
-
def install_plugin(plugin_key, raw_kb_version = nil, specified_group_id = nil, specified_artifact_id = nil, specified_packaging = nil, specified_classifier = nil, specified_version = nil, bundles_dir = nil, specified_type = nil, force_download = false, verify_sha1 = true
|
82
|
+
def install_plugin(plugin_key, raw_kb_version = nil, specified_group_id = nil, specified_artifact_id = nil, specified_packaging = nil, specified_classifier = nil, specified_version = nil, bundles_dir = nil, specified_type = nil, force_download = false, verify_sha1 = true)
|
83
83
|
# plugin_key needs to exist
|
84
84
|
raise ArgumentError, 'Aborting installation: User needs to specify a pluginKey' if plugin_key.nil?
|
85
85
|
|
@@ -94,7 +94,6 @@ module KPM
|
|
94
94
|
# If there is no entry in plugins_directory.yml and the group_id is not the killbill default group_id, the key provided must be a user key and must have a namespace
|
95
95
|
if looked_up_artifact_id.nil? &&
|
96
96
|
specified_group_id != KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID &&
|
97
|
-
specified_group_id != KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID &&
|
98
97
|
plugin_key.split(':').size == 1
|
99
98
|
raise ArgumentError, "Aborting installation: pluginKey = #{plugin_key} does not exist in plugin_directory.yml so format of the key must have a user namespace (e.g namespace:key)"
|
100
99
|
end
|
@@ -114,14 +113,7 @@ module KPM
|
|
114
113
|
version = specified_version || looked_up_version || LATEST_VERSION
|
115
114
|
destination = plugins_dir.join('java').join(artifact_id).join(version)
|
116
115
|
else
|
117
|
-
|
118
|
-
warn_if_jruby_jar_missing(bundles_dir) if verify_jruby_jar
|
119
|
-
|
120
|
-
group_id = specified_group_id || looked_up_group_id || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID
|
121
|
-
packaging = specified_packaging || looked_up_packaging || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING
|
122
|
-
classifier = specified_classifier || looked_up_classifier || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER
|
123
|
-
version = specified_version || looked_up_version || LATEST_VERSION
|
124
|
-
destination = plugins_dir.join('ruby')
|
116
|
+
raise ArgumentError, "Aborting installation: plugin type #{type} unsupported"
|
125
117
|
end
|
126
118
|
sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}"
|
127
119
|
plugins_manager = PluginsManager.new(plugins_dir, @logger)
|
@@ -178,7 +170,7 @@ module KPM
|
|
178
170
|
plugin_name = name.nil? ? Utils.get_plugin_name_from_file_path(file_path) : name
|
179
171
|
destination = plugins_dir.join('java').join(plugin_name).join(version)
|
180
172
|
else
|
181
|
-
|
173
|
+
raise ArgumentError, "Aborting installation: plugin type #{type} unsupported"
|
182
174
|
end
|
183
175
|
|
184
176
|
artifact_info = KPM::KillbillPluginArtifact.pull_from_fs(@logger, file_path, destination)
|
@@ -245,10 +237,6 @@ module KPM
|
|
245
237
|
info.merge('status' => (info[:skipped] ? 'UP_TO_DATE' : 'INSTALLED'),
|
246
238
|
:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier))
|
247
239
|
|
248
|
-
# The special JRuby bundle needs to be called jruby.jar
|
249
|
-
# TODO .first - code smell
|
250
|
-
File.rename Dir.glob("#{destination}/killbill-platform-osgi-bundles-jruby-*.jar").first, destination.join('jruby.jar') unless info[:skipped]
|
251
|
-
|
252
240
|
info
|
253
241
|
end
|
254
242
|
|
@@ -281,35 +269,5 @@ module KPM
|
|
281
269
|
plugins_manager = PluginsManager.new(plugins_dir, @logger)
|
282
270
|
plugins_manager.set_active(artifact_info[:bundle_dir])
|
283
271
|
end
|
284
|
-
|
285
|
-
def warn_if_jruby_jar_missing(bundles_dir)
|
286
|
-
platform_dir = bundles_dir.join('platform')
|
287
|
-
jruby_jar = platform_dir.join('jruby.jar')
|
288
|
-
if !File.exist?(jruby_jar)
|
289
|
-
@logger.warn(" Missing installation for jruby.jar under #{platform_dir}. This is required for ruby plugin installation")
|
290
|
-
else
|
291
|
-
version = extract_jruby_jar_version(jruby_jar)
|
292
|
-
if version
|
293
|
-
@logger.info(" Detected jruby.jar version #{version}")
|
294
|
-
else
|
295
|
-
@logger.warn(" Failed to detect jruby.jar version for #{jruby_jar}")
|
296
|
-
end
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
|
-
def extract_jruby_jar_version(jruby_jar)
|
301
|
-
selected_entries = Zip::File.open(jruby_jar) do |zip_file|
|
302
|
-
zip_file.select do |entry|
|
303
|
-
entry.name == 'META-INF/maven/org.kill-bill.billing/killbill-platform-osgi-bundles-jruby/pom.properties'
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
if selected_entries && selected_entries.size == 1
|
308
|
-
zip_entry = selected_entries[0]
|
309
|
-
content = zip_entry.get_input_stream.read
|
310
|
-
return content.split("\n").select { |e| e.start_with?('version') }[0].split('=')[1]
|
311
|
-
end
|
312
|
-
nil
|
313
|
-
end
|
314
272
|
end
|
315
273
|
end
|
data/lib/kpm/installer.rb
CHANGED
@@ -127,7 +127,6 @@ module KPM
|
|
127
127
|
|
128
128
|
def install_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
129
129
|
install_java_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
130
|
-
install_ruby_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
131
130
|
end
|
132
131
|
|
133
132
|
def install_java_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
@@ -135,20 +134,7 @@ module KPM
|
|
135
134
|
|
136
135
|
infos = []
|
137
136
|
@config['plugins']['java'].each do |plugin|
|
138
|
-
infos << install_plugin(plugin['name'], raw_kb_version, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], bundles_dir, 'java', force_download, verify_sha1
|
139
|
-
end
|
140
|
-
|
141
|
-
infos
|
142
|
-
end
|
143
|
-
|
144
|
-
def install_ruby_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
145
|
-
return if @config['plugins'].nil? || @config['plugins']['ruby'].nil?
|
146
|
-
|
147
|
-
verify_jruby_jar = true
|
148
|
-
infos = []
|
149
|
-
@config['plugins']['ruby'].each do |plugin|
|
150
|
-
infos << install_plugin(plugin['name'], raw_kb_version, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], bundles_dir, 'ruby', force_download, verify_sha1, verify_jruby_jar)
|
151
|
-
verify_jruby_jar = false
|
137
|
+
infos << install_plugin(plugin['name'], raw_kb_version, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], bundles_dir, 'java', force_download, verify_sha1)
|
152
138
|
end
|
153
139
|
|
154
140
|
infos
|
@@ -8,15 +8,15 @@ module KPM
|
|
8
8
|
class << self
|
9
9
|
def pull(logger, group_id, artifact_id, packaging = 'jar', classifier = nil, version = 'LATEST', plugin_name = nil, destination_path = nil, sha1_file = nil, force_download = false, verify_sha1 = true, overrides = {}, ssl_verify = true)
|
10
10
|
coordinate_map = { group_id: group_id, artifact_id: artifact_id, packaging: packaging, classifier: classifier, version: version }
|
11
|
-
pull_and_put_in_place(logger, coordinate_map, plugin_name, destination_path,
|
11
|
+
pull_and_put_in_place(logger, coordinate_map, plugin_name, destination_path, false, sha1_file, force_download, verify_sha1, overrides, ssl_verify)
|
12
12
|
end
|
13
13
|
|
14
14
|
def versions(overrides = {}, ssl_verify = true)
|
15
|
-
plugins = { java: {}
|
15
|
+
plugins = { java: {} }
|
16
16
|
|
17
17
|
nexus = nexus_remote(overrides, ssl_verify)
|
18
18
|
|
19
|
-
[[:java, KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID]
|
19
|
+
[[:java, KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID]].each do |type_and_group_id|
|
20
20
|
response = REXML::Document.new nexus.search_for_artifacts(type_and_group_id[1])
|
21
21
|
response.elements.each('searchNGResponse/data/artifact') do |element|
|
22
22
|
artifact_id = element.elements['artifactId'].text
|
@@ -27,15 +27,6 @@ module KPM
|
|
27
27
|
|
28
28
|
plugins
|
29
29
|
end
|
30
|
-
|
31
|
-
protected
|
32
|
-
|
33
|
-
# Magic methods...
|
34
|
-
|
35
|
-
def ruby_plugin_and_should_skip_top_dir?(group_id, artifact_id)
|
36
|
-
# The second check is for custom ruby plugins
|
37
|
-
group_id == KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID || artifact_id.include?('plugin')
|
38
|
-
end
|
39
30
|
end
|
40
31
|
end
|
41
32
|
end
|
@@ -31,12 +31,11 @@ module KPM
|
|
31
31
|
return nil if plugin.nil?
|
32
32
|
|
33
33
|
type = plugin[:type]
|
34
|
-
is_ruby = type == :ruby
|
35
34
|
|
36
|
-
group_id = plugin[:group_id] ||
|
35
|
+
group_id = plugin[:group_id] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID
|
37
36
|
artifact_id = plugin[:artifact_id] || "#{plugin_key}-plugin"
|
38
|
-
packaging = plugin[:packaging] ||
|
39
|
-
classifier = plugin[:classifier] ||
|
37
|
+
packaging = plugin[:packaging] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING
|
38
|
+
classifier = plugin[:classifier] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER
|
40
39
|
|
41
40
|
if raw_kb_version == 'LATEST'
|
42
41
|
version = 'LATEST'
|
data/lib/kpm/tasks.rb
CHANGED
@@ -187,8 +187,7 @@ module KPM
|
|
187
187
|
options[:destination],
|
188
188
|
'java',
|
189
189
|
options[:force_download],
|
190
|
-
options[:verify_sha1]
|
191
|
-
false)
|
190
|
+
options[:verify_sha1])
|
192
191
|
else
|
193
192
|
installer.install_plugin_from_fs(plugin_key, options[:from_source_file], nil, options[:version], options[:destination], 'java')
|
194
193
|
end
|
@@ -196,72 +195,6 @@ module KPM
|
|
196
195
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
197
196
|
end
|
198
197
|
|
199
|
-
method_option :group_id,
|
200
|
-
type: :string,
|
201
|
-
default: KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID,
|
202
|
-
desc: 'The plugin artifact group-id'
|
203
|
-
method_option :artifact_id,
|
204
|
-
type: :string,
|
205
|
-
default: nil,
|
206
|
-
desc: 'The plugin artifact id'
|
207
|
-
method_option :version,
|
208
|
-
type: :string,
|
209
|
-
default: nil,
|
210
|
-
desc: 'The plugin artifact version'
|
211
|
-
method_option :packaging,
|
212
|
-
type: :string,
|
213
|
-
default: KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING,
|
214
|
-
desc: 'The plugin artifact packaging'
|
215
|
-
method_option :classifier,
|
216
|
-
type: :string,
|
217
|
-
default: KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER,
|
218
|
-
desc: 'The plugin artifact classifier'
|
219
|
-
method_option :from_source_file,
|
220
|
-
type: :string,
|
221
|
-
default: nil,
|
222
|
-
desc: 'Specify the ruby plugin archive that should be used for the installation.'
|
223
|
-
method_option :destination,
|
224
|
-
type: :string,
|
225
|
-
default: nil,
|
226
|
-
desc: 'A different folder other than the current working directory.'
|
227
|
-
method_option :force_download,
|
228
|
-
type: :boolean,
|
229
|
-
default: false,
|
230
|
-
desc: 'Force download of the artifact even if it exists'
|
231
|
-
method_option :sha1_file,
|
232
|
-
type: :string,
|
233
|
-
default: nil,
|
234
|
-
desc: 'Location of the sha1 file'
|
235
|
-
method_option :verify_sha1,
|
236
|
-
type: :boolean,
|
237
|
-
default: true,
|
238
|
-
desc: 'Validates sha1 sum'
|
239
|
-
desc 'install_ruby_plugin plugin-key <kb-version>', 'Pulls a ruby plugin and installs it under the specified destination. If the kb-version has been specified, it is used to download the matching plugin artifact version; if not, it uses the specified plugin version or if null, the LATEST one.'
|
240
|
-
def install_ruby_plugin(plugin_key, kb_version = 'LATEST')
|
241
|
-
installer = BaseInstaller.new(logger,
|
242
|
-
options[:overrides],
|
243
|
-
options[:ssl_verify])
|
244
|
-
|
245
|
-
response = if options[:from_source_file].nil?
|
246
|
-
installer.install_plugin(plugin_key,
|
247
|
-
kb_version,
|
248
|
-
options[:group_id],
|
249
|
-
options[:artifact_id],
|
250
|
-
options[:packaging],
|
251
|
-
options[:classifier],
|
252
|
-
options[:version],
|
253
|
-
options[:destination],
|
254
|
-
'ruby',
|
255
|
-
options[:force_download],
|
256
|
-
options[:verify_sha1],
|
257
|
-
true)
|
258
|
-
else
|
259
|
-
installer.install_plugin_from_fs(plugin_key, options[:from_source_file], nil, nil, options[:destination], 'ruby')
|
260
|
-
end
|
261
|
-
|
262
|
-
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
263
|
-
end
|
264
|
-
|
265
198
|
method_option :destination,
|
266
199
|
type: :string,
|
267
200
|
default: nil,
|
@@ -647,8 +580,7 @@ module KPM
|
|
647
580
|
logger.error e.backtrace.join("\n") unless e.is_a?(Interrupt)
|
648
581
|
end
|
649
582
|
|
650
|
-
map
|
651
|
-
pull_java_plugin: :install_java_plugin
|
583
|
+
map pull_java_plugin: :install_java_plugin
|
652
584
|
|
653
585
|
private
|
654
586
|
|
data/lib/kpm/version.rb
CHANGED
data/packaging/Gemfile
CHANGED
data/packaging/kpm.sh
CHANGED
@@ -11,4 +11,4 @@ unset BUNDLE_IGNORE_CONFIG
|
|
11
11
|
|
12
12
|
# Run the actual app using the bundled Ruby interpreter, with Bundler activated.
|
13
13
|
# See https://github.com/phusion/traveling-ruby/issues/58
|
14
|
-
exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup -rreadline $SELFDIR/lib/vendor
|
14
|
+
exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup -rreadline $SELFDIR/lib/vendor/ruby/2.*/bin/kpm $@
|
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.
|
25
|
+
<version>0.11.0</version>
|
26
26
|
<packaging>pom</packaging>
|
27
27
|
<name>KPM</name>
|
28
28
|
<description>KPM: the Kill Bill Package Manager</description>
|
@@ -147,6 +147,11 @@
|
|
147
147
|
</goals>
|
148
148
|
<configuration>
|
149
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>
|
150
155
|
<artifact>
|
151
156
|
<file>kpm-${project.version}-linux-x86_64.tar.gz</file>
|
152
157
|
<type>tar.gz</type>
|
@@ -157,16 +162,6 @@
|
|
157
162
|
<type>tar.gz</type>
|
158
163
|
<classifier>osx</classifier>
|
159
164
|
</artifact>
|
160
|
-
<artifact>
|
161
|
-
<file>kpm-${project.version}-osx-arm64.tar.gz</file>
|
162
|
-
<type>tar.gz</type>
|
163
|
-
<classifier>osx-arm64</classifier>
|
164
|
-
</artifact>
|
165
|
-
<artifact>
|
166
|
-
<file>kpm-${project.version}-noarch.tar.gz</file>
|
167
|
-
<type>tar.gz</type>
|
168
|
-
<classifier>noarch</classifier>
|
169
|
-
</artifact>
|
170
165
|
</artifacts>
|
171
166
|
</configuration>
|
172
167
|
</execution>
|
data/release.sh
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
BUNDLE=${BUNDLE-"bundle exec"}
|
6
|
+
MVN=${MVN-"mvn"}
|
7
|
+
|
8
|
+
if [ 'GNU' != "$(tar --help | grep GNU | head -1 | awk '{print $1}')" ]; then
|
9
|
+
echo 'Unable to release: make sure to use GNU tar'
|
10
|
+
exit 1
|
11
|
+
fi
|
12
|
+
|
13
|
+
# See TRAVELING_RUBY_VERSION in tasks/package.rake
|
14
|
+
if [[ "$(ruby --version 2>&1 | tail -1 | awk '{print $2}')" != 2.2.2* ]]; then
|
15
|
+
echo 'Ruby version 2.2.2 is required'
|
16
|
+
exit 1
|
17
|
+
fi
|
18
|
+
|
19
|
+
VERSION=`grep -E '<version>([0-9]+\.[0-9]+\.[0-9]+)</version>' pom.xml | sed 's/[\t \n]*<version>\(.*\)<\/version>[\t \n]*/\1/'`
|
20
|
+
if [[ -z "$NO_RELEASE" && "$VERSION" != "$(ruby -r./lib/kpm/version.rb -e "print KPM::VERSION")" ]]; then
|
21
|
+
echo 'Unable to release: make sure the versions in pom.xml and VERSION match'
|
22
|
+
exit 1
|
23
|
+
fi
|
24
|
+
|
25
|
+
if [[ -z "$NO_RELEASE" ]]; then
|
26
|
+
echo 'Pushing the gem to Rubygems'
|
27
|
+
$BUNDLE rake release
|
28
|
+
fi
|
29
|
+
|
30
|
+
# Wait for the gem to be propagated
|
31
|
+
sleep 15
|
32
|
+
|
33
|
+
$BUNDLE rake package
|
34
|
+
|
35
|
+
if [[ -z "$NO_RELEASE" ]]; then
|
36
|
+
GOAL=gpg:sign-and-deploy-file
|
37
|
+
REPOSITORY_ID=ossrh-releases
|
38
|
+
URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
|
39
|
+
REPO_VERSION=$VERSION
|
40
|
+
else
|
41
|
+
GOAL=deploy:deploy-file
|
42
|
+
REPOSITORY_ID=sonatype-nexus-snapshots
|
43
|
+
URL=https://oss.sonatype.org/content/repositories/snapshots/
|
44
|
+
REPO_VERSION="$VERSION-SNAPSHOT"
|
45
|
+
fi
|
46
|
+
|
47
|
+
echo "Pushing artifacts to Maven Central"
|
48
|
+
$MVN $GOAL \
|
49
|
+
-DgroupId=org.kill-bill.billing.installer \
|
50
|
+
-DartifactId=kpm \
|
51
|
+
-Dversion=$REPO_VERSION \
|
52
|
+
-Dpackaging=tar.gz \
|
53
|
+
-DrepositoryId=$REPOSITORY_ID \
|
54
|
+
-Durl=$URL \
|
55
|
+
-Dfile=kpm-$VERSION-linux-x86_64.tar.gz \
|
56
|
+
-Dclassifier=linux-x86_64 \
|
57
|
+
-Dfiles=kpm-$VERSION-linux-x86.tar.gz,kpm-$VERSION-osx.tar.gz \
|
58
|
+
-Dclassifiers=linux-x86,osx \
|
59
|
+
-Dtypes=tar.gz,tar.gz \
|
60
|
+
-DpomFile=pom.xml
|
@@ -63,12 +63,6 @@ describe KPM::Installer do
|
|
63
63
|
}, {
|
64
64
|
'name' => 'stripe',
|
65
65
|
'version' => '7.0.0'
|
66
|
-
}],
|
67
|
-
'ruby' => [{
|
68
|
-
'name' => 'payment-test-plugin',
|
69
|
-
'artifact_id' => 'payment-test-plugin',
|
70
|
-
'group_id' => 'org.kill-bill.billing.plugin.ruby',
|
71
|
-
'version' => '1.8.7'
|
72
66
|
}]
|
73
67
|
}
|
74
68
|
},
|
@@ -85,10 +79,7 @@ describe KPM::Installer do
|
|
85
79
|
installer.install
|
86
80
|
check_installation(plugins_dir, kb_webapp_path, kaui_webapp_path)
|
87
81
|
|
88
|
-
# Finally verify that for
|
89
|
-
info = installer.install_plugin('payment-test-plugin', nil, 'org.kill-bill.billing.plugin.ruby', 'payment-test-plugin', nil, nil, '1.8.7', plugins_dir)
|
90
|
-
expect(info[:bundle_dir]).to eq plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7'
|
91
|
-
|
82
|
+
# Finally verify that for (well behaved) java plugins, skipping the install will still correctly return the `:bundle_dir`
|
92
83
|
info = installer.install_plugin('analytics', nil, nil, nil, nil, nil, '0.7.1', plugins_dir)
|
93
84
|
expect(info[:bundle_dir]).to eq plugins_dir + '/plugins/java/analytics-plugin/0.7.1'
|
94
85
|
end
|
@@ -105,10 +96,7 @@ describe KPM::Installer do
|
|
105
96
|
plugins_dir + '/plugins/java/analytics-plugin',
|
106
97
|
plugins_dir + '/plugins/java/analytics-plugin/0.7.1',
|
107
98
|
plugins_dir + '/plugins/java/stripe-plugin',
|
108
|
-
plugins_dir + '/plugins/java/stripe-plugin/7.0.0'
|
109
|
-
plugins_dir + '/plugins/ruby',
|
110
|
-
plugins_dir + '/plugins/ruby/killbill-payment-test',
|
111
|
-
plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7'
|
99
|
+
plugins_dir + '/plugins/java/stripe-plugin/7.0.0'
|
112
100
|
].each do |dir|
|
113
101
|
expect(File.directory?(dir)).to be_truthy
|
114
102
|
end
|
@@ -116,11 +104,9 @@ describe KPM::Installer do
|
|
116
104
|
[
|
117
105
|
kb_webapp_path,
|
118
106
|
kaui_webapp_path,
|
119
|
-
plugins_dir + '/platform/jruby.jar',
|
120
107
|
plugins_dir + '/plugins/plugin_identifiers.json',
|
121
108
|
plugins_dir + '/plugins/java/analytics-plugin/0.7.1/analytics-plugin-0.7.1.jar',
|
122
|
-
plugins_dir + '/plugins/java/stripe-plugin/7.0.0/stripe-plugin-7.0.0.jar'
|
123
|
-
plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7/killbill.properties'
|
109
|
+
plugins_dir + '/plugins/java/stripe-plugin/7.0.0/stripe-plugin-7.0.0.jar'
|
124
110
|
].each do |file|
|
125
111
|
expect(File.file?(file)).to be_truthy
|
126
112
|
end
|
@@ -129,7 +115,7 @@ describe KPM::Installer do
|
|
129
115
|
JSON.parse(f.read)
|
130
116
|
end
|
131
117
|
|
132
|
-
expect(plugin_identifiers.size).to eq
|
118
|
+
expect(plugin_identifiers.size).to eq 2
|
133
119
|
|
134
120
|
expect(plugin_identifiers['analytics']['plugin_name']).to eq 'analytics-plugin'
|
135
121
|
expect(plugin_identifiers['analytics']['group_id']).to eq 'org.kill-bill.billing.plugin.java'
|
@@ -144,12 +130,5 @@ describe KPM::Installer do
|
|
144
130
|
expect(plugin_identifiers['stripe']['packaging']).to eq 'jar'
|
145
131
|
expect(plugin_identifiers['stripe']['version']).to eq '7.0.0'
|
146
132
|
expect(plugin_identifiers['stripe']['language']).to eq 'java'
|
147
|
-
|
148
|
-
expect(plugin_identifiers['payment-test-plugin']['plugin_name']).to eq 'killbill-payment-test'
|
149
|
-
expect(plugin_identifiers['payment-test-plugin']['group_id']).to eq 'org.kill-bill.billing.plugin.ruby'
|
150
|
-
expect(plugin_identifiers['payment-test-plugin']['artifact_id']).to eq 'payment-test-plugin'
|
151
|
-
expect(plugin_identifiers['payment-test-plugin']['packaging']).to eq 'tar.gz'
|
152
|
-
expect(plugin_identifiers['payment-test-plugin']['version']).to eq '1.8.7'
|
153
|
-
expect(plugin_identifiers['payment-test-plugin']['language']).to eq 'ruby'
|
154
133
|
end
|
155
134
|
end
|
@@ -8,30 +8,6 @@ describe KPM::KillbillPluginArtifact do
|
|
8
8
|
@logger.level = Logger::INFO
|
9
9
|
end
|
10
10
|
|
11
|
-
# This test makes sure the top level directory is correctly verify_is_skipped
|
12
|
-
it 'should be able to download and verify .tar.gz ruby artifacts' do
|
13
|
-
# Use the payment-test-plugin as a test, as it is fairly small (2.5M)
|
14
|
-
group_id = 'org.kill-bill.billing.plugin.ruby'
|
15
|
-
artifact_id = 'payment-test-plugin'
|
16
|
-
packaging = 'tar.gz'
|
17
|
-
classifier = nil
|
18
|
-
version = '1.8.7'
|
19
|
-
plugin_name = 'killbill-payment-test'
|
20
|
-
|
21
|
-
Dir.mktmpdir do |dir|
|
22
|
-
info = KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, plugin_name, dir)
|
23
|
-
expect(info[:file_name]).to be_nil
|
24
|
-
|
25
|
-
files_in_dir = Dir[info[:file_path] + '/*']
|
26
|
-
expect(files_in_dir.size).to eq 1
|
27
|
-
expect(files_in_dir[0]).to eq info[:file_path] + '/killbill-payment-test'
|
28
|
-
|
29
|
-
expect(File.read(info[:file_path] + '/killbill-payment-test/1.8.7/killbill.properties')).to eq "mainClass=PaymentTest::PaymentPlugin\nrequire=payment_test\npluginType=PAYMENT\n"
|
30
|
-
|
31
|
-
expect(info[:bundle_dir]).to eq info[:file_path] + '/killbill-payment-test/1.8.7'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
11
|
it 'should be able to download and verify artifacts' do
|
36
12
|
Dir.mktmpdir do |dir|
|
37
13
|
sha1_file = dir + '/sha1.yml'
|
@@ -49,24 +25,6 @@ describe KPM::KillbillPluginArtifact do
|
|
49
25
|
|
50
26
|
check_yaml_for_resolved_latest_version(sha1_file, 'org.kill-bill.billing.plugin.java:analytics-plugin:jar', '3.0.0')
|
51
27
|
end
|
52
|
-
|
53
|
-
Dir.mktmpdir do |dir|
|
54
|
-
sha1_file = dir + '/sha1.yml'
|
55
|
-
info = KPM::KillbillPluginArtifact.pull(@logger,
|
56
|
-
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID,
|
57
|
-
'logging-plugin',
|
58
|
-
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING,
|
59
|
-
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER,
|
60
|
-
'LATEST',
|
61
|
-
'killbill-analytics',
|
62
|
-
dir,
|
63
|
-
sha1_file)
|
64
|
-
|
65
|
-
# No file name - since we untar'ed it
|
66
|
-
expect(info[:file_name]).to be_nil
|
67
|
-
|
68
|
-
check_yaml_for_resolved_latest_version(sha1_file, 'org.kill-bill.billing.plugin.ruby:logging-plugin:tar.gz', '3.0.0')
|
69
|
-
end
|
70
28
|
end
|
71
29
|
|
72
30
|
it 'should be able to list versions' do
|
@@ -79,12 +37,6 @@ describe KPM::KillbillPluginArtifact do
|
|
79
37
|
expect(logging_plugin_versions[0]).to eq '0.6.0'
|
80
38
|
expect(logging_plugin_versions[1]).to eq '0.7.0'
|
81
39
|
expect(logging_plugin_versions[2]).to eq '0.7.1'
|
82
|
-
|
83
|
-
expect(versions[:ruby]).not_to be_nil
|
84
|
-
expect(versions[:ruby]['logging-plugin']).not_to be_nil
|
85
|
-
logging_plugin_versions = versions[:ruby]['logging-plugin'].to_a
|
86
|
-
expect(logging_plugin_versions.size).to be >= 1
|
87
|
-
expect(logging_plugin_versions[0]).to eq '1.7.0'
|
88
40
|
end
|
89
41
|
|
90
42
|
private
|
data/tasks/package.rake
CHANGED
@@ -9,50 +9,33 @@ PACKAGE_NAME = 'kpm'
|
|
9
9
|
require './lib/kpm/version'
|
10
10
|
VERSION = KPM::VERSION
|
11
11
|
|
12
|
-
# See https://
|
13
|
-
|
14
|
-
# See https://github.com/Homebrew/homebrew-portable-ruby/releases
|
15
|
-
HOMEBREW_PORTABLE_RUBY_VERSION = '2.6.8_1'
|
12
|
+
# See https://traveling-ruby.s3-us-west-2.amazonaws.com/list.html
|
13
|
+
TRAVELING_RUBY_VERSION = '20150715-2.2.2'
|
16
14
|
|
17
15
|
# Remove unused files to reduce package size
|
18
16
|
GEMS_PATH = 'packaging/vendor/ruby/*/gems/*/'
|
19
17
|
REMOVE_FILES = %w[test tests spec README* CHANGE* Change* COPYING* LICENSE* MIT-LICENSE* doc docs examples ext/*/Makefile .gitignore .travis.yml].freeze
|
20
18
|
REMOVE_EXTENSIONS = %w[*.md *.c *.h *.rl extconf.rb *.java *.class *.so *.o].freeze
|
21
19
|
|
22
|
-
NOARCH_TARGET = 'noarch'
|
23
|
-
LINUX_X86_TARGET = 'x86_64_linux'
|
24
|
-
OSX_X86_TARGET = 'el_capitan'
|
25
|
-
OSX_ARM_TARGET = 'arm64_big_sur'
|
26
|
-
|
27
20
|
desc 'Package your app'
|
28
|
-
task package: %w[package:
|
21
|
+
task package: %w[package:linux:x86 package:linux:x86_64 package:osx]
|
29
22
|
|
30
23
|
namespace :package do
|
31
|
-
desc 'Package KPM (noarch)'
|
32
|
-
task noarch: [:bundle_install, "packaging/jruby-dist-#{JRUBY_VERSION}-bin.tar.gz"] do
|
33
|
-
create_package(NOARCH_TARGET, 'noarch')
|
34
|
-
end
|
35
|
-
|
36
24
|
namespace :linux do
|
37
|
-
desc 'Package KPM for Linux
|
38
|
-
task
|
39
|
-
|
40
|
-
create_package(LINUX_X86_TARGET, 'linux-x86_64')
|
25
|
+
desc 'Package KPM for Linux x86'
|
26
|
+
task x86: [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz"] do
|
27
|
+
create_package('linux-x86')
|
41
28
|
end
|
42
|
-
end
|
43
29
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
ensure_ruby_version
|
48
|
-
create_package(OSX_X86_TARGET, 'osx')
|
30
|
+
desc 'Package KPM for Linux x86_64'
|
31
|
+
task x86_64: [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz"] do
|
32
|
+
create_package('linux-x86_64')
|
49
33
|
end
|
34
|
+
end
|
50
35
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
create_package(OSX_ARM_TARGET, 'osx-arm64')
|
55
|
-
end
|
36
|
+
desc 'Package KPM for OS X'
|
37
|
+
task osx: [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz"] do
|
38
|
+
create_package('osx')
|
56
39
|
end
|
57
40
|
|
58
41
|
desc 'Install gems to local directory'
|
@@ -60,12 +43,15 @@ namespace :package do
|
|
60
43
|
# abort if version packaging does not exist on repository
|
61
44
|
abort "KPM #{VERSION} does not exists in the repository." unless gem_exists?
|
62
45
|
|
46
|
+
# Note! Must match TRAVELING_RUBY_VERSION above
|
47
|
+
expected_ruby_version = TRAVELING_RUBY_VERSION.split('-')[-1]
|
48
|
+
abort "You can only 'bundle install' using Ruby #{expected_ruby_version}, because that's what Traveling Ruby uses." if RUBY_VERSION !~ /#{Regexp.quote(expected_ruby_version)}/
|
63
49
|
sh 'rm -rf packaging/tmp'
|
64
50
|
sh 'mkdir -p packaging/tmp'
|
65
51
|
sh 'cp packaging/Gemfile packaging/tmp/'
|
66
52
|
sh "sed -i 's/VERSION/#{VERSION}/g' packaging/tmp/Gemfile"
|
67
53
|
|
68
|
-
sh
|
54
|
+
sh "rm -rf packaging/vendor/ruby/#{expected_ruby_version}/bundler" # if multiple clones of same repo, may load in wrong one
|
69
55
|
|
70
56
|
Bundler.with_clean_env do
|
71
57
|
sh 'cd packaging/tmp && env BUNDLE_IGNORE_CONFIG=1 bundle install --path ../vendor --without development'
|
@@ -94,42 +80,28 @@ namespace :package do
|
|
94
80
|
end
|
95
81
|
end
|
96
82
|
|
97
|
-
file "packaging/
|
98
|
-
|
83
|
+
file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz" do
|
84
|
+
download_runtime('linux-x86')
|
99
85
|
end
|
100
86
|
|
101
|
-
file "packaging/
|
102
|
-
|
87
|
+
file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz" do
|
88
|
+
download_runtime('linux-x86_64')
|
103
89
|
end
|
104
90
|
|
105
|
-
file "packaging/
|
106
|
-
|
91
|
+
file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz" do
|
92
|
+
download_runtime('osx')
|
107
93
|
end
|
108
94
|
|
109
|
-
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
def create_package(target, package_dir_suffix)
|
114
|
-
pom_version = %r{<version>(.*)</version>}.match(File.read("#{__dir__}/../pom.xml"))[1]
|
115
|
-
package_dir = "#{PACKAGE_NAME}-#{pom_version}-#{package_dir_suffix}"
|
95
|
+
def create_package(target)
|
96
|
+
package_dir = "#{PACKAGE_NAME}-#{VERSION}-#{target}"
|
116
97
|
sh "rm -rf #{package_dir}"
|
117
98
|
sh "mkdir -p #{package_dir}/lib/ruby"
|
118
|
-
|
119
|
-
sh "tar -xzf packaging/jruby-dist-#{JRUBY_VERSION}-bin.tar.gz -C #{package_dir}/lib/ruby --strip-components 1"
|
120
|
-
else
|
121
|
-
sh "tar -xzf packaging/portable-ruby-#{HOMEBREW_PORTABLE_RUBY_VERSION}.#{target}.bottle.tar.gz -C #{package_dir}/lib/ruby --strip-components 2"
|
122
|
-
end
|
99
|
+
sh "tar -xzf packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz -C #{package_dir}/lib/ruby"
|
123
100
|
|
124
101
|
sh "cp packaging/kpm.sh #{package_dir}/kpm"
|
125
102
|
sh "chmod +x packaging/kpm.sh #{package_dir}/kpm"
|
126
103
|
|
127
104
|
sh "cp -pR packaging/vendor #{package_dir}/lib/"
|
128
|
-
if target == NOARCH_TARGET
|
129
|
-
# Need to tweak a few things to make it work with JRuby
|
130
|
-
sh "cp #{package_dir}/lib/ruby/bin/jruby #{package_dir}/lib/ruby/bin/ruby"
|
131
|
-
sh "mv #{package_dir}/lib/vendor/ruby #{package_dir}/lib/vendor/jruby"
|
132
|
-
end
|
133
105
|
|
134
106
|
sh "cp packaging/Gemfile* #{package_dir}/lib/vendor/"
|
135
107
|
sh "sed -i 's/VERSION/#{VERSION}/g' #{package_dir}/lib/vendor/Gemfile"
|
@@ -142,14 +114,9 @@ def create_package(target, package_dir_suffix)
|
|
142
114
|
sh "rm -rf #{package_dir}"
|
143
115
|
end
|
144
116
|
|
145
|
-
def
|
146
|
-
sh 'mkdir -p packaging && cd packaging && curl -L -O --fail ' \
|
147
|
-
"https://repo1.maven.org/maven2/org/jruby/jruby-dist/#{JRUBY_VERSION}/jruby-dist-#{JRUBY_VERSION}-bin.tar.gz"
|
148
|
-
end
|
149
|
-
|
150
|
-
def download_portable_runtime(target)
|
117
|
+
def download_runtime(target)
|
151
118
|
sh 'mkdir -p packaging && cd packaging && curl -L -O --fail ' \
|
152
|
-
"https://
|
119
|
+
"https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz"
|
153
120
|
end
|
154
121
|
|
155
122
|
def gem_exists?
|
@@ -159,9 +126,3 @@ def gem_exists?
|
|
159
126
|
specification = YAML.load(response)
|
160
127
|
specification.instance_of?(Gem::Specification)
|
161
128
|
end
|
162
|
-
|
163
|
-
def ensure_ruby_version
|
164
|
-
# Note! Must match HOMEBREW_PORTABLE_RUBY_VERSION above
|
165
|
-
expected_ruby_version = HOMEBREW_PORTABLE_RUBY_VERSION.split('_')[0]
|
166
|
-
abort "You can only 'bundle install' using Ruby #{expected_ruby_version}, because that's what homebrew-portable-ruby uses." if RUBY_VERSION !~ /#{Regexp.quote(expected_ruby_version)}/
|
167
|
-
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.
|
4
|
+
version: 0.11.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:
|
11
|
+
date: 2022-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3.9'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.88.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.88.0
|
125
111
|
description: A package manager for Kill Bill.
|
126
112
|
email: killbilling-users@googlegroups.com
|
127
113
|
executables:
|
@@ -182,6 +168,7 @@ files:
|
|
182
168
|
- packaging/bundler-config
|
183
169
|
- packaging/kpm.sh
|
184
170
|
- pom.xml
|
171
|
+
- release.sh
|
185
172
|
- spec/kpm/remote/base_artifact_spec.rb
|
186
173
|
- spec/kpm/remote/base_installer_spec.rb
|
187
174
|
- spec/kpm/remote/cloudsmith_api_calls_spec.rb
|
@@ -236,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
223
|
- !ruby/object:Gem::Version
|
237
224
|
version: '0'
|
238
225
|
requirements: []
|
239
|
-
rubygems_version: 3.0.
|
226
|
+
rubygems_version: 3.0.8
|
240
227
|
signing_key:
|
241
228
|
specification_version: 4
|
242
229
|
summary: Kill Bill package manager.
|