mogilefs-client.git  about / heads / tags
MogileFS client library for Ruby
blob 4bfa6d96890cef62b4133857d75cf8160ac6a697 775 bytes (raw)
$ git show v3.7.0:GIT-VERSION-GEN	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
#!/usr/bin/env ruby
CONSTANT = "MogileFS::VERSION"
RVF = "lib/mogilefs/version.rb"
DEF_VER = "v3.7.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}'\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__

git clone https://yhbt.net/mogilefs-client.git