cocoapods-downloader 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cocoapods-downloader might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/cocoapods-downloader/base.rb +12 -0
- data/lib/cocoapods-downloader/gem_version.rb +1 -1
- data/lib/cocoapods-downloader/git.rb +23 -2
- data/lib/cocoapods-downloader/http.rb +12 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 128f7eaefbd34c1b7f9c66c06a45dd5e3d186322938a8346fc5283df450617d0
|
4
|
+
data.tar.gz: 60a084074452df93b41cfda6248c2fc455b8111c109fc471075e96ca7085e5b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fd8b780dc60807be9317865fea329ecf608f18ce1e81bca8653c23b548589d9b7c3099d4e82ff7c7097e75f256e856ff788d2691f34312798e61f13f13154f3
|
7
|
+
data.tar.gz: 8435a98df7285ea8753b443656e306d1467dc8bfa28551c70d018630c03ad8820dc564576bd70a90d51d848cdad184a8e8b00ab59d05950740af4548d0971ae0
|
@@ -121,6 +121,18 @@ module Pod
|
|
121
121
|
raise 'Abstract method'
|
122
122
|
end
|
123
123
|
|
124
|
+
# Returns a User-Agent string that itentifies http network requests as
|
125
|
+
# originating from CocoaPods.
|
126
|
+
# Contains version numbers from the CocoaPods Gem and the cocoapods-downloader Gem.
|
127
|
+
#
|
128
|
+
# @param [module] base_module The Base CocoaPods Module to retrieve the version number from.
|
129
|
+
# @return [String] the User-Agent string.
|
130
|
+
#
|
131
|
+
def self.user_agent_string(base_module = Pod)
|
132
|
+
pods_version = base_module.const_defined?('VERSION') ? "CocoaPods/#{base_module::VERSION} " : ''
|
133
|
+
"#{pods_version}cocoapods-downloader/#{Pod::Downloader::VERSION}"
|
134
|
+
end
|
135
|
+
|
124
136
|
#-----------------------------------------------------------------------#
|
125
137
|
|
126
138
|
# Defines two methods for an executable, based on its name. The bang
|
@@ -27,16 +27,37 @@ module Pod
|
|
27
27
|
options[:git],
|
28
28
|
options[:branch]]
|
29
29
|
output = Git.execute_command('git', command)
|
30
|
-
match =
|
30
|
+
match = commit_from_ls_remote output, options[:branch]
|
31
31
|
|
32
32
|
return options if match.nil?
|
33
33
|
|
34
|
-
options[:commit] = match
|
34
|
+
options[:commit] = match
|
35
35
|
options.delete(:branch)
|
36
36
|
|
37
37
|
options
|
38
38
|
end
|
39
39
|
|
40
|
+
# Matches a commit from the branches reported by git ls-remote.
|
41
|
+
#
|
42
|
+
# @note When there is a branch and tag with the same name, it will match
|
43
|
+
# the branch, since `refs/heads` is sorted before `refs/tags`.
|
44
|
+
#
|
45
|
+
# @param [String] output
|
46
|
+
# The output from git ls-remote.
|
47
|
+
#
|
48
|
+
# @param [String] branch_name
|
49
|
+
# The desired branch to match a commit to.
|
50
|
+
#
|
51
|
+
# @return [String] commit hash string, or nil if no match found
|
52
|
+
#
|
53
|
+
def self.commit_from_ls_remote(output, branch_name)
|
54
|
+
return nil if branch_name.nil?
|
55
|
+
match = %r{([a-z0-9]*)\trefs\/(heads|tags)\/#{Regexp.quote(branch_name)}}.match(output)
|
56
|
+
match[1] unless match.nil?
|
57
|
+
end
|
58
|
+
|
59
|
+
private_class_method :commit_from_ls_remote
|
60
|
+
|
40
61
|
private
|
41
62
|
|
42
63
|
# @!group Base class hooks
|
@@ -3,12 +3,16 @@ require 'cocoapods-downloader/remote_file'
|
|
3
3
|
module Pod
|
4
4
|
module Downloader
|
5
5
|
class Http < RemoteFile
|
6
|
+
USER_AGENT_HEADER = 'User-Agent'.freeze
|
7
|
+
|
6
8
|
private
|
7
9
|
|
8
10
|
executable :curl
|
9
11
|
|
10
12
|
def download_file(full_filename)
|
11
13
|
parameters = ['-f', '-L', '-o', full_filename, url, '--create-dirs', '--netrc-optional', '--retry', '2']
|
14
|
+
parameters << user_agent_argument if headers.nil? ||
|
15
|
+
headers.none? { |header| header.casecmp(USER_AGENT_HEADER).zero? }
|
12
16
|
|
13
17
|
headers.each do |h|
|
14
18
|
parameters << '-H'
|
@@ -17,6 +21,14 @@ module Pod
|
|
17
21
|
|
18
22
|
curl! parameters
|
19
23
|
end
|
24
|
+
|
25
|
+
# Returns a cURL command flag to add the CocoaPods User-Agent.
|
26
|
+
#
|
27
|
+
# @return [String] cURL command -A flag and User-Agent.
|
28
|
+
#
|
29
|
+
def user_agent_argument
|
30
|
+
"-A '#{Http.user_agent_string}'"
|
31
|
+
end
|
20
32
|
end
|
21
33
|
end
|
22
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-downloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -45,7 +45,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 2.
|
48
|
+
version: 2.3.3
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|