Class: Bottle

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
brew/Library/Homebrew/software_spec.rb

Defined Under Namespace

Classes: Filename

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formula, spec) ⇒ Bottle

Returns a new instance of Bottle



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'brew/Library/Homebrew/software_spec.rb', line 295

def initialize(formula, spec)
  @name = formula.name
  @resource = Resource.new
  @resource.owner = formula
  @resource.specs[:bottle] = true
  @spec = spec

  checksum, tag = spec.checksum_for(Utils::Bottles.tag)

  filename = Filename.create(formula, tag, spec.rebuild)
  @resource.url("#{spec.root_url}/#{filename.bintray}",
                select_download_strategy(spec.root_url_specs))
  @resource.version = formula.pkg_version
  @resource.checksum = checksum
  @prefix = spec.prefix
  @cellar = spec.cellar
  @rebuild = spec.rebuild
end

Instance Attribute Details

#cellarObject (readonly)

Returns the value of attribute cellar



290
291
292
# File 'brew/Library/Homebrew/software_spec.rb', line 290

def cellar
  @cellar
end

#nameObject (readonly)

Returns the value of attribute name



290
291
292
# File 'brew/Library/Homebrew/software_spec.rb', line 290

def name
  @name
end

#prefixObject (readonly)

Returns the value of attribute prefix



290
291
292
# File 'brew/Library/Homebrew/software_spec.rb', line 290

def prefix
  @prefix
end

#rebuildObject (readonly)

Returns the value of attribute rebuild



290
291
292
# File 'brew/Library/Homebrew/software_spec.rb', line 290

def rebuild
  @rebuild
end

#resourceObject (readonly)

Returns the value of attribute resource



290
291
292
# File 'brew/Library/Homebrew/software_spec.rb', line 290

def resource
  @resource
end

Instance Method Details

#compatible_cellar?Boolean

Returns:

  • (Boolean)


314
315
316
# File 'brew/Library/Homebrew/software_spec.rb', line 314

def compatible_cellar?
  @spec.compatible_cellar?
end

#skip_relocation?Boolean

Does the bottle need to be relocated?

Returns:

  • (Boolean)


319
320
321
# File 'brew/Library/Homebrew/software_spec.rb', line 319

def skip_relocation?
  @spec.skip_relocation?
end

#stageObject



323
324
325
# File 'brew/Library/Homebrew/software_spec.rb', line 323

def stage
  resource.downloader.stage
end