Class: BottleSpecification

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/software_spec.rb,
Library/Homebrew/extend/os/linux/software_spec.rb

Constant Summary collapse

DEFAULT_PREFIX =
Homebrew::DEFAULT_PREFIX

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBottleSpecification

Returns a new instance of BottleSpecification.


335
336
337
338
339
340
341
# File 'Library/Homebrew/software_spec.rb', line 335

def initialize
  @rebuild = 0
  @prefix = Homebrew::DEFAULT_PREFIX
  @cellar = Homebrew::DEFAULT_CELLAR
  @collector = Utils::Bottles::Collector.new
  @root_url_specs = {}
end

Instance Attribute Details

#checksumObject (readonly)

Returns the value of attribute checksum


333
334
335
# File 'Library/Homebrew/software_spec.rb', line 333

def checksum
  @checksum
end

#collectorObject (readonly)

Returns the value of attribute collector


333
334
335
# File 'Library/Homebrew/software_spec.rb', line 333

def collector
  @collector
end

#root_url_specsObject (readonly)

Returns the value of attribute root_url_specs


333
334
335
# File 'Library/Homebrew/software_spec.rb', line 333

def root_url_specs
  @root_url_specs
end

#tapObject

Returns the value of attribute tap


332
333
334
# File 'Library/Homebrew/software_spec.rb', line 332

def tap
  @tap
end

Instance Method Details

#checksum_for(tag) ⇒ Object


374
375
376
# File 'Library/Homebrew/software_spec.rb', line 374

def checksum_for(tag)
  collector.fetch_checksum_for(tag)
end

#checksumsObject


378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'Library/Homebrew/software_spec.rb', line 378

def checksums
  tags = 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 = {}
  tags.reverse_each do |tag|
    checksum = collector[tag]
    checksums[checksum.hash_type] ||= []
    checksums[checksum.hash_type] << { checksum => tag }
  end
  checksums
end

#compatible_cellar?Boolean

Returns:

  • (Boolean)

352
353
354
# File 'Library/Homebrew/software_spec.rb', line 352

def compatible_cellar?
  cellar == :any || cellar == :any_skip_relocation || cellar == HOMEBREW_CELLAR.to_s
end

#root_url(var = nil, specs = {}) ⇒ Object


343
344
345
346
347
348
349
350
# File 'Library/Homebrew/software_spec.rb', line 343

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?

Returns:

  • (Boolean)

357
358
359
# File 'Library/Homebrew/software_spec.rb', line 357

def skip_relocation?
  cellar == :any_skip_relocation
end

#tag?(tag) ⇒ Boolean

Returns:

  • (Boolean)

361
362
363
# File 'Library/Homebrew/software_spec.rb', line 361

def tag?(tag)
  checksum_for(tag) ? true : false
end