27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/is/build.rb', line 27
def mkbuild prefix = ''
@spec = caller[0].split(':')[0]
file = "./.#{name}.vers"
if File.exists? file
data = File.read(file)
vers = sandbox { eval(data) }
else
vers = {}
end
hash = mkhash
vx = version.to_s + '.' + prefix
if vers[vx]
current = vers[vx]
if current[:hash] != hash
current[:build] += 1
current[:hash] = hash
end
else
current = { :hash => hash, :build => 0 }
end
vers[vx] = current
File.open file, 'w' do |f|
f.puts vers.inspect
end
if current[:build] && (current[:build] != 0 || prefix != '')
self.version = vx + current[:build].to_s
end
end
|