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



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

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



340
341
342
# File 'brew/Library/Homebrew/software_spec.rb', line 340

def checksum
  @checksum
end

#collectorObject (readonly)

Returns the value of attribute collector



340
341
342
# File 'brew/Library/Homebrew/software_spec.rb', line 340

def collector
  @collector
end

#root_url_specsObject (readonly)

Returns the value of attribute root_url_specs



340
341
342
# File 'brew/Library/Homebrew/software_spec.rb', line 340

def root_url_specs
  @root_url_specs
end

#tapObject

Returns the value of attribute tap



339
340
341
# File 'brew/Library/Homebrew/software_spec.rb', line 339

def tap
  @tap
end

Instance Method Details

#checksum_for(tag) ⇒ Object



381
382
383
# File 'brew/Library/Homebrew/software_spec.rb', line 381

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

#checksumsObject



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'brew/Library/Homebrew/software_spec.rb', line 385

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)


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

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

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



350
351
352
353
354
355
356
357
# File 'brew/Library/Homebrew/software_spec.rb', line 350

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)


364
365
366
# File 'brew/Library/Homebrew/software_spec.rb', line 364

def skip_relocation?
  cellar == :any_skip_relocation
end

#tag?(tag) ⇒ Boolean

Returns:

  • (Boolean)


368
369
370
# File 'brew/Library/Homebrew/software_spec.rb', line 368

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