Class: BottleSpecification

Inherits:
Object
  • Object
show all
Defined in:
brew/Library/Homebrew/software_spec.rb,
brew/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



336
337
338
339
340
341
342
# File 'brew/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

#checksumObject (readonly)

Returns the value of attribute checksum



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

def checksum
  @checksum
end

#collectorObject (readonly)

Returns the value of attribute collector



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

def collector
  @collector
end

#root_url_specsObject (readonly)

Returns the value of attribute root_url_specs



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

def root_url_specs
  @root_url_specs
end

#tapObject

Returns the value of attribute tap



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

def tap
  @tap
end

Instance Method Details

#checksum_for(tag) ⇒ Object



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

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

#checksumsObject



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

def checksums
  tags = collector.keys.sort_by do |tag|
    # Sort non-MacOS tags below MacOS tags.
    begin
      OS::Mac::Version.from_symbol tag
    rescue ArgumentError
      "0.#{tag}"
    end
  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)


353
354
355
# File 'brew/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 'brew/Library/Homebrew/software_spec.rb', line 344

def root_url(var = nil, specs = {})
  if var.nil?
    @root_url ||= "#{HOMEBREW_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)


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

def skip_relocation?
  cellar == :any_skip_relocation
end

#tag?(tag) ⇒ Boolean

Returns:

  • (Boolean)


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

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