Class: BottleSpecification
- Inherits:
-
Object
- Object
- BottleSpecification
- Extended by:
- T::Sig
- Defined in:
- Library/Homebrew/extend/os/linux/software_spec.rb,
Library/Homebrew/software_spec.rb
Overview
typed: strict frozen_string_literal: true
Constant Summary collapse
- DEFAULT_PREFIX =
Homebrew::DEFAULT_PREFIX
Instance Attribute Summary collapse
-
#checksum ⇒ Object
readonly
Returns the value of attribute checksum.
-
#collector ⇒ Object
readonly
Returns the value of attribute collector.
-
#root_url_specs ⇒ Object
readonly
Returns the value of attribute root_url_specs.
-
#tap ⇒ Object
Returns the value of attribute tap.
Instance Method Summary collapse
- #checksum_for(tag) ⇒ Object
- #checksums ⇒ Object
- #compatible_cellar? ⇒ Boolean
-
#initialize ⇒ BottleSpecification
constructor
A new instance of BottleSpecification.
- #root_url(var = nil, specs = {}) ⇒ Object
-
#skip_relocation? ⇒ Boolean
Does the Bottle this BottleSpecification belongs to need to be relocated?.
- #tag?(tag) ⇒ Boolean
Constructor Details
#initialize ⇒ BottleSpecification
Returns a new instance of BottleSpecification.
336 337 338 339 340 341 342 |
# File 'Library/Homebrew/software_spec.rb', line 336 def initialize @rebuild = 0 @prefix = Homebrew::DEFAULT_PREFIX @cellar = Homebrew::DEFAULT_CELLAR @collector = Utils::Bottles::Collector.new @root_url_specs = {} end |
Instance Attribute Details
#checksum ⇒ Object (readonly)
Returns the value of attribute checksum
334 335 336 |
# File 'Library/Homebrew/software_spec.rb', line 334 def checksum @checksum end |
#collector ⇒ Object (readonly)
Returns the value of attribute collector
334 335 336 |
# File 'Library/Homebrew/software_spec.rb', line 334 def collector @collector end |
#root_url_specs ⇒ Object (readonly)
Returns the value of attribute root_url_specs
334 335 336 |
# File 'Library/Homebrew/software_spec.rb', line 334 def root_url_specs @root_url_specs end |
#tap ⇒ Object
Returns the value of attribute tap
333 334 335 |
# File 'Library/Homebrew/software_spec.rb', line 333 def tap @tap end |
Instance Method Details
#checksum_for(tag) ⇒ Object
375 376 377 |
# File 'Library/Homebrew/software_spec.rb', line 375 def checksum_for(tag) collector.fetch_checksum_for(tag) end |
#checksums ⇒ Object
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'Library/Homebrew/software_spec.rb', line 379 def checksums = collector.keys.sort_by do |tag| # Sort non-MacOS tags below MacOS tags. OS::Mac::Version.from_symbol tag rescue MacOSVersionError "0.#{tag}" end checksums = {} .reverse_each do |tag| checksum = collector[tag] checksums[checksum.hash_type] ||= [] checksums[checksum.hash_type] << { checksum => tag } end checksums end |
#compatible_cellar? ⇒ Boolean
353 354 355 |
# File 'Library/Homebrew/software_spec.rb', line 353 def compatible_cellar? cellar == :any || cellar == :any_skip_relocation || cellar == HOMEBREW_CELLAR.to_s end |
#root_url(var = nil, specs = {}) ⇒ Object
344 345 346 347 348 349 350 351 |
# File 'Library/Homebrew/software_spec.rb', line 344 def root_url(var = nil, specs = {}) if var.nil? @root_url ||= "#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}" else @root_url = var @root_url_specs.merge!(specs) end end |
#skip_relocation? ⇒ Boolean
Does the Bottle this BottleSpecification belongs to need to be relocated?
358 359 360 |
# File 'Library/Homebrew/software_spec.rb', line 358 def skip_relocation? cellar == :any_skip_relocation end |
#tag?(tag) ⇒ Boolean
362 363 364 |
# File 'Library/Homebrew/software_spec.rb', line 362 def tag?(tag) checksum_for(tag) ? true : false end |