Class: Bottle::Filename

Inherits:
Object show all
Defined in:
software_spec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, tag, rebuild) ⇒ void

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.

Parameters:

Raises:

  • (ArgumentError)


298
299
300
301
302
303
304
305
306
307
# File 'software_spec.rb', line 298

def initialize(name, version, tag, rebuild)
  @name = File.basename name

  raise ArgumentError, "Invalid bottle name" unless Utils.safe_filename?(@name)
  raise ArgumentError, "Invalid bottle version" unless Utils.safe_filename?(version.to_s)

  @version = version
  @tag = tag.to_s
  @rebuild = rebuild
end

Instance Attribute Details

#nameObject (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.

Returns the value of attribute name.



290
291
292
# File 'software_spec.rb', line 290

def name
  @name
end

#rebuildObject (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.

Returns the value of attribute rebuild.



290
291
292
# File 'software_spec.rb', line 290

def rebuild
  @rebuild
end

#tagObject (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.

Returns the value of attribute tag.



290
291
292
# File 'software_spec.rb', line 290

def tag
  @tag
end

#versionObject (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.

Returns the value of attribute version.



290
291
292
# File 'software_spec.rb', line 290

def version
  @version
end

Class Method Details

.create(formula, tag, rebuild) ⇒ T.attached_class

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.

Parameters:

Returns:

  • (T.attached_class)


293
294
295
# File 'software_spec.rb', line 293

def self.create(formula, tag, rebuild)
  new(formula.name, formula.pkg_version, tag, rebuild)
end

Instance Method Details

#extnameString

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:



331
332
333
334
# File 'software_spec.rb', line 331

def extname
  s = rebuild.positive? ? ".#{rebuild}" : ""
  ".#{tag}.bottle#{s}.tar.gz"
end

#github_packagesObject



326
327
328
# File 'software_spec.rb', line 326

def github_packages
  "#{name}--#{version}#{extname}"
end

#jsonString

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:



318
319
320
# File 'software_spec.rb', line 318

def json
  "#{name}--#{version}.#{tag}.bottle.json"
end

#to_strString

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:



310
311
312
# File 'software_spec.rb', line 310

def to_str
  "#{name}--#{version}#{extname}"
end

#url_encodeObject



322
323
324
# File 'software_spec.rb', line 322

def url_encode
  ERB::Util.url_encode("#{name}-#{version}#{extname}")
end