aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-08-21 19:50:20 +0100
committerMax Howell2009-08-24 01:03:30 +0100
commit2f31a6e7347b10a33db2c9980bdf6953f95ff1d3 (patch)
treee28aa9b5a3fb064e426dd62be26a8de22d8b26da /Library
parent501b31c8d40d9ec9fe3a9d2c70af3e9414fdde7a (diff)
downloadhomebrew-2f31a6e7347b10a33db2c9980bdf6953f95ff1d3.tar.bz2
GitDownloadStrategy
Untested
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 80b2d6a28..577ea0f0a 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -89,6 +89,26 @@ class SubversionDownloadStrategy <AbstractDownloadStrategy
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
def initialize cmd, args=[]