kpm 0.0.3 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43e527407d6c92cbe6b794e40a664d2aaf4d50e6
4
- data.tar.gz: 05be0ce0caea3d53da35adf9a6198a1ca7b21b9d
3
+ metadata.gz: 1103e0c1045b3a4bb4d09486381b6baa0eed2d2e
4
+ data.tar.gz: 84521cc40cd90d0154678a7ebf54e3a8f823bad2
5
5
  SHA512:
6
- metadata.gz: ef5a9532ff24c1c12d8930787c40c1746719f2df58c34a6890a5faf6df76e99ee2e9051ff5666f7dfe9df1a0b71c3ef5f03037ae2d0fa93835c120bd83357bbd
7
- data.tar.gz: acc1fae6313f28e7505883dfed5348e0d7544da63b9a6a2ab94ae6de3e1ade9e157ca184e04ceada723926cd5227fc7b1e404d3feac071ed8b91ed75c76a27e3
6
+ metadata.gz: 1ff6d10b893cfac7bbe5e6040b985ac6990f00253dfa5cd64eb7fcea9e54472e5a6a74301ea93ef7613f7c878dc99548209549f9cb0c3cfbb7e26a1b424a9992
7
+ data.tar.gz: f0b01a0f7aee0395e5b1ea3122488428ef9fd5821f8fe82dd807a4711bfbafc3199db6b306d8a1881c84ec93c642c16f181cb6f83e3435b6c813bea319b8160d
@@ -2,13 +2,13 @@ require 'nexus_cli'
2
2
 
3
3
  module KPM
4
4
  class BaseArtifact
5
- class << self
6
- KILLBILL_GROUP_ID = 'org.kill-bill.billing'
7
- KILLBILL_JAVA_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.java'
8
- KILLBILL_RUBY_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.ruby'
5
+ KILLBILL_GROUP_ID = 'org.kill-bill.billing'
6
+ KILLBILL_JAVA_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.java'
7
+ KILLBILL_RUBY_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.ruby'
9
8
 
9
+ class << self
10
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}"
11
+ coordinates = build_coordinates(group_id, artifact_id, packaging, nil, version)
12
12
  nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination)
13
13
  end
14
14
 
@@ -22,6 +22,24 @@ module KPM
22
22
  repository: 'central-proxy'
23
23
  }
24
24
  end
25
+
26
+ protected
27
+
28
+ def build_coordinates(group_id, artifact_id, packaging, classifier, version=nil)
29
+ if classifier.nil?
30
+ if version.nil?
31
+ "#{group_id}:#{artifact_id}:#{packaging}"
32
+ else
33
+ "#{group_id}:#{artifact_id}:#{packaging}:#{version}"
34
+ end
35
+ else
36
+ if version.nil?
37
+ "#{group_id}:#{artifact_id}:#{packaging}:#{classifier}"
38
+ else
39
+ "#{group_id}:#{artifact_id}:#{packaging}:#{classifier}:#{version}"
40
+ end
41
+ end
42
+ end
25
43
  end
26
44
  end
27
- end
45
+ end
data/lib/kpm/installer.rb CHANGED
@@ -36,14 +36,18 @@ module KPM
36
36
  private
37
37
 
38
38
  def install_killbill_server
39
+ group_id = @config['group_id'] || BaseArtifact::KILLBILL_GROUP_ID
40
+ artifact_id = @config['artifact_id'] || KillbillServerArtifact::KILLBILL_ARTIFACT_ID
41
+ packaging = @config['packaging'] || KillbillServerArtifact::KILLBILL_PACKAGING
42
+ classifier = @config['classifier'] || KillbillServerArtifact::KILLBILL_CLASSIFIER
39
43
  version = @config['version'] || LATEST_VERSION
40
44
  webapp_path = @config['webapp_path'] || KPM::root
41
45
 
42
46
  webapp_dir = File.dirname(webapp_path)
43
47
  FileUtils.mkdir_p(webapp_dir)
44
48
 
45
- @logger.info "Installing Kill Bill server #{version} to #{webapp_path}"
46
- file = KillbillServerArtifact.pull(version, webapp_dir, @config['nexus'], @config['nexus']['ssl_verify'])
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'])
47
51
  FileUtils.mv file[:file_path], webapp_path
48
52
  end
49
53
 
@@ -6,10 +6,10 @@ module KPM
6
6
  class << self
7
7
  def pull(artifact_id, version='LATEST', type=:java, destination=nil, overrides={}, ssl_verify=true)
8
8
  if type == :java
9
- group_id = KILLBILL_JAVA_PLUGIN_GROUP_ID
9
+ group_id = BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID
10
10
  packaging = 'jar'
11
11
  else
12
- group_id = KILLBILL_RUBY_PLUGIN_GROUP_ID
12
+ group_id = BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID
13
13
  packaging = 'tar.gz'
14
14
  end
15
15
  coordinates = "#{group_id}:#{artifact_id}:#{packaging}:#{version}"
@@ -21,7 +21,7 @@ module KPM
21
21
 
22
22
  nexus = nexus_remote(overrides, ssl_verify)
23
23
 
24
- [[:java, KILLBILL_JAVA_PLUGIN_GROUP_ID], [:ruby, KILLBILL_RUBY_PLUGIN_GROUP_ID]].each do |type_and_group_id|
24
+ [[:java, BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_ID], [:ruby, BaseArtifact::KILLBILL_RUBY_PLUGIN_GROUP_ID]].each do |type_and_group_id|
25
25
  response = REXML::Document.new nexus.search_for_artifacts(type_and_group_id[1])
