Sha256: 0263145e7ef050f77dbbc261bf1db6cb87c423c993e25a01169004a54b5139d8
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
#!/usr/bin/env ruby # Copyright (C) 2016-2019 all contributors <olddoc-public@80x24.org> # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt> # frozen_string_literal: true CONSTANT = "Olddoc::VERSION" RVF = "lib/olddoc/version.rb" GVF = "GIT-VERSION-FILE" DEF_VER = "v1.7.1" vn = DEF_VER.dup # 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}'.freeze # :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 File.chmod(0644, RVF) # generate the makefile snippet new_make_version = "VERSION = #{vn}\n" cur_make_version = File.read(GVF) rescue nil if new_make_version != cur_make_version File.open(GVF, "w") { |fp| fp.write(new_make_version) } end File.chmod(0644, GVF) puts vn if $0 == __FILE__
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
olddoc-1.7.1 | GIT-VERSION-GEN |