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
|
# File 'lib/rest_framework/version.rb', line 5
def self.get_version
return @_version if @_version
begin
version = `git describe`.strip
raise "blank version" if version.nil? || version.match(/^\w*$/)
changes = `git status --porcelain`
version << '.localchanges' if changes.strip.length > 0
return version
rescue
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
|