add Formula#bottle_defined?

This commit is contained in:
Xu Cheng 2015-11-01 20:33:24 +08:00 committed by Mike McQuaid
parent 593dff3dc1
commit ff9fdc078f
2 changed files with 13 additions and 1 deletions

View File

@ -231,6 +231,13 @@ class Formula
active_spec.bottle_disable_reason active_spec.bottle_disable_reason
end end
# Does the currently active {SoftwareSpec} has any bottle?
# @private
def bottle_defined?
active_spec.bottle_defined?
end
# Does the currently active {SoftwareSpec} has an installable bottle?
# @private # @private
def bottled? def bottled?
active_spec.bottled? active_spec.bottled?
@ -1197,7 +1204,8 @@ class Formula
hsh["bottle"] = {} hsh["bottle"] = {}
%w[stable devel].each do |spec_sym| %w[stable devel].each do |spec_sym|
next unless spec = send(spec_sym) next unless spec = send(spec_sym)
next unless (bottle_spec = spec.bottle_specification).checksums.any? next unless spec.bottle_defined?
bottle_spec = spec.bottle_specification
bottle_info = { bottle_info = {
"revision" => bottle_spec.revision, "revision" => bottle_spec.revision,
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? \ "cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? \

View File

@ -75,6 +75,10 @@ class SoftwareSpec
@bottle_disable_reason @bottle_disable_reason
end end
def bottle_defined?
bottle_specification.collector.keys.any?
end
def bottled? def bottled?
bottle_specification.tag?(bottle_tag) && \ bottle_specification.tag?(bottle_tag) && \
(bottle_specification.compatible_cellar? || ARGV.force_bottle?) (bottle_specification.compatible_cellar? || ARGV.force_bottle?)