Class: Cask::URL Private
- Extended by:
- Forwardable
- Defined in:
- cask/url.rb,
sorbet/rbi/dsl/cask/url.rbi
Overview
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.
Class corresponding to the url stanza.
Constant Summary collapse
- DEPRECATED_URL_SPECS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
URL kwargs still accepted from existing cask metadata but otherwise ignored.
[:verified].freeze
Instance Attribute Summary collapse
- #branch ⇒ String? readonly private
- #cookies ⇒ Hash{String => String}? readonly private
- #data ⇒ Hash{String => String}? readonly private
- #header ⇒ Array<String>? readonly private
- #only_path ⇒ String? readonly private
- #referer ⇒ URI::Generic, ... readonly private
- #revision ⇒ String? readonly private
- #revisions ⇒ Hash{Symbol, String => String}? readonly private
- #specs ⇒ Hash{Symbol => T.untyped} readonly private
- #tag ⇒ String? readonly private
- #trust_cert ⇒ Boolean? readonly private
- #uri ⇒ URI::Generic readonly private
- #user_agent ⇒ Symbol, ... readonly private
- #using ⇒ T::Class[AbstractDownloadStrategy], ... readonly private
- #verified ⇒ String? readonly private
Instance Method Summary collapse
-
#initialize(uri, verified: nil, using: nil, tag: nil, branch: nil, revisions: nil, revision: nil, trust_cert: nil, cookies: nil, referer: nil, header: nil, user_agent: nil, data: nil, only_path: nil, caller_location: caller_locations.fetch(0)) ⇒ void
constructor
Creates a
urlstanza. - #location ⇒ Homebrew::SourceLocation private
- #path(*args, &block) ⇒ T.untyped private
- #scheme(*args, &block) ⇒ T.untyped private
- #unversioned?(ignore_major_version: false) ⇒ Boolean private
Constructor Details
#initialize(uri, verified: nil, using: nil, tag: nil, branch: nil, revisions: nil, revision: nil, trust_cert: nil, cookies: nil, referer: nil, header: nil, user_agent: nil, data: nil, only_path: nil, caller_location: caller_locations.fetch(0)) ⇒ void
Creates a url stanza.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'cask/url.rb', line 69 def initialize( uri, verified: nil, using: nil, tag: nil, branch: nil, revisions: nil, revision: nil, trust_cert: nil, cookies: nil, referer: nil, header: nil, user_agent: nil, data: nil, only_path: nil, caller_location: caller_locations.fetch(0) ) @uri = T.let(URI(uri), URI::Generic) header = Array(header) unless header.nil? specs = {} # `verified` is accepted as a no-op for compatibility with existing casks. @verified = verified specs[:using] = @using = T.let(using, T.nilable(T.any(T::Class[AbstractDownloadStrategy], Symbol))) specs[:tag] = @tag = T.let(tag, T.nilable(String)) specs[:branch] = @branch = T.let(branch, T.nilable(String)) specs[:revisions] = @revisions = T.let(revisions, T.nilable(T::Hash[T.any(Symbol, String), String])) specs[:revision] = @revision = T.let(revision, T.nilable(String)) specs[:trust_cert] = @trust_cert = T.let(trust_cert, T.nilable(T::Boolean)) specs[:cookies] = @cookies = T.let(&.transform_keys(&:to_s), T.nilable(T::Hash[String, String])) specs[:referer] = @referer = T.let(referer, T.nilable(T.any(URI::Generic, String))) specs[:headers] = @header = T.let(header, T.nilable(T::Array[String])) specs[:user_agent] = @user_agent = T.let(user_agent || :default, T.nilable(T.any(Symbol, String))) specs[:data] = @data = T.let(data, T.nilable(T::Hash[String, String])) specs[:only_path] = @only_path = T.let(only_path, T.nilable(String)) @specs = T.let(specs.compact, T::Hash[Symbol, T.untyped]) @caller_location = caller_location end |
Instance Attribute Details
#branch ⇒ String? (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.
38 39 40 |
# File 'cask/url.rb', line 38 def branch @branch end |
#cookies ⇒ Hash{String => String}? (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.
20 21 22 |
# File 'cask/url.rb', line 20 def @cookies end |
#data ⇒ Hash{String => String}? (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.
20 21 22 |
# File 'cask/url.rb', line 20 def data @data end |
#header ⇒ Array<String>? (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.
23 24 25 |
# File 'cask/url.rb', line 23 def header @header end |
#only_path ⇒ String? (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.
38 39 40 |
# File 'cask/url.rb', line 38 def only_path @only_path end |
#referer ⇒ URI::Generic, ... (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.
26 27 28 |
# File 'cask/url.rb', line 26 def referer @referer end |
#revision ⇒ String? (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.
38 39 40 |
# File 'cask/url.rb', line 38 def revision @revision end |
#revisions ⇒ Hash{Symbol, String => String}? (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.
14 15 16 |
# File 'cask/url.rb', line 14 def revisions @revisions end |
#specs ⇒ Hash{Symbol => T.untyped} (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.
29 30 31 |
# File 'cask/url.rb', line 29 def specs @specs end |
#tag ⇒ String? (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.
38 39 40 |
# File 'cask/url.rb', line 38 def tag @tag end |
#trust_cert ⇒ Boolean? (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.
17 18 19 |
# File 'cask/url.rb', line 17 def trust_cert @trust_cert end |
#uri ⇒ URI::Generic (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.
11 12 13 |
# File 'cask/url.rb', line 11 def uri @uri end |
#user_agent ⇒ Symbol, ... (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.
32 33 34 |
# File 'cask/url.rb', line 32 def user_agent @user_agent end |
#using ⇒ T::Class[AbstractDownloadStrategy], ... (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.
35 36 37 |
# File 'cask/url.rb', line 35 def using @using end |
#verified ⇒ String? (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.
38 39 40 |
# File 'cask/url.rb', line 38 def verified @verified end |
Instance Method Details
#location ⇒ Homebrew::SourceLocation
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.
100 101 102 |
# File 'cask/url.rb', line 100 def location Homebrew::SourceLocation.new(@caller_location.lineno, raw_url_line&.index("url")) end |
#path(*args, &block) ⇒ T.untyped
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.
10 |
# File 'sorbet/rbi/dsl/cask/url.rbi', line 10 def path(*args, &block); end |
#scheme(*args, &block) ⇒ T.untyped
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.
13 |
# File 'sorbet/rbi/dsl/cask/url.rbi', line 13 def scheme(*args, &block); end |
#unversioned?(ignore_major_version: false) ⇒ Boolean
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.
105 106 107 108 109 110 111 112 113 114 |
# File 'cask/url.rb', line 105 def unversioned?(ignore_major_version: false) interpolated_url = raw_url_line&.then { |line| line[/url\s+"([^"]+)"/, 1] } return false unless interpolated_url interpolated_url = interpolated_url.gsub(/\#{\s*arch\s*}/, "") interpolated_url = interpolated_url.gsub(/\#{\s*version\s*\.major\s*}/, "") if ignore_major_version interpolated_url.exclude?('#{') end |