Class: Bottle::Filename Private

Inherits:
Object show all
Defined in:
bottle.rb

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.

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)


23
24
25
26
27
28
29
30
31
32
# File 'bottle.rb', line 23

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

  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 = T.let(tag.to_unstandardized_sym.to_s, String)
  @rebuild = rebuild
end

Instance Attribute Details

#nameString (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:



9
10
11
# File 'bottle.rb', line 9

def name
  @name
end

#rebuildInteger (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:



15
16
17
# File 'bottle.rb', line 15

def rebuild
  @rebuild
end

#tagString (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:



9
10
11
# File 'bottle.rb', line 9

def tag
  @tag
end

#versionPkgVersion (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:



12
13
14
# File 'bottle.rb', line 12

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)


18
19
20
# File 'bottle.rb', line 18

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:



58
59
60
61
# File 'bottle.rb', line 58

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

#github_packagesString

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:



53
54
55
# File 'bottle.rb', line 53

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:



43
44
45
# File 'bottle.rb', line 43

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:



35
36
37
# File 'bottle.rb', line 35

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

#url_encodeString

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:



48
49
50
# File 'bottle.rb', line 48

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