kpm 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +15 -0
- data/lib/kpm/base_artifact.rb +131 -8
- data/lib/kpm/installer.rb +43 -45
- data/lib/kpm/kaui_artifact.rb +7 -9
- data/lib/kpm/killbill_plugin_artifact.rb +3 -15
- data/lib/kpm/killbill_server_artifact.rb +5 -18
- data/lib/kpm/tasks.rb +88 -31
- data/lib/kpm/version.rb +1 -1
- data/spec/kpm/remote/base_artifact_spec.rb +66 -0
- data/spec/kpm/remote/installer_spec.rb +64 -0
- data/spec/kpm/remote/kaui_artifact_spec.rb +30 -0
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +54 -0
- data/spec/kpm/remote/killbill_server_artifact_spec.rb +31 -0
- data/spec/spec_helper.rb +10 -0
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1de7630338f4ae249d6dd349fdeaa10939b0f9e5
|
4
|
+
data.tar.gz: 5b3848aa883c400c784db73f3b336022cc7101e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9835a80ad3a36ce4037efec42119427eda9e5945dee8ef9bf4d76d9a6f62758c13cadfcb3c830fa4ec34c815a839240ff2eb91ce7b93fb03b38fa0929b86168
|
7
|
+
data.tar.gz: ab104ebd24feea1aa14e69d4f8c235865ed31c3c7d6bd71a902fde86cf4c7557bed2ad74c7e415f2020ee21832559c90bf4c84f940652d31343cfc2b33a63ab4
|
data/Rakefile
CHANGED
@@ -3,3 +3,18 @@
|
|
3
3
|
# Install tasks to build and release the plugin
|
4
4
|
require 'bundler/setup'
|
5
5
|
Bundler::GemHelper.install_tasks
|
6
|
+
|
7
|
+
# Install test tasks
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
namespace :test do
|
10
|
+
namespace :remote do
|
11
|
+
desc 'Run RSpec remote tests'
|
12
|
+
RSpec::Core::RakeTask.new do |task|
|
13
|
+
task.name = 'spec'
|
14
|
+
task.pattern = './spec/*/remote/*_spec.rb'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Run tests by default
|
20
|
+
task :default => 'test:remote:spec'
|
data/lib/kpm/base_artifact.rb
CHANGED
@@ -1,15 +1,43 @@
|
|
1
|
+
require 'digest/sha1'
|
1
2
|
require 'nexus_cli'
|
3
|
+
require 'rexml/document'
|
2
4
|
|
3
5
|
module KPM
|
6
|
+
|
7
|
+
class ArtifactCorruptedException < IOError
|
8
|
+
def message
|
9
|
+
'Downloaded artifact failed checksum verification'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
class BaseArtifact
|
5
|
-
KILLBILL_GROUP_ID
|
6
|
-
|
7
|
-
|
14
|
+
KILLBILL_GROUP_ID = 'org.kill-bill.billing'
|
15
|
+
|
16
|
+
KILLBILL_ARTIFACT_ID = 'killbill-profiles-killbill'
|
17
|
+
KILLBILL_PACKAGING = 'war'
|
18
|
+
KILLBILL_CLASSIFIER = 'jar-with-dependencies'
|
19
|
+
|
20
|
+
KILLPAY_ARTIFACT_ID = 'killbill-profiles-killpay'
|
21
|
+
KILLPAY_PACKAGING = 'war'
|
22
|
+
KILLPAY_CLASSIFIER = 'jar-with-dependencies'
|
23
|
+
|
24
|
+
KILLBILL_JAVA_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.java'
|
25
|
+
KILLBILL_JAVA_PLUGIN_PACKAGING = 'jar'
|
26
|
+
KILLBILL_JAVA_PLUGIN_CLASSIFIER = nil
|
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
|
+
KAUI_GROUP_ID = 'org.kill-bill.billing.kaui'
|
33
|
+
KAUI_ARTIFACT_ID = 'kaui-standalone'
|
34
|
+
KAUI_PACKAGING = 'war'
|
35
|
+
KAUI_CLASSIFIER = nil
|
8
36
|
|
9
37
|
class << self
|
10
|
-
def pull(group_id, artifact_id, packaging='jar', version='LATEST',
|
11
|
-
coordinates = build_coordinates(group_id, artifact_id, packaging,
|
12
|
-
|
38
|
+
def pull(logger, group_id, artifact_id, packaging='jar', classifier=nil, version='LATEST', destination_path=nil, overrides={}, ssl_verify=true)
|
39
|
+
coordinates = build_coordinates(group_id, artifact_id, packaging, classifier, version)
|
40
|
+
pull_and_put_in_place(logger, coordinates, destination_path, is_ruby_plugin_and_should_skip_top_dir(group_id, artifact_id), overrides, ssl_verify)
|
13
41
|
end
|
14
42
|
|
15
43
|
def nexus_remote(overrides={}, ssl_verify=true)
|
@@ -18,13 +46,80 @@ module KPM
|
|
18
46
|
|
19
47
|
def nexus_defaults
|
20
48
|
{
|
21
|
-
|
22
|
-
|
49
|
+
url: 'https://repository.sonatype.org',
|
50
|
+
repository: 'central-proxy'
|
23
51
|
}
|
24
52
|
end
|
25
53
|
|
26
54
|
protected
|
27
55
|
|
56
|
+
def pull_and_put_in_place(logger, coordinates, destination_path=nil, skip_top_dir=true, overrides={}, ssl_verify=true)
|
57
|
+
destination_path = KPM::root if destination_path.nil?
|
58
|
+
|
59
|
+
# Create the destination directory
|
60
|
+
if path_looks_like_a_directory(destination_path)
|
61
|
+
destination_dir = destination_path
|
62
|
+
else
|
63
|
+
destination_dir = File.dirname(destination_path)
|
64
|
+
end
|
65
|
+
FileUtils.mkdir_p(destination_dir)
|
66
|
+
|
67
|
+
# Download the artifact in a temporary directory in case of failures
|
68
|
+
info = {}
|
69
|
+
Dir.mktmpdir do |tmp_destination_dir|
|
70
|
+
logger.info " Starting download of #{coordinates} to #{tmp_destination_dir}"
|
71
|
+
|
72
|
+
info = pull_and_verify(logger, coordinates, tmp_destination_dir, overrides, ssl_verify)
|
73
|
+
|
74
|
+
# Move the file to the final destination, unpacking if necessary
|
75
|
+
is_tgz = info[:file_path].end_with?('.tar.gz') || info[:file_path].end_with?('.tgz')
|
76
|
+
if is_tgz
|
77
|
+
Utils.unpack_tgz(info[:file_path], destination_path, skip_top_dir)
|
78
|
+
FileUtils.rm info[:file_path]
|
79
|
+
else
|
80
|
+
FileUtils.mv info[:file_path], destination_path
|
81
|
+
end
|
82
|
+
|
83
|
+
# Update the info hash with the real destination
|
84
|
+
if File.directory?(destination_path) && !is_tgz
|
85
|
+
destination = File.join(File.expand_path(destination_path), info[:file_name])
|
86
|
+
else
|
87
|
+
destination = destination_path
|
88
|
+
end
|
89
|
+
info[:file_path] = File.expand_path(destination)
|
90
|
+
|
91
|
+
if is_tgz
|
92
|
+
info[:file_name] = nil
|
93
|
+
info[:size] = nil
|
94
|
+
else
|
95
|
+
info[:file_name] = File.basename(destination)
|
96
|
+
end
|
97
|
+
|
98
|
+
logger.info "Successful installation of #{coordinates} to #{info[:file_path]}"
|
99
|
+
end
|
100
|
+
info
|
101
|
+
end
|
102
|
+
|
103
|
+
def pull_and_verify(logger, coordinates, destination_dir, overrides={}, ssl_verify=true)
|
104
|
+
info = nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination_dir)
|
105
|
+
raise ArtifactCorruptedException unless verify(logger, coordinates, info[:file_path], overrides, ssl_verify)
|
106
|
+
info
|
107
|
+
end
|
108
|
+
|
109
|
+
def verify(logger, coordinates, file_path, overrides={}, ssl_verify=true)
|
110
|
+
artifact_info = nexus_remote(overrides, ssl_verify).get_artifact_info(coordinates)
|
111
|
+
sha1_element = REXML::Document.new(artifact_info).elements['//sha1']
|
112
|
+
# Can't check :(
|
113
|
+
if sha1_element.nil?
|
114
|
+
logger.warn("Unable to find sha1 in Nexus repo for #{coordinates}. Artifact info: #{artifact_info.inspect}")
|
115
|
+
return true
|
116
|
+
end
|
117
|
+
|
118
|
+
local_sha1 = Digest::SHA1.file(file_path).hexdigest
|
119
|
+
sha1 = sha1_element.text
|
120
|
+
local_sha1 == sha1
|
121
|
+
end
|
122
|
+
|
28
123
|
def build_coordinates(group_id, artifact_id, packaging, classifier, version=nil)
|
29
124
|
if classifier.nil?
|
30
125
|
if version.nil?
|
@@ -40,6 +135,34 @@ module KPM
|
|
40
135
|
end
|
41
136
|
end
|
42
137
|
end
|
138
|
+
|
139
|
+
# Magic methods...
|
140
|
+
|
141
|
+
def is_ruby_plugin_and_should_skip_top_dir(group_id, artifact_id)
|
142
|
+
# The second check is for custom ruby plugins
|
143
|
+
group_id == KILLBILL_RUBY_PLUGIN_GROUP_ID || artifact_id.include?('plugin')
|
144
|
+
end
|
145
|
+
|
146
|
+
def path_looks_like_a_directory(path)
|
147
|
+
# It already is!
|
148
|
+
return true if File.directory?(path)
|
149
|
+
# It already isn't!
|
150
|
+
return false if File.file?(path)
|
151
|
+
|
152
|
+
last_part = File.basename(path).downcase
|
153
|
+
|
154
|
+
%w(.pom .xml .war .jar .xsd .tar.gz .tgz .gz .zip).each do |classic_file_extension|
|
155
|
+
return false if last_part.end_with?(classic_file_extension)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Known magic files
|
159
|
+
%w(root).each do |classic_filename|
|
160
|
+
return false if last_part == classic_filename
|
161
|
+
end
|
162
|
+
|
163
|
+
# Probably a directory
|
164
|
+
true
|
165
|
+
end
|
43
166
|
end
|
44
167
|
end
|
45
168
|
end
|
data/lib/kpm/installer.rb
CHANGED
@@ -11,15 +11,18 @@ module KPM
|
|
11
11
|
|
12
12
|
def initialize(raw_config, logger=nil)
|
13
13
|
raise(ArgumentError, 'killbill or kaui section must be specified') if raw_config['killbill'].nil? and raw_config['kaui'].nil?
|
14
|
-
@config
|
14
|
+
@config = raw_config['killbill']
|
15
15
|
@kaui_config = raw_config['kaui']
|
16
16
|
|
17
17
|
if logger.nil?
|
18
|
-
@logger
|
18
|
+
@logger = Logger.new(STDOUT)
|
19
19
|
@logger.level = Logger::INFO
|
20
20
|
else
|
21
21
|
@logger = logger
|
22
22
|
end
|
23
|
+
|
24
|
+
@nexus_config = @config['nexus']
|
25
|
+
@nexus_ssl_verify = !@nexus_config.nil? ? @nexus_config['ssl_verify'] : true
|
23
26
|
end
|
24
27
|
|
25
28
|
def install
|
@@ -36,19 +39,14 @@ module KPM
|
|
36
39
|
private
|
37
40
|
|
38
41
|
def install_killbill_server
|
39
|
-
group_id
|
40
|
-
artifact_id = @config['artifact_id'] ||
|
41
|
-
packaging
|
42
|
-
classifier
|
43
|
-
version
|
42
|
+
group_id = @config['group_id'] || KPM::BaseArtifact::KILLBILL_GROUP_ID
|
43
|
+
artifact_id = @config['artifact_id'] || KPM::BaseArtifact::KILLBILL_ARTIFACT_ID
|
44
|
+
packaging = @config['packaging'] || KPM::BaseArtifact::KILLBILL_PACKAGING
|
45
|
+
classifier = @config['classifier'] || KPM::BaseArtifact::KILLBILL_CLASSIFIER
|
46
|
+
version = @config['version'] || LATEST_VERSION
|
44
47
|
webapp_path = @config['webapp_path'] || KPM::root
|
45
48
|
|
46
|
-
|
47
|
-
FileUtils.mkdir_p(webapp_dir)
|
48
|
-
|
49
|
-
@logger.info "Installing Kill Bill server (#{group_id}:#{artifact_id}:#{packaging}:#{classifier}:#{version}) to #{webapp_path}"
|
50
|
-
file = KillbillServerArtifact.pull(group_id, artifact_id, packaging, classifier, version, webapp_dir, @config['nexus'], @config['nexus']['ssl_verify'])
|
51
|
-
FileUtils.mv file[:file_path], webapp_path
|
49
|
+
KPM::KillbillServerArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, @nexus_config, @nexus_ssl_verify)
|
52
50
|
end
|
53
51
|
|
54
52
|
def install_plugins
|
@@ -61,67 +59,67 @@ module KPM
|
|
61
59
|
def install_java_plugins(bundles_dir)
|
62
60
|
return if @config['plugins'].nil? or @config['plugins']['java'].nil?
|
63
61
|
|
62
|
+
infos = []
|
64
63
|
@config['plugins']['java'].each do |plugin|
|
65
|
-
|
66
|
-
|
64
|
+
group_id = plugin['group_id'] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID
|
65
|
+
artifact_id = plugin['artifact_id'] || plugin['name']
|
66
|
+
packaging = plugin['packaging'] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING
|
67
|
+
classifier = plugin['classifier'] || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER
|
68
|
+
version = plugin['version'] || LATEST_VERSION
|
67
69
|
destination = "#{bundles_dir}/plugins/java/#{artifact_id}/#{version}"
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
@logger.info "Installing Kill Bill Java plugin #{artifact_id} #{version} to #{destination}"
|
72
|
-
KillbillPluginArtifact.pull(artifact_id, version, :java, destination, @config['nexus'], @config['nexus']['ssl_verify'])
|
71
|
+
infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @nexus_config, @nexus_ssl_verify)
|
73
72
|
end
|
73
|
+
|
74
|
+
infos
|
74
75
|
end
|
75
76
|
|
76
77
|
def install_ruby_plugins(bundles_dir)
|
77
78
|
return if @config['plugins'].nil? or @config['plugins']['ruby'].nil?
|
78
79
|
|
80
|
+
infos = []
|
79
81
|
@config['plugins']['ruby'].each do |plugin|
|
80
|
-
|
81
|
-
|
82
|
+
group_id = plugin['group_id'] || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID
|
83
|
+
artifact_id = plugin['artifact_id'] || plugin['name']
|
84
|
+
packaging = plugin['packaging'] || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING
|
85
|
+
classifier = plugin['classifier'] || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER
|
86
|
+
version = plugin['version'] || LATEST_VERSION
|
82
87
|
destination = "#{bundles_dir}/plugins/ruby"
|
83
88
|
|
84
|
-
|
85
|
-
|
86
|
-
@logger.info "Installing Kill Bill Ruby plugin #{artifact_id} #{version} to #{destination}"
|
87
|
-
archive = KillbillPluginArtifact.pull(artifact_id, version, :ruby, destination, @config['nexus'], @config['nexus']['ssl_verify'])
|
88
|
-
|
89
|
-
Utils.unpack_tgz(archive[:file_path], destination, true)
|
90
|
-
FileUtils.rm archive[:file_path]
|
89
|
+
infos << KPM::KillbillPluginArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @nexus_config, @nexus_ssl_verify)
|
91
90
|
end
|
91
|
+
|
92
|
+
infos
|
92
93
|
end
|
93
94
|
|
94
95
|
def install_default_bundles
|
95
96
|
return if @config['default_bundles'] == false
|
96
97
|
|
97
|
-
group_id
|
98
|
+
group_id = 'org.kill-bill.billing'
|
98
99
|
artifact_id = 'killbill-platform-osgi-bundles-defaultbundles'
|
99
|
-
packaging
|
100
|
-
|
100
|
+
packaging = 'tar.gz'
|
101
|
+
classifier = nil
|
102
|
+
version = @config['version'] || LATEST_VERSION
|
101
103
|
destination = "#{@config['plugins_dir']}/platform"
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
-
@logger.info "Installing Kill Bill #{artifact_id} #{version} to #{destination}"
|
106
|
-
archive = BaseArtifact.pull(group_id, artifact_id, packaging, version, destination, @config['nexus'], @config['nexus']['ssl_verify'])
|
107
|
-
|
108
|
-
Utils.unpack_tgz(archive[:file_path], destination)
|
109
|
-
FileUtils.rm archive[:file_path]
|
105
|
+
info = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, destination, @nexus_config, @nexus_ssl_verify)
|
110
106
|
|
111
107
|
# The special JRuby bundle needs to be called jruby.jar
|
108
|
+
# TODO .first - code smell
|
112
109
|
File.rename Dir.glob("#{destination}/killbill-platform-osgi-bundles-jruby-*.jar").first, "#{destination}/jruby.jar"
|
110
|
+
|
111
|
+
info
|
113
112
|
end
|
114
113
|
|
115
114
|
def install_kaui
|
116
|
-
|
115
|
+
group_id = @kaui_config['group_id'] || KPM::BaseArtifact::KAUI_GROUP_ID
|
116
|
+
artifact_id = @kaui_config['artifact_id'] || KPM::BaseArtifact::KAUI_ARTIFACT_ID
|
117
|
+
packaging = @kaui_config['packaging'] || KPM::BaseArtifact::KAUI_PACKAGING
|
118
|
+
classifier = @kaui_config['classifier'] || KPM::BaseArtifact::KAUI_CLASSIFIER
|
119
|
+
version = @kaui_config['version'] || LATEST_VERSION
|
117
120
|
webapp_path = @kaui_config['webapp_path'] || KPM::root
|
118
121
|
|
119
|
-
|
120
|
-
FileUtils.mkdir_p(webapp_dir)
|
121
|
-
|
122
|
-
@logger.info "Installing Kaui #{version} to #{webapp_path}"
|
123
|
-
file = KauiArtifact.pull(version, webapp_dir, @kaui_config['nexus'], @kaui_config['nexus']['ssl_verify'])
|
124
|
-
FileUtils.mv file[:file_path], webapp_path
|
122
|
+
KPM::KauiArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, webapp_path, @nexus_config, @nexus_ssl_verify)
|
125
123
|
end
|
126
124
|
end
|
127
125
|
end
|
data/lib/kpm/kaui_artifact.rb
CHANGED
@@ -4,16 +4,14 @@ require 'set'
|
|
4
4
|
module KPM
|
5
5
|
class KauiArtifact < BaseArtifact
|
6
6
|
class << self
|
7
|
-
KAUI_WAR = "org.kill-bill.billing.kaui:kaui-standalone:war"
|
8
|
-
|
9
|
-
def pull(version='LATEST', destination=nil, overrides={}, ssl_verify=true)
|
10
|
-
nexus_remote(overrides, ssl_verify).pull_artifact("#{KAUI_WAR}:#{version}", destination)
|
11
|
-
end
|
12
|
-
|
13
7
|
def versions(overrides={}, ssl_verify=true)
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
coordinates = build_coordinates(KPM::BaseArtifact::KAUI_GROUP_ID,
|
9
|
+
KPM::BaseArtifact::KAUI_ARTIFACT_ID,
|
10
|
+
KPM::BaseArtifact::KAUI_PACKAGING,
|
11
|
+
KPM::BaseArtifact::KAUI_CLASSIFIER)
|
12
|
+
response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
|
13
|
+
versions = SortedSet.new
|
14
|
+
response.elements.each('search-results/data/artifact/version') { |element| versions << element.text }
|
17
15
|
versions
|
18
16
|
end
|
19
17
|
end
|
@@ -4,27 +4,15 @@ require 'set'
|
|
4
4
|
module KPM
|
5
5
|
class KillbillPluginArtifact < BaseArtifact
|
6
6
|
class << self
|
7
|
-
def pull(artifact_id, version='LATEST', type=:java, destination=nil, overrides={}, ssl_verify=true)
|
8
|
-
if type == :java
|
9
|
-
group_id = BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID
|
10
|
-
packaging = 'jar'
|
11
|
-
else
|
12
|
-
group_id = BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID
|
13
|
-
packaging = 'tar.gz'
|
14
|
-
end
|
15
|
-
coordinates = "#{group_id}:#{artifact_id}:#{packaging}:#{version}"
|
16
|
-
nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination)
|
17
|
-
end
|
18
|
-
|
19
7
|
def versions(overrides={}, ssl_verify=true)
|
20
|
-
plugins = {
|
8
|
+
plugins = {:java => {}, :ruby => {}}
|
21
9
|
|
22
10
|
nexus = nexus_remote(overrides, ssl_verify)
|
23
11
|
|
24
|
-
[[:java, BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID], [:ruby, BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID]].each do |type_and_group_id|
|
12
|
+
[[:java, KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID], [:ruby, KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID]].each do |type_and_group_id|
|
25
13
|
response = REXML::Document.new nexus.search_for_artifacts(type_and_group_id[1])
|
26
14
|
response.elements.each('search-results/data/artifact') do |element|
|
27
|
-
artifact_id
|
15
|
+
artifact_id = element.elements['artifactId'].text
|
28
16
|
plugins[type_and_group_id[0]][artifact_id] ||= SortedSet.new
|
29
17
|
plugins[type_and_group_id[0]][artifact_id] << element.elements['version'].text
|
30
18
|
end
|
@@ -3,25 +3,12 @@ require 'set'
|
|
3
3
|
|
4
4
|
module KPM
|
5
5
|
class KillbillServerArtifact < BaseArtifact
|
6
|
-
KILLBILL_ARTIFACT_ID = 'killbill-profiles-killbill'
|
7
|
-
KILLBILL_PACKAGING = 'war'
|
8
|
-
KILLBILL_CLASSIFIER = 'jar-with-dependencies'
|
9
|
-
|
10
|
-
KILLPAY_ARTIFACT_ID = 'killbill-profiles-killpay'
|
11
|
-
KILLPAY_PACKAGING = 'war'
|
12
|
-
KILLPAY_CLASSIFIER = 'jar-with-dependencies'
|
13
|
-
|
14
6
|
class << self
|
15
|
-
def
|
16
|
-
coordinates = build_coordinates(
|
17
|
-
nexus_remote(overrides, ssl_verify).
|
18
|
-
|
19
|
-
|
20
|
-
def versions(group_id, artifact_id, packaging=BaseArtifact::KILLBILL_PACKAGING, classifier=BaseArtifact::KILLBILL_CLASSIFIER, overrides={}, ssl_verify=true)
|
21
|
-
coordinates = build_coordinates(group_id, artifact_id, packaging, classifier)
|
22
|
-
response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
|
23
|
-
versions = SortedSet.new
|
24
|
-
response.elements.each("search-results/data/artifact/version") { |element| versions << element.text }
|
7
|
+
def versions(artifact_id, packaging=KPM::BaseArtifact::KILLBILL_PACKAGING, classifier=KPM::BaseArtifact::KILLBILL_CLASSIFIER, overrides={}, ssl_verify=true)
|
8
|
+
coordinates = build_coordinates(KPM::BaseArtifact::KILLBILL_GROUP_ID, artifact_id, packaging, classifier)
|
9
|
+
response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(coordinates)
|
10
|
+
versions = SortedSet.new
|
11
|
+
response.elements.each('search-results/data/artifact/version') { |element| versions << element.text }
|
25
12
|
versions
|
26
13
|
end
|
27
14
|
end
|
data/lib/kpm/tasks.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'highline'
|
2
|
+
require 'logger'
|
2
3
|
require 'thor'
|
3
4
|
|
4
5
|
module KPM
|
@@ -8,71 +9,111 @@ module KPM
|
|
8
9
|
base.class_eval do
|
9
10
|
|
10
11
|
class_option :overrides,
|
11
|
-
:type
|
12
|
+
:type => :hash,
|
12
13
|
:default => nil,
|
13
|
-
:desc
|
14
|
+
:desc => "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
|
14
15
|
|
15
16
|
class_option :ssl_verify,
|
16
|
-
:type
|
17
|
+
:type => :boolean,
|
17
18
|
:default => true,
|
18
|
-
:desc
|
19
|
+
:desc => 'Set to false to disable SSL Verification.'
|
19
20
|
|
20
|
-
desc
|
21
|
+
desc 'install config_file', 'Install Kill Bill server and plugins according to the specified YAML configuration file.'
|
21
22
|
def install(config_file)
|
22
23
|
Installer.from_file(config_file).install
|
23
24
|
end
|
24
25
|
|
25
26
|
method_option :destination,
|
26
|
-
:type
|
27
|
+
:type => :string,
|
27
28
|
:default => nil,
|
28
|
-
:desc
|
29
|
-
desc
|
29
|
+
:desc => 'A different folder other than the current working directory.'
|
30
|
+
desc 'pull_kb_server_war version', 'Pulls Kill Bill server war from Sonatype and places it on your machine.'
|
30
31
|
def pull_kb_server_war(version='LATEST')
|
31
|
-
response = KillbillServerArtifact.pull(
|
32
|
+
response = KillbillServerArtifact.pull(logger,
|
33
|
+
KillbillServerArtifact::KILLBILL_GROUP_ID,
|
34
|
+
KillbillServerArtifact::KILLBILL_ARTIFACT_ID,
|
35
|
+
KillbillServerArtifact::KILLBILL_PACKAGING,
|
36
|
+
KillbillServerArtifact::KILLBILL_CLASSIFIER,
|
37
|
+
version,
|
38
|
+
options[:destination],
|
39
|
+
options[:overrides],
|
40
|
+
options[:ssl_verify])
|
32
41
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
33
42
|
end
|
34
43
|
|
35
|
-
desc
|
44
|
+
desc 'search_for_kb_server', 'Searches for all versions of Kill Bill server and prints them to the screen.'
|
36
45
|
def search_for_kb_server
|
37
|
-
say "Available versions: #{KillbillServerArtifact.versions(
|
46
|
+
say "Available versions: #{KillbillServerArtifact.versions(KillbillServerArtifact::KILLBILL_ARTIFACT_ID,
|
47
|
+
KillbillServerArtifact::KILLBILL_PACKAGING,
|
48
|
+
KillbillServerArtifact::KILLBILL_CLASSIFIER,
|
49
|
+
options[:overrides],
|
50
|
+
options[:ssl_verify]).to_a.join(', ')}", :green
|
38
51
|
end
|
39
52
|
|
40
53
|
method_option :destination,
|
41
|
-
:type
|
54
|
+
:type => :string,
|
42
55
|
:default => nil,
|
43
|
-
:desc
|
44
|
-
desc
|
56
|
+
:desc => 'A different folder other than the current working directory.'
|
57
|
+
desc 'pull_kp_server_war version', 'Pulls Kill Pay server war from Sonatype and places it on your machine.'
|
45
58
|
def pull_kp_server_war(version='LATEST')
|
46
|
-
response = KillbillServerArtifact.pull(
|
59
|
+
response = KillbillServerArtifact.pull(logger,
|
60
|
+
KillbillServerArtifact::KILLBILL_GROUP_ID,
|
61
|
+
KillbillServerArtifact::KILLPAY_ARTIFACT_ID,
|
62
|
+
KillbillServerArtifact::KILLPAY_PACKAGING,
|
63
|
+
KillbillServerArtifact::KILLPAY_CLASSIFIER,
|
64
|
+
version,
|
65
|
+
options[:destination],
|
66
|
+
options[:overrides],
|
67
|
+
options[:ssl_verify])
|
47
68
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
48
69
|
end
|
49
70
|
|
50
|
-
desc
|
71
|
+
desc 'search_for_kp_server', 'Searches for all versions of Kill Pay server and prints them to the screen.'
|
51
72
|
def search_for_kp_server
|
52
|
-
say "Available versions: #{KillbillServerArtifact.versions(
|
73
|
+
say "Available versions: #{KillbillServerArtifact.versions(KillbillServerArtifact::KILLPAY_ARTIFACT_ID,
|
74
|
+
KillbillServerArtifact::KILLPAY_PACKAGING,
|
75
|
+
KillbillServerArtifact::KILLPAY_CLASSIFIER,
|
76
|
+
options[:overrides],
|
77
|
+
options[:ssl_verify]).to_a.join(', ')}", :green
|
53
78
|
end
|
54
79
|
|
55
80
|
method_option :destination,
|
56
|
-
:type
|
81
|
+
:type => :string,
|
57
82
|
:default => nil,
|
58
|
-
:desc
|
59
|
-
desc
|
83
|
+
:desc => 'A different folder other than the current working directory.'
|
84
|
+
desc 'pull_java_plugin artifact_id', 'Pulls a java plugin from Sonatype and places it on your machine.'
|
60
85
|
def pull_java_plugin(artifact_id, version='LATEST')
|
61
|
-
response = KillbillPluginArtifact.pull(
|
86
|
+
response = KillbillPluginArtifact.pull(logger,
|
87
|
+
KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID,
|
88
|
+
artifact_id,
|
89
|
+
KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING,
|
90
|
+
KillbillPluginArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER,
|
91
|
+
version,
|
92
|
+
options[:destination],
|
93
|
+
options[:overrides],
|
94
|
+
options[:ssl_verify])
|
62
95
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
63
96
|
end
|
64
97
|
|
65
98
|
method_option :destination,
|
66
|
-
:type
|
99
|
+
:type => :string,
|
67
100
|
:default => nil,
|
68
|
-
:desc
|
69
|
-
desc
|
101
|
+
:desc => 'A different folder other than the current working directory.'
|
102
|
+
desc 'pull_ruby_plugin artifact_id', 'Pulls a ruby plugin from Sonatype and places it on your machine.'
|
70
103
|
def pull_ruby_plugin(artifact_id, version='LATEST')
|
71
|
-
response = KillbillPluginArtifact.pull(
|
104
|
+
response = KillbillPluginArtifact.pull(logger,
|
105
|
+
KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID,
|
106
|
+
artifact_id,
|
107
|
+
KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING,
|
108
|
+
KillbillPluginArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER,
|
109
|
+
version,
|
110
|
+
options[:destination],
|
111
|
+
options[:overrides],
|
112
|
+
options[:ssl_verify])
|
72
113
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
73
114
|
end
|
74
115
|
|
75
|
-
desc
|
116
|
+
desc 'search_for_plugins', 'Searches for all available plugins and prints them to the screen.'
|
76
117
|
def search_for_plugins
|
77
118
|
all_plugins = KillbillPluginArtifact.versions(options[:overrides], options[:ssl_verify])
|
78
119
|
|
@@ -88,19 +129,35 @@ module KPM
|
|
88
129
|
end
|
89
130
|
|
90
131
|
method_option :destination,
|
91
|
-
:type
|
132
|
+
:type => :string,
|
92
133
|
:default => nil,
|
93
|
-
:desc
|
94
|
-
desc
|
134
|
+
:desc => 'A different folder other than the current working directory.'
|
135
|
+
desc 'pull_kaui_war version', 'Pulls Kaui war from Sonatype and places it on your machine.'
|
95
136
|
def pull_kaui_war(version='LATEST')
|
96
|
-
response = KauiArtifact.pull(
|
137
|
+
response = KauiArtifact.pull(logger,
|
138
|
+
KauiArtifact::KAUI_GROUP_ID,
|
139
|
+
KauiArtifact::KAUI_ARTIFACT_ID,
|
140
|
+
KauiArtifact::KAUI_PACKAGING,
|
141
|
+
KauiArtifact::KAUI_CLASSIFIER,
|
142
|
+
version,
|
143
|
+
options[:destination],
|
144
|
+
options[:overrides],
|
145
|
+
options[:ssl_verify])
|
97
146
|
say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
|
98
147
|
end
|
99
148
|
|
100
|
-
desc
|
149
|
+
desc 'search_for_kaui', 'Searches for all versions of Kaui and prints them to the screen.'
|
101
150
|
def search_for_kaui
|
102
151
|
say "Available versions: #{KauiArtifact.versions(options[:overrides], options[:ssl_verify]).to_a.join(', ')}", :green
|
103
152
|
end
|
153
|
+
|
154
|
+
private
|
155
|
+
|
156
|
+
def logger
|
157
|
+
logger = ::Logger.new(STDOUT)
|
158
|
+
logger.level = Logger::INFO
|
159
|
+
logger
|
160
|
+
end
|
104
161
|
end
|
105
162
|
end
|
106
163
|
end
|
data/lib/kpm/version.rb
CHANGED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe KPM::BaseArtifact do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@logger = Logger.new(STDOUT)
|
7
|
+
@logger.level = Logger::INFO
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be able to download and verify regular artifacts' do
|
11
|
+
Dir.mktmpdir do |dir|
|
12
|
+
test_download dir, 'foo-oss.pom.xml'
|
13
|
+
end
|
14
|
+
|
15
|
+
Dir.mktmpdir do |dir|
|
16
|
+
test_download dir
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# This test makes sure the top level directory is correctly skipped
|
21
|
+
it 'should be able to download and verify .tar.gz ruby artifacts' do
|
22
|
+
# Use the payment-test-plugin as a test, as it is fairly small (2.5M)
|
23
|
+
group_id = 'org.kill-bill.billing.plugin.ruby'
|
24
|
+
artifact_id = 'payment-test-plugin'
|
25
|
+
packaging = 'tar.gz'
|
26
|
+
classifier = nil
|
27
|
+
version = '1.8.7'
|
28
|
+
|
29
|
+
Dir.mktmpdir do |dir|
|
30
|
+
info = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, dir)
|
31
|
+
info[:file_name].should be_nil
|
32
|
+
|
33
|
+
files_in_dir = Dir[info[:file_path] + '/*']
|
34
|
+
files_in_dir.size.should == 1
|
35
|
+
files_in_dir[0].should == info[:file_path] + '/killbill-payment-test'
|
36
|
+
|
37
|
+
File.read(info[:file_path] + '/killbill-payment-test/1.8.7/killbill.properties').should == "mainClass=PaymentTest::PaymentPlugin\nrequire=payment_test\npluginType=PAYMENT\n"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should be able to download and verify generic .tar.gz artifacts' do
|
42
|
+
# The artifact is not small unfortunately (23.7M)
|
43
|
+
group_id = 'org.kill-bill.billing'
|
44
|
+
artifact_id = 'killbill-osgi-bundles-defaultbundles'
|
45
|
+
packaging = 'tar.gz'
|
46
|
+
classifier = nil
|
47
|
+
version = '0.11.3'
|
48
|
+
|
49
|
+
Dir.mktmpdir do |dir|
|
50
|
+
info = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, version, dir)
|
51
|
+
info[:file_name].should be_nil
|
52
|
+
|
53
|
+
files_in_dir = Dir[info[:file_path] + '/*']
|
54
|
+
files_in_dir.size.should == 20
|
55
|
+
|
56
|
+
File.file?(info[:file_path] + '/killbill-osgi-bundles-jruby-0.11.3.jar').should be_true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_download(dir, filename=nil)
|
61
|
+
path = filename.nil? ? dir : dir + '/' + filename
|
62
|
+
info = KPM::BaseArtifact.pull(@logger, 'org.kill-bill.billing', 'killbill-oss-parent', 'pom', nil, 'LATEST', path)
|
63
|
+
info[:file_name].should == (filename.nil? ? "killbill-oss-parent-#{info[:version]}.pom" : filename)
|
64
|
+
info[:size].should == File.size(info[:file_path])
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe KPM::Installer do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@logger = Logger.new(STDOUT)
|
7
|
+
@logger.level = Logger::INFO
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be able to install all artifacts' do
|
11
|
+
Dir.mktmpdir do |dir|
|
12
|
+
kb_webapp_path = dir + '/KB_ROOT.war'
|
13
|
+
kaui_webapp_path = dir + '/KAUI_ROOT.war'
|
14
|
+
plugins_dir = dir + '/bundles'
|
15
|
+
installer = KPM::Installer.new({
|
16
|
+
'killbill' => {
|
17
|
+
'webapp_path' => kb_webapp_path,
|
18
|
+
'plugins_dir' => plugins_dir,
|
19
|
+
'plugins' => {
|
20
|
+
'java' => [{
|
21
|
+
'name' => 'analytics-plugin',
|
22
|
+
'version' => '0.7.1'
|
23
|
+
}],
|
24
|
+
'ruby' => [{
|
25
|
+
'name' => 'payment-test-plugin',
|
26
|
+
'version' => '1.8.7'
|
27
|
+
}]
|
28
|
+
},
|
29
|
+
},
|
30
|
+
'kaui' => {
|
31
|
+
'webapp_path' => kaui_webapp_path
|
32
|
+
}
|
33
|
+
|
34
|
+
},
|
35
|
+
@logger)
|
36
|
+
|
37
|
+
installer.install
|
38
|
+
|
39
|
+
[
|
40
|
+
plugins_dir,
|
41
|
+
plugins_dir + '/platform',
|
42
|
+
plugins_dir + '/plugins',
|
43
|
+
plugins_dir + '/plugins/java',
|
44
|
+
plugins_dir + '/plugins/java/analytics-plugin',
|
45
|
+
plugins_dir + '/plugins/java/analytics-plugin/0.7.1',
|
46
|
+
plugins_dir + '/plugins/ruby',
|
47
|
+
plugins_dir + '/plugins/ruby/killbill-payment-test',
|
48
|
+
plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7'
|
49
|
+
].each do |dir|
|
50
|
+
File.directory?(dir).should be_true
|
51
|
+
end
|
52
|
+
|
53
|
+
[
|
54
|
+
kb_webapp_path,
|
55
|
+
kaui_webapp_path,
|
56
|
+
plugins_dir + '/platform/jruby.jar',
|
57
|
+
plugins_dir + '/plugins/java/analytics-plugin/0.7.1/analytics-plugin-0.7.1.jar',
|
58
|
+
plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7/killbill.properties'
|
59
|
+
].each do |file|
|
60
|
+
File.file?(file).should be_true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe KPM::KillbillPluginArtifact do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@logger = Logger.new(STDOUT)
|
7
|
+
@logger.level = Logger::INFO
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be able to download and verify artifacts' do
|
11
|
+
Dir.mktmpdir do |dir|
|
12
|
+
info = KPM::KauiArtifact.pull(@logger,
|
13
|
+
KPM::BaseArtifact::KAUI_GROUP_ID,
|
14
|
+
KPM::BaseArtifact::KAUI_ARTIFACT_ID,
|
15
|
+
KPM::BaseArtifact::KAUI_PACKAGING,
|
16
|
+
KPM::BaseArtifact::KAUI_CLASSIFIER,
|
17
|
+
'LATEST',
|
18
|
+
dir)
|
19
|
+
info[:file_name].should == "kaui-standalone-#{info[:version]}.war"
|
20
|
+
info[:size].should == File.size(info[:file_path])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should be able to list versions' do
|
25
|
+
versions = KPM::KauiArtifact.versions.to_a
|
26
|
+
versions.size.should >= 2
|
27
|
+
versions[0].should == '0.0.1'
|
28
|
+
versions[1].should == '0.0.2'
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe KPM::KillbillPluginArtifact do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@logger = Logger.new(STDOUT)
|
7
|
+
@logger.level = Logger::INFO
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be able to download and verify artifacts' do
|
11
|
+
Dir.mktmpdir do |dir|
|
12
|
+
info = KPM::KillbillPluginArtifact.pull(@logger,
|
13
|
+
KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID,
|
14
|
+
'analytics-plugin',
|
15
|
+
KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING,
|
16
|
+
KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER,
|
17
|
+
'LATEST',
|
18
|
+
dir)
|
19
|
+
info[:file_name].should == "analytics-plugin-#{info[:version]}.jar"
|
20
|
+
info[:size].should == File.size(info[:file_path])
|
21
|
+
end
|
22
|
+
|
23
|
+
Dir.mktmpdir do |dir|
|
24
|
+
info = KPM::KillbillPluginArtifact.pull(@logger,
|
25
|
+
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID,
|
26
|
+
'logging-plugin',
|
27
|
+
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING,
|
28
|
+
KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER,
|
29
|
+
'LATEST',
|
30
|
+
dir)
|
31
|
+
|
32
|
+
# No file name - since we untar'ed it
|
33
|
+
info[:file_name].should be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should be able to list versions' do
|
38
|
+
versions = KPM::KillbillPluginArtifact.versions
|
39
|
+
|
40
|
+
versions[:java].should_not be_nil
|
41
|
+
versions[:java]['analytics-plugin'].should_not be_nil
|
42
|
+
logging_plugin_versions = versions[:java]['analytics-plugin'].to_a
|
43
|
+
logging_plugin_versions.size.should >= 3
|
44
|
+
logging_plugin_versions[0].should == '0.6.0'
|
45
|
+
logging_plugin_versions[1].should == '0.7.0'
|
46
|
+
logging_plugin_versions[2].should == '0.7.1'
|
47
|
+
|
48
|
+
versions[:ruby].should_not be_nil
|
49
|
+
versions[:ruby]['logging-plugin'].should_not be_nil
|
50
|
+
logging_plugin_versions = versions[:ruby]['logging-plugin'].to_a
|
51
|
+
logging_plugin_versions.size.should >= 1
|
52
|
+
logging_plugin_versions[0].should == '1.7.0'
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe KPM::KillbillServerArtifact do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@logger = Logger.new(STDOUT)
|
7
|
+
@logger.level = Logger::INFO
|
8
|
+
end
|
9
|
+
|
10
|
+
# Takes about 7 minutes...
|
11
|
+
it 'should be able to download and verify artifacts' do
|
12
|
+
Dir.mktmpdir do |dir|
|
13
|
+
info = KPM::KillbillServerArtifact.pull(@logger,
|
14
|
+
KPM::BaseArtifact::KILLBILL_GROUP_ID,
|
15
|
+
KPM::BaseArtifact::KILLBILL_ARTIFACT_ID,
|
16
|
+
KPM::BaseArtifact::KILLBILL_PACKAGING,
|
17
|
+
KPM::BaseArtifact::KILLBILL_CLASSIFIER,
|
18
|
+
'LATEST',
|
19
|
+
dir)
|
20
|
+
info[:file_name].should == "killbill-profiles-killbill-#{info[:version]}-jar-with-dependencies.war"
|
21
|
+
info[:size].should == File.size(info[:file_path])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should be able to list versions' do
|
26
|
+
versions = KPM::KillbillServerArtifact.versions(KPM::BaseArtifact::KILLBILL_ARTIFACT_ID).to_a
|
27
|
+
versions.size.should >= 2
|
28
|
+
versions[0].should == '0.11.5'
|
29
|
+
versions[1].should == '0.11.6'
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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: 2014-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -104,6 +104,12 @@ files:
|
|
104
104
|
- lib/kpm/tasks.rb
|
105
105
|
- lib/kpm/utils.rb
|
106
106
|
- lib/kpm/version.rb
|
107
|
+
- spec/kpm/remote/base_artifact_spec.rb
|
108
|
+
- spec/kpm/remote/installer_spec.rb
|
109
|
+
- spec/kpm/remote/kaui_artifact_spec.rb
|
110
|
+
- spec/kpm/remote/killbill_plugin_artifact_spec.rb
|
111
|
+
- spec/kpm/remote/killbill_server_artifact_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
107
113
|
homepage: http://kill-bill.org
|
108
114
|
licenses:
|
109
115
|
- Apache License (2.0)
|
@@ -130,4 +136,10 @@ rubygems_version: 2.2.2
|
|
130
136
|
signing_key:
|
131
137
|
specification_version: 4
|
132
138
|
summary: Kill Bill package manager.
|
133
|
-
test_files:
|
139
|
+
test_files:
|
140
|
+
- spec/kpm/remote/base_artifact_spec.rb
|
141
|
+
- spec/kpm/remote/installer_spec.rb
|
142
|
+
- spec/kpm/remote/kaui_artifact_spec.rb
|
143
|
+
- spec/kpm/remote/killbill_plugin_artifact_spec.rb
|
144
|
+
- spec/kpm/remote/killbill_server_artifact_spec.rb
|
145
|
+
- spec/spec_helper.rb
|