kpm 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a964f963d2c0c0b64e07c6d64c756ff2942fb94
4
- data.tar.gz: 42429923060c944a9135b2d05607dc330c1c3b4a
3
+ metadata.gz: 3d5ca5c072ac36556d07be40f72f57095c0f9117
4
+ data.tar.gz: a86dc79c2b6560fdb6090eb5b3ffb2a23452db2d
5
5
  SHA512:
6
- metadata.gz: 73795dce14f6a0b598f47e57d940fb017dcc3976906bf069309cb661b8302b66d62e6c0aebb5ba56f38fd60b12afffe88763cd1a0f27873a376305e22e9345ea
7
- data.tar.gz: 58b38cb7b290599fd00de043c65dcbda2b5b5e9461e56dd9b04fd3affc9f50f82400d293d8fc45160f86a9d41df30fb8fd9cbdf5fa58350c1b944b2fe25d55e8
6
+ metadata.gz: 518eb5300bef6175b10e414830ed73fb339dd03d61705d6007e60aed3f0e19b6948d185706c8f79de2da653f229d880ba99adb6f993da943976eb9b1cac1d0de
7
+ data.tar.gz: e15d1dd9571d85927713032cdf1d90e0825e28eafe27653de3d39ae58782d4da12a24ababbcf8d19a80ff874a5c99a80667d13418b5e4caebcd485d3701b2c9c
@@ -7,6 +7,11 @@ module KPM
7
7
  KILLBILL_JAVA_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.java'
8
8
  KILLBILL_RUBY_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.ruby'
9
9
 
10
+ def pull(group_id, artifact_id, packaging='jar', version='LATEST', destination=nil, overrides={}, ssl_verify=true)
11
+ coordinates = "#{group_id}:#{artifact_id}:#{packaging}:#{version}"
12
+ nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination)
13
+ end
14
+
10
15
  def nexus_remote(overrides={}, ssl_verify=true)
11
16
  nexus_remote ||= NexusCli::RemoteFactory.create(nexus_defaults.merge(overrides || {}), ssl_verify)
12
17
  end
data/lib/kpm/installer.rb CHANGED
@@ -24,6 +24,7 @@ module KPM
24
24
  def install
25
25
  install_killbill_server
26
26
  install_plugins
27
+ install_default_bundles
27
28
  end
28
29
 
29
30
  private
@@ -75,9 +76,30 @@ module KPM
75
76
  @logger.info "Installing Kill Bill Ruby plugin #{artifact_id} #{version} to #{destination}"
76
77
  archive = KillbillPluginArtifact.pull(artifact_id, version, :ruby, destination, @config['nexus'], @config['nexus']['ssl_verify'])
77
78
 
78
- Utils.unpack_tgz(archive[:file_path], destination)
79
+ Utils.unpack_tgz(archive[:file_path], destination, true)
79
80
  FileUtils.rm archive[:file_path]
80
81
  end
81
82
  end
83
+
84
+ def install_default_bundles
85
+ return if @config['default_bundles'] == false
86
+
87
+ group_id = 'org.kill-bill.billing'
88
+ artifact_id = 'killbill-osgi-bundles-defaultbundles'
89
+ packaging = 'tar.gz'
90
+ version = @config['version'] || LATEST_VERSION
91
+ destination = "#{@config['plugins_dir']}/platform"
92
+
93
+ FileUtils.mkdir_p(destination)
94
+
95
+ @logger.info "Installing Kill Bill #{artifact_id} #{version} to #{destination}"
96
+ archive = BaseArtifact.pull(group_id, artifact_id, packaging, version, destination, @config['nexus'], @config['nexus']['ssl_verify'])
97
+
98
+ Utils.unpack_tgz(archive[:file_path], destination)
99
+ FileUtils.rm archive[:file_path]
100
+
101
+ # The special JRuby bundle needs to be called jruby.jar
102
+ File.rename Dir.glob("#{destination}/killbill-osgi-bundles-jruby-*.jar").first, "#{destination}/jruby.jar"
103
+ end
82
104
  end
83
- end
105
+ end
data/lib/kpm/utils.rb CHANGED
@@ -7,15 +7,15 @@ module KPM
7
7
  class << self
8
8
  TAR_LONGLINK = '././@LongLink'
9
9
 
10
- def unpack_tgz(tar_gz_archive, destination)
10
+ def unpack_tgz(tar_gz_archive, destination, skip_top_dir=false)
11
11
  Gem::Package::TarReader.new(Zlib::GzipReader.open(tar_gz_archive)) do |tar|
12
12
  dest = nil
13
13
  tar.each do |entry|
14
14
  if entry.full_name == TAR_LONGLINK
15
- dest = File.join destination, path_with_skipped_top_level_dir(entry.read.strip)
15
+ dest = File.join destination, skip_top_dir ? path_with_skipped_top_level_dir(entry.read.strip) : entry.read.strip
16
16
  next
17
17
  end
18
- dest ||= File.join destination, path_with_skipped_top_level_dir(entry.full_name)
18
+ dest ||= File.join destination, skip_top_dir ? path_with_skipped_top_level_dir(entry.full_name) : entry.full_name
19
19
 
20
20
  if entry.directory?
21
21
  File.delete dest if File.file? dest
data/lib/kpm/version.rb CHANGED
@@ -2,7 +2,7 @@ module KPM
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 1
5
+ PATCH = 2
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
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.1
4
+ version: 0.0.2
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-03-31 00:00:00.000000000 Z
11
+ date: 2014-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline