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, #livecheck_defined?, #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.



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

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.



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

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)


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

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)


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

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:



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

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.



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

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