kpm 0.0.15 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f98562e91b2bb5a44b0d93bcaa886991bf09e0fd
4
- data.tar.gz: 0d539a26c054a22aa1c13b8146bc13f642b346e2
3
+ metadata.gz: cfdf51795bb3bfc5198c442337ecd902616e357c
4
+ data.tar.gz: 5221a817f4b30fc91fa9214c582136d5f00e7532
5
5
  SHA512:
6
- metadata.gz: a1acc6025cfdec57db5b56f6267fa14f7a62ec86cfc2ed9b7be88a42c3786d4ad2f572f6d74277259507ee7323dc4e3ab944230f8e32201bccf770ff26e000a5
7
- data.tar.gz: e6881c699c95ff89b0303f032954ca9bb315f272d5c5e79c0d9ae879165030381d613e61cba295b1a21a72bb3d40b99816c231b2e56209a72207d9c0f1465246
6
+ metadata.gz: 3995b7421e68b14b4e932e27833202f49dc503433536a314a7a72d26b24b021b8dce192ce3fca680ac36a088cfe6eec04dd45e93ebdf74a4344f68c69eb4f287
7
+ data.tar.gz: 4087053ae2f9ce4673e8dfa3635331613242e8328bd98edb353c60a0d112806510971324e6b4572320ae2ec934a3c60a2361fb3df3ba7632d494c4edad905046
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # KPM: the Kill Bill Package Manager
2
2
 
3
- The goal of KPM is to facilitate the installation of Kill Bill and its plugins.
3
+ The goal of KPM is to facilitate the installation of Kill Bill, its plugins and Kaui.
4
4
 
5
5
  kpm can be used interactively to search and download individual artifacts (Kill Bill war, plugins, etc.) or to perform an automatic Kill Bill installation using a configuration file.
6
6
 
@@ -12,55 +12,76 @@ Ruby 2.1+ or JRuby 1.7.11+ is recommended.
12
12
 
13
13
  ## Quick start
14
14
 
