kpm 0.7.1 → 0.9.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.
Files changed (77) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +138 -0
  4. data/Gemfile +2 -0
  5. data/README.adoc +126 -109
  6. data/Rakefile +2 -1
  7. data/bin/kpm +4 -2
  8. data/kpm.gemspec +10 -8
  9. data/lib/kpm.rb +3 -0
  10. data/lib/kpm/account.rb +269 -337
  11. data/lib/kpm/base_artifact.rb +40 -36
  12. data/lib/kpm/base_installer.rb +71 -84
  13. data/lib/kpm/blob.rb +29 -0
  14. data/lib/kpm/cli.rb +3 -1
  15. data/lib/kpm/coordinates.rb +10 -12
  16. data/lib/kpm/database.rb +93 -103
  17. data/lib/kpm/diagnostic_file.rb +126 -146
  18. data/lib/kpm/formatter.rb +76 -48
  19. data/lib/kpm/inspector.rb +24 -34
  20. data/lib/kpm/installer.rb +53 -46
  21. data/lib/kpm/kaui_artifact.rb +4 -3
  22. data/lib/kpm/killbill_plugin_artifact.rb +10 -7
  23. data/lib/kpm/killbill_server_artifact.rb +24 -10
  24. data/lib/kpm/migrations.rb +26 -11
  25. data/lib/kpm/nexus_helper/actions.rb +45 -9
  26. data/lib/kpm/nexus_helper/github_api_calls.rb +70 -0
  27. data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +130 -108
  28. data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
  29. data/lib/kpm/plugins_directory.rb +14 -9
  30. data/lib/kpm/plugins_directory.yml +16 -175
  31. data/lib/kpm/plugins_manager.rb +29 -24
  32. data/lib/kpm/sha1_checker.rb +56 -15
  33. data/lib/kpm/system.rb +104 -135
  34. data/lib/kpm/system_helpers/cpu_information.rb +56 -55
  35. data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
  36. data/lib/kpm/system_helpers/entropy_available.rb +37 -39
  37. data/lib/kpm/system_helpers/memory_information.rb +52 -51
  38. data/lib/kpm/system_helpers/os_information.rb +45 -47
  39. data/lib/kpm/system_helpers/system_proxy.rb +10 -10
  40. data/lib/kpm/tasks.rb +370 -443
  41. data/lib/kpm/tenant_config.rb +68 -83
  42. data/lib/kpm/tomcat_manager.rb +10 -8
  43. data/lib/kpm/trace_logger.rb +18 -16
  44. data/lib/kpm/uninstaller.rb +81 -14
  45. data/lib/kpm/utils.rb +13 -14
  46. data/lib/kpm/version.rb +3 -1
  47. data/packaging/Gemfile +2 -0
  48. data/pom.xml +1 -1
  49. data/spec/kpm/remote/base_artifact_spec.rb +33 -17
  50. data/spec/kpm/remote/base_installer_spec.rb +35 -34
  51. data/spec/kpm/remote/github_api_calls_spec.rb +40 -0
  52. data/spec/kpm/remote/installer_spec.rb +80 -78
  53. data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
  54. data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +25 -30
  55. data/spec/kpm/remote/killbill_server_artifact_spec.rb +30 -13
  56. data/spec/kpm/remote/migrations_spec.rb +12 -11
  57. data/spec/kpm/remote/nexus_facade_spec.rb +32 -28
  58. data/spec/kpm/remote/tenant_config_spec.rb +30 -29
  59. data/spec/kpm/remote/tomcat_manager_spec.rb +4 -3
  60. data/spec/kpm/unit/actions_spec.rb +52 -0
  61. data/spec/kpm/unit/base_artifact_spec.rb +19 -18
  62. data/spec/kpm/unit/cpu_information_spec.rb +67 -0
  63. data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
  64. data/spec/kpm/unit/entropy_information_spec.rb +36 -0
  65. data/spec/kpm/unit/formatter_spec.rb +163 -0
  66. data/spec/kpm/unit/inspector_spec.rb +34 -42
  67. data/spec/kpm/unit/installer_spec.rb +7 -6
  68. data/spec/kpm/unit/memory_information_spec.rb +102 -0
  69. data/spec/kpm/unit/os_information_spec.rb +38 -0
  70. data/spec/kpm/unit/plugins_directory_spec.rb +38 -22
  71. data/spec/kpm/unit/plugins_manager_spec.rb +62 -66
  72. data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
  73. data/spec/kpm/unit/uninstaller_spec.rb +118 -72
  74. data/spec/kpm/unit_mysql/account_spec.rb +144 -143
  75. data/spec/spec_helper.rb +20 -18
  76. data/tasks/package.rake +18 -18
  77. metadata +26 -22
