aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMax Howell2009-08-21 19:50:20 +0100
committerMax Howell2009-08-24 01:03:30 +0100
commitb115f26870fe128294a4662f017fe28be69cf7d5 (patch)
tree9f010d592f3e33a20b1b8af26571e056d382ec38 /Library/Homebrew
parent57a86034a3aabefc7fc0aa9cc999c0fe38145c83 (diff)
downloadbrew-b115f26870fe128294a4662f017fe28be69cf7d5.tar.bz2
GitDownloadStrategy
Untested
Diffstat (limited to 'Library/Homebrew')
-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=[]