def self.version(use_local_git=false)
if use_local_git
unless git_available?
raise RuntimeError,
"GVB.version(use_local_git=true) called, but git isn't installed"
end
sq_git_dir = shell_quoted_string(Dir.pwd)
else
sq_git_dir = shell_quoted_string((File.dirname(caller_file) rescue nil || Dir.pwd))
end
git_ver = `git -C #{sq_git_dir} describe --dirty='.1.dirty.#{Time.now.strftime("%Y%m%d.%H%M%S")}' --match='v[0-9]*.[0-9]*.*[0-9]' 2> #{DEVNULL}`.
strip.
gsub(/^v/, '').
gsub('-', '.')
return git_ver if $? == 0
system("git -C #{sq_git_dir} status > #{DEVNULL} 2>&1")
$? == 0 ? "0.0.0.1.ENOTAG" : gem_version(use_local_git)
end