Sha256: 3fc3a2182a0b832d3603c24571057f9cb8d7df718e97f502168efc03b4fdcb44
Contents?: true
Size: 923 Bytes
Versions: 1
Compression:
Stored size: 923 Bytes
Contents
#!/usr/bin/env ruby # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) CONSTANT = "DTAS::VERSION" RVF = "lib/dtas/version.rb" DEF_VER = "v0.3.0" vn = DEF_VER # First see if there is a version file (included in release tarballs), # then try git-describe, then default. if File.exist?(".git") describe = `git describe --abbrev=4 HEAD 2>/dev/null`.strip case describe when /\Av[0-9]*/ vn = describe system(*%w(git update-index -q --refresh)) unless `git diff-index --name-only HEAD --`.chomp.empty? vn << "-dirty" end vn.tr!('-', '.') end end vn = vn.sub!(/\Av/, "") new_ruby_version = "#{CONSTANT} = '#{vn}' # :nodoc:\n" cur_ruby_version = File.read(RVF) rescue nil if new_ruby_version != cur_ruby_version File.open(RVF, "w") { |fp| fp.write(new_ruby_version) } end puts vn if $0 == __FILE__
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dtas-0.3.0 | GIT-VERSION-GEN |