@@ -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
- self.split('::').inject(Kernel) do |mod, class_name|
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 { |q| sha1=format_sha(q[:sha1]); disabled=""; disabled="(x)" if q[:is_disabled]; default=""; default="(*)" if q[:is_default]; "#{q[:version]}#{sha1}#{default}#{disabled}" }.join(", ")
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 "[???]" if sha.nil?
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
- if data.nil? || data.size == 0
67
- return
68
- end
70
+ puts format_only(data, labels)
71
+ end
69
72
 
70
- if labels.nil?
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 = [{:label => :plugin_name},
74
- {:label => :plugin_key},
75
- {:label => :type},
76
- {:label => :group_id},
77
- {:label => :artifact_id},
78
- {:label => :packaging},
79
- {:label => :versions, :formatter => VersionFormatter.name}]
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
- data.keys.each do |key|
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
- prev_size = e.key?(:size) ? e[:size] : formatter.label.size
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
- border = "_"
101
- border = (0...labels.size).inject(border) { |res, i| res="#{res}_"; res }
102
- border = labels.inject(border) { |res, lbl| (0...lbl[:size] + 2).each { |s| res="#{res}_" }; res }
103
- format = "|"
104
- format = labels.inject(format) { |res, lbl| res="#{res} %#{lbl[:size]}s |"; res }
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
- puts "\n#{border}\n"
109
- puts "#{format}\n" % labels_format_argument
110
- puts "#{border}\n"
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
- data.keys.each do |key|
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
- arguments = []
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
- res << formatter.to_s
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
- puts "#{border}\n\n"
123
-
151
+ labels_format_argument
124
152
  end
125
153
  end
126
154
  end
@@ -1,15 +1,14 @@
1
- module KPM
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.keys.each do |cur_plugin_name|
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
- if coordinate_map[:group_id] == cur[:group_id] &&
47
- coordinate_map[:artifact_id] == cur[:artifact_id] &&
48
- coordinate_map[:packaging] == cur[:packaging]
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.keys.each do |cur|
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
- if !File.exists?(plugins_path)
73
- return []
74
- end
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 == "SET_DEFAULT" }[0]
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
- versions = entries.select do |e|
90
- e != "SET_DEFAULT"
91
- end.inject([]) do |out, e|
92
- is_disabled = File.exists?(plugin_path.join(e).join('tmp').join('disabled.txt'))
93
- out << {:version => e, :is_default => default_version == e, :is_disabled => is_disabled, :sha1 => nil};
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
@@ -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
- def self.from_file(config_path=nil, logger=nil)
9
- if config_path.nil?
10
- # Install Kill Bill, Kaui and the KPM plugin by default
11
- config = build_default_config
12
- else
13
- config = YAML::load_file(config_path)
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
- 'killbill' => {
23
- 'version' => latest_stable_version.to_s,
24
- 'plugins' => {
25
- 'ruby' => [
26
- {'name' => 'kpm'}
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 = Gem::Version.new(kb_version) rescue nil
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
- major, minor, patch, pre = version.segments
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? ? @config['nexus'] : (!@kaui_config.nil? ? @kaui_config['nexus'] : 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? ? @config['plugins_dir'] : (!@kaui_config.nil? ? @kaui_config['plugins_dir'] : 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? or @config['plugins']['java'].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? or @config['plugins']['ruby'].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 !installed_plugins.has_key?(plugin['plugin_name'])
165
- _, plugin_entry = plugins_manager.get_identifier_key_and_entry(plugin_key)
166
- plugins_manager.remove_plugin_identifier_key(plugin_key)
167
- removed_identifiers << plugin_entry
168
- end
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