class Jars::Installer::Dependency
def self.new(line)
def self.new(line) super if /:jar:|:pom:/.match?(line) end
def initialize(line)
def initialize(line) # remove ANSI escape sequences and module section (https://issues.apache.org/jira/browse/MDEP-974) line = line.gsub(/\e\[\d*m/, '') line = line.gsub(/ -- module.*/, '') setup_type(line) line.strip! @coord = line.sub(/:[^:]+:([A-Z]:\\)?[^:]+$/, EMPTY) first, second = @coord.split(/:#{type}:/) group_id, artifact_id = first.split(':') parts = group_id.split('.') parts << artifact_id parts << second.split(':')[-1] @file = line.slice(@coord.length, line.length).sub(REG, EMPTY).strip last = @file.reverse.index(%r{\\|/}) parts << line[-last..] @path = File.join(parts).strip setup_scope(line) @system = !line.index(':system:').nil? @gav = @coord.sub(REG, ':') end
def setup_scope(line)
def setup_scope(line) @scope = case line when /:provided:/ :provided when /:test:/ :test else :runtime end end
def setup_type(line)
def setup_type(line) if line.index(':pom:') @type = :pom elsif line.index(':jar:') @type = :jar end end
def system?
def system? @system end