Module: JBundler::MavenUtil
Instance Method Summary collapse
Instance Method Details
#to_coordinate(line) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/jbundler/maven_util.rb', line 4 def to_coordinate(line) if line =~ /^\s*(jar|pom)\s/ group_id, artifact_id, version, second_version = line.sub(/\s*[a-z]+\s+/, '').sub(/#.*/,'').gsub(/\s+/,'').gsub(/['"],/, ':').gsub(/['"]/, '').split(/:/) mversion = second_version ? to_version(version, second_version) : to_version(version) extension = line.strip.sub(/\s+.*/, '') "#{group_id}:#{artifact_id}:#{extension}:#{mversion}" end end |
#to_version(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jbundler/maven_util.rb', line 14 def to_version(*args) if args.size == 0 || (args.size == 1 && args[0].nil?) "[0,)" else low, high = convert(args[0]) low, high = convert(args[1], low, high) if args[1] =~ /[=~><]/ if low == high low else "#{low || '[0'},#{high || ')'}" end end end |