19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/shipitron/server/git/update_cache.rb', line 19
def call
if !Pathname.new('/home/shipitron/git-cache/objects').directory?
Logger.info 'Cloning the git repository'
FileUtils.cd('/home/shipitron') do
`git clone --bare #{Shellwords.escape repository_url} git-cache`
end
else
Logger.info 'Fetching new git commits'
FileUtils.cd('/home/shipitron/git-cache') do
`git gc --auto`
`git fetch -f #{Shellwords.escape repository_url} #{Shellwords.escape repository_branch}:#{Shellwords.escape repository_branch}`
end
end
end
|