diff options
| author | Mike McQuaid | 2015-03-17 09:03:13 +0000 | 
|---|---|---|
| committer | Mike McQuaid | 2015-03-17 09:16:57 +0000 | 
| commit | 3933b84deaf5673a322a2beed3ed9fe8a486054a (patch) | |
| tree | 2773d55b45a60c79d6c4ac64095ad67cb060527b /Library/Homebrew/software_spec.rb | |
| parent | 514910e812f5f77d04d2ce9948adb7865aa93669 (diff) | |
| download | brew-3933b84deaf5673a322a2beed3ed9fe8a486054a.tar.bz2 | |
software_spec: check if bottles are compatible.
The `bottled?` method makes more sense when it also checks for
compatibility.
This is particularly useful for the case in `brew info` so it prints out
`(bottled)` correctly depending on the `Cellar`.
Closes Homebrew/homebrew#37636.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/software_spec.rb')
| -rw-r--r-- | Library/Homebrew/software_spec.rb | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index b6ec3b485..569ea7988 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -62,7 +62,8 @@ class SoftwareSpec    end    def bottled? -    bottle_specification.tag?(bottle_tag) +    bottle_specification.tag?(bottle_tag) && \ +      bottle_specification.compatible_cellar?    end    def bottle &block @@ -220,6 +221,7 @@ class Bottle      @name = formula.name      @resource = Resource.new      @resource.owner = formula +    @spec = spec      checksum, tag = spec.checksum_for(bottle_tag) @@ -234,7 +236,7 @@ class Bottle    end    def compatible_cellar? -    cellar == :any || cellar == HOMEBREW_CELLAR.to_s +    @spec.compatible_cellar?    end    def stage @@ -265,6 +267,10 @@ class BottleSpecification      @collector = BottleCollector.new    end +  def compatible_cellar? +    cellar == :any || cellar == HOMEBREW_CELLAR.to_s +  end +    def tag?(tag)      !!checksum_for(tag)    end | 