15
- Create a kpm.yml file as follows:
15
+ The following commands
16
+
17
+ mkdir killbill
18
+ cd killbill
19
+ kpm install
20
+
21
+ will setup Kill Bill and Kaui, i.e.:
22
+
23
+ * Tomcat (open-source Java web server) is setup in the `killbill` directory
24
+ * The Kill Bill application (war) is installed in the `killbill/webapps` directory
25
+ * The Kill Bill UI (Kaui war) is installed in the `killbill/webapps` directory
26
+ * Default plugins are installed in the `/var/tmp/bundles` directory, among them:
27
+ * `jruby.jar`, required to run Ruby plugins
28
+ * the [KPM plugin](https://github.com/killbill/killbill-kpm-plugin), required to (un-)install plugins at runtime
29
+
30
+ To start Kill Bill, simply run
31
+
32
+ ./bin/catalina.sh run
33
+
34
+ You can then verify Kill Bill is running by going to http://127.0.0.1:8080/kaui.
35
+
36
+ ## Configuration
37
+
38
+ You can configure the installation process using a kpm.yml file.
39
+
40
+ For example:
16
41
 
17
42
  killbill:
18
- version: 0.12.1
19
- webapp_path: /opt/tomcat/webapps/ROOT
20
- plugins_dir: /var/tmp/bundles
43
+ version: 0.14.0
21
44
  plugins:
22
45
  java:
23
- - name: analytics-plugin
24
- version: 0.7.2
46
+ - name: analytics
25
47
  ruby:
26
- - name: stripe-plugin
27
- version: 0.2.1
28
- kaui:
29
- version: LATEST
30
- webapp_path: /opt/tomcat/webapps/kaui
48
+ - name: stripe
31
49
 
32
50
  This instructs kpm to:
33
- * Download the Kill Bill war (version 0.12.1) and install it as `/opt/tomcat/webapps/ROOT`
34
- * Setup the Analytics (Java) plugin (version 0.7.2) and the Stripe (Ruby) plugin (version 0.2.1) under `/var/tmp/bundles`
35
- * Download the latest Kaui war and install it as `/opt/tomcat/webapps/kaui`
51
+
52
+ * Download Kill Bill version 0.14.0
53
+ * Setup the Analytics (Java) plugin and the Stripe (Ruby) plugin
36
54
 
37
55
  To start the installation:
38
56
 
39
57
  kpm install kpm.yml
40
58
 
41
- To help you with discovery of plugins, you can run
59
+ Common configuration options:
42
60
 
43
- kpm search_for_plugins
61
+ * `jvm`: JVM properties
62
+ * `killbill`: Kill Bill properties
63
+ * `plugins_dir`: OSGI bundles and plugins base directory
64
+ * `webapp_path`: path for the Kill Bill war (if specified, Tomcat isn't downloaded)
44
65
 
45
- This will list available (official) plugins. We maintain a list of recommended versions to use at https://github.com/killbill/killbill-cloud/blob/master/kpm/lib/kpm/plugins_directory.yml.
66
+ There are many more options you can specify. Take a look at the configuration file used in the [Docker](https://github.com/killbill/killbill-cloud/blob/master/docker/templates/killbill/latest/kpm.yml.erb) image for example.
46
67
 
47
68
  ## Internals and Advanced Commands
48
69
 
49
-
50
70
  ### Caching
51
71
 
52
72
  KPM relies on the kpm.yml file to know what to install, and as it installs the pieces it keeps track of what was installed so that if it is invoked again, it does not download again the same binaries:
53
- * For the kilbill artifact itself, kpm will first extract the sha1 from the remote repository and compare with the cuurent sha1 installed under the default `webapp_path`; if those are the same, the file is not downloaded again.
73
+
74
+ * For the Kill Bill artifact itself, kpm will first extract the sha1 from the remote repository and compare with the current sha1 installed under the default `webapp_path`; if those are the same, the file is not downloaded again.
54
75
  * For the plugins, since those are downloaded as an archive (*.tgz) and then decompressed/expanded, kpm will use an internal file, `<plugins_dir>/sha1.yml` to keep track of the sha1 archive. If there is an entry and the sha1 matches, then the file is not downloaded again.
55
76
 
56
77
  Note that you can override that behavior with the `--force-download` switch.
57
78
 
58
79
  ### Custom Downloads
59
80
 
60
- Note that you can also download specific versions/artifacts directly with the followinhg commands -- bypassing the kpm.yml file:
81
+ Note that you can also download specific versions/artifacts directly with the following commands -- bypassing the kpm.yml file:
82
+
61
83
  * `kpm pull_kaui_war <version>`
62
84
  * `kpm pull_kb_server_war <version>`
63
85
  * `kpm pull_ruby_plugin <artifact_id>`
64
86
 
65
87
  For more details see `kpm --help`.
66
-
data/Rakefile CHANGED
@@ -7,14 +7,20 @@ Bundler::GemHelper.install_tasks
7
7
  # Install test tasks
8
8
  require 'rspec/core/rake_task'
9
9
  namespace :test do
10
+ desc 'Run RSpec tests'
11
+ RSpec::Core::RakeTask.new do |task|
12
+ task.name = 'spec'
13
+ task.pattern = './spec/*/unit/*_spec.rb'
14
+ end
15
+
10
16
  namespace :remote do
11
17
  desc 'Run RSpec remote tests'
12
18
  RSpec::Core::RakeTask.new do |task|
13
- task.name = 'spec'
19
+ task.name = 'spec'
14
20
  task.pattern = './spec/*/remote/*_spec.rb'
15
21
  end
16
22
  end
17
23
  end
18
24
 
19
25
  # Run tests by default
20
- task :default => 'test:remote:spec'
26
+ task :default => 'test:spec'
data/lib/kpm.rb CHANGED
@@ -2,9 +2,12 @@ module KPM
2
2
  autoload :Utils, 'kpm/utils'
3
3
  autoload :BaseArtifact, 'kpm/base_artifact'
4
4
  autoload :Sha1Checker, 'kpm/sha1_checker'
5
+ autoload :TomcatManager, 'kpm/tomcat_manager'
5
6
  autoload :KillbillServerArtifact, 'kpm/killbill_server_artifact'
6
7
  autoload :KillbillPluginArtifact, 'kpm/killbill_plugin_artifact'
7
8
  autoload :KauiArtifact, 'kpm/kaui_artifact'
9
+ autoload :PluginsManager, 'kpm/plugins_manager'
10
+ autoload :BaseInstaller, 'kpm/base_installer'
8
11
  autoload :Installer, 'kpm/installer'
9
12
  autoload :Tasks, 'kpm/tasks'
10
13
  autoload :Cli, 'kpm/cli'
@@ -19,4 +22,4 @@ module KPM
19
22
  @ui ||= Thor::Shell::Color.new
20
23
  end
21
24
  end
22
- end
25
+ end
@@ -40,6 +40,10 @@ module KPM
40
40
  pull_and_put_in_place(logger, coordinates, 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
+ def pull_from_fs(logger, file_path, destination_path=nil)
44
+ pull_from_fs_and_put_in_place(logger, file_path, destination_path)
45
+ end
46
+
43
47
  def nexus_remote(overrides={}, ssl_verify=true)
44
48
  nexus_remote ||= NexusCli::RemoteFactory.create(nexus_defaults.merge(overrides || {}), ssl_verify)
45
49
  end
@@ -54,38 +58,60 @@ module KPM
54
58
  protected
55
59
 
56
60
  def pull_and_put_in_place(logger, coordinates, destination_path=nil, skip_top_dir=true, sha1_file=nil, force_download=false, verify_sha1=true, overrides={}, ssl_verify=true)
57
- destination_path = KPM::root if destination_path.nil?
61
+ # Build artifact info
62
+ artifact_info = artifact_info(coordinates, overrides, ssl_verify)
58
63
 
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)
64
+ populate_fs_info(artifact_info, destination_path)
66
65
 
67
- # Build artifact info
68
- artifact_info = artifact_info(coordinates, destination_path, overrides, ssl_verify)
66
+ # Return early if there's nothing to do
69
67
  if !force_download && skip_if_exists(artifact_info, coordinates, sha1_file)
70
- logger.info "Skipping installation of #{coordinates} to #{artifact_info[:file_path]}, file already exists"
68
+ logger.info " Skipping installation of #{coordinates} to #{artifact_info[:file_path]}, file already exists"
71
69
  artifact_info[:skipped] = true
72
70
  return artifact_info
73
71
  end
74
72
 
73
+ # Create the destination directory
74
+ FileUtils.mkdir_p(artifact_info[:dir_name])
75
+
75
76
  # Download the artifact in a temporary directory in case of failures
76
77
  Dir.mktmpdir do |tmp_destination_dir|
77
78
  logger.info " Starting download of #{coordinates} to #{tmp_destination_dir}"
78
79
 
79
- downloaded_artifact_info = pull_and_verify(logger, artifact_info[:sha1], coordinates, tmp_destination_dir, sha1_file, verify_sha1, overrides, ssl_verify)
80
+ downloaded_artifact_info = pull_and_verify(logger, artifact_info[:sha1], coordinates, tmp_destination_dir, sha1_file, verify_sha1, overrides, ssl_verify)
80
81
  if artifact_info[:is_tgz]
81
- Utils.unpack_tgz(downloaded_artifact_info[:file_path], destination_path, skip_top_dir)
82
+ artifact_info[:bundle_dir] = Utils.unpack_tgz(downloaded_artifact_info[:file_path], artifact_info[:dir_name], skip_top_dir)
82
83
  FileUtils.rm downloaded_artifact_info[:file_path]
83
84
  else
84
- FileUtils.mv downloaded_artifact_info[:file_path], destination_path
85
+ FileUtils.mv downloaded_artifact_info[:file_path], artifact_info[:file_path]
86
+ artifact_info[:bundle_dir] = artifact_info[:dir_name]
85
87
  artifact_info[:size] = downloaded_artifact_info[:size]
86
88
  end
87
- logger.info "Successful installation of #{coordinates} to #{artifact_info[:file_path]}"
89
+ logger.info "Successful installation of #{coordinates} to #{artifact_info[:bundle_dir]}"
90
+ end
91
+ artifact_info
92
+ end
93
+
94
+ # Logic similar than pull_and_put_in_place above
95
+ def pull_from_fs_and_put_in_place(logger, file_path, destination_path=nil)
96
+ artifact_info = {
97
+ :skipped => false,
98
+ :repository_path => file_path,
99
+ :is_tgz => file_path.end_with?('.tar.gz') || file_path.end_with?('.tgz')
100
+ }
101
+
102
+ populate_fs_info(artifact_info, destination_path)
103
+
104
+ # Create the destination directory
105
+ FileUtils.mkdir_p(artifact_info[:dir_name])
106
+
107
+ if artifact_info[:is_tgz]
108
+ artifact_info[:bundle_dir] = Utils.unpack_tgz(file_path, artifact_info[:dir_name], true)
109
+ else
110
+ FileUtils.cp file_path, artifact_info[:dir_name]
111
+ artifact_info[:bundle_dir] = artifact_info[:dir_name]
88
112
  end
113
+ logger.info "Successful installation of #{file_path} to #{artifact_info[:bundle_dir]}"
114
+
89
115
  artifact_info
90
116
  end
91
117
 
@@ -112,33 +138,50 @@ module KPM
112
138
  local_sha1 == artifact_info[:sha1]
113
139
  end
114
140
 
141
+ def artifact_info(coordinates, overrides={}, ssl_verify=true)
142
+ info = {
143
+ :skipped => false
144
+ }
115
145
 
116
- def artifact_info(coordinates, destination_path, overrides={}, ssl_verify=true)
117
-
118
- info = {}
119
146
  nexus_info = nexus_remote(overrides, ssl_verify).get_artifact_info(coordinates)
120
147
 
121
148
  xml = REXML::Document.new(nexus_info)
122
- repository_path = xml.elements['//repositoryPath'].text unless xml.elements['//repositoryPath'].nil?
123
- sha1 = xml.elements['//sha1'].text unless xml.elements['//sha1'].nil?
124
- version = xml.elements['//version'].text unless xml.elements['//version'].nil?
125
-
126
- info[:sha1] = sha1
127
- info[:version] = version
128
- info[:is_tgz] = repository_path.end_with?('.tar.gz') || repository_path.end_with?('.tgz')
129
- if File.directory?(destination_path) && !info[:is_tgz]
130
- destination = File.join(File.expand_path(destination_path), File.basename(repository_path))
131
- info[:file_name] = File.basename(repository_path)
149
+ info[:sha1] = xml.elements['//sha1'].text unless xml.elements['//sha1'].nil?
150
+ info[:version] = xml.elements['//version'].text unless xml.elements['//version'].nil?
151
+ info[:repository_path] = xml.elements['//repositoryPath'].text unless xml.elements['//repositoryPath'].nil?
152
+ info[:is_tgz] = info[:repository_path].end_with?('.tar.gz') || info[:repository_path].end_with?('.tgz')
153
+
154
+ info
155
+ end
156
+
157
+ def update_destination_path(info, destination_path)
158
+ # In case LATEST was specified, use the actual version as the directory name
159
+ destination_path = KPM::root if destination_path.nil?
160
+ plugin_dir, version_dir = File.split(destination_path)
161
+ destination_path = Pathname.new(plugin_dir).join(info[:version]).to_s if version_dir == 'LATEST' && !info[:version].nil?
162
+ destination_path
163
+ end
164
+
165
+ def populate_fs_info(info, destination_path)
166
+ destination_path = update_destination_path(info, destination_path)
167
+
168
+ if path_looks_like_a_directory(destination_path) && !info[:is_tgz]
169
+ info[:dir_name] = File.expand_path(destination_path)
170
+ info[:file_name] = File.basename(info[:repository_path])
171
+ info[:file_path] = File.expand_path(File.join(info[:dir_name], File.basename(info[:repository_path])))
132
172
  else
133
173
  # The destination was a fully specified path or this is an archive and we keep the directory
134
- destination = destination_path
135
- info[:file_name] = File.basename(destination_path) if !info[:is_tgz]
174
+ if info[:is_tgz]
175
+ info[:dir_name] = File.expand_path(destination_path)
176
+ else
177
+ info[:dir_name] = File.dirname(destination_path)
178
+ info[:file_name] = File.basename(destination_path)
179
+ end
180
+ info[:file_path] = File.expand_path(destination_path)
136
181
  end
137
- info[:file_path] = File.expand_path(destination)
138
- info[:skipped] = false
139
- info
140
- end
141
182
 
183
+ destination_path
184
+ end
142
185
 
143
186
  def pull_and_verify(logger, remote_sha1, coordinates, destination_dir, sha1_file, verify_sha1, overrides={}, ssl_verify=true)
144
187
  info = nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination_dir)
@@ -0,0 +1,183 @@
1
+ require 'pathname'
2
+
3
+ module KPM
4
+ class BaseInstaller
5
+
6
+ LATEST_VERSION = 'LATEST'
7
+ SHA1_FILENAME = 'sha1.yml'
8
+ DEFAULT_BUNDLES_DIR = Pathname.new('/var').join('tmp').join('bundles').to_s
9
+
10
+ def initialize(logger, nexus_config, nexus_ssl_verify)
11
+ @logger = logger
12
+ @nexus_config = nexus_config
13
+ @nexus_ssl_verify = nexus_ssl_verify
14
+ end
15
+
16
+ def install_killbill_server(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, force_download=false, verify_sha1=true)
17
+ group_id = specified_group_id || KPM::BaseArtifact::KILLBILL_GROUP_ID
18
+ artifact_id = specified_artifact_id || KPM::BaseArtifact::KILLBILL_ARTIFACT_ID
19
+ packaging = specified_packaging || KPM::BaseArtifact::KILLBILL_PACKAGING
20
+ classifier = specified_classifier || KPM::BaseArtifact::KILLBILL_CLASSIFIER
21
+ version = specified_version || LATEST_VERSION
22
+ webapp_path = specified_webapp_path || KPM::root
23
+
24
+ @logger.debug("Installing Kill Bill server: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} webapp_path=#{webapp_path}")
25
+ KPM::KillbillServerArtifact.pull(@logger,
26
+ group_id,
27
+ artifact_id,
28
+ packaging,
29
+ classifier,
30
+ version,
31
+ webapp_path,
32
+ nil,
33
+ force_download,
34
+ verify_sha1,
35
+ @nexus_config,
36
+ @nexus_ssl_verify)
37
+ end
38
+
39
+ def install_kaui(specified_group_id=nil, specified_artifact_id=nil, specified_packaging=nil, specified_classifier=nil, specified_version=nil, specified_webapp_path=nil, force_download=false, verify_sha1=true)
40
+ group_id = specified_group_id || KPM::BaseArtifact::KAUI_GROUP_ID
41
+ artifact_id = specified_artifact_id || KPM::BaseArtifact::KAUI_ARTIFACT_ID
42
+ packaging = specified_packaging || KPM::BaseArtifact::KAUI_PACKAGING
43
+ classifier = specified_classifier || KPM::BaseArtifact::KAUI_CLASSIFIER
44
+ version = specified_version || LATEST_VERSION
45
+ webapp_path = specified_webapp_path || KPM::root
46
+
47
+ @logger.debug("Installing Kaui: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} webapp_path=#{webapp_path}")
48
+ KPM::KauiArtifact.pull(@logger,
49
+ group_id,
50
+ artifact_id,
51
+ packaging,
52
+ classifier,
53
+ version,
54
+ webapp_path,
55
+ nil,
56
+ force_download,
57
+ verify_sha1,
58
+ @nexus_config,
59
+ @nexus_ssl_verify)
60
+ end
61
+
62
+ def install_plugin(specified_group_id, specified_artifact_id, specified_packaging=nil, specified_classifier=nil, specified_version=nil, bundles_dir=nil, specified_type='java', force_download=false, verify_sha1=true)
63
+ looked_up_group_id, looked_up_artifact_id, looked_up_packaging, looked_up_classifier, looked_up_version, looked_up_type = KPM::PluginsDirectory.lookup(specified_artifact_id, true)
64
+
65
+ # Specified parameters have always precedence except for the artifact_id (to map stripe to stripe-plugin)
66
+ artifact_id = looked_up_artifact_id || specified_artifact_id
67
+ if artifact_id.nil?
68
+ @logger.warn("Aborting installation: unable to lookup plugin #{specified_artifact_id}")
69
+ return nil
70
+ end
71
+
72
+ bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
73
+ plugins_dir = bundles_dir.join('plugins')
74
+
75
+ type = specified_type || looked_up_type
76
+ if type.to_s == 'java'
77
+ group_id = specified_group_id || looked_up_group_id || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID
78
+ packaging = specified_packaging || looked_up_packaging || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_PACKAGING
79
+ classifier = specified_classifier || looked_up_classifier || KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_CLASSIFIER
80
+ version = specified_version || looked_up_version || LATEST_VERSION
81
+ destination = plugins_dir.join('java').join(artifact_id).join(version)
82
+ else
83
+ group_id = specified_group_id || looked_up_group_id || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID
84
+ packaging = specified_packaging || looked_up_packaging || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_PACKAGING
85
+ classifier = specified_classifier || looked_up_classifier || KPM::BaseArtifact::KILLBILL_RUBY_PLUGIN_CLASSIFIER
86
+ version = specified_version || looked_up_version || LATEST_VERSION
87
+ destination = plugins_dir.join('ruby')
88
+ end
89
+ sha1_file = "#{bundles_dir}/#{SHA1_FILENAME}"
90
+
91
+ @logger.debug("Installing plugin: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} destination=#{destination}")
92
+ artifact_info = KPM::KillbillPluginArtifact.pull(@logger,
93
+ group_id,
94
+ artifact_id,
95
+ packaging,
96
+ classifier,
97
+ version,
98
+ destination,
99
+ sha1_file,
100
+ force_download,
101
+ verify_sha1,
102
+ @nexus_config,
103
+ @nexus_ssl_verify)
104
+
105
+ mark_as_active(plugins_dir, artifact_info, artifact_id)
106
+
107
+ artifact_info
108
+ end
109
+
110
+ def install_plugin_from_fs(file_path, name, version, bundles_dir=nil, type='java')
111
+ bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
112
+ plugins_dir = bundles_dir.join('plugins')
113
+
114
+ if type.to_s == 'java'
115
+ destination = plugins_dir.join('java').join(name).join(version)
116
+ else
117
+ destination = plugins_dir.join('ruby')
118
+ end
119
+
120
+ artifact_info = KPM::KillbillPluginArtifact.pull_from_fs(@logger, file_path, destination)
121
+ artifact_info[:version] ||= version
122
+
123
+ mark_as_active(plugins_dir, artifact_info)
124
+
125
+ artifact_info
126
+ end
127
+
128
+ def install_default_bundles(bundles_dir, specified_version=nil, kb_version=nil, force_download=false, verify_sha1=true)
129
+ group_id = 'org.kill-bill.billing'
130
+ artifact_id = 'killbill-platform-osgi-bundles-defaultbundles'
131
+ packaging = 'tar.gz'
132
+ classifier = nil
133
+
134
+ version = specified_version
135
+ if version.nil?
136
+ info = KPM::KillbillServerArtifact.info(kb_version || LATEST_VERSION, @nexus_config, @nexus_ssl_verify)
137
+ version = info['killbill-platform']
138
+ end
139
+ version ||= LATEST_VERSION
140
+
141
+ bundles_dir = Pathname.new(bundles_dir || DEFAULT_BUNDLES_DIR).expand_path
142
+ destination = bundles_dir.join('platform')
143
+ sha1_file = bundles_dir.join(SHA1_FILENAME)
144
+
145
+ @logger.debug("Installing default bundles: group_id=#{group_id} artifact_id=#{artifact_id} packaging=#{packaging} classifier=#{classifier} version=#{version} destination=#{destination}")
146
+ info = KPM::BaseArtifact.pull(@logger,
147
+ group_id,
148
+ artifact_id,
149
+ packaging,
150
+ classifier,
151
+ version,
152
+ destination,
153
+ sha1_file,
154
+ force_download,
155
+ verify_sha1,
156
+ @nexus_config,
157
+ @nexus_ssl_verify)
158
+
159
+ # The special JRuby bundle needs to be called jruby.jar
160
+ # TODO .first - code smell
161
+ unless info[:skipped]
162
+ File.rename Dir.glob("#{destination}/killbill-platform-osgi-bundles-jruby-*.jar").first, destination.join('jruby.jar')
163
+ end
164
+
165
+ info
166
+ end
167
+
168
+ private
169
+
170
+ def mark_as_active(plugins_dir, artifact_info, artifact_id=nil)
171
+ # Mark this bundle as active
172
+ plugins_manager = PluginsManager.new(plugins_dir, @logger)
173
+ if artifact_info[:bundle_dir].nil?
174
+ # In case the artifact on disk already existed and the installation is skipped,
175
+ # we don't know the plugin name on disk (arbitrary if it's a .tar.gz). That being said,
176
+ # we can guess it for Kill Bill plugins (using our naming conventions)
177
+ plugins_manager.set_active(plugins_manager.guess_plugin_name(artifact_id), artifact_info[:version])
178
+ else
179
+ plugins_manager.set_active(artifact_info[:bundle_dir])
180
+ end
181
+ end
182
+ end
183
+ end