diff options
| author | Max Howell | 2009-08-21 19:50:20 +0100 |
|---|---|---|
| committer | Max Howell | 2009-08-24 01:03:30 +0100 |
| commit | b115f26870fe128294a4662f017fe28be69cf7d5 (patch) | |
| tree | 9f010d592f3e33a20b1b8af26571e056d382ec38 /Library | |
| parent | 57a86034a3aabefc7fc0aa9cc999c0fe38145c83 (diff) | |
| download | brew-b115f26870fe128294a4662f017fe28be69cf7d5.tar.bz2 | |
GitDownloadStrategy
Untested
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 20 |
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=[] |
