GitDownloadStrategy

Untested
This commit is contained in:
Max Howell 2009-08-21 19:50:20 +01:00
parent 57a86034a3
commit b115f26870

View File

@ -89,6 +89,26 @@ class SubversionDownloadStrategy <AbstractDownloadStrategy
end end
end end
class GitDownloadStrategy <AbstractDownloadStrategy
def fetch
ohai "Cloning #{@url}"
@clone=HOMEBREW_CACHE+@unique_token
unless @clone.exist?
safe_system 'git', 'clone', @url, @clone
else
# TODO git pull?
puts "Repository already cloned"
end
end
def stage
dst=Dir.getwd
Dir.chdir @clone do
# http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
safe_system 'git', 'checkout-index', '-af', "--prefix=#{dst}"
end
end
end
class ExecutionError <RuntimeError class ExecutionError <RuntimeError
def initialize cmd, args=[] def initialize cmd, args=[]