Sha256: 6671fe7edd9c59a8d1347e4ea60a749631a648a5a3ec46f5ff56df57e4c6913a

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

module KVM
  module Artifact
    def self.parse_name(name, dist = "bin")
      results = name.scan(/([[:alpha:]]+)-([[:alnum:]\.]+)(?:-([[:alpha:]]+))?.*/)
      raise "Invalid artifact identifier #{name}" if results.length == 0
      parsed = {
        :name => name,
        :project => results[0][0],
        :version => results[0][1],
        :dist => results[0][2]
      }
      parsed[:dist] = dist unless parsed[:project] == "kfs" # kfs only has a single distribution
      parsed
    end
    
    def self.to_name(info)
      [ info[:project], info[:version], info[:dist] ].join('-')
    end

    def self.filename(info, ext)
      [ dirname(info), ext ].join(".")
    end

    def self.dirname(info)
      to_name(info)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kvm-0.0.1.pre lib/kvm/artifact.rb