5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/rest_framework/version.rb', line 5
def self.get_version(skip_git: false)
return @_version if @_version
unless skip_git
begin
version = `git describe 2>/dev/null`.strip
raise "blank version" if version.nil? || version.match(/^\w*$/)
changes = `git status --porcelain 2>/dev/null`
version << '.localchanges' if changes.strip.length > 0
return version
rescue
end
end
begin
version = File.read(File.expand_path("VERSION_STAMP", __dir__))
unless version.nil? || version.match(/^\w*$/)
return (@_version = version) end
rescue
end
return '0.unknown'
end
|