kpm 0.7.2 → 0.10.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 +5 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +138 -0
- data/Gemfile +2 -0
- data/README.adoc +144 -107
- data/Rakefile +2 -1
- data/bin/kpm +4 -2
- data/kpm.gemspec +11 -8
- data/lib/kpm.rb +3 -0
- data/lib/kpm/account.rb +268 -338
- data/lib/kpm/base_artifact.rb +33 -39
- data/lib/kpm/base_installer.rb +69 -83
- data/lib/kpm/blob.rb +29 -0
- data/lib/kpm/cli.rb +3 -1
- data/lib/kpm/coordinates.rb +10 -12
- data/lib/kpm/database.rb +94 -113
- data/lib/kpm/diagnostic_file.rb +126 -147
- data/lib/kpm/formatter.rb +76 -48
- data/lib/kpm/inspector.rb +24 -34
- data/lib/kpm/installer.rb +53 -46
- data/lib/kpm/kaui_artifact.rb +4 -3
- data/lib/kpm/killbill_plugin_artifact.rb +10 -7
- data/lib/kpm/killbill_server_artifact.rb +13 -12
- data/lib/kpm/migrations.rb +26 -11
- data/lib/kpm/nexus_helper/actions.rb +52 -9
- data/lib/kpm/nexus_helper/cloudsmith_api_calls.rb +83 -0
- data/lib/kpm/nexus_helper/github_api_calls.rb +70 -0
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +130 -108
- data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
- data/lib/kpm/plugins_directory.rb +9 -8
- data/lib/kpm/plugins_directory.yml +14 -173
- data/lib/kpm/plugins_manager.rb +29 -24
- data/lib/kpm/sha1_checker.rb +31 -18
- data/lib/kpm/system.rb +104 -135
- data/lib/kpm/system_helpers/cpu_information.rb +56 -55
- data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
- data/lib/kpm/system_helpers/entropy_available.rb +37 -39
- data/lib/kpm/system_helpers/memory_information.rb +52 -51
- data/lib/kpm/system_helpers/os_information.rb +45 -47
- data/lib/kpm/system_helpers/system_proxy.rb +10 -10
- data/lib/kpm/tasks.rb +381 -438
- data/lib/kpm/tenant_config.rb +68 -83
- data/lib/kpm/tomcat_manager.rb +10 -8
- data/lib/kpm/trace_logger.rb +18 -16
- data/lib/kpm/uninstaller.rb +81 -14
- data/lib/kpm/utils.rb +13 -14
- data/lib/kpm/version.rb +3 -1
- data/packaging/Gemfile +2 -0
- data/pom.xml +211 -40
- data/spec/kpm/remote/base_artifact_spec.rb +20 -20
- data/spec/kpm/remote/base_installer_spec.rb +35 -34
- data/spec/kpm/remote/cloudsmith_api_calls_spec.rb +40 -0
- data/spec/kpm/remote/github_api_calls_spec.rb +40 -0
- data/spec/kpm/remote/installer_spec.rb +80 -79
- data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +25 -30
- data/spec/kpm/remote/killbill_server_artifact_spec.rb +17 -16
- data/spec/kpm/remote/migrations_spec.rb +12 -11
- data/spec/kpm/remote/nexus_facade_spec.rb +32 -28
- data/spec/kpm/remote/tenant_config_spec.rb +30 -29
- data/spec/kpm/remote/tomcat_manager_spec.rb +4 -3
- data/spec/kpm/unit/actions_spec.rb +52 -0
- data/spec/kpm/unit/base_artifact_spec.rb +19 -18
- data/spec/kpm/unit/cpu_information_spec.rb +67 -0
- data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
- data/spec/kpm/unit/entropy_information_spec.rb +36 -0
- data/spec/kpm/unit/formatter_spec.rb +163 -0
- data/spec/kpm/unit/inspector_spec.rb +34 -42
- data/spec/kpm/unit/installer_spec.rb +7 -6
- data/spec/kpm/unit/memory_information_spec.rb +102 -0
- data/spec/kpm/unit/os_information_spec.rb +38 -0
- data/spec/kpm/unit/plugins_directory_spec.rb +38 -22
- data/spec/kpm/unit/plugins_manager_spec.rb +62 -66
- data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
- data/spec/kpm/unit/uninstaller_spec.rb +118 -72
- data/spec/kpm/unit_mysql/account_spec.rb +127 -142
- data/spec/spec_helper.rb +20 -18
- data/tasks/package.rake +18 -18
- metadata +42 -22
data/lib/kpm/formatter.rb
CHANGED
@@ -1,22 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Extend String to be able to instantiate a object based on its classname
|
2
4
|
class String
|
3
5
|
def to_class
|
4
|
-
|
6
|
+
split('::').inject(Kernel) do |mod, class_name|
|
5
7
|
mod.const_get(class_name)
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
10
12
|
module KPM
|
11
|
-
|
12
13
|
class Formatter
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
end
|
16
|
-
|
17
14
|
# Used for normal types where to_s is enough
|
18
15
|
class DefaultFormatter
|
19
|
-
|
20
16
|
def initialize(label, input)
|
21
17
|
@label = label
|
22
18
|
@input = input
|
@@ -37,7 +33,6 @@ module KPM
|
|
37
33
|
|
38
34
|
# Used for the version map
|
39
35
|
class VersionFormatter
|
40
|
-
|
41
36
|
def initialize(label, versions)
|
42
37
|
@label = label
|
43
38
|
@versions = versions
|
@@ -48,79 +43,112 @@ module KPM
|
|
48
43
|
end
|
49
44
|
|
50
45
|
def to_s
|
51
|
-
@versions.map
|
46
|
+
@versions.map do |q|
|
47
|
+
sha1 = format_sha(q[:sha1])
|
48
|
+
disabled = ''
|
49
|
+
disabled = '(x)' if q[:is_disabled]
|
50
|
+
default = ''
|
51
|
+
default = '(*)' if q[:is_default]
|
52
|
+
"#{q[:version]}#{sha1}#{default}#{disabled}"
|
53
|
+
end.join(', ')
|
52
54
|
end
|
53
55
|
|
54
56
|
def label
|
55
57
|
"#{@label.to_s.upcase.gsub(/_/, ' ')} sha1=[], def=(*), del=(x)"
|
56
58
|
end
|
57
59
|
|
60
|
+
private
|
61
|
+
|
58
62
|
def format_sha(sha)
|
59
|
-
return
|
63
|
+
return '[???]' if sha.nil?
|
64
|
+
|
60
65
|
"[#{sha[0..5]}..]"
|
61
66
|
end
|
62
67
|
end
|
63
68
|
|
64
|
-
|
65
69
|
def format(data, labels = nil)
|
66
|
-
|
67
|
-
|
68
|
-
end
|
70
|
+
puts format_only(data, labels)
|
71
|
+
end
|
69
72
|
|
70
|
-
|
73
|
+
private
|
74
|
+
|
75
|
+
def format_only(data, labels = nil)
|
76
|
+
return if data.nil? || data.empty?
|
71
77
|
|
78
|
+
if labels.nil?
|
72
79
|
# What we want to output
|
73
|
-
labels = [{:
|
74
|
-
{:
|
75
|
-
{:
|
76
|
-
{:
|
77
|
-
{:
|
78
|
-
{:
|
79
|
-
{:
|
80
|
+
labels = [{ label: :plugin_name },
|
81
|
+
{ label: :plugin_key },
|
82
|
+
{ label: :type },
|
83
|
+
{ label: :group_id },
|
84
|
+
{ label: :artifact_id },
|
85
|
+
{ label: :packaging },
|
86
|
+
{ label: :versions, formatter: VersionFormatter.name }]
|
80
87
|
end
|
81
88
|
|
82
89
|
# Compute label to print along with max size for each label
|
83
|
-
labels_format_argument =
|
84
|
-
|
90
|
+
labels_format_argument = compute_labels(data, labels)
|
91
|
+
|
92
|
+
border = compute_border(labels)
|
93
|
+
|
94
|
+
format_string = compute_format(labels)
|
95
|
+
|
96
|
+
formatted = "\n#{border}\n"
|
97
|
+
formatted += Kernel.format("#{format_string}\n", *labels_format_argument)
|
98
|
+
formatted += "#{border}\n"
|
99
|
+
|
100
|
+
data.each_key do |key|
|
85
101
|
v = data[key]
|
86
|
-
labels.each do |e|
|
87
|
-
# sanitize entry at the same time
|
88
|
-
v[e[:label]] = v[e[:label]] || "???"
|
89
102
|
|
103
|
+
arguments = []
|
104
|
+
labels.inject(arguments) do |res, e|
|
90
105
|
formatter = e[:formatter].nil? ? DefaultFormatter.new(e[:label], v[e[:label]]) : e[:formatter].to_class.new(e[:label], v[e[:label]])
|
91
|
-
|
92
|
-
cur_size = formatter.size
|
93
|
-
e[:size] = prev_size < cur_size ? cur_size : prev_size
|
94
|
-
labels_format_argument << formatter.label
|
106
|
+
res << formatter.to_s
|
95
107
|
end
|
108
|
+
formatted += Kernel.format("#{format_string}\n", *arguments)
|
96
109
|
end
|
110
|
+
formatted += "#{border}\n\n"
|
97
111
|
|
112
|
+
formatted
|
113
|
+
end
|
98
114
|
|
115
|
+
def compute_format(labels)
|
116
|
+
format = '|'
|
117
|
+
labels.inject(format) { |res, lbl| "#{res} %#{lbl[:size]}s |" }
|
118
|
+
end
|
99
119
|
|
100
|
-
|
101
|
-
border =
|
102
|
-
border = labels.inject(border) { |res,
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
120
|
+
def compute_border(labels)
|
121
|
+
border = '_'
|
122
|
+
border = (0...labels.size).inject(border) { |res, _i| "#{res}_" }
|
123
|
+
labels.inject(border) do |res, lbl|
|
124
|
+
(0...lbl[:size] + 2).each { |_s| res = "#{res}_" }
|
125
|
+
res
|
126
|
+
end
|
127
|
+
end
|
107
128
|
|
108
|
-
|
109
|
-
|
110
|
-
|
129
|
+
# Return labels for each row and update the labels hash with the size of each column
|
130
|
+
def compute_labels(data, labels)
|
131
|
+
seen_labels = Set.new
|
111
132
|
|
112
|
-
|
133
|
+
labels_format_argument = []
|
134
|
+
data.each_key do |key|
|
113
135
|
v = data[key]
|
136
|
+
labels.each do |e|
|
137
|
+
# sanitize entry at the same time
|
138
|
+
v[e[:label]] = v[e[:label]] || '???'
|
114
139
|
|
115
|
-
|
116
|
-
labels.inject(arguments) do |res, e|
|
140
|
+
# Always recompute the size
|
117
141
|
formatter = e[:formatter].nil? ? DefaultFormatter.new(e[:label], v[e[:label]]) : e[:formatter].to_class.new(e[:label], v[e[:label]])
|
118
|
-
|
142
|
+
prev_size = e.key?(:size) ? e[:size] : formatter.label.size
|
143
|
+
cur_size = formatter.size
|
144
|
+
e[:size] = prev_size < cur_size ? cur_size : prev_size
|
145
|
+
|
146
|
+
# Labels should be unique though
|
147
|
+
labels_format_argument << formatter.label unless seen_labels.include?(e[:label])
|
148
|
+
seen_labels << e[:label]
|
119
149
|
end
|
120
|
-
puts "#{format}\n" % arguments
|
121
150
|
end
|
122
|
-
|
123
|
-
|
151
|
+
labels_format_argument
|
124
152
|
end
|
125
153
|
end
|
126
154
|
end
|
data/lib/kpm/inspector.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module KPM
|
3
4
|
class Inspector
|
4
|
-
|
5
|
-
def initialize
|
6
|
-
end
|
5
|
+
def initialize; end
|
7
6
|
|
8
7
|
def inspect(bundles_dir)
|
9
8
|
bundles_dir = Pathname.new(bundles_dir || KPM::BaseInstaller::DEFAULT_BUNDLES_DIR).expand_path
|
10
|
-
plugins= bundles_dir.join('plugins')
|
11
|
-
ruby_plugins_path=bundles_dir.join('plugins/ruby')
|
12
|
-
java_plugins_path=bundles_dir.join('plugins/java')
|
9
|
+
plugins = bundles_dir.join('plugins')
|
10
|
+
ruby_plugins_path = bundles_dir.join('plugins/ruby')
|
11
|
+
java_plugins_path = bundles_dir.join('plugins/java')
|
13
12
|
|
14
13
|
all_plugins = {}
|
15
14
|
build_plugins_for_type(ruby_plugins_path, 'ruby', all_plugins)
|
@@ -27,37 +26,33 @@ module KPM
|
|
27
26
|
formatter.format(all_plugins)
|
28
27
|
end
|
29
28
|
|
30
|
-
|
31
29
|
private
|
32
30
|
|
33
31
|
def add_sha1_info(bundles_dir, all_plugins)
|
34
|
-
|
35
32
|
sha1_filename = KPM::BaseInstaller::SHA1_FILENAME
|
36
33
|
sha1_file = "#{bundles_dir}/#{sha1_filename}"
|
37
34
|
sha1_checker = Sha1Checker.from_file(sha1_file)
|
38
35
|
|
39
|
-
all_plugins.
|
36
|
+
all_plugins.each_key do |cur_plugin_name|
|
40
37
|
cur = all_plugins[cur_plugin_name]
|
41
38
|
|
42
39
|
sha1_checker.all_sha1.each do |e|
|
43
40
|
coord, sha1 = e
|
44
41
|
coordinate_map = KPM::Coordinates.get_coordinate_map(coord)
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
found_version = cur[:versions].select { |v| v[:version] == coordinate_map[:version] }[0]
|
51
|
-
found_version[:sha1] = sha1 if found_version
|
52
|
-
end
|
43
|
+
next unless coordinate_map[:group_id] == cur[:group_id] &&
|
44
|
+
coordinate_map[:artifact_id] == cur[:artifact_id] &&
|
45
|
+
coordinate_map[:packaging] == cur[:packaging]
|
53
46
|
|
47
|
+
found_version = cur[:versions].select { |v| v[:version] == coordinate_map[:version] }[0]
|
48
|
+
found_version[:sha1] = sha1 if found_version
|
54
49
|
end
|
55
50
|
end
|
56
51
|
end
|
57
52
|
|
58
53
|
def add_plugin_identifier_info(plugins, all_plugins)
|
59
54
|
plugins_manager = PluginsManager.new(plugins, @logger)
|
60
|
-
all_plugins.
|
55
|
+
all_plugins.each_key do |cur|
|
61
56
|
plugin_key, entry = plugins_manager.get_identifier_key_and_entry(cur)
|
62
57
|
all_plugins[cur][:plugin_key] = plugin_key
|
63
58
|
all_plugins[cur][:group_id] = entry ? entry['group_id'] : nil
|
@@ -67,31 +62,27 @@ module KPM
|
|
67
62
|
end
|
68
63
|
end
|
69
64
|
|
70
|
-
|
71
65
|
def build_plugins_for_type(plugins_path, type, res)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
get_entries(plugins_path).inject(res) do |out, e|
|
66
|
+
return [] unless File.exist?(plugins_path)
|
67
|
+
|
68
|
+
get_entries(plugins_path).each_with_object(res) do |e, out|
|
76
69
|
plugin_map = build_plugin_map(e, plugins_path.join(e), type)
|
77
70
|
out[e] = plugin_map
|
78
|
-
out
|
79
71
|
end
|
80
72
|
end
|
81
73
|
|
82
74
|
def build_plugin_map(plugin_name, plugin_path, type)
|
83
|
-
|
84
|
-
plugin_map = {:plugin_name => plugin_name, :plugin_path => plugin_path.to_s, :type => type}
|
75
|
+
plugin_map = { plugin_name: plugin_name, plugin_path: plugin_path.to_s, type: type }
|
85
76
|
entries = get_entries(plugin_path)
|
86
|
-
set_default = entries.select { |e| e ==
|
77
|
+
set_default = entries.select { |e| e == 'SET_DEFAULT' }[0]
|
87
78
|
default_version = File.basename(File.readlink(plugin_path.join(set_default))) if set_default
|
88
79
|
|
89
|
-
|
90
|
-
e
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
out
|
80
|
+
non_default = entries.reject do |e|
|
81
|
+
e == 'SET_DEFAULT'
|
82
|
+
end
|
83
|
+
versions = non_default.each_with_object([]) do |e, out|
|
84
|
+
is_disabled = File.exist?(plugin_path.join(e).join('tmp').join('disabled.txt'))
|
85
|
+
out << { version: e, is_default: default_version == e, is_disabled: is_disabled, sha1: nil }
|
95
86
|
end
|
96
87
|
|
97
88
|
versions.sort! { |a, b| a[:version] <=> b[:version] }
|
@@ -103,6 +94,5 @@ module KPM
|
|
103
94
|
def get_entries(path)
|
104
95
|
Dir.entries(path).select { |entry| entry != '.' && entry != '..' && File.directory?(File.join(path, entry)) }
|
105
96
|
end
|
106
|
-
|
107
97
|
end
|
108
98
|
end
|
data/lib/kpm/installer.rb
CHANGED
@@ -1,40 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'logger'
|
2
4
|
require 'pathname'
|
3
5
|
require 'yaml'
|
4
6
|
|
5
7
|
module KPM
|
6
8
|
class Installer < BaseInstaller
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
9
|
+
def self.from_file(config_path = nil, logger = nil)
|
10
|
+
config = if config_path.nil?
|
11
|
+
# Install Kill Bill, Kaui and the KPM plugin by default
|
12
|
+
build_default_config
|
13
|
+
else
|
14
|
+
YAML.load_file(config_path)
|
15
|
+
end
|
15
16
|
Installer.new(config, logger)
|
16
17
|
end
|
17
18
|
|
18
|
-
def self.build_default_config(all_kb_versions=nil)
|
19
|
+
def self.build_default_config(all_kb_versions = nil)
|
19
20
|
latest_stable_version = get_kb_latest_stable_version(all_kb_versions)
|
20
21
|
|
21
22
|
{
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
},
|
30
|
-
'kaui' => {
|
31
|
-
# Note: we assume no unstable version of Kaui is published today
|
32
|
-
'version' => 'LATEST'
|
33
|
-
}
|
23
|
+
'killbill' => {
|
24
|
+
'version' => latest_stable_version.to_s
|
25
|
+
},
|
26
|
+
'kaui' => {
|
27
|
+
# Note: we assume no unstable version of Kaui is published today
|
28
|
+
'version' => 'LATEST'
|
29
|
+
}
|
34
30
|
}
|
35
31
|
end
|
36
32
|
|
37
|
-
def self.get_kb_latest_stable_version(all_kb_versions=nil)
|
33
|
+
def self.get_kb_latest_stable_version(all_kb_versions = nil)
|
38
34
|
all_kb_versions ||= KillbillServerArtifact.versions(KillbillServerArtifact::KILLBILL_ARTIFACT_ID,
|
39
35
|
KillbillServerArtifact::KILLBILL_PACKAGING,
|
40
36
|
KillbillServerArtifact::KILLBILL_CLASSIFIER,
|
@@ -42,10 +38,14 @@ module KPM
|
|
42
38
|
true).to_a
|
43
39
|
latest_stable_version = Gem::Version.new('0.0.0')
|
44
40
|
all_kb_versions.each do |kb_version|
|
45
|
-
version =
|
41
|
+
version = begin
|
42
|
+
Gem::Version.new(kb_version)
|
43
|
+
rescue StandardError
|
44
|
+
nil
|
45
|
+
end
|
46
46
|
next if version.nil?
|
47
47
|
|
48
|
-
|
48
|
+
_major, minor, _patch, pre = version.segments
|
49
49
|
next if !pre.nil? || minor.nil? || minor.to_i.odd?
|
50
50
|
|
51
51
|
latest_stable_version = version if version > latest_stable_version
|
@@ -54,7 +54,7 @@ module KPM
|
|
54
54
|
latest_stable_version.to_s
|
55
55
|
end
|
56
56
|
|
57
|
-
def initialize(raw_config, logger=nil)
|
57
|
+
def initialize(raw_config, logger = nil)
|
58
58
|
@config = raw_config['killbill']
|
59
59
|
@kaui_config = raw_config['kaui']
|
60
60
|
|
@@ -65,14 +65,26 @@ module KPM
|
|
65
65
|
logger.level = Logger::INFO
|
66
66
|
end
|
67
67
|
|
68
|
-
nexus_config = !@config.nil?
|
68
|
+
nexus_config = if !@config.nil?
|
69
|
+
@config['nexus']
|
70
|
+
elsif !@kaui_config.nil?
|
71
|
+
@kaui_config['nexus']
|
72
|
+
else
|
73
|
+
nil
|
74
|
+
end
|
69
75
|
nexus_ssl_verify = !nexus_config.nil? ? nexus_config['ssl_verify'] : true
|
70
76
|
|
71
77
|
super(logger, nexus_config, nexus_ssl_verify)
|
72
78
|
end
|
73
79
|
|
74
|
-
def install(force_download=false, verify_sha1=true)
|
75
|
-
bundles_dir = !@config.nil?
|
80
|
+
def install(force_download = false, verify_sha1 = true)
|
81
|
+
bundles_dir = if !@config.nil?
|
82
|
+
@config['plugins_dir']
|
83
|
+
elsif !@kaui_config.nil?
|
84
|
+
@kaui_config['plugins_dir']
|
85
|
+
else
|
86
|
+
nil
|
87
|
+
end
|
76
88
|
bundles_dir ||= DEFAULT_BUNDLES_DIR
|
77
89
|
|
78
90
|
help = nil
|
@@ -80,9 +92,7 @@ module KPM
|
|
80
92
|
help = install_tomcat if @config['webapp_path'].nil?
|
81
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)
|
82
94
|
install_plugins(bundles_dir, @config['version'], force_download, verify_sha1)
|
83
|
-
unless @config['default_bundles'] == false
|
84
|
-
install_default_bundles(bundles_dir, @config['default_bundles_version'], @config['version'], force_download, verify_sha1)
|
85
|
-
end
|
95
|
+
install_default_bundles(bundles_dir, @config['default_bundles_version'], @config['version'], force_download, verify_sha1) unless @config['default_bundles'] == false
|
86
96
|
clean_up_descriptors(bundles_dir)
|
87
97
|
end
|
88
98
|
|
@@ -95,13 +105,13 @@ module KPM
|
|
95
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)
|
96
106
|
end
|
97
107
|
|
98
|
-
@trace_logger.add('help',help)
|
108
|
+
@trace_logger.add('help', nil, help)
|
99
109
|
@trace_logger.to_json
|
100
110
|
end
|
101
111
|
|
102
112
|
private
|
103
113
|
|
104
|
-
def install_tomcat(dir=Dir.pwd)
|
114
|
+
def install_tomcat(dir = Dir.pwd)
|
105
115
|
# Download and unpack Tomcat
|
106
116
|
manager = KPM::TomcatManager.new(dir, @logger)
|
107
117
|
manager.download
|
@@ -109,9 +119,7 @@ module KPM
|
|
109
119
|
# Update main config
|
110
120
|
root_war_path = manager.setup
|
111
121
|
@config['webapp_path'] = root_war_path
|
112
|
-
unless @kaui_config.nil?
|
113
|
-
@kaui_config['webapp_path'] = Pathname.new(File.dirname(root_war_path)).join('kaui.war').to_s
|
114
|
-
end
|
122
|
+
@kaui_config['webapp_path'] = Pathname.new(File.dirname(root_war_path)).join('kaui.war').to_s unless @kaui_config.nil?
|
115
123
|
|
116
124
|
# Help message
|
117
125
|
manager.help
|
@@ -123,7 +131,7 @@ module KPM
|
|
123
131
|
end
|
124
132
|
|
125
133
|
def install_java_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
126
|
-
return if @config['plugins'].nil?
|
134
|
+
return if @config['plugins'].nil? || @config['plugins']['java'].nil?
|
127
135
|
|
128
136
|
infos = []
|
129
137
|
@config['plugins']['java'].each do |plugin|
|
@@ -134,13 +142,13 @@ module KPM
|
|
134
142
|
end
|
135
143
|
|
136
144
|
def install_ruby_plugins(bundles_dir, raw_kb_version, force_download, verify_sha1)
|
137
|
-
return if @config['plugins'].nil?
|
145
|
+
return if @config['plugins'].nil? || @config['plugins']['ruby'].nil?
|
138
146
|
|
139
|
-
verify_jruby_jar=true
|
147
|
+
verify_jruby_jar = true
|
140
148
|
infos = []
|
141
149
|
@config['plugins']['ruby'].each do |plugin|
|
142
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)
|
143
|
-
verify_jruby_jar=false
|
151
|
+
verify_jruby_jar = false
|
144
152
|
end
|
145
153
|
|
146
154
|
infos
|
@@ -161,11 +169,11 @@ module KPM
|
|
161
169
|
plugin_identifiers = plugins_manager.read_plugin_identifiers
|
162
170
|
removed_identifiers = []
|
163
171
|
plugin_identifiers.each do |plugin_key, plugin|
|
164
|
-
if
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
172
|
+
next if installed_plugins.key?(plugin['plugin_name'])
|
173
|
+
|
174
|
+
_, plugin_entry = plugins_manager.get_identifier_key_and_entry(plugin_key)
|
175
|
+
plugins_manager.remove_plugin_identifier_key(plugin_key)
|
176
|
+
removed_identifiers << plugin_entry
|
169
177
|
end
|
170
178
|
|
171
179
|
removed_identifiers
|
@@ -182,6 +190,5 @@ module KPM
|
|
182
190
|
sha1checker.remove_entry!(coordinates)
|
183
191
|
end
|
184
192
|
end
|
185
|
-
|
186
193
|
end
|
187
194
|
end
|