Sha256: 7d6ae45ff025ca1a8d8c51077907e6aba7d737ff043b700b86c4e48d4e0db7cf

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

require 'rexml/document'
require 'set'

module KPM
  class KillbillPluginArtifact < BaseArtifact
    class << self
      def pull(artifact_id, version='LATEST', type=:java, destination=nil, overrides={}, ssl_verify=true)
        if type == :java
          group_id = KILLBILL_JAVA_PLUGIN_GROUP_ID
          packaging = 'jar'
        else
          group_id = KILLBILL_RUBY_PLUGIN_GROUP_ID
          packaging = 'tar.gz'
        end
        coordinates = "#{group_id}:#{artifact_id}:#{packaging}:#{version}"
        nexus_remote(overrides, ssl_verify).pull_artifact(coordinates, destination)
      end

      def versions(overrides={}, ssl_verify=true)
        plugins = { :java => {}, :ruby => {} }

        nexus = nexus_remote(overrides, ssl_verify)

        [[:java, KILLBILL_JAVA_PLUGIN_GROUP_ID], [:ruby, KILLBILL_RUBY_PLUGIN_GROUP_ID]].each do |type_and_group_id|
          response = REXML::Document.new nexus.search_for_artifacts(type_and_group_id[1])
          response.elements.each('search-results/data/artifact') do |element|
            artifact_id = element.elements['artifactId'].text
            plugins[type_and_group_id[0]][artifact_id] ||= SortedSet.new
            plugins[type_and_group_id[0]][artifact_id] << element.elements['version'].text
          end
        end

        plugins
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kpm-0.0.3 lib/kpm/killbill_plugin_artifact.rb
kpm-0.0.2 lib/kpm/killbill_plugin_artifact.rb
kpm-0.0.1 lib/kpm/killbill_plugin_artifact.rb