kpm 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +66 -0
- data/Gemfile +2 -0
- data/README.adoc +111 -109
- data/Rakefile +2 -1
- data/bin/kpm +4 -2
- data/kpm.gemspec +8 -6
- data/lib/kpm.rb +3 -0
- data/lib/kpm/account.rb +267 -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 +6 -9
- data/lib/kpm/database.rb +90 -114
- data/lib/kpm/diagnostic_file.rb +126 -147
- data/lib/kpm/formatter.rb +74 -46
- data/lib/kpm/inspector.rb +22 -32
- 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 +8 -7
- data/lib/kpm/nexus_helper/actions.rb +47 -8
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +87 -94
- data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
- data/lib/kpm/plugins_directory.rb +9 -8
- data/lib/kpm/plugins_directory.yml +8 -175
- data/lib/kpm/plugins_manager.rb +29 -24
- data/lib/kpm/sha1_checker.rb +31 -18
- data/lib/kpm/system.rb +105 -136
- 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 +364 -437
- data/lib/kpm/tenant_config.rb +68 -83
- data/lib/kpm/tomcat_manager.rb +9 -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 +1 -1
- data/spec/kpm/remote/base_artifact_spec.rb +13 -15
- data/spec/kpm/remote/base_installer_spec.rb +30 -29
- data/spec/kpm/remote/installer_spec.rb +73 -73
- data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +19 -24
- 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 +30 -26
- data/spec/kpm/remote/tenant_config_spec.rb +27 -26
- data/spec/kpm/remote/tomcat_manager_spec.rb +2 -1
- data/spec/kpm/unit/actions_spec.rb +52 -0
- data/spec/kpm/unit/base_artifact_spec.rb +17 -16
- 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 +5 -4
- 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 +34 -18
- data/spec/kpm/unit/plugins_manager_spec.rb +61 -65
- data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
- data/spec/kpm/unit/uninstaller_spec.rb +107 -61
- data/spec/kpm/unit_mysql/account_spec.rb +120 -135
- data/spec/spec_helper.rb +19 -17
- data/tasks/package.rake +18 -18
- metadata +17 -8
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'actions'
|
2
4
|
module KPM
|
3
5
|
module NexusFacade
|
@@ -11,10 +13,10 @@ module KPM
|
|
11
13
|
|
12
14
|
class RemoteFactory
|
13
15
|
class << self
|
14
|
-
def create(overrides, ssl_verify=true, logger=nil)
|
15
|
-
Actions.new(overrides, ssl_verify,logger || NexusFacade.logger)
|
16
|
+
def create(overrides, ssl_verify = true, logger = nil)
|
17
|
+
Actions.new(overrides, ssl_verify, logger || NexusFacade.logger)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
|
-
end
|
22
|
+
end
|
@@ -1,30 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'open-uri'
|
2
4
|
require 'yaml'
|
3
5
|
|
4
6
|
module KPM
|
5
7
|
class PluginsDirectory
|
6
|
-
def self.all(latest=false)
|
8
|
+
def self.all(latest = false)
|
7
9
|
if latest
|
8
10
|
# Look at GitHub (source of truth)
|
9
11
|
begin
|
10
12
|
source = URI.parse('https://raw.githubusercontent.com/killbill/killbill-cloud/master/kpm/lib/kpm/plugins_directory.yml').read
|
11
13
|
rescue StandardError
|
12
14
|
# Default to built-in version if GitHub isn't accessible
|
13
|
-
return
|
15
|
+
return all(false)
|
14
16
|
end
|
15
17
|
YAML.load(source)
|
16
18
|
else
|
17
|
-
source = File.join(
|
19
|
+
source = File.join(__dir__, 'plugins_directory.yml')
|
18
20
|
YAML.load_file(source)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
all(latest).inject({}) { |out, (key, val)| out[key]=val[:versions][kb_version.to_sym] if val[:versions].key?(kb_version.to_sym) ; out}
|
24
|
+
def self.list_plugins(latest = false, kb_version)
|
25
|
+
all(latest).each_with_object({}) { |(key, val), out| out[key] = val[:versions][kb_version.to_sym] if val[:versions].key?(kb_version.to_sym); }
|
25
26
|
end
|
26
27
|
|
27
|
-
def self.lookup(raw_plugin_key, latest=false, raw_kb_version=nil)
|
28
|
+
def self.lookup(raw_plugin_key, latest = false, raw_kb_version = nil)
|
28
29
|
plugin_key = raw_plugin_key.to_s.downcase
|
29
30
|
plugin = all(latest)[plugin_key.to_sym]
|
30
31
|
return nil if plugin.nil?
|
@@ -40,7 +41,7 @@ module KPM
|
|
40
41
|
if raw_kb_version == 'LATEST'
|
41
42
|
version = 'LATEST'
|
42
43
|
else
|
43
|
-
captures = raw_kb_version.nil? ? [] : raw_kb_version.scan(/(\d+\.\d+)(\.\d)?/)
|
44
|
+
captures = raw_kb_version.nil? ? [] : raw_kb_version.scan(/(\d+\.\d+)(\.\d+)?/)
|
44
45
|
if captures.empty? || captures.first.nil? || captures.first.first.nil?
|
45
46
|
version = 'LATEST'
|
46
47
|
else
|
@@ -2,241 +2,74 @@
|
|
2
2
|
:accertify:
|
3
3
|
:type: :java
|
4
4
|
:versions:
|
5
|
-
:0.14: 0.1.0
|
6
|
-
:0.16: 0.2.0
|
7
5
|
:0.18: 0.3.0
|
8
|
-
:require:
|
9
|
-
- :org.killbill.billing.plugin.accertify.url
|
10
|
-
- :org.killbill.billing.plugin.accertify.username
|
11
|
-
- :org.killbill.billing.plugin.accertify.password
|
12
6
|
:adyen:
|
13
7
|
:type: :java
|
14
8
|
:versions:
|
15
|
-
:0.
|
16
|
-
:0.15: 0.2.1
|
17
|
-
:0.16: 0.3.2
|
18
|
-
:0.17: 0.4.10
|
19
|
-
:0.18: 0.5.18
|
20
|
-
:0.19: 0.6.0
|
9
|
+
:0.18: 0.5.26
|
21
10
|
:0.20: 0.7.0
|
22
|
-
:require:
|
23
|
-
- :org.killbill.billing.plugin.adyen.merchantAccount
|
24
|
-
- :org.killbill.billing.plugin.adyen.username
|
25
|
-
- :org.killbill.billing.plugin.adyen.password
|
26
|
-
- :org.killbill.billing.plugin.adyen.paymentUrl
|
27
11
|
:analytics:
|
28
12
|
:type: :java
|
29
13
|
:versions:
|
30
|
-
:0.14: 1.0.3
|
31
|
-
:0.15: 2.0.1
|
32
|
-
:0.16: 3.0.2
|
33
|
-
:0.17: 4.0.5
|
34
14
|
:0.18: 4.2.5
|
35
|
-
:0.19: 5.1.4
|
36
15
|
:0.20: 6.0.1
|
37
|
-
:0.
|
16
|
+
:0.22: 7.0.8
|
38
17
|
:avatax:
|
39
18
|
:type: :java
|
40
19
|
:versions:
|
41
|
-
:0.14: 0.1.0
|
42
|
-
:0.15: 0.2.0
|
43
|
-
:0.16: 0.3.0
|
44
20
|
:0.18: 0.4.1
|
45
|
-
:0.19: 0.5.1
|
46
21
|
:0.20: 0.6.1
|
47
|
-
:0.
|
48
|
-
:require:
|
49
|
-
- :org.killbill.billing.plugin.avatax.url
|
50
|
-
- :org.killbill.billing.plugin.avatax.accountNumber
|
51
|
-
- :org.killbill.billing.plugin.avatax.licenseKey
|
52
|
-
:braintree_blue:
|
53
|
-
:type: :ruby
|
54
|
-
:versions:
|
55
|
-
:0.14: 0.0.1
|
56
|
-
:0.16: 0.2.1
|
57
|
-
:0.18: 0.3.1
|
58
|
-
:require:
|
59
|
-
- :merchant_id
|
60
|
-
- :public_key
|
61
|
-
- :private_key
|
62
|
-
:currency:
|
63
|
-
:type: :ruby
|
64
|
-
:artifact_id: killbill-currency-plugin
|
65
|
-
:versions:
|
66
|
-
:0.16: 2.0.0
|
67
|
-
:0.18: 3.0.0
|
22
|
+
:0.22: 0.7.0
|
68
23
|
:cybersource:
|
69
24
|
:type: :ruby
|
70
25
|
:versions:
|
71
|
-
:0.14: 1.0.0
|
72
|
-
:0.15: 3.3.0
|
73
|
-
:0.16: 4.0.12
|
74
26
|
:0.18: 5.2.7
|
75
|
-
:require:
|
76
|
-
- :login
|
77
|
-
- :password
|
78
27
|
:dwolla:
|
79
28
|
:type: :java
|
80
29
|
:versions:
|
81
30
|
:0.18: 0.1.0
|
82
|
-
:require:
|
83
|
-
- :org.killbill.billing.plugin.dwolla.baseUrl
|
84
|
-
- :org.killbill.billing.plugin.dwolla.baseOAuthUrl
|
85
|
-
- :org.killbill.billing.plugin.dwolla.scopes
|
86
|
-
- :org.killbill.billing.plugin.dwolla.clientId
|
87
|
-
- :org.killbill.billing.plugin.dwolla.clientSecret
|
88
|
-
- :org.killbill.billing.plugin.dwolla.accountId
|
89
31
|
:email-notifications:
|
90
32
|
:type: :java
|
91
33
|
:artifact_id: killbill-email-notifications-plugin
|
92
34
|
:versions:
|
93
|
-
:0.14: 0.1.0
|
94
|
-
:0.16: 0.2.0
|
95
35
|
:0.18: 0.3.1
|
96
|
-
:0.19: 0.4.0
|
97
36
|
:0.20: 0.5.1
|
98
|
-
:
|
99
|
-
:type: :ruby
|
100
|
-
:artifact_id: firstdata-e4-plugin
|
101
|
-
:versions:
|
102
|
-
:0.16: 0.1.0
|
103
|
-
:0.18: 0.2.0
|
104
|
-
:require:
|
105
|
-
- :login
|
106
|
-
- :password
|
37
|
+
:0.22: 0.6.0
|
107
38
|
:forte:
|
108
39
|
:type: :java
|
109
40
|
:versions:
|
110
|
-
:0.14: 0.1.0
|
111
|
-
:0.16: 0.2.0
|
112
41
|
:0.18: 0.3.0
|
113
|
-
:require:
|
114
|
-
- :org.killbill.billing.plugin.forte.merchantId
|
115
|
-
- :org.killbill.billing.plugin.forte.password
|
116
|
-
- :org.killbill.billing.plugin.forte.host
|
117
|
-
- :org.killbill.billing.plugin.forte.port
|
118
|
-
- :org.killbill.billing.plugin.forte.apiLoginId
|
119
|
-
- :org.killbill.billing.plugin.forte.secureTransactionKey
|
120
|
-
:kpm:
|
121
|
-
:type: :ruby
|
122
|
-
:versions:
|
123
|
-
:0.15: 0.0.2
|
124
|
-
:0.16: 0.0.5
|
125
|
-
:0.17: 1.0.0
|
126
|
-
:0.18: 1.1.2
|
127
|
-
:0.19: 1.2.4
|
128
|
-
:0.20: 1.3.0
|
129
|
-
:litle:
|
130
|
-
:type: :ruby
|
131
|
-
:versions:
|
132
|
-
:0.14: 2.0.0
|
133
|
-
:0.16: 3.0.0
|
134
|
-
:0.18: 4.0.0
|
135
|
-
:0.20: 5.0.0
|
136
|
-
:require:
|
137
|
-
- :account_id
|
138
|
-
- :merchant_id
|
139
|
-
- :username
|
140
|
-
- :password
|
141
|
-
- :secure_page_url
|
142
|
-
- :paypage_id
|
143
|
-
:logging:
|
144
|
-
:type: :ruby
|
145
|
-
:versions:
|
146
|
-
:0.14: 1.7.0
|
147
|
-
:0.15: 2.0.0
|
148
|
-
:0.16: 3.0.0
|
149
|
-
:0.18: 4.0.0
|
150
42
|
:orbital:
|
151
43
|
:type: :ruby
|
152
44
|
:versions:
|
153
|
-
:0.16: 0.0.2
|
154
45
|
:0.18: 0.1.15
|
155
|
-
:require:
|
156
|
-
- :login
|
157
|
-
- :password
|
158
|
-
- :merchant_id
|
159
46
|
:payment_bridge:
|
160
47
|
:type: :java
|
161
48
|
:artifact_id: bridge-plugin
|
162
49
|
:versions:
|
163
|
-
:0.19: 0.0.12
|
164
50
|
:0.20: 0.1.2
|
165
|
-
:0.21: 0.2.
|
166
|
-
:payeezy:
|
167
|
-
:type: :java
|
168
|
-
:versions:
|
169
|
-
:0.17: 0.1.0
|
170
|
-
:require:
|
171
|
-
- :org.killbill.billing.plugin.payeezy.apiKey
|
172
|
-
- :org.killbill.billing.plugin.payeezy.token
|
173
|
-
- :org.killbill.billing.plugin.payeezy.secret
|
174
|
-
- :org.killbill.billing.plugin.payeezy.paymentUrl
|
51
|
+
:0.21: 0.2.1
|
175
52
|
:payment-retries:
|
176
53
|
:type: :java
|
177
54
|
:versions:
|
178
|
-
:0.16: 0.0.1
|
179
|
-
:0.17: 0.1.0
|
180
55
|
:0.18: 0.2.4
|
181
56
|
:paypal:
|
182
57
|
:type: :ruby
|
183
58
|
:artifact_id: paypal-express-plugin
|
184
59
|
:versions:
|
185
|
-
:0.
|
186
|
-
:0.15: 3.0.0
|
187
|
-
:0.16: 4.1.7
|
188
|
-
:0.18: 5.0.9
|
60
|
+
:0.18: 5.0.15
|
189
61
|
:0.20: 6.0.0
|
190
|
-
:require:
|
191
|
-
- :signature
|
192
|
-
- :login
|
193
|
-
- :password
|
194
|
-
:payu_latam:
|
195
|
-
:type: :ruby
|
196
|
-
:artifact_id: payu-latam-plugin
|
197
|
-
:versions:
|
198
|
-
:0.14: 0.1.0
|
199
|
-
:0.16: 0.2.0
|
200
|
-
:0.18: 0.3.0
|
201
|
-
:require:
|
202
|
-
- :api_login
|
203
|
-
- :api_key
|
204
|
-
- :country_account_id
|
205
|
-
- :merchant_id
|
206
62
|
:payment-test:
|
207
63
|
:type: :ruby
|
208
64
|
:artifact_id: payment-test-plugin
|
209
65
|
:versions:
|
210
66
|
:0.18: 4.2.0
|
211
|
-
:0.19: 5.0.0
|
212
67
|
:0.20: 6.0.0
|
213
68
|
:securenet:
|
214
69
|
:type: :ruby
|
215
70
|
:versions:
|
216
|
-
:0.16: 0.1.0
|
217
71
|
:0.18: 0.2.0
|
218
|
-
:require:
|
219
|
-
- :login
|
220
|
-
- :password
|
221
72
|
:stripe:
|
222
|
-
:type: :
|
223
|
-
:versions:
|
224
|
-
:0.14: 1.0.0
|
225
|
-
:0.15: 2.0.0
|
226
|
-
:0.16: 3.0.3
|
227
|
-
:0.17: 4.0.0
|
228
|
-
:0.18: 4.1.1
|
229
|
-
:0.19: 5.0.0
|
230
|
-
:0.20: 6.0.1
|
231
|
-
:require:
|
232
|
-
- :api_secret_key
|
233
|
-
:zendesk:
|
234
|
-
:type: :ruby
|
73
|
+
:type: :java
|
235
74
|
:versions:
|
236
|
-
:0.
|
237
|
-
:0.16: 2.0.0
|
238
|
-
:0.18: 3.0.1
|
239
|
-
:require:
|
240
|
-
- :subdomain
|
241
|
-
- :username
|
242
|
-
- :password
|
75
|
+
:0.22: 7.0.0
|
data/lib/kpm/plugins_manager.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
require 'json'
|
3
5
|
|
4
6
|
module KPM
|
5
7
|
class PluginsManager
|
6
|
-
|
7
8
|
def initialize(plugins_dir, logger)
|
8
9
|
@plugins_dir = Pathname.new(plugins_dir)
|
9
10
|
@logger = logger
|
10
11
|
end
|
11
12
|
|
12
|
-
def set_active(plugin_name_or_path, plugin_version=nil)
|
13
|
+
def set_active(plugin_name_or_path, plugin_version = nil)
|
13
14
|
if plugin_name_or_path.nil?
|
14
15
|
@logger.warn('Unable to mark a plugin as active: no name or path specified')
|
15
16
|
return
|
@@ -19,7 +20,7 @@ module KPM
|
|
19
20
|
# Full path specified, with version
|
20
21
|
link = Pathname.new(plugin_name_or_path).join('../SET_DEFAULT')
|
21
22
|
FileUtils.rm_f(link)
|
22
|
-
FileUtils.ln_s(plugin_name_or_path, link, :
|
23
|
+
FileUtils.ln_s(plugin_name_or_path, link, force: true)
|
23
24
|
else
|
24
25
|
# Plugin name (fs directory) specified
|
25
26
|
plugin_dir_glob = @plugins_dir.join('*').join(plugin_name_or_path)
|
@@ -28,7 +29,7 @@ module KPM
|
|
28
29
|
plugin_dir = Pathname.new(plugin_dir_path)
|
29
30
|
link = plugin_dir.join('SET_DEFAULT')
|
30
31
|
FileUtils.rm_f(link)
|
31
|
-
FileUtils.ln_s(plugin_dir.join(plugin_version), link, :
|
32
|
+
FileUtils.ln_s(plugin_dir.join(plugin_version), link, force: true)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -38,7 +39,7 @@ module KPM
|
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
|
-
def uninstall(plugin_name_or_path, plugin_version=nil)
|
42
|
+
def uninstall(plugin_name_or_path, plugin_version = nil)
|
42
43
|
update_fs(plugin_name_or_path, plugin_version) do |tmp_dir|
|
43
44
|
FileUtils.rm_f(tmp_dir.join('restart.txt'))
|
44
45
|
# Be safe, keep the code, just never start it
|
@@ -46,7 +47,7 @@ module KPM
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
49
|
-
def restart(plugin_name_or_path, plugin_version=nil)
|
50
|
+
def restart(plugin_name_or_path, plugin_version = nil)
|
50
51
|
update_fs(plugin_name_or_path, plugin_version) do |tmp_dir|
|
51
52
|
# Remove disabled.txt so that the plugin is started if it was stopped
|
52
53
|
FileUtils.rm_f(tmp_dir.join('disabled.txt'))
|
@@ -59,20 +60,19 @@ module KPM
|
|
59
60
|
entry = identifiers[plugin_key]
|
60
61
|
if entry
|
61
62
|
coordinate_map.each_pair do |key, value|
|
62
|
-
return false
|
63
|
+
return false unless validate_plugin_identifier_key_value(plugin_key, key, entry[key.to_s], value)
|
63
64
|
end
|
64
65
|
end
|
65
66
|
true
|
66
67
|
end
|
67
68
|
|
68
69
|
def add_plugin_identifier_key(plugin_key, plugin_name, language, coordinate_map)
|
69
|
-
|
70
70
|
identifiers = read_plugin_identifiers
|
71
71
|
# If key does not already exists or if the version in the json is not the one we are currently installing we update the entry, if not nothing to do
|
72
|
-
if !identifiers.
|
72
|
+
if !identifiers.key?(plugin_key) ||
|
73
73
|
(coordinate_map && identifiers[plugin_key]['version'] != coordinate_map[:version])
|
74
74
|
|
75
|
-
entry = {'plugin_name' => plugin_name}
|
75
|
+
entry = { 'plugin_name' => plugin_name }
|
76
76
|
entry['language'] = language
|
77
77
|
if coordinate_map
|
78
78
|
entry['group_id'] = coordinate_map[:group_id]
|
@@ -91,7 +91,7 @@ module KPM
|
|
91
91
|
def remove_plugin_identifier_key(plugin_key)
|
92
92
|
identifiers = read_plugin_identifiers
|
93
93
|
# If key does not already exists we update it, if not nothing to do.
|
94
|
-
if identifiers.
|
94
|
+
if identifiers.key?(plugin_key)
|
95
95
|
identifiers.delete(plugin_key)
|
96
96
|
write_plugin_identifiers(identifiers)
|
97
97
|
end
|
@@ -101,7 +101,7 @@ module KPM
|
|
101
101
|
|
102
102
|
def get_plugin_key_and_name(plugin_name_or_key)
|
103
103
|
identifiers = read_plugin_identifiers
|
104
|
-
if identifiers.
|
104
|
+
if identifiers.key?(plugin_name_or_key)
|
105
105
|
# It's a plugin key
|
106
106
|
[plugin_name_or_key, identifiers[plugin_name_or_key]['plugin_name']]
|
107
107
|
else
|
@@ -121,19 +121,20 @@ module KPM
|
|
121
121
|
|
122
122
|
def guess_plugin_name(artifact_id)
|
123
123
|
return nil if artifact_id.nil?
|
124
|
+
|
124
125
|
captures = artifact_id.scan(/(.*)-plugin/)
|
125
|
-
if captures.empty? || captures.first.nil? || captures.first.first.nil?
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
126
|
+
short_name = if captures.empty? || captures.first.nil? || captures.first.first.nil?
|
127
|
+
artifact_id
|
128
|
+
else
|
129
|
+
# 'analytics-plugin' or 'stripe-plugin' passed
|
130
|
+
captures.first.first
|
131
|
+
end
|
131
132
|
Dir.glob(@plugins_dir.join('*').join('*')).each do |plugin_path|
|
132
133
|
plugin_name = File.basename(plugin_path)
|
133
134
|
if plugin_name == short_name ||
|
134
|
-
|
135
|
-
|
136
|
-
|
135
|
+
plugin_name == artifact_id ||
|
136
|
+
!plugin_name.scan(/-#{short_name}/).empty? ||
|
137
|
+
!plugin_name.scan(/#{short_name}-/).empty?
|
137
138
|
return plugin_name
|
138
139
|
end
|
139
140
|
end
|
@@ -148,6 +149,7 @@ module KPM
|
|
148
149
|
JSON.parse(f.read)
|
149
150
|
end
|
150
151
|
rescue Errno::ENOENT
|
152
|
+
# Ignore
|
151
153
|
end
|
152
154
|
identifiers
|
153
155
|
end
|
@@ -166,7 +168,6 @@ module KPM
|
|
166
168
|
end
|
167
169
|
|
168
170
|
def write_plugin_identifiers(identifiers)
|
169
|
-
|
170
171
|
path = Pathname.new(@plugins_dir).join('plugin_identifiers.json')
|
171
172
|
Dir.mktmpdir do |tmp_dir|
|
172
173
|
tmp_path = Pathname.new(tmp_dir).join('plugin_identifiers.json')
|
@@ -179,13 +180,17 @@ module KPM
|
|
179
180
|
end
|
180
181
|
|
181
182
|
# Note: the plugin name here is the directory name on the filesystem
|
182
|
-
def update_fs(plugin_name_or_path, plugin_version=nil
|
183
|
+
def update_fs(plugin_name_or_path, plugin_version = nil)
|
183
184
|
if plugin_name_or_path.nil?
|
184
185
|
@logger.warn('Unable to update the filesystem: no name or path specified')
|
185
186
|
return
|
186
187
|
end
|
187
188
|
|
188
|
-
p = plugin_version.nil?
|
189
|
+
p = if plugin_version.nil?
|
190
|
+
plugin_name_or_path
|
191
|
+
else
|
192
|
+
@plugins_dir.join('*').join(plugin_name_or_path).join(plugin_version == :all ? '*' : plugin_version)
|
193
|
+
end
|
189
194
|
|
190
195
|
modified = []
|
191
196
|
Dir.glob(p).each do |plugin_dir_path|
|