26
26
  response.elements.each('search-results/data/artifact') do |element|
27
27
  artifact_id = element.elements['artifactId'].text
@@ -34,4 +34,4 @@ module KPM
34
34
  end
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -3,20 +3,27 @@ require 'set'
3
3
 
4
4
  module KPM
5
5
  class KillbillServerArtifact < BaseArtifact
6
- class << self
7
- KILLBILL_SERVER_ARTIFACT_ID = 'killbill-server'
8
- KILLBILL_SERVER_WAR = "#{KILLBILL_GROUP_ID}:#{KILLBILL_SERVER_ARTIFACT_ID}:war:jar-with-dependencies"
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'
9
13
 
10
- def pull(version='LATEST', destination=nil, overrides={}, ssl_verify=true)
11
- nexus_remote(overrides, ssl_verify).pull_artifact("#{KILLBILL_SERVER_WAR}:#{version}", destination)
14
+ class << self
15
+ def pull(group_id, artifact_id, packaging=BaseArtifact::KILLBILL_PACKAGING, classifier=BaseArtifact::KILLBILL_CLASSIFIER, version='LATEST', destination=nil, overrides={}, ssl_verify=true)
16
+ coordinates = build_coordinates(group_id, artifact_id, packaging, classifier, version)
17
+ nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination)
12
18
  end
13
19
 
14
- def versions(overrides={}, ssl_verify=true)
15
- response = REXML::Document.new nexus_remote(overrides, ssl_verify).search_for_artifacts(KILLBILL_SERVER_WAR)
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)
16
23
  versions = SortedSet.new
17
24
  response.elements.each("search-results/data/artifact/version") { |element| versions << element.text }
18
25
  versions
19
26
  end
20
27
  end
21
28
  end
22
- end
29
+ end
data/lib/kpm/tasks.rb CHANGED
@@ -17,7 +17,7 @@ module KPM
17
17
  :default => true,
18
18
  :desc => "Set to false to disable SSL Verification."
19
19
 
20
- desc "install", "Install Kill Bill server and plugins according to the specified YAML configuration file."
20
+ desc "install config_file", "Install Kill Bill server and plugins according to the specified YAML configuration file."
21
21
  def install(config_file)
22
22
  Installer.from_file(config_file).install
23
23
  end
@@ -28,13 +28,28 @@ module KPM
28
28
  :desc => "A different folder other than the current working directory."
29
29
  desc "pull_kb_server_war version", "Pulls Kill Bill server war from Sonatype and places it on your machine."
30
30
  def pull_kb_server_war(version='LATEST')
31
- response = KillbillServerArtifact.pull(version, options[:destination], options[:overrides], options[:ssl_verify])
31
+ response = KillbillServerArtifact.pull(BaseArtifact::KILLBILL_GROUP_ID, KillbillServerArtifact::KILLBILL_ARTIFACT_ID, KillbillServerArtifact::KILLBILL_PACKAGING, KillbillServerArtifact::KILLBILL_CLASSIFIER, version, options[:destination], options[:overrides], options[:ssl_verify])
32
32
  say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
33
33
  end
34
34
 
35
35
  desc "search_for_kb_server", "Searches for all versions of Kill Bill server and prints them to the screen."
36
36
  def search_for_kb_server
37
- say "Available versions: #{KillbillServerArtifact.versions(options[:overrides], options[:ssl_verify]).to_a.join(', ')}", :green
37
+ say "Available versions: #{KillbillServerArtifact.versions(BaseArtifact::KILLBILL_GROUP_ID, KillbillServerArtifact::KILLBILL_ARTIFACT_ID, KillbillServerArtifact::KILLBILL_PACKAGING, KillbillServerArtifact::KILLBILL_CLASSIFIER, options[:overrides], options[:ssl_verify]).to_a.join(', ')}", :green
38
+ end
39
+
40
+ method_option :destination,
41
+ :type => :string,
42
+ :default => nil,
43
+ :desc => "A different folder other than the current working directory."
44
+ desc "pull_kp_server_war version", "Pulls Kill Pay server war from Sonatype and places it on your machine."
45
+ def pull_kp_server_war(version='LATEST')
46
+ response = KillbillServerArtifact.pull(BaseArtifact::KILLBILL_GROUP_ID, KillbillServerArtifact::KILLPAY_ARTIFACT_ID, KillbillServerArtifact::KILLPAY_PACKAGING, KillbillServerArtifact::KILLPAY_CLASSIFIER, version, options[:destination], options[:overrides], options[:ssl_verify])
47
+ say "Artifact has been retrieved and can be found at path: #{response[:file_path]}", :green
48
+ end
49
+
50
+ desc "search_for_kp_server", "Searches for all versions of Kill Pay server and prints them to the screen."
51
+ def search_for_kp_server
52
+ say "Available versions: #{KillbillServerArtifact.versions(BaseArtifact::KILLBILL_GROUP_ID, KillbillServerArtifact::KILLPAY_ARTIFACT_ID, KillbillServerArtifact::KILLPAY_PACKAGING, KillbillServerArtifact::KILLPAY_CLASSIFIER, options[:overrides], options[:ssl_verify]).to_a.join(', ')}", :green
38
53
  end
39
54
 
40
55
  method_option :destination,
@@ -89,4 +104,4 @@ module KPM
89
104
  end
90
105
  end
91
106
  end
92
- end
107
+ end
data/lib/kpm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module KPM
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
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.3
4
+ version: 0.0.4
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-04-10 00:00:00.000000000 Z
11
+ date: 2014-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline