Class: Pod::Downloader::Request
- Inherits:
-
Object
- Object
- Pod::Downloader::Request
- Defined in:
- lib/cocoapods/downloader/request.rb
Overview
This class represents a download request for a given Pod.
Instance Attribute Summary collapse
-
#head ⇒ Boolean
(also: #head?)
readonly
Whether the download request is for a head download.
-
#name ⇒ String
readonly
The name of the pod whose dowload is being requested.
-
#params ⇒ Hash<Symbol, String>
readonly
The download parameters for this request.
-
#released_pod ⇒ Boolean
(also: #released_pod?)
readonly
Whether this download request is for a released pod.
-
#spec ⇒ Specification, Nil
readonly
The specification for the pod whose download is being requested.
Instance Method Summary collapse
-
#initialize(spec: nil, released: false, name: nil, params: false, head: false) ⇒ Request
constructor
Initialize a new instance.
-
#slug(name: self.name, params: self.params, spec: self.spec) ⇒ String
The slug used to store the files resulting from this download request.
Constructor Details
#initialize(spec: nil, released: false, name: nil, params: false, head: false) ⇒ Request
Initialize a new instance
48 49 50 51 52 53 54 55 56 |
# File 'lib/cocoapods/downloader/request.rb', line 48 def initialize(spec: nil, released: false, name: nil, params: false, head: false) @released_pod = released @spec = spec @params = spec ? (spec.source && spec.source.dup) : params @name = spec ? spec.name : name @head = head validate! end |
Instance Attribute Details
#head ⇒ Boolean (readonly) Also known as: head?
Returns Whether the download request is for a head download.
28 29 30 |
# File 'lib/cocoapods/downloader/request.rb', line 28 def head @head end |
#name ⇒ String (readonly)
Returns The name of the pod whose dowload is being requested.
20 21 22 |
# File 'lib/cocoapods/downloader/request.rb', line 20 def name @name end |
#params ⇒ Hash<Symbol, String> (readonly)
Returns The download parameters for this request.
24 25 26 |
# File 'lib/cocoapods/downloader/request.rb', line 24 def params @params end |
#released_pod ⇒ Boolean (readonly) Also known as: released_pod?
Returns Whether this download request is for a released pod.
15 16 17 |
# File 'lib/cocoapods/downloader/request.rb', line 15 def released_pod @released_pod end |
#spec ⇒ Specification, Nil (readonly)
Returns The specification for the pod whose download is being requested.
11 12 13 |
# File 'lib/cocoapods/downloader/request.rb', line 11 def spec @spec end |
Instance Method Details
#slug(name: self.name, params: self.params, spec: self.spec) ⇒ String
Returns The slug used to store the files resulting from this download request.
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cocoapods/downloader/request.rb', line 70 def slug(name: self.name, params: self.params, spec: self.spec) checksum = spec && spec.checksum && '-' << spec.checksum[0, 5] if released_pod? "Release/#{name}/#{spec.version}#{checksum}" else opts = params.to_a.sort_by(&:first).map { |k, v| "#{k}=#{v}" }.join('-') digest = Digest::MD5.hexdigest(opts) "External/#{name}/#{digest}#{checksum}" end end |