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)


16
17
18
19
20
21
22
23
24
25
# File 'bottle.rb', line 16

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_unstandardized_sym.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.



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

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.



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

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.



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

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.



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

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)


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

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:



49
50
51
52
# File 'bottle.rb', line 49

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

#github_packagesObject

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.



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

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:



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

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:



28
29
30
# File 'bottle.rb', line 28

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

#url_encodeObject

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.



40
41
42
# File 'bottle.rb', line 40

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