Class: Bottle
Defined Under Namespace
Classes: Filename
Instance Attribute Summary collapse
-
#cellar ⇒ Object
readonly
Returns the value of attribute cellar.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rebuild ⇒ Object
readonly
Returns the value of attribute rebuild.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#clear_cache ⇒ Object
-
#compatible_locations? ⇒ Boolean
-
#fetch(verify_download_integrity: true) ⇒ Object
-
#fetch_tab ⇒ Object
-
#initialize(formula, spec, tag = nil) ⇒ Bottle
constructor
A new instance of Bottle.
-
#skip_relocation? ⇒ Boolean
Does the bottle need to be relocated?.
-
#stage ⇒ Object
-
#tab_attributes ⇒ Object
Constructor Details
#initialize(formula, spec, tag = nil) ⇒ Bottle
Returns a new instance of Bottle.
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'software_spec.rb', line 310 def initialize(formula, spec, tag = nil) @name = formula.name @resource = Resource.new @resource.specs[:bottle] = true @resource.owner = formula @spec = spec tag_spec = spec.tag_specification_for(Utils::Bottles.tag(tag)) @tag = tag_spec.tag @cellar = tag_spec.cellar @rebuild = spec.rebuild @resource.version = formula.pkg_version @resource.checksum = tag_spec.checksum @fetch_tab_retried = false root_url(spec.root_url, spec.root_url_specs) end |
Instance Attribute Details
#cellar ⇒ Object (readonly)
Returns the value of attribute cellar.
305 306 307 |
# File 'software_spec.rb', line 305 def cellar @cellar end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
305 306 307 |
# File 'software_spec.rb', line 305 def name @name end |
#rebuild ⇒ Object (readonly)
Returns the value of attribute rebuild.
305 306 307 |
# File 'software_spec.rb', line 305 def rebuild @rebuild end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
305 306 307 |
# File 'software_spec.rb', line 305 def resource @resource end |
Instance Method Details
#clear_cache ⇒ Object
340 341 342 343 344 |
# File 'software_spec.rb', line 340 def clear_cache @resource.clear_cache github_packages_manifest_resource&.clear_cache @fetch_tab_retried = false end |
#compatible_locations? ⇒ Boolean
346 347 348 |
# File 'software_spec.rb', line 346 def compatible_locations? @spec.compatible_locations?(tag: @tag) end |
#fetch(verify_download_integrity: true) ⇒ Object
331 332 333 334 335 336 337 338 |
# File 'software_spec.rb', line 331 def fetch(verify_download_integrity: true) @resource.fetch(verify_download_integrity: verify_download_integrity) rescue DownloadError raise unless fallback_on_error fetch_tab retry end |
#fetch_tab ⇒ Object
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'software_spec.rb', line 359 def fetch_tab return if github_packages_manifest_resource.blank? # a checksum is used later identifying the correct tab but we do not have the checksum for the manifest/tab github_packages_manifest_resource.fetch(verify_download_integrity: false) begin github_packages_manifest_resource_tab(github_packages_manifest_resource) rescue RuntimeError => e raise DownloadError.new(github_packages_manifest_resource, e) end rescue DownloadError raise unless fallback_on_error retry rescue ArgumentError raise if @fetch_tab_retried @fetch_tab_retried = true github_packages_manifest_resource.clear_cache retry end |
#skip_relocation? ⇒ Boolean
Does the bottle need to be relocated?
351 352 353 |
# File 'software_spec.rb', line 351 def skip_relocation? @spec.skip_relocation?(tag: @tag) end |
#stage ⇒ Object
355 356 357 |
# File 'software_spec.rb', line 355 def stage resource.downloader.stage end |
#tab_attributes ⇒ Object
382 383 384 385 386 |
# File 'software_spec.rb', line 382 def tab_attributes return {} unless github_packages_manifest_resource&.downloaded? github_packages_manifest_resource_tab(github_packages_manifest_resource) end |