rely on SO_KEEPALIVE for upload timeouts
[ruby-mogilefs-client.git] / GIT-VERSION-GEN
blob2cc76f057ffc609a53454df863ddb5a0f1bc9335
1 #!/usr/bin/env ruby
2 CONSTANT = "MogileFS::VERSION"
3 RVF = "lib/mogilefs/version.rb"
4 DEF_VER = "v3.0.0"
5 vn = DEF_VER
7 # First see if there is a version file (included in release tarballs),
8 # then try git-describe, then default.
9 if File.exist?(".git")
10 describe = `git describe --abbrev=4 HEAD 2>/dev/null`.strip
11 case describe
12 when /\Av[0-9]*/
13 vn = describe
14 system(*%w(git update-index -q --refresh))
15 unless `git diff-index --name-only HEAD --`.chomp.empty?
16 vn << "-dirty"
17 end
18 vn.tr!('-', '.')
19 end
20 end
22 vn = vn.sub!(/\Av/, "")
23 new_ruby_version = "#{CONSTANT} = '#{vn}'\n"
24 cur_ruby_version = File.read(RVF) rescue nil
25 if new_ruby_version != cur_ruby_version
26 File.open(RVF, "w") { |fp| fp.write(new_ruby_version) }
27 end
28 puts vn if $0 == __FILE__