Sha256: 5ea648210f763045dd196dc671aa1f04a7c84dc5c966425bb4fa8be300b96090

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 KB

Contents

module KPM

  class Coordinates

    class << self

      def build_coordinates(coordinate_map)
        group_id = coordinate_map[:group_id]
        artifact_id = coordinate_map[:artifact_id]
        packaging = coordinate_map[:packaging]
        classifier = coordinate_map[:classifier]
        version = coordinate_map[:version]

        if classifier.nil?
          if version.nil?
            "#{group_id}:#{artifact_id}:#{packaging}"
          else
            "#{group_id}:#{artifact_id}:#{packaging}:#{version}"
          end
        else
          "#{group_id}:#{artifact_id}:#{packaging}:#{classifier}:#{version}"
        end
      end

      def get_coordinate_map(entry)
        parts = entry.split(':')
        length = parts.size
        if length == 3
          {:group_id => parts[0], :artifact_id => parts[1], :packaging => parts[2]}
        elsif length == 4
          {:group_id => parts[0], :artifact_id => parts[1], :packaging => parts[2], :version => parts[3]}
        elsif length == 5
          {:group_id => parts[0], :artifact_id => parts[1], :packaging => parts[2],  :classifier => parts[3], :version => parts[4]}
        end
      end

    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
kpm-0.7.2 lib/kpm/coordinates.rb
kpm-0.7.1 lib/kpm/coordinates.rb
kpm-0.7.0 lib/kpm/coordinates.rb
kpm-0.6.5 lib/kpm/coordinates.rb
kpm-0.6.4 lib/kpm/coordinates.rb
kpm-0.6.3 lib/kpm/coordinates.rb
kpm-0.6.2 lib/kpm/coordinates.rb
kpm-0.6.1 lib/kpm/coordinates.rb
kpm-0.6.0 lib/kpm/coordinates.rb
kpm-0.5.3 lib/kpm/coordinates.rb
kpm-0.5.2 lib/kpm/coordinates.rb
kpm-0.5.1 lib/kpm/coordinates.rb
kpm-0.5.0 lib/kpm/coordinates.rb
kpm-0.4.2 lib/kpm/coordinates.rb
kpm-0.4.1 lib/kpm/coordinates.rb
kpm-0.4.0 lib/kpm/coordinates.rb
kpm-0.3.0 lib/kpm/coordinates.rb
kpm-0.2.4 lib/kpm/coordinates.rb
kpm-0.2.3 lib/kpm/coordinates.rb
kpm-0.2.2 lib/kpm/coordinates.rb