Class: BottleSpecification

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/software_spec.rb

Constant Summary

DEFAULT_PREFIX =
"/usr/local".freeze
DEFAULT_CELLAR =
"/usr/local/Cellar".freeze
DEFAULT_DOMAIN =
(ENV["HOMEBREW_BOTTLE_DOMAIN"] || "https://homebrew.bintray.com").freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBottleSpecification

Returns a new instance of BottleSpecification



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

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

Instance Attribute Details

#checksumObject (readonly)

Returns the value of attribute checksum



327
328
329
# File 'Library/Homebrew/software_spec.rb', line 327

def checksum
  @checksum
end

#collectorObject (readonly)

Returns the value of attribute collector



327
328
329
# File 'Library/Homebrew/software_spec.rb', line 327

def collector
  @collector
end

#tapObject

Returns the value of attribute tap



326
327
328
# File 'Library/Homebrew/software_spec.rb', line 326

def tap
  @tap
end

Instance Method Details

#checksum_for(tag) ⇒ Object



366
367
368
# File 'Library/Homebrew/software_spec.rb', line 366

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

#checksumsObject



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'Library/Homebrew/software_spec.rb', line 370

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)


344
345
346
# File 'Library/Homebrew/software_spec.rb', line 344

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

#root_url(var = nil) ⇒ Object



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

def root_url(var = nil)
  if var.nil?
    @root_url ||= "#{DEFAULT_DOMAIN}/#{Utils::Bottles::Bintray.repository(tap)}"
  else
    @root_url = var
  end
end

#skip_relocation?Boolean

Does the Bottle this BottleSpecification belongs to need to be relocated?

Returns:

  • (Boolean)


349
350
351
# File 'Library/Homebrew/software_spec.rb', line 349

def skip_relocation?
  cellar == :any_skip_relocation
end

#tag?(tag) ⇒ Boolean

Returns:

  • (Boolean)


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

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