kpm 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kpm/base_artifact.rb +37 -7
- data/lib/kpm/base_installer.rb +14 -19
- data/lib/kpm/installer.rb +2 -2
- data/lib/kpm/kaui_artifact.rb +4 -4
- data/lib/kpm/killbill_server_artifact.rb +2 -1
- data/lib/kpm/plugins_manager.rb +13 -13
- data/lib/kpm/sha1_checker.rb +4 -0
- data/lib/kpm/tasks.rb +21 -0
- data/lib/kpm/version.rb +1 -1
- data/spec/kpm/remote/installer_spec.rb +9 -0
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +33 -2
- data/spec/kpm/unit/plugins_manager_spec.rb +28 -4
- metadata +56 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf947b3325fa9702980797739a85241543a1084d
|
4
|
+
data.tar.gz: 79241998d05b9583a74b74c6b79a854d283b46c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a84a0a01fc7aa88bce35da72f38b771c0ddd8a7b9d899ee32eda996413be22de161a7152d67476011e770ea6ff5a0f8fbc8d69b9123d6418d59759a01dc790f
|
7
|
+
data.tar.gz: 4e44086024f1509f77ae7adfc9872b99ca6f09c3822d7601858ae92b47d361447891e48e2f651b4566b7994ad605496e3faea527a968a5e95ac60ac76dbba54c
|
data/lib/kpm/base_artifact.rb
CHANGED
@@ -36,8 +36,8 @@ module KPM
|
|
36
36
|
|
37
37
|
class << self
|
38
38
|
def pull(logger, group_id, artifact_id, packaging='jar', classifier=nil, version='LATEST', destination_path=nil, sha1_file=nil, force_download=false, verify_sha1=true, overrides={}, ssl_verify=true)
|
39
|
-
|
40
|
-
pull_and_put_in_place(logger,
|
39
|
+
coordinate_map = {:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier, :version => version}
|
40
|
+
pull_and_put_in_place(logger, coordinate_map, destination_path, is_ruby_plugin_and_should_skip_top_dir(group_id, artifact_id), sha1_file, force_download, verify_sha1, overrides, ssl_verify)
|
41
41
|
end
|
42
42
|
|
43
43
|
def pull_from_fs(logger, file_path, destination_path=nil)
|
@@ -57,19 +57,41 @@ module KPM
|
|
57
57
|
|
58
58
|
protected
|
59
59
|
|
60
|
-
def pull_and_put_in_place(logger,
|
60
|
+
def pull_and_put_in_place(logger, coordinate_map, destination_path=nil, skip_top_dir=true, sha1_file=nil, force_download=false, verify_sha1=true, overrides={}, ssl_verify=true)
|
61
61
|
# Build artifact info
|
62
|
-
artifact_info = artifact_info(
|
63
|
-
|
62
|
+
artifact_info = artifact_info(coordinate_map, overrides, ssl_verify)
|
64
63
|
populate_fs_info(artifact_info, destination_path)
|
65
64
|
|
65
|
+
# Update with resolved version in case 'LATEST' was passed
|
66
|
+
coordinate_map[:version] = artifact_info[:version]
|
67
|
+
coordinates = build_coordinates(coordinate_map)
|
68
|
+
|
66
69
|
# Return early if there's nothing to do
|
67
70
|
if !force_download && skip_if_exists(artifact_info, coordinates, sha1_file)
|
68
71
|
logger.info " Skipping installation of #{coordinates} to #{artifact_info[:file_path]}, file already exists"
|
72
|
+
|
73
|
+
# We need to do a bit of magic to make sure that artifact_info[:bundle_dir] is correctly populated when we bail early
|
74
|
+
if artifact_info[:is_tgz]
|
75
|
+
plugin_dir = File.split(artifact_info[:dir_name])[0]
|
76
|
+
plugins_manager = PluginsManager.new(plugin_dir, logger)
|
77
|
+
artifact_id = coordinates.split(':')[1]
|
78
|
+
plugin_name = plugins_manager.guess_plugin_name(artifact_id)
|
79
|
+
if plugin_name.nil?
|
80
|
+
logger.warn("Failed to guess plugin_name for #{coordinates}: artifact_info[:bundle_dir] will not be populated correctly")
|
81
|
+
else
|
82
|
+
version = artifact_info[:version]
|
83
|
+
artifact_info[:bundle_dir] = Pathname.new(artifact_info[:dir_name]).join(plugin_name).join(version).to_s
|
84
|
+
end
|
85
|
+
else
|
86
|
+
artifact_info[:bundle_dir] = artifact_info[:dir_name]
|
87
|
+
end
|
88
|
+
|
69
89
|
artifact_info[:skipped] = true
|
70
90
|
return artifact_info
|
71
91
|
end
|
72
92
|
|
93
|
+
|
94
|
+
|
73
95
|
# Create the destination directory
|
74
96
|
FileUtils.mkdir_p(artifact_info[:dir_name])
|
75
97
|
|
@@ -138,11 +160,12 @@ module KPM
|
|
138
160
|
local_sha1 == artifact_info[:sha1]
|
139
161
|
end
|
140
162
|
|
141
|
-
def artifact_info(
|
163
|
+
def artifact_info(coordinate_map, overrides={}, ssl_verify=true)
|
142
164
|
info = {
|
143
165
|
:skipped => false
|
144
166
|
}
|
145
167
|
|
168
|
+
coordinates = build_coordinates(coordinate_map)
|
146
169
|
nexus_info = nexus_remote(overrides, ssl_verify).get_artifact_info(coordinates)
|
147
170
|
|
148
171
|
xml = REXML::Document.new(nexus_info)
|
@@ -216,7 +239,14 @@ module KPM
|
|
216
239
|
res
|
217
240
|
end
|
218
241
|
|
219
|
-
def build_coordinates(
|
242
|
+
def build_coordinates(coordinate_map)
|
243
|
+
|
244
|
+
group_id = coordinate_map[:group_id]
|
245
|
+
artifact_id = coordinate_map[:artifact_id]
|
246
|
+
packaging = coordinate_map[:packaging]
|
247
|
+
classifier = coordinate_map[:classifier]
|
248
|
+
version = coordinate_map[:version]
|
249
|
+
|
220
250
|
if classifier.nil?
|
221
251
|
if version.nil?
|
222
252
|
"#{group_id}:#{artifact_id}:#{packaging}"
|
data/lib/kpm/base_installer.rb
CHANGED
@@ -63,7 +63,7 @@ module KPM
|
|
63
63
|
|
64
64
|
|
65
65
|
|
66
|
-
def install_plugin(plugin_key, 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)
|
66
|
+
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)
|
67
67
|
|
68
68
|
# plugin_key needs to exist
|
69
69
|
if plugin_key.nil?
|
@@ -73,7 +73,7 @@ module KPM
|
|
73
73
|
|
74
74
|
|
75
75
|
# Lookup artifact and perform validation against input
|
76
|
-
looked_up_group_id, looked_up_artifact_id, looked_up_packaging, looked_up_classifier, looked_up_version, looked_up_type = KPM::PluginsDirectory.lookup(plugin_key, true)
|
76
|
+
looked_up_group_id, looked_up_artifact_id, looked_up_packaging, looked_up_classifier, looked_up_version, looked_up_type = KPM::PluginsDirectory.lookup(plugin_key, true, raw_kb_version)
|
77
77
|
return if !validate_installation_arg(plugin_key, 'group_id', specified_group_id, looked_up_group_id)
|
78
78
|
return if !validate_installation_arg(plugin_key, 'artifact_id', specified_artifact_id, looked_up_artifact_id)
|
79
79
|
return if !validate_installation_arg(plugin_key, 'packaging', specified_packaging, looked_up_packaging)
|
@@ -119,8 +119,8 @@ module KPM
|
|
119
119
|
|
120
120
|
|
121
121
|
# Before we do the install we verify that the entry we have in the plugin_identifiers.json matches our current request
|
122
|
-
|
123
|
-
return if !validate_plugin_key(plugins_dir, plugin_key,
|
122
|
+
coordinate_map = {:group_id => group_id, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier}
|
123
|
+
return if !validate_plugin_key(plugins_dir, plugin_key, coordinate_map)
|
124
124
|
|
125
125
|
|
126
126
|
@logger.debug("Installing plugin: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} destination=#{destination}")
|
@@ -137,9 +137,12 @@ module KPM
|
|
137
137
|
@nexus_config,
|
138
138
|
@nexus_ssl_verify)
|
139
139
|
|
140
|
+
# Update with resolved version
|
141
|
+
coordinate_map[:version] = artifact_info[:version]
|
142
|
+
|
140
143
|
mark_as_active(plugins_dir, artifact_info, artifact_id)
|
141
144
|
|
142
|
-
update_plugin_identifier(plugins_dir, plugin_key, type.to_s,
|
145
|
+
update_plugin_identifier(plugins_dir, plugin_key, type.to_s, coordinate_map, artifact_info)
|
143
146
|
|
144
147
|
artifact_info
|
145
148
|
end
|
@@ -240,32 +243,24 @@ module KPM
|
|
240
243
|
true
|
241
244
|
end
|
242
245
|
|
243
|
-
def validate_plugin_key(plugins_dir, plugin_key,
|
246
|
+
def validate_plugin_key(plugins_dir, plugin_key, coordinate_map)
|
244
247
|
plugins_manager = PluginsManager.new(plugins_dir, @logger)
|
245
|
-
return plugins_manager.validate_plugin_identifier_key(plugin_key,
|
248
|
+
return plugins_manager.validate_plugin_identifier_key(plugin_key, coordinate_map)
|
246
249
|
end
|
247
250
|
|
248
|
-
def update_plugin_identifier(plugins_dir, plugin_key, type,
|
249
|
-
|
250
|
-
path = artifact_info[:bundle_dir] || artifact_info[:dir_name]
|
251
|
+
def update_plugin_identifier(plugins_dir, plugin_key, type, coordinate_map, artifact_info)
|
252
|
+
path = artifact_info[:bundle_dir]
|
251
253
|
|
252
254
|
# The plugin_name needs to be computed after the fact (after the installation) because some plugin archive embed their directory structure
|
253
255
|
plugin_name = Pathname.new(path).parent.split[1].to_s
|
254
256
|
plugins_manager = PluginsManager.new(plugins_dir, @logger)
|
255
|
-
plugins_manager.add_plugin_identifier_key(plugin_key, plugin_name, type,
|
257
|
+
plugins_manager.add_plugin_identifier_key(plugin_key, plugin_name, type, coordinate_map)
|
256
258
|
end
|
257
259
|
|
258
260
|
def mark_as_active(plugins_dir, artifact_info, artifact_id=nil)
|
259
261
|
# Mark this bundle as active
|
260
262
|
plugins_manager = PluginsManager.new(plugins_dir, @logger)
|
261
|
-
|
262
|
-
# In case the artifact on disk already existed and the installation is skipped,
|
263
|
-
# we don't know the plugin name on disk (arbitrary if it's a .tar.gz). That being said,
|
264
|
-
# we can guess it for Kill Bill plugins (using our naming conventions)
|
265
|
-
plugins_manager.set_active(plugins_manager.guess_plugin_name(artifact_id), artifact_info[:version])
|
266
|
-
else
|
267
|
-
plugins_manager.set_active(artifact_info[:bundle_dir])
|
268
|
-
end
|
263
|
+
plugins_manager.set_active(artifact_info[:bundle_dir])
|
269
264
|
end
|
270
265
|
end
|
271
266
|
end
|
data/lib/kpm/installer.rb
CHANGED
@@ -79,7 +79,7 @@ module KPM
|
|
79
79
|
|
80
80
|
infos = []
|
81
81
|
@config['plugins']['java'].each do |plugin|
|
82
|
-
infos << install_plugin(plugin['name'], plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], @config['plugins_dir'], 'java', force_download, verify_sha1)
|
82
|
+
infos << install_plugin(plugin['name'], nil, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], @config['plugins_dir'], 'java', force_download, verify_sha1)
|
83
83
|
end
|
84
84
|
|
85
85
|
infos
|
@@ -90,7 +90,7 @@ module KPM
|
|
90
90
|
|
91
91
|
infos = []
|
92
92
|
@config['plugins']['ruby'].each do |plugin|
|
93
|
-
infos << install_plugin(plugin['name'], plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], @config['plugins_dir'], 'ruby', force_download, verify_sha1)
|
93
|
+
infos << install_plugin(plugin['name'], nil, plugin['group_id'], plugin['artifact_id'], plugin['packaging'], plugin['classifier'], plugin['version'], @config['plugins_dir'], 'ruby', force_download, verify_sha1)
|
94
94
|
end
|
95
95
|
|
96
96
|
infos
|
data/lib/kpm/kaui_artifact.rb
CHANGED
@@ -5,10 +5,10 @@ module KPM
|
|
5
5
|
class KauiArtifact < BaseArtifact
|
6
6
|
class << self
|
7
7
|
def versions(overrides={}, ssl_verify=true)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
|
9
|
+
coordinate_map = {:group_id => KPM::BaseArtifact::KAUI_GROUP_ID, :artifact_id => KPM::BaseArtifact::KAUI_ARTIFACT_ID, :packaging => KPM::BaseArtifact::KAUI_PACKAGING, :classifier => KPM::BaseArtifact::KAUI_CLASSIFIER}
|
10
|
+
|
11
|
+
coordinates = build_coordinates(coordinate_map)
|
12
12
|
response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
|
13
13
|
versions = SortedSet.new
|
14
14
|
response.elements.each('search-results/data/artifact/version') { |element| versions << element.text }
|
@@ -5,7 +5,8 @@ module KPM
|
|
5
5
|
class KillbillServerArtifact < BaseArtifact
|
6
6
|
class << self
|
7
7
|
def versions(artifact_id, packaging=KPM::BaseArtifact::KILLBILL_PACKAGING, classifier=KPM::BaseArtifact::KILLBILL_CLASSIFIER, overrides={}, ssl_verify=true)
|
8
|
-
|
8
|
+
coordinate_map = {:group_id => KPM::BaseArtifact::KILLBILL_GROUP_ID, :artifact_id => artifact_id, :packaging => packaging, :classifier => classifier}
|
9
|
+
coordinates = build_coordinates(coordinate_map)
|
9
10
|
response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
|
10
11
|
versions = SortedSet.new
|
11
12
|
response.elements.each('search-results/data/artifact/version') { |element| versions << element.text }
|
data/lib/kpm/plugins_manager.rb
CHANGED
@@ -54,32 +54,32 @@ module KPM
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def validate_plugin_identifier_key(plugin_key,
|
58
|
-
|
57
|
+
def validate_plugin_identifier_key(plugin_key, coordinate_map)
|
59
58
|
identifiers = read_plugin_identifiers
|
60
59
|
entry = identifiers[plugin_key]
|
61
60
|
if entry
|
62
|
-
|
63
|
-
return false if !validate_plugin_identifier_key_value(plugin_key,
|
61
|
+
coordinate_map.each_pair do |key, value|
|
62
|
+
return false if !validate_plugin_identifier_key_value(plugin_key, key, entry[key.to_s], value)
|
64
63
|
end
|
65
64
|
end
|
66
65
|
true
|
67
66
|
end
|
68
67
|
|
69
|
-
def add_plugin_identifier_key(plugin_key, plugin_name, language,
|
68
|
+
def add_plugin_identifier_key(plugin_key, plugin_name, language, coordinate_map)
|
70
69
|
|
71
70
|
identifiers = read_plugin_identifiers
|
72
|
-
# If key does not already exists we update
|
73
|
-
if !identifiers.has_key?(plugin_key)
|
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.has_key?(plugin_key) ||
|
73
|
+
(coordinate_map && identifiers[plugin_key]['version'] != coordinate_map[:version])
|
74
74
|
|
75
75
|
entry = {'plugin_name' => plugin_name}
|
76
76
|
entry['language'] = language
|
77
|
-
if
|
78
|
-
entry['group_id'] =
|
79
|
-
entry['artifact_id'] =
|
80
|
-
entry['packaging'] =
|
81
|
-
entry['classifier'] =
|
82
|
-
entry['version'] =
|
77
|
+
if coordinate_map
|
78
|
+
entry['group_id'] = coordinate_map[:group_id]
|
79
|
+
entry['artifact_id'] = coordinate_map[:artifact_id]
|
80
|
+
entry['packaging'] = coordinate_map[:packaging]
|
81
|
+
entry['classifier'] = coordinate_map[:classifier]
|
82
|
+
entry['version'] = coordinate_map[:version]
|
83
83
|
end
|
84
84
|
identifiers[plugin_key] = entry
|
85
85
|
write_plugin_identifiers(identifiers)
|
data/lib/kpm/sha1_checker.rb
CHANGED
data/lib/kpm/tasks.rb
CHANGED
@@ -174,6 +174,27 @@ module KPM
|
|
174
174
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
175
175
|
end
|
176
176
|
|
177
|
+
method_option :force_download,
|
178
|
+
:type => :boolean,
|
179
|
+
:default => false,
|
180
|
+
:desc => 'Force download of the artifact even if it exists'
|
181
|
+
method_option :verify_sha1,
|
182
|
+
:type => :boolean,
|
183
|
+
:default => true,
|
184
|
+
:desc => 'Validates sha1 sum'
|
185
|
+
desc 'pull_defaultbundles', 'Pulls the default OSGI bundles from Sonatype and places it on your machine.'
|
186
|
+
def pull_defaultbundles(kb_version='LATEST')
|
187
|
+
response = BaseInstaller.new(logger,
|
188
|
+
options[:overrides],
|
189
|
+
options[:ssl_verify])
|
190
|
+
.install_default_bundles(nil,
|
191
|
+
nil,
|
192
|
+
kb_version,
|
193
|
+
options[:force_download],
|
194
|
+
options[:verify_sha1])
|
195
|
+
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
196
|
+
end
|
197
|
+
|
177
198
|
desc 'search_for_plugins', 'Searches for all available plugins and prints them to the screen.'
|
178
199
|
def search_for_plugins
|
179
200
|
all_plugins = KillbillPluginArtifact.versions(options[:overrides], options[:ssl_verify])
|
data/lib/kpm/version.rb
CHANGED
@@ -46,6 +46,15 @@ describe KPM::Installer do
|
|
46
46
|
# Verify idempotency
|
47
47
|
installer.install
|
48
48
|
check_installation(plugins_dir, kb_webapp_path, kaui_webapp_path)
|
49
|
+
|
50
|
+
# Finally verify that for both (well behaved) ruby and java plugin, skipping the install will still correctly return the `:bundle_dir`
|
51
|
+
info = installer.install_plugin('payment-test-plugin', nil, 'org.kill-bill.billing.plugin.ruby', 'payment-test-plugin', nil, nil, '1.8.7', plugins_dir)
|
52
|
+
info[:bundle_dir].should == plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7'
|
53
|
+
|
54
|
+
|
55
|
+
info = installer.install_plugin('analytics', nil, nil, nil, nil, nil, '0.7.1', plugins_dir)
|
56
|
+
info[:bundle_dir].should == plugins_dir + '/plugins/java/analytics-plugin/0.7.1'
|
57
|
+
|
49
58
|
end
|
50
59
|
end
|
51
60
|
|
@@ -9,29 +9,40 @@ describe KPM::KillbillPluginArtifact do
|
|
9
9
|
|
10
10
|
it 'should be able to download and verify artifacts' do
|
11
11
|
Dir.mktmpdir do |dir|
|
12
|
+
sha1_file = dir + '/sha1.yml'
|
12
13
|
info = KPM::KillbillPluginArtifact.pull(@logger,
|
13
14
|
KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID,
|
14
15
|
'analytics-plugin',
|
15
16
|
KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING,
|
16
17
|
KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER,
|
17
18
|
'LATEST',
|
18
|
-
dir
|
19
|
+
dir,
|
20
|
+
sha1_file)
|
19
21
|
info[:file_name].should == "analytics-plugin-#{info[:version]}.jar"
|
20
22
|
info[:size].should == File.size(info[:file_path])
|
23
|
+
|
24
|
+
check_yaml_for_resolved_latest_version(sha1_file, 'org.kill-bill.billing.plugin.java:analytics-plugin:jar', '3.0.0')
|
21
25
|
end
|
22
26
|
|
23
27
|
Dir.mktmpdir do |dir|
|
28
|
+
sha1_file = dir + '/sha1.yml'
|
24
29
|
info = KPM::KillbillPluginArtifact.pull(@logger,
|
25
30
|
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID,
|
26
31
|
'logging-plugin',
|
27
32
|
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING,
|
28
33
|
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER,
|
29
34
|
'LATEST',
|
30
|
-
dir
|
35
|
+
dir,
|
36
|
+
sha1_file)
|
31
37
|
|
32
38
|
# No file name - since we untar'ed it
|
33
39
|
info[:file_name].should be_nil
|
40
|
+
|
41
|
+
check_yaml_for_resolved_latest_version(sha1_file, 'org.kill-bill.billing.plugin.ruby:logging-plugin:tar.gz', '3.0.0')
|
34
42
|
end
|
43
|
+
|
44
|
+
|
45
|
+
|
35
46
|
end
|
36
47
|
|
37
48
|
it 'should be able to list versions' do
|
@@ -51,4 +62,24 @@ describe KPM::KillbillPluginArtifact do
|
|
51
62
|
logging_plugin_versions.size.should >= 1
|
52
63
|
logging_plugin_versions[0].should == '1.7.0'
|
53
64
|
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
# We verify that 'LATEST' version has been correctly translated into the yml file
|
69
|
+
# (we can't check against actual version because as we keep releasing those increment,
|
70
|
+
# so the best we can do it check this is *not* LATEST and greater than current version at the time the test was written )
|
71
|
+
def check_yaml_for_resolved_latest_version(sha1_file, key_prefix, minimum_version)
|
72
|
+
|
73
|
+
sha1_checker = KPM::Sha1Checker.from_file(sha1_file)
|
74
|
+
|
75
|
+
keys = sha1_checker.all_sha1.keys.select { |k| k.start_with? key_prefix}
|
76
|
+
keys.size.should == 1
|
77
|
+
|
78
|
+
parts = keys[0].split(':')
|
79
|
+
parts.size.should == 4
|
80
|
+
parts[3].should_not == 'LATEST'
|
81
|
+
parts[3].should >= minimum_version
|
82
|
+
end
|
83
|
+
|
84
|
+
|
54
85
|
end
|
@@ -30,7 +30,8 @@ describe KPM::PluginsManager do
|
|
30
30
|
|
31
31
|
it 'creates a plugin identifier entry with coordinates' do
|
32
32
|
# Verifies file gets created if does not exist
|
33
|
-
|
33
|
+
coordinate_map = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version'}
|
34
|
+
identifiers = @manager.add_plugin_identifier_key('bar', 'bar_name', 'type', coordinate_map)
|
34
35
|
identifiers.size.should == 1
|
35
36
|
identifiers['bar']['plugin_name'].should == 'bar_name'
|
36
37
|
identifiers['bar']['group_id'].should == 'group'
|
@@ -98,17 +99,40 @@ describe KPM::PluginsManager do
|
|
98
99
|
|
99
100
|
it 'creates plugin identifiers and validate entry' do
|
100
101
|
# Verifies file gets created if does not exist
|
101
|
-
|
102
|
+
coordinate_map = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version'}
|
103
|
+
|
104
|
+
identifiers = @manager.add_plugin_identifier_key('yoyo', 'yoyo_name', 'type', coordinate_map)
|
102
105
|
identifiers.size.should == 1
|
103
106
|
identifiers['yoyo']['plugin_name'].should == 'yoyo_name'
|
104
107
|
|
105
|
-
@manager.validate_plugin_identifier_key('yoyo',
|
108
|
+
@manager.validate_plugin_identifier_key('yoyo', coordinate_map).should == true
|
106
109
|
|
107
110
|
# Negative validation
|
108
|
-
|
111
|
+
invalid_coordinate_map = {:group_id => 'group1', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version'}
|
112
|
+
|
113
|
+
@manager.validate_plugin_identifier_key('yoyo', invalid_coordinate_map).should == false
|
109
114
|
end
|
110
115
|
|
111
116
|
|
117
|
+
it 'creates a plugin identifier entry with a new version' do
|
118
|
+
# Verifies file gets created if does not exist
|
119
|
+
|
120
|
+
coordinate_map1 = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version1'}
|
121
|
+
|
122
|
+
identifiers = @manager.add_plugin_identifier_key('bar', 'bar_name', 'type', coordinate_map1)
|
123
|
+
identifiers.size.should == 1
|
124
|
+
identifiers['bar']['plugin_name'].should == 'bar_name'
|
125
|
+
identifiers['bar']['version'].should == 'version1'
|
126
|
+
|
127
|
+
coordinate_map2 = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version2'}
|
128
|
+
|
129
|
+
identifiers = @manager.add_plugin_identifier_key('bar', 'bar_name', 'type', coordinate_map2)
|
130
|
+
identifiers.size.should == 1
|
131
|
+
identifiers['bar']['plugin_name'].should == 'bar_name'
|
132
|
+
identifiers['bar']['version'].should == 'version2'
|
133
|
+
|
134
|
+
end
|
135
|
+
|
112
136
|
it 'sets a path as active' do
|
113
137
|
@manager.set_active(@plugin_dir.join('1.0.0'))
|
114
138
|
File.exists?(@plugin_dir.join('SET_DEFAULT')).should be_true
|
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-28 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
|
-
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
23
|
requirements:
|
22
|
-
- - ~>
|
24
|
+
- - "~>"
|
23
25
|
- !ruby/object:Gem::Version
|
24
26
|
version: 1.6.21
|
25
|
-
prerelease: false
|
26
|
-
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nexus_cli
|
29
|
-
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 4.1.0
|
34
|
-
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
37
|
requirements:
|
36
|
-
- - ~>
|
38
|
+
- - "~>"
|
37
39
|
- !ruby/object:Gem::Version
|
38
40
|
version: 4.1.0
|
39
|
-
prerelease: false
|
40
|
-
type: :runtime
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
|
-
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.19.1
|
48
|
-
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
51
|
requirements:
|
50
|
-
- - ~>
|
52
|
+
- - "~>"
|
51
53
|
- !ruby/object:Gem::Version
|
52
54
|
version: 0.19.1
|
53
|
-
prerelease: false
|
54
|
-
type: :runtime
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
|
-
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 10.0.0
|
62
|
-
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
65
|
requirements:
|
64
|
-
- -
|
66
|
+
- - ">="
|
65
67
|
- !ruby/object:Gem::Version
|
66
68
|
version: 10.0.0
|
67
|
-
prerelease: false
|
68
|
-
type: :development
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.12.0
|
76
|
-
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
79
|
requirements:
|
78
|
-
- - ~>
|
80
|
+
- - "~>"
|
79
81
|
- !ruby/object:Gem::Version
|
80
82
|
version: 2.12.0
|
81
|
-
prerelease: false
|
82
|
-
type: :development
|
83
83
|
description: A package manager for Kill Bill.
|
84
84
|
email: killbilling-users@googlegroups.com
|
85
85
|
executables:
|
@@ -87,8 +87,8 @@ executables:
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gemrelease
|
91
|
-
- .gitignore
|
90
|
+
- ".gemrelease"
|
91
|
+
- ".gitignore"
|
92
92
|
- Gemfile
|
93
93
|
- README.md
|
94
94
|
- Rakefile
|
@@ -127,26 +127,38 @@ homepage: http://kill-bill.org
|
|
127
127
|
licenses:
|
128
128
|
- Apache License (2.0)
|
129
129
|
metadata: {}
|
130
|
-
post_install_message:
|
130
|
+
post_install_message:
|
131
131
|
rdoc_options:
|
132
|
-
- --exclude
|
133
|
-
- .
|
132
|
+
- "--exclude"
|
133
|
+
- "."
|
134
134
|
require_paths:
|
135
135
|
- lib
|
136
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: 1.8.6
|
141
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
|
-
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
149
|
-
signing_key:
|
147
|
+
rubyforge_project:
|
148
|
+
rubygems_version: 2.2.2
|
149
|
+
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Kill Bill package manager.
|
152
|
-
test_files:
|
152
|
+
test_files:
|
153
|
+
- spec/kpm/remote/base_artifact_spec.rb
|
154
|
+
- spec/kpm/remote/installer_spec.rb
|
155
|
+
- spec/kpm/remote/kaui_artifact_spec.rb
|
156
|
+
- spec/kpm/remote/killbill_plugin_artifact_spec.rb
|
157
|
+
- spec/kpm/remote/killbill_server_artifact_spec.rb
|
158
|
+
- spec/kpm/remote/tomcat_manager_spec.rb
|
159
|
+
- spec/kpm/unit/base_artifact_spec.rb
|
160
|
+
- spec/kpm/unit/plugins_directory_spec.rb
|
161
|
+
- spec/kpm/unit/plugins_manager_spec.rb
|
162
|
+
- spec/kpm/unit/sha1_checker_spec.rb
|
163
|
+
- spec/kpm/unit/sha1_test.yml
|
164
|
+
- spec/spec_helper.rb
|