Class: Resource::BottleManifest Private

Inherits:
Resource show all
Defined in:
resource.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

A resource for a bottle manifest.

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Attributes inherited from Resource

#checksum, #download_strategy, #livecheck, #name, #owner, #patches, #source_modified_time

Attributes included from Downloadable

#checksum, #mirrors, #url

Instance Method Summary collapse

Methods inherited from Resource

#apply_patches, #download_name, #escaped_name, #fetch, #fetch_patches, #files, #freeze, #initialize_dup, #livecheckable?, #mirror, #patch, #prepare_patches, #sha256, #specs, #stage, #unpack, #url, #using, #version

Methods included from OnSystem::MacOSAndLinux

included

Methods included from Downloadable

#cached_download, #clear_cache, #download_name, #download_strategy, #download_type, #downloaded?, #downloader, #fetch, #freeze, #initialize_dup, #name, #version

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

#initialize(bottle) ⇒ BottleManifest

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns a new instance of BottleManifest.



306
307
308
309
310
# File 'resource.rb', line 306

def initialize(bottle)
  super("#{bottle.name}_bottle_manifest")
  @bottle = bottle
  @manifest_annotations = nil
end

Instance Attribute Details

#bottleObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



304
305
306
# File 'resource.rb', line 304

def bottle
  @bottle
end

Instance Method Details

#bottle_sizeInteger?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Integer, nil)


329
330
331
# File 'resource.rb', line 329

def bottle_size
  manifest_annotations["sh.brew.bottle.size"]&.to_i
end

#installed_sizeInteger?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Integer, nil)


334
335
336
# File 'resource.rb', line 334

def installed_size
  manifest_annotations["sh.brew.bottle.installed_size"]&.to_i
end

#tabObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Raises:



317
318
319
320
321
322
323
324
325
326
# File 'resource.rb', line 317

def tab
  tab = manifest_annotations["sh.brew.tab"]
  raise Error, "Couldn't find tab from manifest." if tab.blank?

  begin
    JSON.parse(tab)
  rescue JSON::ParserError
    raise Error, "Couldn't parse tab JSON."
  end
end

#verify_download_integrity(_filename) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



312
313
314
315
# File 'resource.rb', line 312

def verify_download_integrity(_filename)
  # We don't have a checksum, but we can at least try parsing it.
  tab
end