kpm 0.10.5 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +0 -18
- data/install_example.yml +0 -5
- data/kpm.gemspec +3 -3
- data/lib/kpm/base_artifact.rb +0 -4
- data/lib/kpm/base_installer.rb +3 -45
- data/lib/kpm/installer.rb +3 -32
- 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/lib/kpm.rb +0 -1
- data/pom.xml +1 -1
- data/spec/kpm/remote/installer_spec.rb +4 -25
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +0 -48
- metadata +28 -12
- data/lib/kpm/tomcat_manager.rb +0 -95
- data/spec/kpm/remote/tomcat_manager_spec.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92f89695b531e939275ac653417d228d51b897570504418032418797a56674bf
|
4
|
+
data.tar.gz: acd577c2a29a56c50c0daeacb09a62f7fcf6068650d1ba8ed2e527d6f9db2962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c44713659fe2517572916f45722df1d6ae7b8d639cb24b227ba161386e104df0c2dcf3f38f7a735cfe0f399cbe5d791dc5802cda6a8a73ec791c5ba9853adfd7
|
7
|
+
data.tar.gz: fd47e470a0df6c75785383a45857a93909ff44d4464136a57ad3f4d27e9331a2b9d31cb4a08834885ee099292a7df5ea6ee9417bfa94fa3c93801114c3af15d3
|
data/README.adoc
CHANGED
@@ -38,24 +38,6 @@ gem install kpm
|
|
38
38
|
[[kill-bill-installation]]
|
39
39
|
=== Kill Bill installation
|
40
40
|
|
41
|
-
[[kpm-install]]
|
42
|
-
==== kpm install
|
43
|
-
|
44
|
-
`kpm install` (with no argument) will setup https://github.com/killbill/killbill[Kill Bill] and https://github.com/killbill/killbill-admin-ui-standalone[Kaui] in your current directory, including:
|
45
|
-
|
46
|
-
* http://tomcat.apache.org/[Tomcat] (open-source Java web server)
|
47
|
-
* The Kill Bill application (war) is installed in the `./webapps` directory
|
48
|
-
* The Kill Bill UI (Kaui war) is installed in the `./webapps` directory
|
49
|
-
* Default OSGI bundles are installed in the `/var/tmp/bundles` directory
|
50
|
-
|
51
|
-
To start Kill Bill, simply run
|
52
|
-
|
53
|
-
....
|
54
|
-
./bin/catalina.sh run
|
55
|
-
....
|
56
|
-
|
57
|
-
You can then verify Kill Bill is running by going to http://127.0.0.1:8080/kaui.
|
58
|
-
|
59
41
|
[[kpm-install-using-a-kpm.yml-file]]
|
60
42
|
==== kpm install Using A `kpm.yml` File
|
61
43
|
|
data/install_example.yml
CHANGED
data/kpm.gemspec
CHANGED
@@ -41,10 +41,10 @@ Gem::Specification.new do |s|
|
|
41
41
|
|
42
42
|
s.rdoc_options << '--exclude' << '.'
|
43
43
|
|
44
|
-
s.add_dependency 'highline', '
|
44
|
+
s.add_dependency 'highline', '>= 1.6.21', '< 2.1.0'
|
45
45
|
s.add_dependency 'killbill-client', '~> 3.2'
|
46
|
-
s.add_dependency 'rubyzip', '
|
47
|
-
s.add_dependency 'thor', '
|
46
|
+
s.add_dependency 'rubyzip', '>= 1.3', '< 2.4'
|
47
|
+
s.add_dependency 'thor', '>= 0.19.1', '< 1.3.0'
|
48
48
|
|
49
49
|
s.add_development_dependency 'gem-release', '~> 2.2'
|
50
50
|
s.add_development_dependency 'rake', '~> 13.0'
|
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
@@ -87,9 +87,9 @@ module KPM
|
|
87
87
|
end
|
88
88
|
bundles_dir ||= DEFAULT_BUNDLES_DIR
|
89
89
|
|
90
|
-
help = nil
|
91
90
|
unless @config.nil?
|
92
|
-
|
91
|
+
raise ArgumentError, "Aborting installation, no webapp_path specified in config: #{@config}" if @config['webapp_path'].nil?
|
92
|
+
|
93
93
|
install_killbill_server(@config['group_id'], @config['artifact_id'], @config['packaging'], @config['classifier'], @config['version'], @config['webapp_path'], bundles_dir, force_download, verify_sha1)
|
94
94
|
install_plugins(bundles_dir, @config['version'], force_download, verify_sha1)
|
95
95
|
install_default_bundles(bundles_dir, @config['default_bundles_version'], @config['version'], force_download, verify_sha1) unless @config['default_bundles'] == false
|
@@ -105,29 +105,13 @@ module KPM
|
|
105
105
|
install_kaui(@kaui_config['group_id'], @kaui_config['artifact_id'], @kaui_config['packaging'], @kaui_config['classifier'], @kaui_config['version'], @kaui_config['webapp_path'], bundles_dir, force_download, verify_sha1)
|
106
106
|
end
|
107
107
|
|
108
|
-
@trace_logger.add('help', nil, help)
|
109
108
|
@trace_logger.to_json
|
110
109
|
end
|
111
110
|
|
112
111
|
private
|
113
112
|
|
114
|
-
def install_tomcat(dir = Dir.pwd)
|
115
|
-
# Download and unpack Tomcat
|
116
|
-
manager = KPM::TomcatManager.new(dir, @logger)
|
117
|
-
manager.download
|
118
|
-
|
119
|
-
# Update main config
|
120
|
-
root_war_path = manager.setup
|
121
|
-
@config['webapp_path'] = root_war_path
|
122
|
-
@kaui_config['webapp_path'] = Pathname.new(File.dirname(root_war_path)).join('kaui.war').to_s unless @kaui_config.nil?
|
123
|
-
|
124
|
-
# Help message
|
125
|
-
manager.help
|
126
|
-
end
|
127
|
-
|
128
113
|
def install_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
129
114
|
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
115
|
end
|
132
116
|
|
133
117
|
def install_java_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
@@ -135,20 +119,7 @@ module KPM
|
|
135
119
|
|
136
120
|
infos = []
|
137
121
|
@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
|
122
|
+
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
123
|
end
|
153
124
|
|
154
125
|
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/lib/kpm.rb
CHANGED
@@ -7,7 +7,6 @@ module KPM
|
|
7
7
|
autoload :Formatter, 'kpm/formatter'
|
8
8
|
autoload :Inspector, 'kpm/inspector'
|
9
9
|
autoload :Sha1Checker, 'kpm/sha1_checker'
|
10
|
-
autoload :TomcatManager, 'kpm/tomcat_manager'
|
11
10
|
autoload :KillbillServerArtifact, 'kpm/killbill_server_artifact'
|
12
11
|
autoload :KillbillPluginArtifact, 'kpm/killbill_plugin_artifact'
|
13
12
|
autoload :KauiArtifact, 'kpm/kaui_artifact'
|
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.1</version>
|
26
26
|
<packaging>pom</packaging>
|
27
27
|
<name>KPM</name>
|
28
28
|
<description>KPM: the Kill Bill Package Manager</description>
|
@@ -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
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.1
|
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-
|
11
|
+
date: 2022-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.6.21
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.1.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 1.6.21
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.1.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: killbill-client
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,30 +48,42 @@ dependencies:
|
|
42
48
|
name: rubyzip
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.3
|
53
|
+
version: '1.3'
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2.4'
|
48
57
|
type: :runtime
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- - "
|
61
|
+
- - ">="
|
53
62
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.3
|
63
|
+
version: '1.3'
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '2.4'
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: thor
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
59
|
-
- - "
|
71
|
+
- - ">="
|
60
72
|
- !ruby/object:Gem::Version
|
61
73
|
version: 0.19.1
|
74
|
+
- - "<"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.3.0
|
62
77
|
type: :runtime
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
66
|
-
- - "
|
81
|
+
- - ">="
|
67
82
|
- !ruby/object:Gem::Version
|
68
83
|
version: 0.19.1
|
84
|
+
- - "<"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 1.3.0
|
69
87
|
- !ruby/object:Gem::Dependency
|
70
88
|
name: gem-release
|
71
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +191,6 @@ files:
|
|
173
191
|
- lib/kpm/system_helpers/system_proxy.rb
|
174
192
|
- lib/kpm/tasks.rb
|
175
193
|
- lib/kpm/tenant_config.rb
|
176
|
-
- lib/kpm/tomcat_manager.rb
|
177
194
|
- lib/kpm/trace_logger.rb
|
178
195
|
- lib/kpm/uninstaller.rb
|
179
196
|
- lib/kpm/utils.rb
|
@@ -194,7 +211,6 @@ files:
|
|
194
211
|
- spec/kpm/remote/nexus_facade_spec.rb
|
195
212
|
- spec/kpm/remote/tenant_config_spec.rb
|
196
213
|
- spec/kpm/remote/tenant_config_spec.yml
|
197
|
-
- spec/kpm/remote/tomcat_manager_spec.rb
|
198
214
|
- spec/kpm/unit/actions_spec.rb
|
199
215
|
- spec/kpm/unit/base_artifact_spec.rb
|
200
216
|
- spec/kpm/unit/cpu_information_spec.rb
|
data/lib/kpm/tomcat_manager.rb
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
require 'net/http'
|
5
|
-
require 'uri'
|
6
|
-
|
7
|
-
module KPM
|
8
|
-
class TomcatManager
|
9
|
-
DOWNLOAD_URL = 'https://s3.amazonaws.com/kb-binaries/apache-tomcat-7.0.42.tar.gz'
|
10
|
-
|
11
|
-
def initialize(tomcat_dir, logger)
|
12
|
-
@tomcat_dir = Pathname.new(tomcat_dir)
|
13
|
-
@logger = logger
|
14
|
-
end
|
15
|
-
|
16
|
-
def download
|
17
|
-
uri = URI.parse(DOWNLOAD_URL)
|
18
|
-
|
19
|
-
path = nil
|
20
|
-
Dir.mktmpdir do |dir|
|
21
|
-
file = Pathname.new(dir).join('tomcat.tar.gz')
|
22
|
-
|
23
|
-
@logger.info "Starting download of #{DOWNLOAD_URL} to #{file}"
|
24
|
-
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
25
|
-
File.open(file, 'wb+') do |f|
|
26
|
-
http.get(uri.path) do |body|
|
27
|
-
f.write(body)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
path = Utils.unpack_tgz(file.to_s, @tomcat_dir, true)
|
33
|
-
end
|
34
|
-
|
35
|
-
@logger.info "Successful installation of #{DOWNLOAD_URL} to #{path}"
|
36
|
-
path
|
37
|
-
end
|
38
|
-
|
39
|
-
def setup
|
40
|
-
# Remove default webapps
|
41
|
-
%w[ROOT docs examples host-manager manager].each do |webapp|
|
42
|
-
FileUtils.rm_rf(@tomcat_dir.join('webapps').join(webapp))
|
43
|
-
end
|
44
|
-
|
45
|
-
# Update Root.xml
|
46
|
-
root_xml_dir = @tomcat_dir.join('conf').join('Catalina').join('localhost')
|
47
|
-
FileUtils.mkdir_p(root_xml_dir)
|
48
|
-
File.write(root_xml_dir.join('ROOT.xml'), '<Context></Context>')
|
49
|
-
|
50
|
-
# Setup default properties
|
51
|
-
setenv_sh_path = @tomcat_dir.join('bin').join('setenv.sh')
|
52
|
-
|
53
|
-
File.write(setenv_sh_path, "export CATALINA_OPTS=\"$CATALINA_OPTS #{default_java_properties}\"")
|
54
|
-
|
55
|
-
@tomcat_dir.join('webapps').join('ROOT.war').to_s
|
56
|
-
end
|
57
|
-
|
58
|
-
def help
|
59
|
-
"Tomcat installed at #{@tomcat_dir}
|
60
|
-
Start script: #{@tomcat_dir.join('bin').join('startup.sh')}
|
61
|
-
Stop script: #{@tomcat_dir.join('bin').join('shutdown.sh')}
|
62
|
-
Logs: #{@tomcat_dir.join('logs')}"
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def default_java_properties
|
68
|
-
<<HEREDOC.gsub(/\s+/, ' ').strip
|
69
|
-
-server
|
70
|
-
-showversion
|
71
|
-
-XX:+PrintCommandLineFlags
|
72
|
-
-XX:+UseCodeCacheFlushing
|
73
|
-
-XX:PermSize=512m
|
74
|
-
-XX:MaxPermSize=1G
|
75
|
-
-Xms1G
|
76
|
-
-Xmx2G
|
77
|
-
-XX:+CMSClassUnloadingEnabled
|
78
|
-
-XX:-OmitStackTraceInFastThrow
|
79
|
-
-XX:+UseParNewGC
|
80
|
-
-XX:+UseConcMarkSweepGC
|
81
|
-
-XX:+CMSConcurrentMTEnabled
|
82
|
-
-XX:+CMSParallelRemarkEnabled
|
83
|
-
-XX:+UseCMSInitiatingOccupancyOnly
|
84
|
-
-XX:CMSInitiatingOccupancyFraction=70
|
85
|
-
-XX:+ScavengeBeforeFullGC
|
86
|
-
-XX:+CMSScavengeBeforeRemark
|
87
|
-
-XX:NewSize=600m
|
88
|
-
-XX:MaxNewSize=900m
|
89
|
-
-XX:SurvivorRatio=10
|
90
|
-
-XX:+DisableExplicitGC
|
91
|
-
-Djava.security.egd=file:/dev/./urandom
|
92
|
-
HEREDOC
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe KPM::TomcatManager do
|
6
|
-
before(:all) do
|
7
|
-
@logger = Logger.new(STDOUT)
|
8
|
-
@logger.level = Logger::INFO
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should be able to download and unpack tomcat' do
|
12
|
-
Dir.mktmpdir do |dir|
|
13
|
-
manager = KPM::TomcatManager.new(dir, @logger)
|
14
|
-
|
15
|
-
tomcat_path = manager.download
|
16
|
-
expect(tomcat_path).not_to be_nil
|
17
|
-
|
18
|
-
root_war_path = manager.setup
|
19
|
-
expect(root_war_path).not_to be_nil
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|