class Rake::Delphi::Git
Public Class Methods
version()
click to toggle source
# File lib/rake/common/git.rb, line 10 def self.version null = Rake.cygwin? ? '/dev/null' : 'nul' r = `git rev-parse 1>#{null} 2>&1 && git describe --abbrev=1 2>#{null}` # trim r.chomp! unless r.to_s.empty? # add ".0" for exact version (like v3.0.43) # example: v3.0.43-5-g3952dc # take text before '-g' r << '.0' r = r.split('-g')[0] # remove any non-digits in the beginning # remove any alpha-characters r.gsub!(/^\D+|[a-zA-Z]+/, '') # replace any non-digits with dots r.gsub!(/\D/, '.') end end