A class tha helps dealing with RPM version numbers
# File lib/boxgrinder-build/helpers/linux-helper.rb, line 36 def compare(v1, v2) s1 = split(v1) s2 = split(v2) for i in (0..s1.size-1) cmp = (s1[i].to_i <=> s2[i].to_i) return cmp unless cmp == 0 end 0 end
Returns newest version from the array
# File lib/boxgrinder-build/helpers/linux-helper.rb, line 50 def newest(versions) versions.sort { |x,y| compare(x,y) }.last end
# File lib/boxgrinder-build/helpers/linux-helper.rb, line 26 def split(version) version_array = [] version.split('-').each do |v| v.split('.').each { |nb| version_array << nb } end version_array end