diff options
| author | Jannis Leidel | 2009-10-17 14:35:24 +0200 |
|---|---|---|
| committer | Max Howell | 2009-10-19 04:02:48 +0100 |
| commit | ef02031d7cd1ef048c53cf940b208a6070451b8d (patch) | |
| tree | 6348222cbe139278db8556afc05158425473ba7b /Library/Homebrew/formula.rb | |
| parent | 53d6f617d7246a40c8991653a6b166ec320880c2 (diff) | |
| download | brew-ef02031d7cd1ef048c53cf940b208a6070451b8d.tar.bz2 | |
Fix Homebrew/homebrew#52: Add ability to checkout a branch or tag.
GitDownloadStrategy and MercurialDownloadStrategy
now can be used like this:
head 'git://server/repo.git', :branch => 'stable'
head 'hg://server/repo/', :tag => '1.0.4'
Diffstat (limited to 'Library/Homebrew/formula.rb')
| -rw-r--r-- | Library/Homebrew/formula.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 6fa22feae..5d022d098 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -46,6 +46,7 @@ class Formula def initialize name='__UNKNOWN__' set_instance_variable 'url' set_instance_variable 'head' + set_instance_variable 'specs' if @head and (not @url or ARGV.flag? '--HEAD') @url=@head @@ -85,7 +86,7 @@ class Formula self.class.path name end - attr_reader :url, :version, :homepage, :name + attr_reader :url, :version, :homepage, :name, :specs def bin; prefix+'bin' end def sbin; prefix+'sbin' end @@ -281,7 +282,7 @@ private end def stage - ds=download_strategy.new url, name, version + ds=download_strategy.new url, name, version, specs HOMEBREW_CACHE.mkpath dl=ds.fetch verify_download_integrity dl if dl.kind_of? Pathname @@ -380,7 +381,14 @@ private end end - attr_rw :url, :version, :homepage, :head, :deps, *CHECKSUM_TYPES + attr_rw :url, :version, :homepage, :specs, :deps, *CHECKSUM_TYPES + + def head val=nil, specs=nil + if specs + @specs = specs + end + val.nil? ? @head : @head = val + end def depends_on name, *args @deps ||= [] |
