class Jars::GemspecArtifacts::Artifact

def self.new(line)

def self.new(line)
  line = line.strip
  index = line.index(/\s/)
  return nil if index.nil?
  type = line[0..index].strip
  return nil unless ALLOWED_TYPES.member?(type)
  line = line[index..]
  line.gsub!(/['"]/, '')
  line.strip!
  options = {}
  line.sub!(/,\s*:exclusions\s*(:|=>)\s*(\[[^\]]+\])/) do
    options[:exclusions] = Exclusions.new(Regexp.last_match(2).strip)
    ''
  end
  line.sub!(/,\s*:([a-z]+)\s*(:|=>)\s*(:?[a-zA-Z0-9_]+)/) do
    options[Regexp.last_match(1).to_sym] = Regexp.last_match(3).sub(/^:/, '')
    ''
  end
  exclusions = nil
  line.sub!(/[,:]\s*\[(.+:.+,?\s*)+\]$/) do |a|
    exclusions = Exclusions.new(a[1..].strip)
    ''
  end
  line.strip!
  line.gsub!(/,\s*/, ':')
  if /[\[()\]]/.match?(line)
    index = line.index(/[\[(].+$/)
    version = line[index..].sub(/:/, ', ')
    line = line[0..index - 1].strip.sub(/:$/, '')
  else
    index = line.index(/:[^:]+$/)
    version = line[index + 1..]
    line = line[0..index - 1].strip
  end
  case line.count(':')
  when 2
    group_id, artifact_id, classifier = line.split(':')
  when 1
    group_id, artifact_id = line.split(':')
    classifier = nil
  else
    warn line
    return nil
  end
  super(options, type, group_id, artifact_id, classifier, version, exclusions)
end

def initialize(options, *args)

def initialize(options, *args)
  @type, @group_id, @artifact_id, @classifier, @version, @exclusions = *args
  options.each do |k, v|
    instance_variable_set(:"@#{k}", v)
  end
end

def key

def key
  args = [@group_id, @artifact_id]
  args << @classifier if @classifier
  args.join(':')
end

def to_coord

def to_coord
  args = [@group_id, @artifact_id]
  args << @classifier if @classifier
  args << @type
  args << MavenVersion.new(@version)
  args.join(':')
end

def to_coord_no_classifier

def to_coord_no_classifier
  args = [@group_id, @artifact_id]
  args << @type
  args << MavenVersion.new(@version)
  args.join(':')
end

def to_gacv

def to_gacv
  args = [@group_id, @artifact_id]
  args << @classifier if @classifier
  args << @version
  args.join(':')
end

def to_s

def to_s
  args = [@group_id, @artifact_id]
  args << @classifier if @classifier
  args << @version
  args << @exclusions.to_s if @exclusions
  "#{@type} #{group_id}:#{args[1..].join(', ')}"
end