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
29
30
31
32
33
|
# File 'lib/dev/cmd/Pull.rb', line 4
def self.execute
puts "checking dependencies in #{DEV[:directory]}"
text = File.read("#{DEV[:directory]}/rakefile.rb")
new_text = text
DEV[:dep].each {|key,value|
puts_debug "checking dep key #{key}"
if(value.has_key?(:dir) && value[:dir].include?('@'))
cmd="svn info #{value[:uri].gsub(/@[\d\w]+/,'')}"
puts_debug cmd
call=Dev::SystemCall.new(cmd)
call.puts_summary
info =call.outputnew_revision = info.match(/Last Changed Rev: (?<rev>\d+)/)[:rev]
new_dir = value[:dir].gsub(/@[\d]+/,"@#{new_revision}")
puts_debug "new_dir=#{new_dir}"
if(new_dir != value[:dir])
puts "updating from #{value[:dir]} to #{new_dir}"
new_text = new_text.gsub(value[:dir],new_dir)
end
end
}
if(text != new_text)
File.open("#{DEV[:directory]}/rakefile.rb",'w') { |f|f.write(new_text) }
end
end
|